mirror of
				https://github.com/Telecominfraproject/wlan-cloud-ui.git
				synced 2025-11-04 04:37:53 +00:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			master
			...
			release/v1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					922e11938e | 
							
								
								
									
										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"}')
 | 
					          [[ "${{ 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
 | 
					          # Use Docker `latest` tag convention
 | 
				
			||||||
          [ "$VERSION" == "master" ] && VERSION=1.3.0-SNAPSHOT
 | 
					          [ "$VERSION" == "master" ] && VERSION=1.1.0-SNAPSHOT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          TIMESTAMP=$(date +'%Y-%m-%d')
 | 
					          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"}')
 | 
					          [[ "${{ 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
 | 
					          # Use Docker `latest` tag convention
 | 
				
			||||||
          [ "$VERSION" == "master" ] && VERSION=1.3.0-SNAPSHOT
 | 
					          [ "$VERSION" == "master" ] && VERSION=1.1.0-SNAPSHOT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          echo IMAGE_ID=$IMAGE_ID
 | 
					          echo IMAGE_ID=$IMAGE_ID
 | 
				
			||||||
          echo VERSION=$VERSION
 | 
					          echo VERSION=$VERSION
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,9 +3,9 @@ export const COMPANY = 'Telecom Infra Project';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export const USER_FRIENDLY_RADIOS = {
 | 
					export const USER_FRIENDLY_RADIOS = {
 | 
				
			||||||
  is2dot4GHz: '2.4GHz',
 | 
					  is2dot4GHz: '2.4GHz',
 | 
				
			||||||
  is5GHz: '5GHz',
 | 
					 | 
				
			||||||
  is5GHzL: '5GHz (L)',
 | 
					  is5GHzL: '5GHz (L)',
 | 
				
			||||||
  is5GHzU: '5GHz (U)',
 | 
					  is5GHzU: '5GHz (U)',
 | 
				
			||||||
 | 
					  is5GHz: '5GHz',
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const ROUTES = {
 | 
					export const ROUTES = {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -95,7 +95,7 @@ const Accounts = () => {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const handleCreateUser = ({ email, password, roles }) => {
 | 
					  const handleCreateUser = (email, password, roles) => {
 | 
				
			||||||
    createUser({
 | 
					    createUser({
 | 
				
			||||||
      variables: {
 | 
					      variables: {
 | 
				
			||||||
        username: email,
 | 
					        username: email,
 | 
				
			||||||
@@ -119,7 +119,7 @@ const Accounts = () => {
 | 
				
			|||||||
      );
 | 
					      );
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const handleEditUser = ({ id, email, password, roles, lastModifiedTimestamp }) => {
 | 
					  const handleEditUser = (id, email, password, roles, lastModifiedTimestamp) => {
 | 
				
			||||||
    updateUser({
 | 
					    updateUser({
 | 
				
			||||||
      variables: {
 | 
					      variables: {
 | 
				
			||||||
        id,
 | 
					        id,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,11 +4,10 @@ import { useMutation, useQuery, gql } from '@apollo/client';
 | 
				
			|||||||
import { notification } from 'antd';
 | 
					import { notification } from 'antd';
 | 
				
			||||||
import { useHistory } from 'react-router-dom';
 | 
					import { useHistory } from 'react-router-dom';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { ROUTES, AUTH_TOKEN } from 'constants/index';
 | 
					import { ROUTES } from 'constants/index';
 | 
				
			||||||
import UserContext from 'contexts/UserContext';
 | 
					import UserContext from 'contexts/UserContext';
 | 
				
			||||||
import { GET_ALL_PROFILES, GET_API_URL } from 'graphql/queries';
 | 
					import { GET_ALL_PROFILES } from 'graphql/queries';
 | 
				
			||||||
import { fetchMoreProfiles } from 'graphql/functions';
 | 
					import { fetchMoreProfiles } from 'graphql/functions';
 | 
				
			||||||
import { getItem } from 'utils/localStorage';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const CREATE_PROFILE = gql`
 | 
					const CREATE_PROFILE = gql`
 | 
				
			||||||
  mutation CreateProfile(
 | 
					  mutation CreateProfile(
 | 
				
			||||||
@@ -36,9 +35,6 @@ const CREATE_PROFILE = gql`
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const AddProfile = () => {
 | 
					const AddProfile = () => {
 | 
				
			||||||
  const { customerId } = useContext(UserContext);
 | 
					  const { customerId } = useContext(UserContext);
 | 
				
			||||||
 | 
					 | 
				
			||||||
  const { data: apiUrl } = useQuery(GET_API_URL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  const { data: ssidProfiles, fetchMore } = useQuery(GET_ALL_PROFILES(), {
 | 
					  const { data: ssidProfiles, fetchMore } = useQuery(GET_ALL_PROFILES(), {
 | 
				
			||||||
    variables: { customerId, type: 'ssid' },
 | 
					    variables: { customerId, type: 'ssid' },
 | 
				
			||||||
    fetchPolicy: 'network-only',
 | 
					    fetchPolicy: 'network-only',
 | 
				
			||||||
@@ -79,15 +75,6 @@ const AddProfile = () => {
 | 
				
			|||||||
    variables: { customerId, type: 'rf' },
 | 
					    variables: { customerId, type: 'rf' },
 | 
				
			||||||
    fetchPolicy: 'network-only',
 | 
					    fetchPolicy: 'network-only',
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					 | 
				
			||||||
  const { data: passpointProfiles, fetchMore: fetchMorePasspointProfiles } = useQuery(
 | 
					 | 
				
			||||||
    GET_ALL_PROFILES(),
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      variables: { customerId, type: 'passpoint' },
 | 
					 | 
				
			||||||
      fetchPolicy: 'network-only',
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  const [createProfile] = useMutation(CREATE_PROFILE);
 | 
					  const [createProfile] = useMutation(CREATE_PROFILE);
 | 
				
			||||||
  const history = useHistory();
 | 
					  const history = useHistory();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -126,51 +113,9 @@ const AddProfile = () => {
 | 
				
			|||||||
      fetchMoreProfiles(e, operatorProfiles, fetchMoreOperatorProfiles);
 | 
					      fetchMoreProfiles(e, operatorProfiles, fetchMoreOperatorProfiles);
 | 
				
			||||||
    else if (key === 'passpoint_osu_id_provider')
 | 
					    else if (key === 'passpoint_osu_id_provider')
 | 
				
			||||||
      fetchMoreProfiles(e, idProviderProfiles, fetchMoreIdProviderProfiles);
 | 
					      fetchMoreProfiles(e, idProviderProfiles, fetchMoreIdProviderProfiles);
 | 
				
			||||||
    else if (key === 'passpoint')
 | 
					 | 
				
			||||||
      fetchMoreProfiles(e, passpointProfiles, fetchMorePasspointProfiles);
 | 
					 | 
				
			||||||
    else fetchMoreProfiles(e, ssidProfiles, fetchMore);
 | 
					    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 (
 | 
					  return (
 | 
				
			||||||
    <AddProfilePage
 | 
					    <AddProfilePage
 | 
				
			||||||
      onCreateProfile={handleAddProfile}
 | 
					      onCreateProfile={handleAddProfile}
 | 
				
			||||||
@@ -181,9 +126,7 @@ const AddProfile = () => {
 | 
				
			|||||||
      operatorProfiles={operatorProfiles?.getAllProfiles?.items}
 | 
					      operatorProfiles={operatorProfiles?.getAllProfiles?.items}
 | 
				
			||||||
      idProviderProfiles={idProviderProfiles?.getAllProfiles?.items}
 | 
					      idProviderProfiles={idProviderProfiles?.getAllProfiles?.items}
 | 
				
			||||||
      rfProfiles={rfProfiles?.getAllProfiles?.items}
 | 
					      rfProfiles={rfProfiles?.getAllProfiles?.items}
 | 
				
			||||||
      passpointProfiles={passpointProfiles?.getAllProfiles?.items}
 | 
					 | 
				
			||||||
      onFetchMoreProfiles={handleFetchMoreProfiles}
 | 
					      onFetchMoreProfiles={handleFetchMoreProfiles}
 | 
				
			||||||
      fileUpload={handleFileUpload}
 | 
					 | 
				
			||||||
    />
 | 
					    />
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,6 +75,7 @@ const App = () => {
 | 
				
			|||||||
        <Helmet titleTemplate={`%s - ${COMPANY}`} defaultTitle={COMPANY}>
 | 
					        <Helmet titleTemplate={`%s - ${COMPANY}`} defaultTitle={COMPANY}>
 | 
				
			||||||
          <meta name="description" content={COMPANY} />
 | 
					          <meta name="description" content={COMPANY} />
 | 
				
			||||||
        </Helmet>
 | 
					        </Helmet>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <Switch>
 | 
					        <Switch>
 | 
				
			||||||
          <UnauthenticatedRoute exact path={ROUTES.login} component={Login} />
 | 
					          <UnauthenticatedRoute exact path={ROUTES.login} component={Login} />
 | 
				
			||||||
          <ProtectedRouteWithLayout exact path={ROUTES.root} component={RedirectToDashboard} />
 | 
					          <ProtectedRouteWithLayout exact path={ROUTES.root} component={RedirectToDashboard} />
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,27 +34,12 @@ function trafficTooltipFormatter() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const lineChartConfig = [
 | 
					const lineChartConfig = [
 | 
				
			||||||
  {
 | 
					  { key: 'service', title: 'Inservice APs (24 hours)' },
 | 
				
			||||||
    key: 'service',
 | 
					  { key: 'clientDevices', title: 'Client Devices (24 hours)' },
 | 
				
			||||||
    title: 'Inservice APs (24 hours)',
 | 
					 | 
				
			||||||
    lines: [{ key: 'inServiceAps', name: 'Inservice APs' }],
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    key: 'clientDevices',
 | 
					 | 
				
			||||||
    title: 'Client Devices (24 hours)',
 | 
					 | 
				
			||||||
    lines: [
 | 
					 | 
				
			||||||
      { key: 'clientDevices2dot4GHz', name: '2.4GHz' },
 | 
					 | 
				
			||||||
      { key: 'clientDevices5GHz', name: '5GHz' },
 | 
					 | 
				
			||||||
    ],
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    key: 'traffic',
 | 
					    key: 'traffic',
 | 
				
			||||||
    title: 'Traffic - 5 min intervals (24 hours)',
 | 
					    title: 'Traffic (24 hours)',
 | 
				
			||||||
    lines: [
 | 
					    options: { formatter: trafficLabelFormatter, tooltipFormatter: trafficTooltipFormatter },
 | 
				
			||||||
      { key: 'trafficBytesDownstreamData', name: 'Downstream' },
 | 
					 | 
				
			||||||
      { key: 'trafficBytesUpstreamData', name: 'Upstream' },
 | 
					 | 
				
			||||||
    ],
 | 
					 | 
				
			||||||
    options: { formatter: trafficLabelFormatter, trafficTooltipFormatter },
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
];
 | 
					];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -73,8 +58,34 @@ const Dashboard = () => {
 | 
				
			|||||||
    variables: { customerId, statusDataTypes: ['CUSTOMER_DASHBOARD'] },
 | 
					    variables: { customerId, statusDataTypes: ['CUSTOMER_DASHBOARD'] },
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const [lineChartData, setLineChartData] = useState([]);
 | 
					  const [lineChartData, setLineChartData] = useState({
 | 
				
			||||||
  const [trafficBytesData, setTrafficBytesData] = useState();
 | 
					    service: {
 | 
				
			||||||
 | 
					      inservicesAPs: {
 | 
				
			||||||
 | 
					        key: 'Inservice APs',
 | 
				
			||||||
 | 
					        value: [],
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    clientDevices: {
 | 
				
			||||||
 | 
					      is2dot4GHz: {
 | 
				
			||||||
 | 
					        key: USER_FRIENDLY_RADIOS.is2dot4GHz,
 | 
				
			||||||
 | 
					        value: [],
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      is5GHz: {
 | 
				
			||||||
 | 
					        key: USER_FRIENDLY_RADIOS.is5GHz,
 | 
				
			||||||
 | 
					        value: [],
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    traffic: {
 | 
				
			||||||
 | 
					      trafficBytesDownstream: {
 | 
				
			||||||
 | 
					        key: 'Down Stream',
 | 
				
			||||||
 | 
					        value: [],
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      trafficBytesUpstream: {
 | 
				
			||||||
 | 
					        key: 'Up Stream',
 | 
				
			||||||
 | 
					        value: [],
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const { loading: metricsLoading, error: metricsError, data: metricsData, fetchMore } = useQuery(
 | 
					  const { loading: metricsLoading, error: metricsError, data: metricsData, fetchMore } = useQuery(
 | 
				
			||||||
    FILTER_SYSTEM_EVENTS,
 | 
					    FILTER_SYSTEM_EVENTS,
 | 
				
			||||||
@@ -92,13 +103,12 @@ const Dashboard = () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const formatLineChartData = (list = []) => {
 | 
					  const formatLineChartData = (list = []) => {
 | 
				
			||||||
    if (list.length) {
 | 
					    if (list.length) {
 | 
				
			||||||
      const chartData = [];
 | 
					      setLineChartData(prev => {
 | 
				
			||||||
 | 
					        const inservicesAPs = [];
 | 
				
			||||||
      let inServiceAps = 0;
 | 
					        const clientDevices2dot4GHz = [];
 | 
				
			||||||
      let clientDevices2dot4GHz = 0;
 | 
					        const clientDevices5GHz = [];
 | 
				
			||||||
      let clientDevices5GHz = 0;
 | 
					        const trafficBytesDownstreamData = [];
 | 
				
			||||||
      let trafficBytesDownstreamData = 0;
 | 
					        const trafficBytesUpstreamData = [];
 | 
				
			||||||
      let trafficBytesUpstreamData = 0;
 | 
					 | 
				
			||||||
        let totalDown = 0;
 | 
					        let totalDown = 0;
 | 
				
			||||||
        let totalUp = 0;
 | 
					        let totalUp = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -117,40 +127,59 @@ const Dashboard = () => {
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
          }) => {
 | 
					          }) => {
 | 
				
			||||||
            const timestamp = parseInt(eventTimestamp, 10);
 | 
					            const timestamp = parseInt(eventTimestamp, 10);
 | 
				
			||||||
          inServiceAps = equipmentInServiceCount;
 | 
					            inservicesAPs.push({ timestamp, value: equipmentInServiceCount });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            let total5GHz = 0;
 | 
					            let total5GHz = 0;
 | 
				
			||||||
            total5GHz += (radios?.is5GHz || 0) + (radios?.is5GHzL || 0) + (radios?.is5GHzU || 0); // combine all 5GHz radios
 | 
					            total5GHz += (radios?.is5GHz || 0) + (radios?.is5GHzL || 0) + (radios?.is5GHzU || 0); // combine all 5GHz radios
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          clientDevices2dot4GHz = radios.is2dot4GHz || 0;
 | 
					            clientDevices2dot4GHz.push({ timestamp, value: radios.is2dot4GHz || 0 });
 | 
				
			||||||
          clientDevices5GHz = total5GHz || 0;
 | 
					            clientDevices5GHz.push({ timestamp, value: total5GHz || 0 });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          trafficBytesDownstreamData = (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0;
 | 
					            trafficBytesDownstreamData.push({
 | 
				
			||||||
          trafficBytesUpstreamData = (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0;
 | 
					              timestamp,
 | 
				
			||||||
 | 
					              value: (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0,
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            trafficBytesUpstreamData.push({
 | 
				
			||||||
 | 
					              timestamp,
 | 
				
			||||||
 | 
					              value: (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0,
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            totalDown += (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0;
 | 
					            totalDown += (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0;
 | 
				
			||||||
            totalUp += (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0;
 | 
					            totalUp += (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0;
 | 
				
			||||||
          chartData.push({
 | 
					 | 
				
			||||||
            timestamp,
 | 
					 | 
				
			||||||
            inServiceAps,
 | 
					 | 
				
			||||||
            clientDevices2dot4GHz,
 | 
					 | 
				
			||||||
            clientDevices5GHz,
 | 
					 | 
				
			||||||
            trafficBytesDownstreamData,
 | 
					 | 
				
			||||||
            trafficBytesUpstreamData,
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      setTrafficBytesData(prev => {
 | 
					 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
          totalUpstreamTraffic: (prev?.totalUpstreamTraffic || 0) + totalUp,
 | 
					          service: {
 | 
				
			||||||
          totalDownstreamTraffic: (prev?.totalDownstreamTraffic || 0) + totalDown,
 | 
					            inservicesAPs: {
 | 
				
			||||||
 | 
					              ...prev.service.inservicesAPs,
 | 
				
			||||||
 | 
					              value: [...prev.service.inservicesAPs.value, ...inservicesAPs],
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					          clientDevices: {
 | 
				
			||||||
 | 
					            is2dot4GHz: {
 | 
				
			||||||
 | 
					              ...prev.clientDevices.is2dot4GHz,
 | 
				
			||||||
 | 
					              value: [...prev.clientDevices.is2dot4GHz.value, ...clientDevices2dot4GHz],
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            is5GHz: {
 | 
				
			||||||
 | 
					              ...prev.clientDevices.is5GHz,
 | 
				
			||||||
 | 
					              value: [...prev.clientDevices.is5GHz.value, ...clientDevices5GHz],
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					          traffic: {
 | 
				
			||||||
 | 
					            trafficBytesDownstream: {
 | 
				
			||||||
 | 
					              ...prev.traffic.trafficBytesDownstream,
 | 
				
			||||||
 | 
					              value: [...prev.traffic.trafficBytesDownstream.value, ...trafficBytesDownstreamData],
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            trafficBytesUpstream: {
 | 
				
			||||||
 | 
					              ...prev.traffic.trafficBytesUpstream,
 | 
				
			||||||
 | 
					              value: [...prev.traffic.trafficBytesUpstream.value, ...trafficBytesUpstreamData],
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					          totalDownstreamTraffic: totalDown,
 | 
				
			||||||
 | 
					          totalUpstreamTraffic: totalUp,
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					 | 
				
			||||||
      setLineChartData(prev => {
 | 
					 | 
				
			||||||
        return [...prev, ...chartData];
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -250,8 +279,8 @@ const Dashboard = () => {
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          title: 'Usage Information (24 hours)',
 | 
					          title: 'Usage Information (24 hours)',
 | 
				
			||||||
          'Total Traffic (Downstream)': formatBytes(trafficBytesData?.totalDownstreamTraffic),
 | 
					          'Total Traffic (US)': formatBytes(lineChartData?.totalUpstreamTraffic),
 | 
				
			||||||
          'Total Traffic (Upstream)': formatBytes(trafficBytesData?.totalUpstreamTraffic),
 | 
					          'Total Traffic (DS)': formatBytes(lineChartData?.totalDownstreamTraffic),
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
      ]}
 | 
					      ]}
 | 
				
			||||||
      pieChartDetails={pieChartsData}
 | 
					      pieChartDetails={pieChartsData}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +1,9 @@
 | 
				
			|||||||
import React, { useContext, useMemo, useEffect } from 'react';
 | 
					import React, { useContext, useMemo } from 'react';
 | 
				
			||||||
import PropTypes from 'prop-types';
 | 
					import PropTypes from 'prop-types';
 | 
				
			||||||
import { Alert, notification } from 'antd';
 | 
					import { Alert, notification } from 'antd';
 | 
				
			||||||
import { useParams } from 'react-router-dom';
 | 
					import { useParams } from 'react-router-dom';
 | 
				
			||||||
import { useLazyQuery, useMutation } from '@apollo/client';
 | 
					import { useQuery, useMutation } from '@apollo/client';
 | 
				
			||||||
import { BulkEditAccessPoints, sortRadioTypes } from '@tip-wlan/wlan-cloud-ui-library';
 | 
					import { BulkEditAccessPoints, Loading } from '@tip-wlan/wlan-cloud-ui-library';
 | 
				
			||||||
import { USER_FRIENDLY_RADIOS } from 'constants/index';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import { getBreadcrumbPath, getLocationPath } from 'utils/locations';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { FILTER_EQUIPMENT_BULK_EDIT_APS } from 'graphql/queries';
 | 
					import { FILTER_EQUIPMENT_BULK_EDIT_APS } from 'graphql/queries';
 | 
				
			||||||
import { UPDATE_EQUIPMENT_BULK } from 'graphql/mutations';
 | 
					import { UPDATE_EQUIPMENT_BULK } from 'graphql/mutations';
 | 
				
			||||||
@@ -14,6 +11,8 @@ import { UPDATE_EQUIPMENT_BULK } from 'graphql/mutations';
 | 
				
			|||||||
import UserContext from 'contexts/UserContext';
 | 
					import UserContext from 'contexts/UserContext';
 | 
				
			||||||
import styles from './index.module.scss';
 | 
					import styles from './index.module.scss';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const defaultAppliedRadios = { is5GHzL: 'is5GHzL', is2dot4GHz: 'is2dot4GHz', is5GHzU: 'is5GHzU' };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const renderTableCell = tabCell => {
 | 
					const renderTableCell = tabCell => {
 | 
				
			||||||
  if (Array.isArray(tabCell)) {
 | 
					  if (Array.isArray(tabCell)) {
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
@@ -29,13 +28,6 @@ const renderTableCell = tabCell => {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
const accessPointsChannelTableColumns = [
 | 
					const accessPointsChannelTableColumns = [
 | 
				
			||||||
  { title: 'Name', dataIndex: 'name', key: 'name', width: 250, render: renderTableCell },
 | 
					  { title: 'Name', dataIndex: 'name', key: 'name', width: 250, render: renderTableCell },
 | 
				
			||||||
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    title: 'Radios',
 | 
					 | 
				
			||||||
    dataIndex: 'radioMap',
 | 
					 | 
				
			||||||
    width: 150,
 | 
					 | 
				
			||||||
    render: text => renderTableCell(text.map(i => USER_FRIENDLY_RADIOS[i])),
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    title: 'Manual Active Channel',
 | 
					    title: 'Manual Active Channel',
 | 
				
			||||||
    dataIndex: 'manualChannelNumber',
 | 
					    dataIndex: 'manualChannelNumber',
 | 
				
			||||||
@@ -96,117 +88,157 @@ const accessPointsChannelTableColumns = [
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
];
 | 
					];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const getRadioDetails = (radioDetails, type) => {
 | 
					const getBreadcrumbPath = (id, locations) => {
 | 
				
			||||||
  const sortedRadios = sortRadioTypes(Object.keys(radioDetails?.radioMap || {}));
 | 
					  const locationsPath = [];
 | 
				
			||||||
 | 
					  const treeRecurse = (parentNodeId, node) => {
 | 
				
			||||||
  if (type === 'manualChannelNumber') {
 | 
					    if (node.id === parentNodeId) {
 | 
				
			||||||
    return sortedRadios.map(i => radioDetails.radioMap[i]?.manualChannelNumber);
 | 
					      locationsPath.unshift(node);
 | 
				
			||||||
 | 
					      return node;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (node.children) {
 | 
				
			||||||
  if (type === 'manualBackupChannelNumber') {
 | 
					      let parent;
 | 
				
			||||||
    return sortedRadios.map(i => radioDetails.radioMap[i]?.manualBackupChannelNumber);
 | 
					      node.children.some(i => {
 | 
				
			||||||
  }
 | 
					        parent = treeRecurse(parentNodeId, i);
 | 
				
			||||||
  if (type === 'snrDrop') {
 | 
					        return parent;
 | 
				
			||||||
    return sortedRadios.map(
 | 
					 | 
				
			||||||
      i => radioDetails.advancedRadioMap[i]?.bestApSettings?.value?.dropInSnrPercentage
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  if (type === 'allowedChannels') {
 | 
					 | 
				
			||||||
    return sortedRadios.map(i => radioDetails.radioMap[i]?.allowedChannelsPowerLevels);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (type === 'minLoad') {
 | 
					 | 
				
			||||||
    return sortedRadios.map(
 | 
					 | 
				
			||||||
      i => radioDetails.advancedRadioMap[i]?.bestApSettings?.value?.minLoadFactor
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (type === 'cellSize') {
 | 
					 | 
				
			||||||
    return sortedRadios.map(i => radioDetails.radioMap[i]?.rxCellSizeDb?.value);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (type === 'probeResponseThreshold') {
 | 
					 | 
				
			||||||
    return sortedRadios.map(i => radioDetails.radioMap[i]?.probeResponseThresholdDb?.value);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (type === 'clientDisconnectThreshold') {
 | 
					 | 
				
			||||||
    return sortedRadios.map(i => radioDetails.radioMap[i]?.clientDisconnectThresholdDb?.value);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return sortedRadios;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const formatRadioFrequencies = ({
 | 
					 | 
				
			||||||
  manualChannelNumber,
 | 
					 | 
				
			||||||
  manualBackupChannelNumber,
 | 
					 | 
				
			||||||
  snrDrop,
 | 
					 | 
				
			||||||
  minLoad,
 | 
					 | 
				
			||||||
  cellSize,
 | 
					 | 
				
			||||||
  probeResponseThreshold,
 | 
					 | 
				
			||||||
  clientDisconnectThreshold,
 | 
					 | 
				
			||||||
  radioMap = [],
 | 
					 | 
				
			||||||
}) => {
 | 
					 | 
				
			||||||
  const frequencies = {};
 | 
					 | 
				
			||||||
  radioMap.forEach((i, index) => {
 | 
					 | 
				
			||||||
    frequencies[i] = {
 | 
					 | 
				
			||||||
      channelNumber: manualChannelNumber[index],
 | 
					 | 
				
			||||||
      backupChannelNumber: manualBackupChannelNumber[index],
 | 
					 | 
				
			||||||
      dropInSnrPercentage: snrDrop[index],
 | 
					 | 
				
			||||||
      minLoadFactor: minLoad[index],
 | 
					 | 
				
			||||||
      rxCellSizeDb: {
 | 
					 | 
				
			||||||
        auto: true,
 | 
					 | 
				
			||||||
        value: cellSize[index],
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      probeResponseThresholdDb: {
 | 
					 | 
				
			||||||
        auto: true,
 | 
					 | 
				
			||||||
        value: probeResponseThreshold[index],
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      clientDisconnectThresholdDb: {
 | 
					 | 
				
			||||||
        auto: true,
 | 
					 | 
				
			||||||
        value: clientDisconnectThreshold[index],
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
  return frequencies;
 | 
					      if (parent) {
 | 
				
			||||||
 | 
					        locationsPath.unshift(node);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      return parent;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return null;
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  treeRecurse(id, {
 | 
				
			||||||
 | 
					    id: 0,
 | 
				
			||||||
 | 
					    children: locations,
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return locationsPath;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const getLocationPath = (selectedId, locations) => {
 | 
				
			||||||
 | 
					  const locationsPath = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const treeRecurse = (parentNodeId, node) => {
 | 
				
			||||||
 | 
					    if (node.id === parentNodeId) {
 | 
				
			||||||
 | 
					      locationsPath.unshift(node.id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (node.children) {
 | 
				
			||||||
 | 
					        const flatten = children => {
 | 
				
			||||||
 | 
					          children.forEach(i => {
 | 
				
			||||||
 | 
					            locationsPath.unshift(i.id);
 | 
				
			||||||
 | 
					            if (i.children) {
 | 
				
			||||||
 | 
					              flatten(i.children);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          });
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        flatten(node.children);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      return node;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (node.children) {
 | 
				
			||||||
 | 
					      let parent;
 | 
				
			||||||
 | 
					      node.children.some(i => {
 | 
				
			||||||
 | 
					        parent = treeRecurse(parentNodeId, i);
 | 
				
			||||||
 | 
					        return parent;
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					      return parent;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return null;
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (selectedId) {
 | 
				
			||||||
 | 
					    treeRecurse(selectedId, { id: 0, children: locations });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return locationsPath;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const BulkEditAPs = ({ locations, checkedLocations }) => {
 | 
					const BulkEditAPs = ({ locations, checkedLocations }) => {
 | 
				
			||||||
  const { id } = useParams();
 | 
					  const { id } = useParams();
 | 
				
			||||||
  const { customerId } = useContext(UserContext);
 | 
					  const { customerId } = useContext(UserContext);
 | 
				
			||||||
 | 
					 | 
				
			||||||
  const locationIds = useMemo(() => {
 | 
					  const locationIds = useMemo(() => {
 | 
				
			||||||
    const locationPath = getLocationPath(id, locations);
 | 
					    const locationPath = getLocationPath(id, locations);
 | 
				
			||||||
    return locationPath.filter(f => checkedLocations.includes(f));
 | 
					    return locationPath.filter(f => checkedLocations.includes(f));
 | 
				
			||||||
  }, [id, locations, checkedLocations]);
 | 
					  }, [id, locations, checkedLocations]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const [
 | 
					  const {
 | 
				
			||||||
    filterEquipment,
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
    loading: filterEquipmentLoading,
 | 
					    loading: filterEquipmentLoading,
 | 
				
			||||||
    error: filterEquipmentError,
 | 
					    error: filterEquipmentError,
 | 
				
			||||||
    refetch,
 | 
					    refetch,
 | 
				
			||||||
    data: equipData,
 | 
					    data: equipData,
 | 
				
			||||||
    fetchMore,
 | 
					    fetchMore,
 | 
				
			||||||
    },
 | 
					  } = useQuery(FILTER_EQUIPMENT_BULK_EDIT_APS, {
 | 
				
			||||||
  ] = useLazyQuery(FILTER_EQUIPMENT_BULK_EDIT_APS, {
 | 
					    variables: { customerId, locationIds, equipmentType: 'AP' },
 | 
				
			||||||
    errorPolicy: 'all',
 | 
					 | 
				
			||||||
    fetchPolicy: 'cache-first',
 | 
					 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const fetchFilterEquipment = async () => {
 | 
					 | 
				
			||||||
    filterEquipment({
 | 
					 | 
				
			||||||
      variables: {
 | 
					 | 
				
			||||||
        customerId,
 | 
					 | 
				
			||||||
        locationIds,
 | 
					 | 
				
			||||||
        equipmentType: 'AP',
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
  const [updateEquipmentBulk] = useMutation(UPDATE_EQUIPMENT_BULK);
 | 
					  const [updateEquipmentBulk] = useMutation(UPDATE_EQUIPMENT_BULK);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const formattedTableData = useMemo(
 | 
					  const getRadioDetails = (radioDetails, type) => {
 | 
				
			||||||
    () =>
 | 
					    if (type === 'manualChannelNumber') {
 | 
				
			||||||
      equipData?.filterEquipment?.items?.map(({ id: key, name, details = {} }) => ({
 | 
					      const manualChannelNumbers = [];
 | 
				
			||||||
 | 
					      Object.keys(radioDetails?.radioMap || {}).map(i => {
 | 
				
			||||||
 | 
					        return manualChannelNumbers.push(radioDetails.radioMap[i]?.manualChannelNumber);
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					      return manualChannelNumbers;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (type === 'manualBackupChannelNumber') {
 | 
				
			||||||
 | 
					      const manualBackupChannelNumbers = [];
 | 
				
			||||||
 | 
					      Object.keys(radioDetails?.radioMap || {}).map(i => {
 | 
				
			||||||
 | 
					        return manualBackupChannelNumbers.push(radioDetails.radioMap[i]?.manualBackupChannelNumber);
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					      return manualBackupChannelNumbers;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (type === 'cellSize') {
 | 
				
			||||||
 | 
					      const cellSizeValues = [];
 | 
				
			||||||
 | 
					      Object.keys(radioDetails?.radioMap || {}).map(i => {
 | 
				
			||||||
 | 
					        return cellSizeValues.push(radioDetails.radioMap[i]?.rxCellSizeDb?.value);
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					      return cellSizeValues;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (type === 'probeResponseThreshold') {
 | 
				
			||||||
 | 
					      const probeResponseThresholdValues = [];
 | 
				
			||||||
 | 
					      Object.keys(radioDetails?.radioMap || {}).map(i => {
 | 
				
			||||||
 | 
					        return probeResponseThresholdValues.push(
 | 
				
			||||||
 | 
					          radioDetails.radioMap[i]?.probeResponseThresholdDb?.value
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					      return probeResponseThresholdValues;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (type === 'clientDisconnectThreshold') {
 | 
				
			||||||
 | 
					      const clientDisconnectThresholdValues = [];
 | 
				
			||||||
 | 
					      Object.keys(radioDetails?.radioMap || {}).map(i => {
 | 
				
			||||||
 | 
					        return clientDisconnectThresholdValues.push(
 | 
				
			||||||
 | 
					          radioDetails.radioMap[i]?.clientDisconnectThresholdDb?.value
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					      return clientDisconnectThresholdValues;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (type === 'snrDrop') {
 | 
				
			||||||
 | 
					      const snrDropValues = [];
 | 
				
			||||||
 | 
					      Object.keys(radioDetails?.radioMap || {}).map(i => {
 | 
				
			||||||
 | 
					        return snrDropValues.push(
 | 
				
			||||||
 | 
					          radioDetails.advancedRadioMap[i]?.bestApSettings?.value?.dropInSnrPercentage
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					      return snrDropValues;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const minLoadValue = [];
 | 
				
			||||||
 | 
					    Object.keys(radioDetails?.radioMap || {}).map(i => {
 | 
				
			||||||
 | 
					      return minLoadValue.push(
 | 
				
			||||||
 | 
					        radioDetails.advancedRadioMap[i]?.bestApSettings?.value?.minLoadFactor
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    return minLoadValue;
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const setAccessPointsBulkEditTableData = (dataSource = []) =>
 | 
				
			||||||
 | 
					    dataSource.items.map(({ id: key, name, details }) => ({
 | 
				
			||||||
      key,
 | 
					      key,
 | 
				
			||||||
      id: key,
 | 
					      id: key,
 | 
				
			||||||
      name,
 | 
					      name,
 | 
				
			||||||
@@ -217,11 +249,54 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
 | 
				
			|||||||
      clientDisconnectThreshold: getRadioDetails(details, 'clientDisconnectThreshold'),
 | 
					      clientDisconnectThreshold: getRadioDetails(details, 'clientDisconnectThreshold'),
 | 
				
			||||||
      snrDrop: getRadioDetails(details, 'snrDrop'),
 | 
					      snrDrop: getRadioDetails(details, 'snrDrop'),
 | 
				
			||||||
      minLoad: getRadioDetails(details, 'minLoad'),
 | 
					      minLoad: getRadioDetails(details, 'minLoad'),
 | 
				
			||||||
        radioMap: getRadioDetails(details, 'radioMap'),
 | 
					      radioMap: Object.keys(details?.radioMap || {}),
 | 
				
			||||||
        allowedChannels: getRadioDetails(details, 'allowedChannels'),
 | 
					    }));
 | 
				
			||||||
      })),
 | 
					
 | 
				
			||||||
    [equipData?.filterEquipment?.items]
 | 
					  const setUpdatedBulkEditTableData = (
 | 
				
			||||||
  );
 | 
					    equipmentId,
 | 
				
			||||||
 | 
					    manualChannelNumber,
 | 
				
			||||||
 | 
					    manualBackupChannelNumber,
 | 
				
			||||||
 | 
					    cellSize,
 | 
				
			||||||
 | 
					    probeResponseThreshold,
 | 
				
			||||||
 | 
					    clientDisconnectThreshold,
 | 
				
			||||||
 | 
					    snrDrop,
 | 
				
			||||||
 | 
					    minLoad,
 | 
				
			||||||
 | 
					    dataSource = []
 | 
				
			||||||
 | 
					  ) => {
 | 
				
			||||||
 | 
					    const updatedItems = [];
 | 
				
			||||||
 | 
					    let dropInSnrPercentage;
 | 
				
			||||||
 | 
					    let minLoadFactor;
 | 
				
			||||||
 | 
					    dataSource.items.forEach(({ id: itemId, details }) => {
 | 
				
			||||||
 | 
					      if (equipmentId === itemId) {
 | 
				
			||||||
 | 
					        Object.keys(details?.radioMap || defaultAppliedRadios).forEach((i, dataIndex) => {
 | 
				
			||||||
 | 
					          const frequencies = {};
 | 
				
			||||||
 | 
					          dropInSnrPercentage = snrDrop[dataIndex];
 | 
				
			||||||
 | 
					          minLoadFactor = minLoad[dataIndex];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          frequencies[`${i}`] = {
 | 
				
			||||||
 | 
					            channelNumber: manualChannelNumber[dataIndex],
 | 
				
			||||||
 | 
					            backupChannelNumber: manualBackupChannelNumber[dataIndex],
 | 
				
			||||||
 | 
					            rxCellSizeDb: {
 | 
				
			||||||
 | 
					              auto: true,
 | 
				
			||||||
 | 
					              value: cellSize[dataIndex],
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            probeResponseThresholdDb: {
 | 
				
			||||||
 | 
					              auto: true,
 | 
				
			||||||
 | 
					              value: probeResponseThreshold[dataIndex],
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            clientDisconnectThresholdDb: {
 | 
				
			||||||
 | 
					              auto: true,
 | 
				
			||||||
 | 
					              value: clientDisconnectThreshold[dataIndex],
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            dropInSnrPercentage,
 | 
				
			||||||
 | 
					            minLoadFactor,
 | 
				
			||||||
 | 
					          };
 | 
				
			||||||
 | 
					          updatedItems.push(frequencies);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    return updatedItems;
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const updateEquipments = editedRowsArr => {
 | 
					  const updateEquipments = editedRowsArr => {
 | 
				
			||||||
    updateEquipmentBulk({
 | 
					    updateEquipmentBulk({
 | 
				
			||||||
@@ -247,10 +322,38 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
 | 
				
			|||||||
  const handleSaveChanges = updatedRows => {
 | 
					  const handleSaveChanges = updatedRows => {
 | 
				
			||||||
    const editedRowsArr = [];
 | 
					    const editedRowsArr = [];
 | 
				
			||||||
    Object.keys(updatedRows).forEach(key => {
 | 
					    Object.keys(updatedRows).forEach(key => {
 | 
				
			||||||
      return editedRowsArr.push({
 | 
					      const {
 | 
				
			||||||
        equipmentId: updatedRows[key].id,
 | 
					        id: equipmentId,
 | 
				
			||||||
        perRadioDetails: formatRadioFrequencies(updatedRows[key]),
 | 
					        manualChannelNumber,
 | 
				
			||||||
 | 
					        manualBackupChannelNumber,
 | 
				
			||||||
 | 
					        cellSize,
 | 
				
			||||||
 | 
					        probeResponseThreshold,
 | 
				
			||||||
 | 
					        clientDisconnectThreshold,
 | 
				
			||||||
 | 
					        snrDrop,
 | 
				
			||||||
 | 
					        minLoad,
 | 
				
			||||||
 | 
					      } = updatedRows[key];
 | 
				
			||||||
 | 
					      const updatedEuips = setUpdatedBulkEditTableData(
 | 
				
			||||||
 | 
					        equipmentId,
 | 
				
			||||||
 | 
					        manualChannelNumber,
 | 
				
			||||||
 | 
					        manualBackupChannelNumber,
 | 
				
			||||||
 | 
					        cellSize,
 | 
				
			||||||
 | 
					        probeResponseThreshold,
 | 
				
			||||||
 | 
					        clientDisconnectThreshold,
 | 
				
			||||||
 | 
					        snrDrop,
 | 
				
			||||||
 | 
					        minLoad,
 | 
				
			||||||
 | 
					        equipData && equipData.filterEquipment
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					      const tempObj = {
 | 
				
			||||||
 | 
					        equipmentId,
 | 
				
			||||||
 | 
					        perRadioDetails: {},
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					      updatedEuips.map(item => {
 | 
				
			||||||
 | 
					        Object.keys(item).forEach(i => {
 | 
				
			||||||
 | 
					          tempObj.perRadioDetails[i] = item[i];
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					        return tempObj;
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					      return editedRowsArr.push(tempObj);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    updateEquipments(editedRowsArr);
 | 
					    updateEquipments(editedRowsArr);
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
@@ -274,30 +377,24 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  useEffect(() => {
 | 
					  if (filterEquipmentLoading) {
 | 
				
			||||||
    fetchFilterEquipment();
 | 
					    return <Loading />;
 | 
				
			||||||
  }, [locationIds]);
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (filterEquipmentError) {
 | 
					  if (filterEquipmentError) {
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
      <Alert
 | 
					      <Alert message="Error" description="Failed to load equipments data." type="error" showIcon />
 | 
				
			||||||
        message="Error"
 | 
					 | 
				
			||||||
        description="Failed to load equipment(s) data."
 | 
					 | 
				
			||||||
        type="error"
 | 
					 | 
				
			||||||
        showIcon
 | 
					 | 
				
			||||||
      />
 | 
					 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <BulkEditAccessPoints
 | 
					    <BulkEditAccessPoints
 | 
				
			||||||
      tableColumns={accessPointsChannelTableColumns}
 | 
					      tableColumns={accessPointsChannelTableColumns}
 | 
				
			||||||
      tableData={formattedTableData}
 | 
					      tableData={setAccessPointsBulkEditTableData(equipData?.filterEquipment)}
 | 
				
			||||||
      onLoadMore={handleLoadMore}
 | 
					      onLoadMore={handleLoadMore}
 | 
				
			||||||
      isLastPage={equipData?.filterEquipment?.context?.lastPage}
 | 
					      isLastPage={equipData?.filterEquipment?.context?.lastPage}
 | 
				
			||||||
      onSaveChanges={handleSaveChanges}
 | 
					      onSaveChanges={handleSaveChanges}
 | 
				
			||||||
      breadcrumbPath={getBreadcrumbPath(id, locations)}
 | 
					      breadcrumbPath={getBreadcrumbPath(id, locations)}
 | 
				
			||||||
      loading={filterEquipmentLoading}
 | 
					 | 
				
			||||||
    />
 | 
					    />
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
import React, { useState, useContext } from 'react';
 | 
					import React, { useState, useContext } from 'react';
 | 
				
			||||||
import { useParams, Redirect } from 'react-router-dom';
 | 
					import { useParams, Redirect } from 'react-router-dom';
 | 
				
			||||||
import { useQuery, useMutation, gql } from '@apollo/client';
 | 
					import { useQuery, useMutation, gql } from '@apollo/client';
 | 
				
			||||||
import { notification } from 'antd';
 | 
					import { Alert, notification } from 'antd';
 | 
				
			||||||
import { ProfileDetails as ProfileDetailsPage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
 | 
					import { ProfileDetails as ProfileDetailsPage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { ROUTES, AUTH_TOKEN } from 'constants/index';
 | 
					import { ROUTES, AUTH_TOKEN } from 'constants/index';
 | 
				
			||||||
@@ -32,8 +32,6 @@ const GET_PROFILE = gql`
 | 
				
			|||||||
      osuSsidProfile {
 | 
					      osuSsidProfile {
 | 
				
			||||||
        id
 | 
					        id
 | 
				
			||||||
        name
 | 
					        name
 | 
				
			||||||
        profileType
 | 
					 | 
				
			||||||
        details
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      childProfileIds
 | 
					      childProfileIds
 | 
				
			||||||
      createdTimestamp
 | 
					      createdTimestamp
 | 
				
			||||||
@@ -89,10 +87,9 @@ const ProfileDetails = () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const { data: apiUrl } = useQuery(GET_API_URL);
 | 
					  const { data: apiUrl } = useQuery(GET_API_URL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const { loading, data } = useQuery(GET_PROFILE, {
 | 
					  const { loading, error, data } = useQuery(GET_PROFILE, {
 | 
				
			||||||
    variables: { id },
 | 
					    variables: { id },
 | 
				
			||||||
    fetchPolicy: 'network-only',
 | 
					    fetchPolicy: 'network-only',
 | 
				
			||||||
    errorPolicy: 'all',
 | 
					 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const { data: ssidProfiles, fetchMore } = useQuery(GET_ALL_PROFILES(), {
 | 
					  const { data: ssidProfiles, fetchMore } = useQuery(GET_ALL_PROFILES(), {
 | 
				
			||||||
@@ -142,14 +139,6 @@ const ProfileDetails = () => {
 | 
				
			|||||||
    fetchPolicy: 'network-only',
 | 
					    fetchPolicy: 'network-only',
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const { data: passpointProfiles, fetchMore: fetchMorePasspointProfiles } = useQuery(
 | 
					 | 
				
			||||||
    GET_ALL_PROFILES(),
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      variables: { customerId, type: 'passpoint' },
 | 
					 | 
				
			||||||
      fetchPolicy: 'network-only',
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  const [updateProfile] = useMutation(UPDATE_PROFILE);
 | 
					  const [updateProfile] = useMutation(UPDATE_PROFILE);
 | 
				
			||||||
  const [deleteProfile] = useMutation(DELETE_PROFILE);
 | 
					  const [deleteProfile] = useMutation(DELETE_PROFILE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -280,8 +269,6 @@ const ProfileDetails = () => {
 | 
				
			|||||||
      fetchMoreProfiles(e, operatorProfiles, fetchMoreOperatorProfiles);
 | 
					      fetchMoreProfiles(e, operatorProfiles, fetchMoreOperatorProfiles);
 | 
				
			||||||
    else if (key === 'passpoint_osu_id_provider')
 | 
					    else if (key === 'passpoint_osu_id_provider')
 | 
				
			||||||
      fetchMoreProfiles(e, idProviderProfiles, fetchMoreIdProviderProfiles);
 | 
					      fetchMoreProfiles(e, idProviderProfiles, fetchMoreIdProviderProfiles);
 | 
				
			||||||
    else if (key === 'passpoint')
 | 
					 | 
				
			||||||
      fetchMoreProfiles(e, passpointProfiles, fetchMorePasspointProfiles);
 | 
					 | 
				
			||||||
    else fetchMoreProfiles(e, ssidProfiles, fetchMore);
 | 
					    else fetchMoreProfiles(e, ssidProfiles, fetchMore);
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -289,6 +276,12 @@ const ProfileDetails = () => {
 | 
				
			|||||||
    return <Loading />;
 | 
					    return <Loading />;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (error) {
 | 
				
			||||||
 | 
					    return (
 | 
				
			||||||
 | 
					      <Alert message="Error" description="Failed to load profile data." type="error" showIcon />
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (redirect) {
 | 
					  if (redirect) {
 | 
				
			||||||
    return <Redirect to={ROUTES.profiles} />;
 | 
					    return <Redirect to={ROUTES.profiles} />;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -296,7 +289,6 @@ const ProfileDetails = () => {
 | 
				
			|||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <ProfileDetailsPage
 | 
					    <ProfileDetailsPage
 | 
				
			||||||
      name={data.getProfile.name}
 | 
					      name={data.getProfile.name}
 | 
				
			||||||
      profileId={data?.getProfile?.id}
 | 
					 | 
				
			||||||
      profileType={data.getProfile.profileType}
 | 
					      profileType={data.getProfile.profileType}
 | 
				
			||||||
      details={data.getProfile.details}
 | 
					      details={data.getProfile.details}
 | 
				
			||||||
      childProfiles={data.getProfile.childProfiles}
 | 
					      childProfiles={data.getProfile.childProfiles}
 | 
				
			||||||
@@ -312,7 +304,6 @@ const ProfileDetails = () => {
 | 
				
			|||||||
      idProviderProfiles={idProviderProfiles?.getAllProfiles?.items}
 | 
					      idProviderProfiles={idProviderProfiles?.getAllProfiles?.items}
 | 
				
			||||||
      associatedSsidProfiles={data.getProfile?.associatedSsidProfiles}
 | 
					      associatedSsidProfiles={data.getProfile?.associatedSsidProfiles}
 | 
				
			||||||
      osuSsidProfile={data.getProfile?.osuSsidProfile}
 | 
					      osuSsidProfile={data.getProfile?.osuSsidProfile}
 | 
				
			||||||
      passpointProfiles={passpointProfiles?.getAllProfiles?.items}
 | 
					 | 
				
			||||||
      fileUpload={handleFileUpload}
 | 
					      fileUpload={handleFileUpload}
 | 
				
			||||||
      onFetchMoreProfiles={handleFetchMoreProfiles}
 | 
					      onFetchMoreProfiles={handleFetchMoreProfiles}
 | 
				
			||||||
      onDownloadFile={handleDownloadFile}
 | 
					      onDownloadFile={handleDownloadFile}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import React, { useContext, useMemo } from 'react';
 | 
					import React, { useContext } from 'react';
 | 
				
			||||||
import { useQuery, useMutation } from '@apollo/client';
 | 
					import { useQuery, useMutation } from '@apollo/client';
 | 
				
			||||||
import { Alert, notification } from 'antd';
 | 
					import { Alert, notification } from 'antd';
 | 
				
			||||||
import { AutoProvision as AutoProvisionPage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
 | 
					import { AutoProvision as AutoProvisionPage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
 | 
				
			||||||
@@ -7,7 +7,6 @@ import UserContext from 'contexts/UserContext';
 | 
				
			|||||||
import { GET_CUSTOMER, GET_ALL_LOCATIONS, GET_ALL_PROFILES } from 'graphql/queries';
 | 
					import { GET_CUSTOMER, GET_ALL_LOCATIONS, GET_ALL_PROFILES } from 'graphql/queries';
 | 
				
			||||||
import { UPDATE_CUSTOMER } from 'graphql/mutations';
 | 
					import { UPDATE_CUSTOMER } from 'graphql/mutations';
 | 
				
			||||||
import { fetchMoreProfiles } from 'graphql/functions';
 | 
					import { fetchMoreProfiles } from 'graphql/functions';
 | 
				
			||||||
import { formatLocations } from 'utils/locations';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const AutoProvision = () => {
 | 
					const AutoProvision = () => {
 | 
				
			||||||
  const { customerId } = useContext(UserContext);
 | 
					  const { customerId } = useContext(UserContext);
 | 
				
			||||||
@@ -66,10 +65,6 @@ const AutoProvision = () => {
 | 
				
			|||||||
    fetchMoreProfiles(e, dataProfile, fetchMore);
 | 
					    fetchMoreProfiles(e, dataProfile, fetchMore);
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const locationsTree = useMemo(() => {
 | 
					 | 
				
			||||||
    return formatLocations(dataLocation?.getAllLocations, true);
 | 
					 | 
				
			||||||
  }, [dataLocation?.getAllLocations]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (loading) {
 | 
					  if (loading) {
 | 
				
			||||||
    return <Loading />;
 | 
					    return <Loading />;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -82,9 +77,9 @@ const AutoProvision = () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <AutoProvisionPage
 | 
					    <AutoProvisionPage
 | 
				
			||||||
      data={data?.getCustomer}
 | 
					      data={data && data.getCustomer}
 | 
				
			||||||
      locationsTree={locationsTree}
 | 
					      dataLocation={dataLocation && dataLocation.getAllLocations}
 | 
				
			||||||
      dataProfile={dataProfile?.getAllProfiles?.items}
 | 
					      dataProfile={dataProfile && dataProfile.getAllProfiles.items}
 | 
				
			||||||
      loadingLocation={loadingLocation}
 | 
					      loadingLocation={loadingLocation}
 | 
				
			||||||
      loadingProfile={loadingProfile}
 | 
					      loadingProfile={loadingProfile}
 | 
				
			||||||
      errorLocation={errorLocation}
 | 
					      errorLocation={errorLocation}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +1,11 @@
 | 
				
			|||||||
import React from 'react';
 | 
					import React from 'react';
 | 
				
			||||||
import PropTypes from 'prop-types';
 | 
					import PropTypes from 'prop-types';
 | 
				
			||||||
import { RolesProvider } from '@tip-wlan/wlan-cloud-ui-library';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import UserContext from 'contexts/UserContext';
 | 
					import UserContext from 'contexts/UserContext';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const UserProvider = ({ children, id, email, roles, customerId, updateUser, updateToken }) => (
 | 
					const UserProvider = ({ children, id, email, roles, customerId, updateUser, updateToken }) => (
 | 
				
			||||||
  <UserContext.Provider value={{ id, email, roles, customerId, updateUser, updateToken }}>
 | 
					  <UserContext.Provider value={{ id, email, roles, customerId, updateUser, updateToken }}>
 | 
				
			||||||
    <RolesProvider role={roles}>{children}</RolesProvider>
 | 
					    {children}
 | 
				
			||||||
  </UserContext.Provider>
 | 
					  </UserContext.Provider>
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,6 @@ import { AUTH_TOKEN } from 'constants/index';
 | 
				
			|||||||
import { REFRESH_TOKEN } from 'graphql/mutations';
 | 
					import { REFRESH_TOKEN } from 'graphql/mutations';
 | 
				
			||||||
import { getItem, setItem, removeItem } from 'utils/localStorage';
 | 
					import { getItem, setItem, removeItem } from 'utils/localStorage';
 | 
				
			||||||
import history from 'utils/history';
 | 
					import history from 'utils/history';
 | 
				
			||||||
import { ScrollToTop } from '@tip-wlan/wlan-cloud-ui-library';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const API_URI = process.env.NODE_ENV === 'production' ? window.REACT_APP_API : process.env.API;
 | 
					const API_URI = process.env.NODE_ENV === 'production' ? window.REACT_APP_API : process.env.API;
 | 
				
			||||||
const MOUNT_NODE = document.getElementById('root');
 | 
					const MOUNT_NODE = document.getElementById('root');
 | 
				
			||||||
@@ -103,7 +102,6 @@ const render = () => {
 | 
				
			|||||||
  ReactDOM.render(
 | 
					  ReactDOM.render(
 | 
				
			||||||
    <Router history={history}>
 | 
					    <Router history={history}>
 | 
				
			||||||
      <ApolloProvider client={client}>
 | 
					      <ApolloProvider client={client}>
 | 
				
			||||||
        <ScrollToTop />
 | 
					 | 
				
			||||||
        <App />
 | 
					        <App />
 | 
				
			||||||
      </ApolloProvider>
 | 
					      </ApolloProvider>
 | 
				
			||||||
    </Router>,
 | 
					    </Router>,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,14 +1,3 @@
 | 
				
			|||||||
body {
 | 
					body {
 | 
				
			||||||
  font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;
 | 
					  font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
input:-webkit-autofill,
 | 
					 | 
				
			||||||
input:-webkit-autofill:hover,
 | 
					 | 
				
			||||||
input:-webkit-autofill:focus,
 | 
					 | 
				
			||||||
input:-webkit-autofill:active,
 | 
					 | 
				
			||||||
input:-webkit-autofill::first-line {
 | 
					 | 
				
			||||||
  -webkit-transition: color 9999s ease-out, background-color 9999s ease-out;
 | 
					 | 
				
			||||||
  transition: color 9999s ease-out, background-color 9999s ease-out;
 | 
					 | 
				
			||||||
  font-size: 14px !important;
 | 
					 | 
				
			||||||
  font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,110 +0,0 @@
 | 
				
			|||||||
import { filter, isEmpty, each } from 'lodash';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export const NETWORK_NODE = {
 | 
					 | 
				
			||||||
  title: 'Network',
 | 
					 | 
				
			||||||
  id: '0',
 | 
					 | 
				
			||||||
  key: '0',
 | 
					 | 
				
			||||||
  value: '0',
 | 
					 | 
				
			||||||
  name: 'Network',
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export const formatLocations = (list = [], disableRoot = false) => {
 | 
					 | 
				
			||||||
  function unflatten(array, p) {
 | 
					 | 
				
			||||||
    let tree = [];
 | 
					 | 
				
			||||||
    const parent = typeof p !== 'undefined' ? p : { id: '0' };
 | 
					 | 
				
			||||||
    let children = filter(array, child => child.parentId === parent.id);
 | 
					 | 
				
			||||||
    children = children.map(c => ({
 | 
					 | 
				
			||||||
      title: c.name,
 | 
					 | 
				
			||||||
      value: `${c.id}`,
 | 
					 | 
				
			||||||
      key: c.id,
 | 
					 | 
				
			||||||
      isLeaf: false,
 | 
					 | 
				
			||||||
      ...c,
 | 
					 | 
				
			||||||
    }));
 | 
					 | 
				
			||||||
    if (!isEmpty(children)) {
 | 
					 | 
				
			||||||
      if (parent.id === '0') {
 | 
					 | 
				
			||||||
        tree = children;
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        parent.children = children;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      each(children, child => unflatten(array, child));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return tree;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return [
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      ...NETWORK_NODE,
 | 
					 | 
				
			||||||
      ...(disableRoot && { disabled: true }),
 | 
					 | 
				
			||||||
      children: unflatten(list),
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  ];
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export const getBreadcrumbPath = (id, locations) => {
 | 
					 | 
				
			||||||
  const locationsPath = [];
 | 
					 | 
				
			||||||
  const treeRecurse = (parentNodeId, node) => {
 | 
					 | 
				
			||||||
    if (node.id === parentNodeId) {
 | 
					 | 
				
			||||||
      locationsPath.unshift(node);
 | 
					 | 
				
			||||||
      return node;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    if (node.children) {
 | 
					 | 
				
			||||||
      let parent;
 | 
					 | 
				
			||||||
      node.children.some(i => {
 | 
					 | 
				
			||||||
        parent = treeRecurse(parentNodeId, i);
 | 
					 | 
				
			||||||
        return parent;
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      if (parent) {
 | 
					 | 
				
			||||||
        locationsPath.unshift(node);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      return parent;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return null;
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  treeRecurse(id, {
 | 
					 | 
				
			||||||
    id: 0,
 | 
					 | 
				
			||||||
    children: locations,
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return locationsPath;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export const getLocationPath = (selectedId, locations) => {
 | 
					 | 
				
			||||||
  const locationsPath = [];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  const treeRecurse = (parentNodeId, node) => {
 | 
					 | 
				
			||||||
    if (node.id === parentNodeId) {
 | 
					 | 
				
			||||||
      locationsPath.unshift(node.id);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (node.children) {
 | 
					 | 
				
			||||||
        const flatten = children => {
 | 
					 | 
				
			||||||
          children.forEach(i => {
 | 
					 | 
				
			||||||
            locationsPath.unshift(i.id);
 | 
					 | 
				
			||||||
            if (i.children) {
 | 
					 | 
				
			||||||
              flatten(i.children);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        flatten(node.children);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      return node;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    if (node.children) {
 | 
					 | 
				
			||||||
      let parent;
 | 
					 | 
				
			||||||
      node.children.some(i => {
 | 
					 | 
				
			||||||
        parent = treeRecurse(parentNodeId, i);
 | 
					 | 
				
			||||||
        return parent;
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      return parent;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return null;
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (selectedId) {
 | 
					 | 
				
			||||||
    treeRecurse(selectedId, { id: 0, children: locations });
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return locationsPath;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
							
								
								
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "wlan-cloud-ui",
 | 
					  "name": "wlan-cloud-ui",
 | 
				
			||||||
  "version": "1.2.0",
 | 
					  "version": "1.1.8",
 | 
				
			||||||
  "lockfileVersion": 1,
 | 
					  "lockfileVersion": 1,
 | 
				
			||||||
  "requires": true,
 | 
					  "requires": true,
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
@@ -2223,9 +2223,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "@tip-wlan/wlan-cloud-ui-library": {
 | 
					    "@tip-wlan/wlan-cloud-ui-library": {
 | 
				
			||||||
      "version": "1.2.6",
 | 
					      "version": "1.1.14",
 | 
				
			||||||
      "resolved": "https://tip.jfrog.io/artifactory/api/npm/tip-wlan-cloud-npm-repo/@tip-wlan/wlan-cloud-ui-library/-/@tip-wlan/wlan-cloud-ui-library-1.2.6.tgz",
 | 
					      "resolved": "https://tip.jfrog.io/artifactory/api/npm/tip-wlan-cloud-npm-repo/@tip-wlan/wlan-cloud-ui-library/-/@tip-wlan/wlan-cloud-ui-library-1.1.14.tgz",
 | 
				
			||||||
      "integrity": "sha1-BZoknNYpmGz7TCJmRVDSOtrA4B4="
 | 
					      "integrity": "sha1-BRTU+IQ03oDQWJM5xGo+D+S49Kc="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "@types/anymatch": {
 | 
					    "@types/anymatch": {
 | 
				
			||||||
      "version": "1.3.1",
 | 
					      "version": "1.3.1",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "wlan-cloud-ui",
 | 
					  "name": "wlan-cloud-ui",
 | 
				
			||||||
  "version": "1.2.0",
 | 
					  "version": "1.1.8",
 | 
				
			||||||
  "author": "ConnectUs",
 | 
					  "author": "ConnectUs",
 | 
				
			||||||
  "description": "React Portal",
 | 
					  "description": "React Portal",
 | 
				
			||||||
  "engines": {
 | 
					  "engines": {
 | 
				
			||||||
@@ -21,7 +21,7 @@
 | 
				
			|||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "@ant-design/icons": "^4.2.1",
 | 
					    "@ant-design/icons": "^4.2.1",
 | 
				
			||||||
    "@apollo/client": "^3.1.3",
 | 
					    "@apollo/client": "^3.1.3",
 | 
				
			||||||
    "@tip-wlan/wlan-cloud-ui-library": "^1.2.6",
 | 
					    "@tip-wlan/wlan-cloud-ui-library": "^1.1.14",
 | 
				
			||||||
    "antd": "^4.5.2",
 | 
					    "antd": "^4.5.2",
 | 
				
			||||||
    "apollo-upload-client": "^13.0.0",
 | 
					    "apollo-upload-client": "^13.0.0",
 | 
				
			||||||
    "graphql": "^15.5.0",
 | 
					    "graphql": "^15.5.0",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user