mirror of
https://github.com/Telecominfraproject/wlan-cloud-ui.git
synced 2025-11-01 03:07:53 +00:00
Merge pull request #90 from Telecominfraproject/bugfix/WIFI-1505
hotfix/WIFI-1505: Manual Channel Editing
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useParams, useHistory } from 'react-router-dom';
|
import { useParams, useHistory } from 'react-router-dom';
|
||||||
import { useQuery, useMutation, gql } from '@apollo/client';
|
import { useQuery, useMutation } from '@apollo/client';
|
||||||
import { Alert, notification } from 'antd';
|
import { Alert, notification } from 'antd';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import {
|
import {
|
||||||
@@ -9,8 +9,15 @@ import {
|
|||||||
Loading,
|
Loading,
|
||||||
} from '@tip-wlan/wlan-cloud-ui-library';
|
} from '@tip-wlan/wlan-cloud-ui-library';
|
||||||
|
|
||||||
import { FILTER_SERVICE_METRICS, GET_ALL_FIRMWARE, GET_ALL_PROFILES } from 'graphql/queries';
|
|
||||||
import {
|
import {
|
||||||
|
GET_EQUIPMENT,
|
||||||
|
FILTER_SERVICE_METRICS,
|
||||||
|
GET_ALL_FIRMWARE,
|
||||||
|
GET_ALL_PROFILES,
|
||||||
|
} from 'graphql/queries';
|
||||||
|
import {
|
||||||
|
UPDATE_EQUIPMENT,
|
||||||
|
DELETE_EQUIPMENT,
|
||||||
UPDATE_EQUIPMENT_FIRMWARE,
|
UPDATE_EQUIPMENT_FIRMWARE,
|
||||||
REQUEST_EQUIPMENT_SWITCH_BANK,
|
REQUEST_EQUIPMENT_SWITCH_BANK,
|
||||||
REQUEST_EQUIPMENT_REBOOT,
|
REQUEST_EQUIPMENT_REBOOT,
|
||||||
@@ -18,120 +25,6 @@ import {
|
|||||||
import { fetchMoreProfiles } from 'graphql/functions';
|
import { fetchMoreProfiles } from 'graphql/functions';
|
||||||
import UserContext from 'contexts/UserContext';
|
import UserContext from 'contexts/UserContext';
|
||||||
|
|
||||||
const GET_EQUIPMENT = gql`
|
|
||||||
query GetEquipment($id: ID!) {
|
|
||||||
getEquipment(id: $id) {
|
|
||||||
id
|
|
||||||
equipmentType
|
|
||||||
inventoryId
|
|
||||||
customerId
|
|
||||||
profileId
|
|
||||||
locationId
|
|
||||||
name
|
|
||||||
latitude
|
|
||||||
longitude
|
|
||||||
serial
|
|
||||||
lastModifiedTimestamp
|
|
||||||
details
|
|
||||||
profile {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
childProfiles {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
details
|
|
||||||
}
|
|
||||||
}
|
|
||||||
baseMacAddress
|
|
||||||
manufacturer
|
|
||||||
status {
|
|
||||||
firmware {
|
|
||||||
detailsJSON
|
|
||||||
}
|
|
||||||
protocol {
|
|
||||||
detailsJSON
|
|
||||||
}
|
|
||||||
radioUtilization {
|
|
||||||
detailsJSON
|
|
||||||
}
|
|
||||||
clientDetails {
|
|
||||||
detailsJSON
|
|
||||||
details {
|
|
||||||
numClientsPerRadio
|
|
||||||
}
|
|
||||||
}
|
|
||||||
osPerformance {
|
|
||||||
detailsJSON
|
|
||||||
}
|
|
||||||
}
|
|
||||||
model
|
|
||||||
alarmsCount
|
|
||||||
alarms {
|
|
||||||
severity
|
|
||||||
alarmCode
|
|
||||||
details
|
|
||||||
createdTimestamp
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const UPDATE_EQUIPMENT = gql`
|
|
||||||
mutation UpdateEquipment(
|
|
||||||
$id: ID!
|
|
||||||
$equipmentType: String!
|
|
||||||
$inventoryId: String!
|
|
||||||
$customerId: ID!
|
|
||||||
$profileId: ID!
|
|
||||||
$locationId: ID!
|
|
||||||
$name: String!
|
|
||||||
$baseMacAddress: String
|
|
||||||
$latitude: String
|
|
||||||
$longitude: String
|
|
||||||
$serial: String
|
|
||||||
$lastModifiedTimestamp: String
|
|
||||||
$details: JSONObject
|
|
||||||
) {
|
|
||||||
updateEquipment(
|
|
||||||
id: $id
|
|
||||||
equipmentType: $equipmentType
|
|
||||||
inventoryId: $inventoryId
|
|
||||||
customerId: $customerId
|
|
||||||
profileId: $profileId
|
|
||||||
locationId: $locationId
|
|
||||||
name: $name
|
|
||||||
baseMacAddress: $baseMacAddress
|
|
||||||
latitude: $latitude
|
|
||||||
longitude: $longitude
|
|
||||||
serial: $serial
|
|
||||||
lastModifiedTimestamp: $lastModifiedTimestamp
|
|
||||||
details: $details
|
|
||||||
) {
|
|
||||||
id
|
|
||||||
equipmentType
|
|
||||||
inventoryId
|
|
||||||
customerId
|
|
||||||
profileId
|
|
||||||
locationId
|
|
||||||
name
|
|
||||||
baseMacAddress
|
|
||||||
latitude
|
|
||||||
longitude
|
|
||||||
serial
|
|
||||||
lastModifiedTimestamp
|
|
||||||
details
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const DELETE_EQUIPMENT = gql`
|
|
||||||
mutation DeleteEquipment($id: ID!) {
|
|
||||||
deleteEquipment(id: $id) {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const toTime = moment();
|
const toTime = moment();
|
||||||
const fromTime = moment().subtract(1, 'hour');
|
const fromTime = moment().subtract(1, 'hour');
|
||||||
|
|
||||||
|
|||||||
@@ -27,13 +27,22 @@ const renderTableCell = tabCell => {
|
|||||||
return <span>{tabCell}</span>;
|
return <span>{tabCell}</span>;
|
||||||
};
|
};
|
||||||
const accessPointsChannelTableColumns = [
|
const accessPointsChannelTableColumns = [
|
||||||
{ title: 'Name', dataIndex: 'name', key: 'name', width: 150, render: renderTableCell },
|
{ title: 'Name', dataIndex: 'name', key: 'name', width: 250, render: renderTableCell },
|
||||||
{
|
{
|
||||||
title: 'Channel',
|
title: 'Manual Active Channel',
|
||||||
dataIndex: 'channel',
|
dataIndex: 'manualChannelNumber',
|
||||||
key: 'channel',
|
key: 'manualChannelNumber',
|
||||||
editable: true,
|
editable: true,
|
||||||
width: 150,
|
width: 200,
|
||||||
|
render: renderTableCell,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: 'Manual Backup Channel',
|
||||||
|
dataIndex: 'manualBackupChannelNumber',
|
||||||
|
key: 'manualBackupChannelNumber',
|
||||||
|
editable: true,
|
||||||
|
width: 210,
|
||||||
render: renderTableCell,
|
render: renderTableCell,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -49,7 +58,7 @@ const accessPointsChannelTableColumns = [
|
|||||||
dataIndex: 'probeResponseThreshold',
|
dataIndex: 'probeResponseThreshold',
|
||||||
key: 'probeResponseThreshold',
|
key: 'probeResponseThreshold',
|
||||||
editable: true,
|
editable: true,
|
||||||
width: 200,
|
width: 210,
|
||||||
render: renderTableCell,
|
render: renderTableCell,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -57,7 +66,7 @@ const accessPointsChannelTableColumns = [
|
|||||||
dataIndex: 'clientDisconnectThreshold',
|
dataIndex: 'clientDisconnectThreshold',
|
||||||
key: 'clientDisconnectThreshold',
|
key: 'clientDisconnectThreshold',
|
||||||
editable: true,
|
editable: true,
|
||||||
width: 200,
|
width: 210,
|
||||||
|
|
||||||
render: renderTableCell,
|
render: renderTableCell,
|
||||||
},
|
},
|
||||||
@@ -66,7 +75,7 @@ const accessPointsChannelTableColumns = [
|
|||||||
dataIndex: 'snrDrop',
|
dataIndex: 'snrDrop',
|
||||||
key: 'snrDrop',
|
key: 'snrDrop',
|
||||||
editable: true,
|
editable: true,
|
||||||
width: 175,
|
width: 150,
|
||||||
render: renderTableCell,
|
render: renderTableCell,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -169,6 +178,21 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
|
|||||||
const [updateEquipmentBulk] = useMutation(UPDATE_EQUIPMENT_BULK);
|
const [updateEquipmentBulk] = useMutation(UPDATE_EQUIPMENT_BULK);
|
||||||
|
|
||||||
const getRadioDetails = (radioDetails, type) => {
|
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') {
|
if (type === 'cellSize') {
|
||||||
const cellSizeValues = [];
|
const cellSizeValues = [];
|
||||||
Object.keys(radioDetails?.radioMap || {}).map(i => {
|
Object.keys(radioDetails?.radioMap || {}).map(i => {
|
||||||
@@ -214,12 +238,13 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const setAccessPointsBulkEditTableData = (dataSource = []) => {
|
const setAccessPointsBulkEditTableData = (dataSource = []) => {
|
||||||
const tableData = dataSource.items.map(({ id: key, name, channel, details }) => {
|
const tableData = dataSource.items.map(({ id: key, name, details }) => {
|
||||||
return {
|
return {
|
||||||
key,
|
key,
|
||||||
id: key,
|
id: key,
|
||||||
name,
|
name,
|
||||||
channel,
|
manualChannelNumber: getRadioDetails(details, 'manualChannelNumber'),
|
||||||
|
manualBackupChannelNumber: getRadioDetails(details, 'manualBackupChannelNumber'),
|
||||||
cellSize: getRadioDetails(details, 'cellSize'),
|
cellSize: getRadioDetails(details, 'cellSize'),
|
||||||
probeResponseThreshold: getRadioDetails(details, 'probeResponseThreshold'),
|
probeResponseThreshold: getRadioDetails(details, 'probeResponseThreshold'),
|
||||||
clientDisconnectThreshold: getRadioDetails(details, 'clientDisconnectThreshold'),
|
clientDisconnectThreshold: getRadioDetails(details, 'clientDisconnectThreshold'),
|
||||||
@@ -232,7 +257,8 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
|
|||||||
|
|
||||||
const setUpdatedBulkEditTableData = (
|
const setUpdatedBulkEditTableData = (
|
||||||
equipmentId,
|
equipmentId,
|
||||||
channel,
|
manualChannelNumber,
|
||||||
|
manualBackupChannelNumber,
|
||||||
cellSize,
|
cellSize,
|
||||||
probeResponseThreshold,
|
probeResponseThreshold,
|
||||||
clientDisconnectThreshold,
|
clientDisconnectThreshold,
|
||||||
@@ -251,7 +277,8 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
|
|||||||
minLoadFactor = minLoad[dataIndex];
|
minLoadFactor = minLoad[dataIndex];
|
||||||
|
|
||||||
frequencies[`${i}`] = {
|
frequencies[`${i}`] = {
|
||||||
channelNumber: channel[dataIndex],
|
channelNumber: manualChannelNumber[dataIndex],
|
||||||
|
backupChannelNumber: manualBackupChannelNumber[dataIndex],
|
||||||
rxCellSizeDb: {
|
rxCellSizeDb: {
|
||||||
auto: true,
|
auto: true,
|
||||||
value: cellSize[dataIndex],
|
value: cellSize[dataIndex],
|
||||||
@@ -300,7 +327,8 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
|
|||||||
Object.keys(updatedRows).forEach(key => {
|
Object.keys(updatedRows).forEach(key => {
|
||||||
const {
|
const {
|
||||||
id: equipmentId,
|
id: equipmentId,
|
||||||
channel,
|
manualChannelNumber,
|
||||||
|
manualBackupChannelNumber,
|
||||||
cellSize,
|
cellSize,
|
||||||
probeResponseThreshold,
|
probeResponseThreshold,
|
||||||
clientDisconnectThreshold,
|
clientDisconnectThreshold,
|
||||||
@@ -309,7 +337,8 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
|
|||||||
} = updatedRows[key];
|
} = updatedRows[key];
|
||||||
const updatedEuips = setUpdatedBulkEditTableData(
|
const updatedEuips = setUpdatedBulkEditTableData(
|
||||||
equipmentId,
|
equipmentId,
|
||||||
channel,
|
manualChannelNumber,
|
||||||
|
manualBackupChannelNumber,
|
||||||
cellSize,
|
cellSize,
|
||||||
probeResponseThreshold,
|
probeResponseThreshold,
|
||||||
clientDisconnectThreshold,
|
clientDisconnectThreshold,
|
||||||
@@ -364,18 +393,9 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
|
|||||||
return (
|
return (
|
||||||
<BulkEditAccessPoints
|
<BulkEditAccessPoints
|
||||||
tableColumns={accessPointsChannelTableColumns}
|
tableColumns={accessPointsChannelTableColumns}
|
||||||
tableData={
|
tableData={setAccessPointsBulkEditTableData(equipData && equipData?.filterEquipment)}
|
||||||
equipData &&
|
|
||||||
equipData.filterEquipment &&
|
|
||||||
setAccessPointsBulkEditTableData(equipData && equipData.filterEquipment)
|
|
||||||
}
|
|
||||||
onLoadMore={handleLoadMore}
|
onLoadMore={handleLoadMore}
|
||||||
isLastPage={
|
isLastPage={equipData?.filterEquipment?.context?.lastPage}
|
||||||
equipData &&
|
|
||||||
equipData.filterEquipment &&
|
|
||||||
equipData.filterEquipment.context &&
|
|
||||||
equipData.filterEquipment.context.lastPage
|
|
||||||
}
|
|
||||||
onSaveChanges={handleSaveChanges}
|
onSaveChanges={handleSaveChanges}
|
||||||
breadcrumbPath={getBreadcrumbPath(id, locations)}
|
breadcrumbPath={getBreadcrumbPath(id, locations)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -255,6 +255,62 @@ export const CREATE_EQUIPMENT = gql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const UPDATE_EQUIPMENT = gql`
|
||||||
|
mutation UpdateEquipment(
|
||||||
|
$id: ID!
|
||||||
|
$equipmentType: String!
|
||||||
|
$inventoryId: String!
|
||||||
|
$customerId: ID!
|
||||||
|
$profileId: ID!
|
||||||
|
$locationId: ID!
|
||||||
|
$name: String!
|
||||||
|
$baseMacAddress: String
|
||||||
|
$latitude: String
|
||||||
|
$longitude: String
|
||||||
|
$serial: String
|
||||||
|
$lastModifiedTimestamp: String
|
||||||
|
$details: JSONObject
|
||||||
|
) {
|
||||||
|
updateEquipment(
|
||||||
|
id: $id
|
||||||
|
equipmentType: $equipmentType
|
||||||
|
inventoryId: $inventoryId
|
||||||
|
customerId: $customerId
|
||||||
|
profileId: $profileId
|
||||||
|
locationId: $locationId
|
||||||
|
name: $name
|
||||||
|
baseMacAddress: $baseMacAddress
|
||||||
|
latitude: $latitude
|
||||||
|
longitude: $longitude
|
||||||
|
serial: $serial
|
||||||
|
lastModifiedTimestamp: $lastModifiedTimestamp
|
||||||
|
details: $details
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
equipmentType
|
||||||
|
inventoryId
|
||||||
|
customerId
|
||||||
|
profileId
|
||||||
|
locationId
|
||||||
|
name
|
||||||
|
baseMacAddress
|
||||||
|
latitude
|
||||||
|
longitude
|
||||||
|
serial
|
||||||
|
lastModifiedTimestamp
|
||||||
|
details
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const DELETE_EQUIPMENT = gql`
|
||||||
|
mutation DeleteEquipment($id: ID!) {
|
||||||
|
deleteEquipment(id: $id) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export const UPDATE_CUSTOMER = gql`
|
export const UPDATE_CUSTOMER = gql`
|
||||||
mutation UpdateCustomer(
|
mutation UpdateCustomer(
|
||||||
$id: ID!
|
$id: ID!
|
||||||
|
|||||||
@@ -77,6 +77,64 @@ export const FILTER_EQUIPMENT = gql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const GET_EQUIPMENT = gql`
|
||||||
|
query GetEquipment($id: ID!) {
|
||||||
|
getEquipment(id: $id) {
|
||||||
|
id
|
||||||
|
equipmentType
|
||||||
|
inventoryId
|
||||||
|
customerId
|
||||||
|
profileId
|
||||||
|
locationId
|
||||||
|
name
|
||||||
|
latitude
|
||||||
|
longitude
|
||||||
|
serial
|
||||||
|
lastModifiedTimestamp
|
||||||
|
details
|
||||||
|
profile {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
childProfiles {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
details
|
||||||
|
}
|
||||||
|
}
|
||||||
|
baseMacAddress
|
||||||
|
manufacturer
|
||||||
|
status {
|
||||||
|
firmware {
|
||||||
|
detailsJSON
|
||||||
|
}
|
||||||
|
protocol {
|
||||||
|
detailsJSON
|
||||||
|
}
|
||||||
|
radioUtilization {
|
||||||
|
detailsJSON
|
||||||
|
}
|
||||||
|
clientDetails {
|
||||||
|
detailsJSON
|
||||||
|
details {
|
||||||
|
numClientsPerRadio
|
||||||
|
}
|
||||||
|
}
|
||||||
|
osPerformance {
|
||||||
|
detailsJSON
|
||||||
|
}
|
||||||
|
}
|
||||||
|
model
|
||||||
|
alarmsCount
|
||||||
|
alarms {
|
||||||
|
severity
|
||||||
|
alarmCode
|
||||||
|
details
|
||||||
|
createdTimestamp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export const FILTER_EQUIPMENT_BULK_EDIT_APS = gql`
|
export const FILTER_EQUIPMENT_BULK_EDIT_APS = gql`
|
||||||
query FilterEquipment(
|
query FilterEquipment(
|
||||||
$locationIds: [ID]
|
$locationIds: [ID]
|
||||||
|
|||||||
Reference in New Issue
Block a user