mirror of
				https://github.com/Telecominfraproject/wlan-cloud-ui.git
				synced 2025-11-03 20:28:12 +00:00 
			
		
		
		
	Compare commits
	
		
			5 Commits
		
	
	
		
			release/v1
			...
			WIFI-2434
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					0017541d82 | ||
| 
						 | 
					516fb50817 | ||
| 
						 | 
					4449465edc | ||
| 
						 | 
					57f91633c2 | ||
| 
						 | 
					aa559971d8 | 
							
								
								
									
										4
									
								
								.github/workflows/dockerpublish.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/dockerpublish.yml
									
									
									
									
										vendored
									
									
								
							@@ -61,7 +61,7 @@ jobs:
 | 
			
		||||
          [[ "${{ github.ref }}" == "refs/heads/release/"* ]] && VERSION=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\/release\/[v]//' | awk '{print $1"-SNAPSHOT"}')
 | 
			
		||||
 | 
			
		||||
          # Use Docker `latest` tag convention
 | 
			
		||||
          [ "$VERSION" == "master" ] && VERSION=1.1.0-SNAPSHOT
 | 
			
		||||
          [ "$VERSION" == "master" ] && VERSION=1.2.0-SNAPSHOT
 | 
			
		||||
 | 
			
		||||
          TIMESTAMP=$(date +'%Y-%m-%d')
 | 
			
		||||
 | 
			
		||||
@@ -96,7 +96,7 @@ jobs:
 | 
			
		||||
          [[ "${{ github.ref }}" == "refs/heads/release/"* ]] && VERSION=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\/release\/[v]//' | awk '{print $1"-SNAPSHOT"}')
 | 
			
		||||
 | 
			
		||||
          # Use Docker `latest` tag convention
 | 
			
		||||
          [ "$VERSION" == "master" ] && VERSION=1.1.0-SNAPSHOT
 | 
			
		||||
          [ "$VERSION" == "master" ] && VERSION=1.2.0-SNAPSHOT
 | 
			
		||||
 | 
			
		||||
          echo IMAGE_ID=$IMAGE_ID
 | 
			
		||||
          echo VERSION=$VERSION
 | 
			
		||||
 
 | 
			
		||||
@@ -95,7 +95,7 @@ const Accounts = () => {
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  const handleCreateUser = (email, password, roles) => {
 | 
			
		||||
  const handleCreateUser = ({ email, password, roles }) => {
 | 
			
		||||
    createUser({
 | 
			
		||||
      variables: {
 | 
			
		||||
        username: email,
 | 
			
		||||
@@ -119,7 +119,7 @@ const Accounts = () => {
 | 
			
		||||
      );
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  const handleEditUser = (id, email, password, roles, lastModifiedTimestamp) => {
 | 
			
		||||
  const handleEditUser = ({ id, email, password, roles, lastModifiedTimestamp }) => {
 | 
			
		||||
    updateUser({
 | 
			
		||||
      variables: {
 | 
			
		||||
        id,
 | 
			
		||||
 
 | 
			
		||||
@@ -4,10 +4,11 @@ import { useMutation, useQuery, gql } from '@apollo/client';
 | 
			
		||||
import { notification } from 'antd';
 | 
			
		||||
import { useHistory } from 'react-router-dom';
 | 
			
		||||
 | 
			
		||||
import { ROUTES } from 'constants/index';
 | 
			
		||||
import { ROUTES, AUTH_TOKEN } from 'constants/index';
 | 
			
		||||
import UserContext from 'contexts/UserContext';
 | 
			
		||||
import { GET_ALL_PROFILES } from 'graphql/queries';
 | 
			
		||||
import { GET_ALL_PROFILES, GET_API_URL } from 'graphql/queries';
 | 
			
		||||
import { fetchMoreProfiles } from 'graphql/functions';
 | 
			
		||||
import { getItem } from 'utils/localStorage';
 | 
			
		||||
 | 
			
		||||
const CREATE_PROFILE = gql`
 | 
			
		||||
  mutation CreateProfile(
 | 
			
		||||
@@ -35,6 +36,9 @@ const CREATE_PROFILE = gql`
 | 
			
		||||
 | 
			
		||||
const AddProfile = () => {
 | 
			
		||||
  const { customerId } = useContext(UserContext);
 | 
			
		||||
 | 
			
		||||
  const { data: apiUrl } = useQuery(GET_API_URL);
 | 
			
		||||
 | 
			
		||||
  const { data: ssidProfiles, fetchMore } = useQuery(GET_ALL_PROFILES(), {
 | 
			
		||||
    variables: { customerId, type: 'ssid' },
 | 
			
		||||
    fetchPolicy: 'network-only',
 | 
			
		||||
@@ -116,6 +120,46 @@ const AddProfile = () => {
 | 
			
		||||
    else fetchMoreProfiles(e, ssidProfiles, fetchMore);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  const handleFileUpload = async (fileName, file) => {
 | 
			
		||||
    const token = getItem(AUTH_TOKEN);
 | 
			
		||||
 | 
			
		||||
    if (apiUrl?.getApiUrl) {
 | 
			
		||||
      fetch(`${apiUrl?.getApiUrl}filestore/${fileName}`, {
 | 
			
		||||
        method: 'POST',
 | 
			
		||||
        headers: {
 | 
			
		||||
          Authorization: token ? `Bearer ${token.access_token}` : '',
 | 
			
		||||
          'Content-Type': 'application/octet-stream',
 | 
			
		||||
        },
 | 
			
		||||
        body: file,
 | 
			
		||||
      })
 | 
			
		||||
        .then(response => response.json())
 | 
			
		||||
        .then(resp => {
 | 
			
		||||
          if (resp?.success) {
 | 
			
		||||
            notification.success({
 | 
			
		||||
              message: 'Success',
 | 
			
		||||
              description: 'File successfully uploaded.',
 | 
			
		||||
            });
 | 
			
		||||
          } else {
 | 
			
		||||
            notification.error({
 | 
			
		||||
              message: 'Error',
 | 
			
		||||
              description: 'File could not be uploaded.',
 | 
			
		||||
            });
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
        .catch(() => {
 | 
			
		||||
          notification.error({
 | 
			
		||||
            message: 'Error',
 | 
			
		||||
            description: 'File could not be uploaded.',
 | 
			
		||||
          });
 | 
			
		||||
        });
 | 
			
		||||
    } else {
 | 
			
		||||
      notification.error({
 | 
			
		||||
        message: 'Error',
 | 
			
		||||
        description: 'File could not be uploaded.',
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <AddProfilePage
 | 
			
		||||
      onCreateProfile={handleAddProfile}
 | 
			
		||||
@@ -127,6 +171,7 @@ const AddProfile = () => {
 | 
			
		||||
      idProviderProfiles={idProviderProfiles?.getAllProfiles?.items}
 | 
			
		||||
      rfProfiles={rfProfiles?.getAllProfiles?.items}
 | 
			
		||||
      onFetchMoreProfiles={handleFetchMoreProfiles}
 | 
			
		||||
      fileUpload={handleFileUpload}
 | 
			
		||||
    />
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,12 @@
 | 
			
		||||
import React from 'react';
 | 
			
		||||
import PropTypes from 'prop-types';
 | 
			
		||||
import { RolesProvider } from '@tip-wlan/wlan-cloud-ui-library';
 | 
			
		||||
 | 
			
		||||
import UserContext from 'contexts/UserContext';
 | 
			
		||||
 | 
			
		||||
const UserProvider = ({ children, id, email, roles, customerId, updateUser, updateToken }) => (
 | 
			
		||||
  <UserContext.Provider value={{ id, email, roles, customerId, updateUser, updateToken }}>
 | 
			
		||||
    {children}
 | 
			
		||||
    <RolesProvider role={roles}>{children}</RolesProvider>
 | 
			
		||||
  </UserContext.Provider>
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "wlan-cloud-ui",
 | 
			
		||||
  "version": "1.1.8",
 | 
			
		||||
  "version": "1.1.9",
 | 
			
		||||
  "lockfileVersion": 1,
 | 
			
		||||
  "requires": true,
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "wlan-cloud-ui",
 | 
			
		||||
  "version": "1.1.8",
 | 
			
		||||
  "version": "1.1.9",
 | 
			
		||||
  "author": "ConnectUs",
 | 
			
		||||
  "description": "React Portal",
 | 
			
		||||
  "engines": {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user