46 Commits

Author SHA1 Message Date
Sean Macfarlane
0c5d35f7b8 updated library 2021-08-23 22:41:37 -04:00
Sean Macfarlane
d21304e8fb Merge pull request #110 from Telecominfraproject/hotfix/PasspointProfileFixes
hotfix/PasspointProfileFixes: Added Passpoint profile to Add/Update profile
2021-08-23 22:36:27 -04:00
irtiza-h30
3f7c3a8478 updated gql errorPolicy 2021-08-20 17:23:05 -04:00
irtiza-h30
0de1e380b5 undo commit 2021-08-20 17:22:26 -04:00
irtiza-h30
30bf5adfc1 updated gql errorPolicy 2021-08-20 17:12:41 -04:00
irtiza-h30
1f9983ba65 Fixed profile type 2021-08-18 14:10:15 -04:00
irtiza-h30
bc4a9c6152 Added Passpoint profile to Add/Update profile 2021-08-18 13:54:38 -04:00
Sean Macfarlane
eeb1f8a886 Merge pull request #109 from Telecominfraproject/NETEXP-3471
WIFI-3471 Change image tag to 1.3.0-SNAPSHOT
2021-08-17 14:55:09 -04:00
AkshayJagadish-ne
7588eae33d Update dockerpublish.yml 2021-08-13 14:17:42 -04:00
Sean Macfarlane
8b4d15d0b2 updated library 2021-08-09 15:48:48 -04:00
Sean Macfarlane
716b5e227e Merge pull request #108 from Telecominfraproject/hotfix/AutoProvisionLocationSelect
hotfix/AutoProvisionLocation: Changed location data structure for Auto-Provision
2021-08-09 14:01:19 -04:00
irtiza-h30
27a2548c71 Changed location data structure for Auto-Provision 2021-08-06 18:46:13 -04:00
Sean Macfarlane
6e7d857bbe v1.2.0 2021-07-29 18:55:18 -04:00
Sean Macfarlane
6cd475ea8e v1.1.21 2021-07-26 16:47:11 -04:00
Sean Macfarlane
66c7d629a3 Merge pull request #107 from Telecominfraproject/hotfix/BulkEditAllowedChannels
hotfix/BulkEditAllowedChannels: Added allowedChannels field to BulkEditTable
2021-07-26 13:07:35 -04:00
irtiza-h30
5c84362777 added allowedChannels field to BulkEditTable 2021-07-23 12:18:38 -04:00
Sean Macfarlane
29a66613c1 v1.1.20 2021-07-22 18:10:13 -04:00
Sean Macfarlane
10adeeeba3 Merge pull request #106 from Telecominfraproject/bugfix/NOJIRA-dashboard-data-structure
Bugfix/NOJIRA: Restructure Dashboard Data
2021-07-22 17:59:04 -04:00
Hassan Azmi
8938b9a800 restructure data 2021-07-21 15:15:56 -04:00
Sean Macfarlane
9592450d5f v1.1.19 2021-07-20 11:43:50 -04:00
Sean Macfarlane
d4b12c614f updated library 2021-07-09 16:48:58 -04:00
Sean Macfarlane
a952a40eb5 v1.1.18 2021-06-25 17:37:53 -04:00
Sean Macfarlane
6c0e5f959d Merge pull request #104 from Telecominfraproject/hotfix/AutofillCss
hotfix/AutofillCss: Fixed autofill styling
2021-06-25 13:48:09 -04:00
Sean Macfarlane
4450a01397 Merge pull request #105 from Telecominfraproject/hotfix/ApRadiosOrder
hotfix/ApRadiosOrder: Changed USER_FRIENDLY_RADIOS order
2021-06-25 13:46:37 -04:00
irtiza-h30
5d3192e314 changed USER_FRIENDLY_RADIOS order 2021-06-25 13:01:01 -04:00
irtiza-h30
7ccebb107a added all fonts 2021-06-24 14:28:40 -04:00
irtiza-h30
42eaa86893 fixed autofill css 2021-06-24 14:19:26 -04:00
Sean Macfarlane
48f6a64790 Merge pull request #103 from Telecominfraproject/hotfix/ScrollToTopComponent
hotfix/ScrollToTop: Added ScrollToTop  component
2021-06-23 12:16:15 -04:00
irtiza-h30
879c97f44d fixed ScrollToTop import 2021-06-22 18:59:42 -04:00
irtiza-h30
01599ca670 Added ScrollToTop component 2021-06-22 15:30:46 -04:00
Sean Macfarlane
1be788925e v1.1.17 2021-06-21 14:08:57 -04:00
Sean Macfarlane
3697d0b4a9 v1.1.16 2021-06-11 15:23:43 -04:00
Sean Macfarlane
a9655e25aa v1.1.15 2021-06-09 13:10:13 -04:00
Sean Macfarlane
6bd8beb436 v1.1.14 2021-06-07 12:52:10 -04:00
Sean Macfarlane
e023ef0569 v1.1.13 2021-06-02 15:28:40 -04:00
Sean Macfarlane
8d93cf4f73 updated library 2021-06-01 13:53:33 -04:00
Sean Macfarlane
87b056967f v1.1.12 2021-05-31 18:06:04 -04:00
norm-traxler
d6d207c058 Merge pull request #102 from Telecominfraproject/WIFI-2434
WIFI-2434: Update SDK master to use image tag 1.2.0-SNAPSHOT
2021-05-26 23:04:17 -04:00
Akshay Jagadish
0017541d82 WIFI-2434: Update SDK master to use image tag 1.2.0-SNAPSHOT 2021-05-26 19:03:40 -04:00
Sean Macfarlane
eab3476dbe v1.1.11 2021-05-26 15:36:10 -04:00
Sean Macfarlane
ff5b6dc1fc install library 2021-05-21 14:07:36 -04:00
Sean Macfarlane
40033efb61 v1.1.10 2021-05-21 13:43:54 -04:00
Sean Macfarlane
516fb50817 Merge pull request #101 from Telecominfraproject/hotfix/AddProfileFileUpload
hotfix/AddProfileFileUpload: Added file uploading to Add Profile
2021-05-19 13:35:42 -04:00
irtiza-h30
4449465edc Added file uploading to Add Profile 2021-05-18 18:27:11 -04:00
Sean Macfarlane
57f91633c2 v1.1.9 2021-05-13 10:57:50 -04:00
Sean Macfarlane
aa559971d8 WIFI-2013 2021-05-13 10:57:11 -04:00
15 changed files with 428 additions and 360 deletions

View File

@@ -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.3.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.3.0-SNAPSHOT
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION

View File

@@ -3,9 +3,9 @@ export const COMPANY = 'Telecom Infra Project';
export const USER_FRIENDLY_RADIOS = {
is2dot4GHz: '2.4GHz',
is5GHz: '5GHz',
is5GHzL: '5GHz (L)',
is5GHzU: '5GHz (U)',
is5GHz: '5GHz',
};
export const ROUTES = {

View File

@@ -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,

View File

@@ -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',
@@ -75,6 +79,15 @@ const AddProfile = () => {
variables: { customerId, type: 'rf' },
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 history = useHistory();
@@ -113,9 +126,51 @@ const AddProfile = () => {
fetchMoreProfiles(e, operatorProfiles, fetchMoreOperatorProfiles);
else if (key === 'passpoint_osu_id_provider')
fetchMoreProfiles(e, idProviderProfiles, fetchMoreIdProviderProfiles);
else if (key === 'passpoint')
fetchMoreProfiles(e, passpointProfiles, fetchMorePasspointProfiles);
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}
@@ -126,7 +181,9 @@ const AddProfile = () => {
operatorProfiles={operatorProfiles?.getAllProfiles?.items}
idProviderProfiles={idProviderProfiles?.getAllProfiles?.items}
rfProfiles={rfProfiles?.getAllProfiles?.items}
passpointProfiles={passpointProfiles?.getAllProfiles?.items}
onFetchMoreProfiles={handleFetchMoreProfiles}
fileUpload={handleFileUpload}
/>
);
};

View File

@@ -75,7 +75,6 @@ const App = () => {
<Helmet titleTemplate={`%s - ${COMPANY}`} defaultTitle={COMPANY}>
<meta name="description" content={COMPANY} />
</Helmet>
<Switch>
<UnauthenticatedRoute exact path={ROUTES.login} component={Login} />
<ProtectedRouteWithLayout exact path={ROUTES.root} component={RedirectToDashboard} />

View File

@@ -34,12 +34,27 @@ function trafficTooltipFormatter() {
}
const lineChartConfig = [
{ key: 'service', title: 'Inservice APs (24 hours)' },
{ key: 'clientDevices', title: 'Client Devices (24 hours)' },
{
key: 'service',
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',
title: 'Traffic (24 hours)',
options: { formatter: trafficLabelFormatter, tooltipFormatter: trafficTooltipFormatter },
title: 'Traffic - 5 min intervals (24 hours)',
lines: [
{ key: 'trafficBytesDownstreamData', name: 'Downstream' },
{ key: 'trafficBytesUpstreamData', name: 'Upstream' },
],
options: { formatter: trafficLabelFormatter, trafficTooltipFormatter },
},
];
@@ -58,34 +73,8 @@ const Dashboard = () => {
variables: { customerId, statusDataTypes: ['CUSTOMER_DASHBOARD'] },
});
const [lineChartData, setLineChartData] = 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 [lineChartData, setLineChartData] = useState([]);
const [trafficBytesData, setTrafficBytesData] = useState();
const { loading: metricsLoading, error: metricsError, data: metricsData, fetchMore } = useQuery(
FILTER_SYSTEM_EVENTS,
@@ -103,83 +92,65 @@ const Dashboard = () => {
const formatLineChartData = (list = []) => {
if (list.length) {
setLineChartData(prev => {
const inservicesAPs = [];
const clientDevices2dot4GHz = [];
const clientDevices5GHz = [];
const trafficBytesDownstreamData = [];
const trafficBytesUpstreamData = [];
let totalDown = 0;
let totalUp = 0;
const chartData = [];
list.forEach(
({
eventTimestamp,
details: {
payload: {
details: {
equipmentInServiceCount,
associatedClientsCountPerRadio: radios,
trafficBytesDownstream,
trafficBytesUpstream,
},
let inServiceAps = 0;
let clientDevices2dot4GHz = 0;
let clientDevices5GHz = 0;
let trafficBytesDownstreamData = 0;
let trafficBytesUpstreamData = 0;
let totalDown = 0;
let totalUp = 0;
list.forEach(
({
eventTimestamp,
details: {
payload: {
details: {
equipmentInServiceCount,
associatedClientsCountPerRadio: radios,
trafficBytesDownstream,
trafficBytesUpstream,
},
},
}) => {
const timestamp = parseInt(eventTimestamp, 10);
inservicesAPs.push({ timestamp, value: equipmentInServiceCount });
},
}) => {
const timestamp = parseInt(eventTimestamp, 10);
inServiceAps = equipmentInServiceCount;
let total5GHz = 0;
total5GHz += (radios?.is5GHz || 0) + (radios?.is5GHzL || 0) + (radios?.is5GHzU || 0); // combine all 5GHz radios
let total5GHz = 0;
total5GHz += (radios?.is5GHz || 0) + (radios?.is5GHzL || 0) + (radios?.is5GHzU || 0); // combine all 5GHz radios
clientDevices2dot4GHz.push({ timestamp, value: radios.is2dot4GHz || 0 });
clientDevices5GHz.push({ timestamp, value: total5GHz || 0 });
clientDevices2dot4GHz = radios.is2dot4GHz || 0;
clientDevices5GHz = total5GHz || 0;
trafficBytesDownstreamData.push({
timestamp,
value: (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0,
});
trafficBytesUpstreamData.push({
timestamp,
value: (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0,
});
trafficBytesDownstreamData = (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0;
trafficBytesUpstreamData = (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0;
totalDown += (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0;
totalUp += (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0;
}
);
totalDown += (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0;
totalUp += (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0;
chartData.push({
timestamp,
inServiceAps,
clientDevices2dot4GHz,
clientDevices5GHz,
trafficBytesDownstreamData,
trafficBytesUpstreamData,
});
}
);
setTrafficBytesData(prev => {
return {
service: {
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,
totalUpstreamTraffic: (prev?.totalUpstreamTraffic || 0) + totalUp,
totalDownstreamTraffic: (prev?.totalDownstreamTraffic || 0) + totalDown,
};
});
setLineChartData(prev => {
return [...prev, ...chartData];
});
}
};
@@ -279,8 +250,8 @@ const Dashboard = () => {
},
{
title: 'Usage Information (24 hours)',
'Total Traffic (US)': formatBytes(lineChartData?.totalUpstreamTraffic),
'Total Traffic (DS)': formatBytes(lineChartData?.totalDownstreamTraffic),
'Total Traffic (Downstream)': formatBytes(trafficBytesData?.totalDownstreamTraffic),
'Total Traffic (Upstream)': formatBytes(trafficBytesData?.totalUpstreamTraffic),
},
]}
pieChartDetails={pieChartsData}

View File

@@ -1,9 +1,12 @@
import React, { useContext, useMemo } from 'react';
import React, { useContext, useMemo, useEffect } from 'react';
import PropTypes from 'prop-types';
import { Alert, notification } from 'antd';
import { useParams } from 'react-router-dom';
import { useQuery, useMutation } from '@apollo/client';
import { BulkEditAccessPoints, Loading } from '@tip-wlan/wlan-cloud-ui-library';
import { useLazyQuery, useMutation } from '@apollo/client';
import { BulkEditAccessPoints, sortRadioTypes } 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 { UPDATE_EQUIPMENT_BULK } from 'graphql/mutations';
@@ -11,8 +14,6 @@ import { UPDATE_EQUIPMENT_BULK } from 'graphql/mutations';
import UserContext from 'contexts/UserContext';
import styles from './index.module.scss';
const defaultAppliedRadios = { is5GHzL: 'is5GHzL', is2dot4GHz: 'is2dot4GHz', is5GHzU: 'is5GHzU' };
const renderTableCell = tabCell => {
if (Array.isArray(tabCell)) {
return (
@@ -28,6 +29,13 @@ const renderTableCell = tabCell => {
};
const accessPointsChannelTableColumns = [
{ 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',
dataIndex: 'manualChannelNumber',
@@ -88,215 +96,132 @@ const accessPointsChannelTableColumns = [
},
];
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;
};
const getRadioDetails = (radioDetails, type) => {
const sortedRadios = sortRadioTypes(Object.keys(radioDetails?.radioMap || {}));
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 });
if (type === 'manualChannelNumber') {
return sortedRadios.map(i => radioDetails.radioMap[i]?.manualChannelNumber);
}
return locationsPath;
if (type === 'manualBackupChannelNumber') {
return sortedRadios.map(i => radioDetails.radioMap[i]?.manualBackupChannelNumber);
}
if (type === 'snrDrop') {
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;
};
const BulkEditAPs = ({ locations, checkedLocations }) => {
const { id } = useParams();
const { customerId } = useContext(UserContext);
const locationIds = useMemo(() => {
const locationPath = getLocationPath(id, locations);
return locationPath.filter(f => checkedLocations.includes(f));
}, [id, locations, checkedLocations]);
const {
loading: filterEquipmentLoading,
error: filterEquipmentError,
refetch,
data: equipData,
fetchMore,
} = useQuery(FILTER_EQUIPMENT_BULK_EDIT_APS, {
variables: { customerId, locationIds, equipmentType: 'AP' },
const [
filterEquipment,
{
loading: filterEquipmentLoading,
error: filterEquipmentError,
refetch,
data: equipData,
fetchMore,
},
] = useLazyQuery(FILTER_EQUIPMENT_BULK_EDIT_APS, {
errorPolicy: 'all',
fetchPolicy: 'cache-first',
});
const fetchFilterEquipment = async () => {
filterEquipment({
variables: {
customerId,
locationIds,
equipmentType: 'AP',
},
});
};
const [updateEquipmentBulk] = useMutation(UPDATE_EQUIPMENT_BULK);
const getRadioDetails = (radioDetails, type) => {
if (type === 'manualChannelNumber') {
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,
id: key,
name,
manualChannelNumber: getRadioDetails(details, 'manualChannelNumber'),
manualBackupChannelNumber: getRadioDetails(details, 'manualBackupChannelNumber'),
cellSize: getRadioDetails(details, 'cellSize'),
probeResponseThreshold: getRadioDetails(details, 'probeResponseThreshold'),
clientDisconnectThreshold: getRadioDetails(details, 'clientDisconnectThreshold'),
snrDrop: getRadioDetails(details, 'snrDrop'),
minLoad: getRadioDetails(details, 'minLoad'),
radioMap: Object.keys(details?.radioMap || {}),
}));
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 formattedTableData = useMemo(
() =>
equipData?.filterEquipment?.items?.map(({ id: key, name, details = {} }) => ({
key,
id: key,
name,
manualChannelNumber: getRadioDetails(details, 'manualChannelNumber'),
manualBackupChannelNumber: getRadioDetails(details, 'manualBackupChannelNumber'),
cellSize: getRadioDetails(details, 'cellSize'),
probeResponseThreshold: getRadioDetails(details, 'probeResponseThreshold'),
clientDisconnectThreshold: getRadioDetails(details, 'clientDisconnectThreshold'),
snrDrop: getRadioDetails(details, 'snrDrop'),
minLoad: getRadioDetails(details, 'minLoad'),
radioMap: getRadioDetails(details, 'radioMap'),
allowedChannels: getRadioDetails(details, 'allowedChannels'),
})),
[equipData?.filterEquipment?.items]
);
const updateEquipments = editedRowsArr => {
updateEquipmentBulk({
@@ -322,38 +247,10 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
const handleSaveChanges = updatedRows => {
const editedRowsArr = [];
Object.keys(updatedRows).forEach(key => {
const {
id: equipmentId,
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({
equipmentId: updatedRows[key].id,
perRadioDetails: formatRadioFrequencies(updatedRows[key]),
});
return editedRowsArr.push(tempObj);
});
updateEquipments(editedRowsArr);
};
@@ -377,24 +274,30 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
}
};
if (filterEquipmentLoading) {
return <Loading />;
}
useEffect(() => {
fetchFilterEquipment();
}, [locationIds]);
if (filterEquipmentError) {
return (
<Alert message="Error" description="Failed to load equipments data." type="error" showIcon />
<Alert
message="Error"
description="Failed to load equipment(s) data."
type="error"
showIcon
/>
);
}
return (
<BulkEditAccessPoints
tableColumns={accessPointsChannelTableColumns}
tableData={setAccessPointsBulkEditTableData(equipData?.filterEquipment)}
tableData={formattedTableData}
onLoadMore={handleLoadMore}
isLastPage={equipData?.filterEquipment?.context?.lastPage}
onSaveChanges={handleSaveChanges}
breadcrumbPath={getBreadcrumbPath(id, locations)}
loading={filterEquipmentLoading}
/>
);
};

View File

@@ -1,7 +1,7 @@
import React, { useState, useContext } from 'react';
import { useParams, Redirect } from 'react-router-dom';
import { useQuery, useMutation, gql } from '@apollo/client';
import { Alert, notification } from 'antd';
import { notification } from 'antd';
import { ProfileDetails as ProfileDetailsPage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
import { ROUTES, AUTH_TOKEN } from 'constants/index';
@@ -32,6 +32,8 @@ const GET_PROFILE = gql`
osuSsidProfile {
id
name
profileType
details
}
childProfileIds
createdTimestamp
@@ -87,9 +89,10 @@ const ProfileDetails = () => {
const { data: apiUrl } = useQuery(GET_API_URL);
const { loading, error, data } = useQuery(GET_PROFILE, {
const { loading, data } = useQuery(GET_PROFILE, {
variables: { id },
fetchPolicy: 'network-only',
errorPolicy: 'all',
});
const { data: ssidProfiles, fetchMore } = useQuery(GET_ALL_PROFILES(), {
@@ -139,6 +142,14 @@ const ProfileDetails = () => {
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 [deleteProfile] = useMutation(DELETE_PROFILE);
@@ -269,6 +280,8 @@ const ProfileDetails = () => {
fetchMoreProfiles(e, operatorProfiles, fetchMoreOperatorProfiles);
else if (key === 'passpoint_osu_id_provider')
fetchMoreProfiles(e, idProviderProfiles, fetchMoreIdProviderProfiles);
else if (key === 'passpoint')
fetchMoreProfiles(e, passpointProfiles, fetchMorePasspointProfiles);
else fetchMoreProfiles(e, ssidProfiles, fetchMore);
};
@@ -276,12 +289,6 @@ const ProfileDetails = () => {
return <Loading />;
}
if (error) {
return (
<Alert message="Error" description="Failed to load profile data." type="error" showIcon />
);
}
if (redirect) {
return <Redirect to={ROUTES.profiles} />;
}
@@ -289,6 +296,7 @@ const ProfileDetails = () => {
return (
<ProfileDetailsPage
name={data.getProfile.name}
profileId={data?.getProfile?.id}
profileType={data.getProfile.profileType}
details={data.getProfile.details}
childProfiles={data.getProfile.childProfiles}
@@ -304,6 +312,7 @@ const ProfileDetails = () => {
idProviderProfiles={idProviderProfiles?.getAllProfiles?.items}
associatedSsidProfiles={data.getProfile?.associatedSsidProfiles}
osuSsidProfile={data.getProfile?.osuSsidProfile}
passpointProfiles={passpointProfiles?.getAllProfiles?.items}
fileUpload={handleFileUpload}
onFetchMoreProfiles={handleFetchMoreProfiles}
onDownloadFile={handleDownloadFile}

View File

@@ -1,4 +1,4 @@
import React, { useContext } from 'react';
import React, { useContext, useMemo } from 'react';
import { useQuery, useMutation } from '@apollo/client';
import { Alert, notification } from 'antd';
import { AutoProvision as AutoProvisionPage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
@@ -7,6 +7,7 @@ import UserContext from 'contexts/UserContext';
import { GET_CUSTOMER, GET_ALL_LOCATIONS, GET_ALL_PROFILES } from 'graphql/queries';
import { UPDATE_CUSTOMER } from 'graphql/mutations';
import { fetchMoreProfiles } from 'graphql/functions';
import { formatLocations } from 'utils/locations';
const AutoProvision = () => {
const { customerId } = useContext(UserContext);
@@ -65,6 +66,10 @@ const AutoProvision = () => {
fetchMoreProfiles(e, dataProfile, fetchMore);
};
const locationsTree = useMemo(() => {
return formatLocations(dataLocation?.getAllLocations, true);
}, [dataLocation?.getAllLocations]);
if (loading) {
return <Loading />;
}
@@ -77,9 +82,9 @@ const AutoProvision = () => {
return (
<AutoProvisionPage
data={data && data.getCustomer}
dataLocation={dataLocation && dataLocation.getAllLocations}
dataProfile={dataProfile && dataProfile.getAllProfiles.items}
data={data?.getCustomer}
locationsTree={locationsTree}
dataProfile={dataProfile?.getAllProfiles?.items}
loadingLocation={loadingLocation}
loadingProfile={loadingProfile}
errorLocation={errorLocation}

View File

@@ -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>
);

View File

@@ -14,6 +14,7 @@ import { AUTH_TOKEN } from 'constants/index';
import { REFRESH_TOKEN } from 'graphql/mutations';
import { getItem, setItem, removeItem } from 'utils/localStorage';
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 MOUNT_NODE = document.getElementById('root');
@@ -102,6 +103,7 @@ const render = () => {
ReactDOM.render(
<Router history={history}>
<ApolloProvider client={client}>
<ScrollToTop />
<App />
</ApolloProvider>
</Router>,

View File

@@ -1,3 +1,14 @@
body {
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;
}

110
app/utils/locations.js Normal file
View File

@@ -0,0 +1,110 @@
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
View File

@@ -1,6 +1,6 @@
{
"name": "wlan-cloud-ui",
"version": "1.1.8",
"version": "1.2.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -2223,9 +2223,9 @@
}
},
"@tip-wlan/wlan-cloud-ui-library": {
"version": "1.1.13",
"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.13.tgz",
"integrity": "sha1-vAxSv7SrTSO2PWIdITaEw7y6ONk="
"version": "1.2.6",
"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",
"integrity": "sha1-BZoknNYpmGz7TCJmRVDSOtrA4B4="
},
"@types/anymatch": {
"version": "1.3.1",

View File

@@ -1,6 +1,6 @@
{
"name": "wlan-cloud-ui",
"version": "1.1.8",
"version": "1.2.0",
"author": "ConnectUs",
"description": "React Portal",
"engines": {
@@ -21,7 +21,7 @@
"dependencies": {
"@ant-design/icons": "^4.2.1",
"@apollo/client": "^3.1.3",
"@tip-wlan/wlan-cloud-ui-library": "^1.1.13",
"@tip-wlan/wlan-cloud-ui-library": "^1.2.6",
"antd": "^4.5.2",
"apollo-upload-client": "^13.0.0",
"graphql": "^15.5.0",