Merge pull request #64 from Telecominfraproject/feature/WIFI-817

Feature/wifi 817: Switch to Inactive Bank, and Reboot AP
This commit is contained in:
Sean Macfarlane
2020-10-02 17:51:03 -04:00
committed by GitHub
4 changed files with 80 additions and 12 deletions

View File

@@ -10,7 +10,11 @@ import {
} from '@tip-wlan/wlan-cloud-ui-library';
import { FILTER_SERVICE_METRICS, GET_ALL_FIRMWARE, GET_ALL_PROFILES } from 'graphql/queries';
import { UPDATE_EQUIPMENT_FIRMWARE } from 'graphql/mutations';
import {
UPDATE_EQUIPMENT_FIRMWARE,
REQUEST_EQUIPMENT_SWITCH_BANK,
REQUEST_EQUIPMENT_REBOOT,
} from 'graphql/mutations';
import { updateQueryGetAllProfiles } from 'graphql/functions';
import UserContext from 'contexts/UserContext';
@@ -175,6 +179,8 @@ const AccessPointDetails = ({ locations }) => {
const [updateEquipment] = useMutation(UPDATE_EQUIPMENT);
const [updateEquipmentFirmware] = useMutation(UPDATE_EQUIPMENT_FIRMWARE);
const [requestEquipmentSwitchBank] = useMutation(REQUEST_EQUIPMENT_SWITCH_BANK);
const [requestEquipmentReboot] = useMutation(REQUEST_EQUIPMENT_REBOOT);
const refetchData = () => {
refetch();
@@ -229,16 +235,16 @@ const AccessPointDetails = ({ locations }) => {
const handleUpdateEquipmentFirmware = (equipmentId, firmwareVersionId) =>
updateEquipmentFirmware({ variables: { equipmentId, firmwareVersionId } })
.then(firmwareResp => {
if (firmwareResp && firmwareResp.data.updateEquipmentFirmware.success === false) {
notification.error({
message: 'Error',
description: 'Equipment Firmware Upgrade could not be updated.',
});
} else {
if (firmwareResp?.data?.updateEquipmentFirmware?.success === true) {
notification.success({
message: 'Success',
description: 'Equipment Firmware Upgrade in progress',
});
} else {
notification.error({
message: 'Error',
description: 'Equipment Firmware Upgrade could not be updated.',
});
}
})
.catch(() =>
@@ -248,6 +254,50 @@ const AccessPointDetails = ({ locations }) => {
})
);
const handleRequestEquipmentSwitchBank = equipmentId =>
requestEquipmentSwitchBank({ variables: { equipmentId } })
.then(firmwareResp => {
if (firmwareResp?.data?.requestEquipmentSwitchBank?.success === true) {
notification.success({
message: 'Success',
description: 'Equipment Firmware in progress',
});
} else {
notification.error({
message: 'Error',
description: 'Equipment Firmware could not be updated.',
});
}
})
.catch(() =>
notification.error({
message: 'Error',
description: 'Equipment Firmware could not be updated.',
})
);
const handleRequestEquipmentReboot = equipmentId =>
requestEquipmentReboot({ variables: { equipmentId } })
.then(firmwareResp => {
if (firmwareResp?.data?.requestEquipmentReboot?.success === true) {
notification.success({
message: 'Success',
description: 'Equipment Firmware in progress',
});
} else {
notification.error({
message: 'Error',
description: 'Equipment Firmware could not be updated.',
});
}
})
.catch(() =>
notification.error({
message: 'Error',
description: 'Equipment Firmware could not be updated.',
})
);
const handleFetchProfiles = e => {
if (dataProfiles.getAllProfiles.context.lastPage) {
return false;
@@ -295,6 +345,8 @@ const AccessPointDetails = ({ locations }) => {
firmware={dataFirmware?.getAllFirmware}
locations={locations}
onUpdateEquipmentFirmware={handleUpdateEquipmentFirmware}
onRequestEquipmentSwitchBank={handleRequestEquipmentSwitchBank}
onRequestEquipmentReboot={handleRequestEquipmentReboot}
loadingProfiles={loadingProfiles}
errorProfiles={errorProfiles}
loadingFirmware={loadingFirmware}

View File

@@ -99,6 +99,22 @@ export const UPDATE_EQUIPMENT_FIRMWARE = gql`
}
`;
export const REQUEST_EQUIPMENT_SWITCH_BANK = gql`
mutation RequestEquipmentSwitchBank($equipmentId: ID) {
requestEquipmentSwitchBank(equipmentId: $equipmentId) {
success
}
}
`;
export const REQUEST_EQUIPMENT_REBOOT = gql`
mutation RequestEquipmentReboot($equipmentId: ID) {
requestEquipmentReboot(equipmentId: $equipmentId) {
success
}
}
`;
export const UPDATE_TRACK_ASSIGNMENT = gql`
mutation UpdateFirmwareTrackAssignment(
$trackRecordId: ID!

6
package-lock.json generated
View File

@@ -1845,9 +1845,9 @@
}
},
"@tip-wlan/wlan-cloud-ui-library": {
"version": "0.3.3",
"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-0.3.3.tgz",
"integrity": "sha1-Ymx4mR+bW0VYFFnKQ2ypJjJabOI="
"version": "0.3.5",
"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-0.3.5.tgz",
"integrity": "sha1-PS05GIMSgSjP4t4BG+j8UdBnvNY="
},
"@types/anymatch": {
"version": "1.3.1",

View File

@@ -1,6 +1,6 @@
{
"name": "wlan-cloud-ui",
"version": "0.4.2",
"version": "0.4.3",
"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": "^0.3.3",
"@tip-wlan/wlan-cloud-ui-library": "^0.3.5",
"antd": "^4.5.2",
"apollo-upload-client": "^13.0.0",
"clean-webpack-plugin": "^3.0.0",