From 8a37ae767acf5cf39e57dcd5065b9e0013d82e6f Mon Sep 17 00:00:00 2001 From: Irtiza-h30 Date: Wed, 15 Jul 2020 20:15:34 -0400 Subject: [PATCH 01/11] initial commit --- app/containers/System/containers/Firmware/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/containers/System/containers/Firmware/index.js b/app/containers/System/containers/Firmware/index.js index 3a09550..489afe9 100644 --- a/app/containers/System/containers/Firmware/index.js +++ b/app/containers/System/containers/Firmware/index.js @@ -1,7 +1,8 @@ import React from 'react'; +import { Firmware as FirmwarePage } from '@tip-wlan/wlan-cloud-ui-library'; const Firmware = () => { - return

Firmware Page

; + return ; }; export default Firmware; From 31a61fe8046c9a904d36f60b42b3579cbd0faaa7 Mon Sep 17 00:00:00 2001 From: Irtiza-h30 Date: Thu, 16 Jul 2020 12:28:03 -0400 Subject: [PATCH 02/11] firmware query --- .../System/containers/Firmware/index.js | 19 +++++++++++++++++-- app/graphql/queries.js | 14 ++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/app/containers/System/containers/Firmware/index.js b/app/containers/System/containers/Firmware/index.js index 489afe9..db434aa 100644 --- a/app/containers/System/containers/Firmware/index.js +++ b/app/containers/System/containers/Firmware/index.js @@ -1,8 +1,23 @@ import React from 'react'; -import { Firmware as FirmwarePage } from '@tip-wlan/wlan-cloud-ui-library'; +import { useQuery } from '@apollo/react-hooks'; +import { Alert } from 'antd'; +import { GET_ALL_FIRMWARE } from 'graphql/queries'; +import { Firmware as FirmwarePage, Loading } from '@tip-wlan/wlan-cloud-ui-library'; const Firmware = () => { - return ; + const { data, error, loading } = useQuery(GET_ALL_FIRMWARE); + + if (error) { + return ( + + ); + } + + if (loading) { + return ; + } + + return ; }; export default Firmware; diff --git a/app/graphql/queries.js b/app/graphql/queries.js index f5fa9d1..afd422e 100644 --- a/app/graphql/queries.js +++ b/app/graphql/queries.js @@ -223,3 +223,17 @@ export const GET_ALL_STATUS = gql` } } `; + +export const GET_ALL_FIRMWARE = gql` + query GetAllFirmware { + getAllFirmware { + id + modelId + versionName + description + filename + commit + releaseDate + } + } +`; From 4fde4c4db98612b4a33322fb27e7fff6636c1d2c Mon Sep 17 00:00:00 2001 From: Irtiza-h30 Date: Thu, 16 Jul 2020 18:35:12 -0400 Subject: [PATCH 03/11] updated commit --- .../System/containers/Firmware/index.js | 83 +++++++++++++++++-- app/graphql/mutations.js | 23 +++++ app/graphql/queries.js | 11 +++ 3 files changed, 111 insertions(+), 6 deletions(-) diff --git a/app/containers/System/containers/Firmware/index.js b/app/containers/System/containers/Firmware/index.js index db434aa..bf25204 100644 --- a/app/containers/System/containers/Firmware/index.js +++ b/app/containers/System/containers/Firmware/index.js @@ -1,11 +1,64 @@ import React from 'react'; -import { useQuery } from '@apollo/react-hooks'; -import { Alert } from 'antd'; -import { GET_ALL_FIRMWARE } from 'graphql/queries'; +import { useQuery, useMutation } from '@apollo/react-hooks'; +import { Alert, notification } from 'antd'; +import { GET_ALL_FIRMWARE, GET_TRACK_ASSIGNMENTS } from 'graphql/queries'; +import { DELETE_TRACK_ASSIGNMENT, DELETE_FIRMWARE } from 'graphql/mutations'; import { Firmware as FirmwarePage, Loading } from '@tip-wlan/wlan-cloud-ui-library'; const Firmware = () => { - const { data, error, loading } = useQuery(GET_ALL_FIRMWARE); + const { data, error, loading, refetch } = useQuery(GET_ALL_FIRMWARE); + const { + data: trackAssignmentData, + error: trackAssignmentError, + loading: trackAssignmentLoading, + refetch: refetchAssignmentData, + } = useQuery(GET_TRACK_ASSIGNMENTS); + + const [deleteTrackAssignment] = useMutation(DELETE_TRACK_ASSIGNMENT); + const [deleteFirmware] = useMutation(DELETE_FIRMWARE); + + const handleDeleteTrackAssignment = (firmwareTrackId, firmwareVersionId) => { + deleteTrackAssignment({ + variables: { + firmwareTrackId, + firmwareVersionId, + }, + }) + .then(() => { + refetchAssignmentData(); + notification.success({ + message: 'Success', + description: 'Track Assignment successfully deleted.', + }); + }) + .catch(() => + notification.error({ + message: 'Error', + description: 'Track Assignment could not be deleted.', + }) + ); + }; + + const handleDeleteFirmware = id => { + deleteFirmware({ + variables: { + id, + }, + }) + .then(() => { + refetch(); + notification.success({ + message: 'Success', + description: 'Firmware successfully deleted.', + }); + }) + .catch(() => + notification.error({ + message: 'Error', + description: 'Firmware could not be deleted.', + }) + ); + }; if (error) { return ( @@ -13,11 +66,29 @@ const Firmware = () => { ); } - if (loading) { + if (trackAssignmentError) { + return ( + + ); + } + + if (loading || trackAssignmentLoading) { return ; } - return ; + return ( + + ); }; export default Firmware; diff --git a/app/graphql/mutations.js b/app/graphql/mutations.js index f1bc6b0..42eb661 100644 --- a/app/graphql/mutations.js +++ b/app/graphql/mutations.js @@ -99,3 +99,26 @@ export const UPDATE_EQUIPMENT_FIRMWARE = gql` } } `; + +export const DELETE_TRACK_ASSIGNMENT = gql` + mutation UpdateEquipmentFirmware($firmwareTrackId: ID!, $firmwareVersionId: ID!) { + deleteFirmwareTrackAssignment( + firmwareTrackId: $firmwareTrackId + firmwareVersionId: $firmwareVersionId + ) { + trackRecordId + firmwareVersionRecordId + modelId + createdTimestamp + lastModifiedTimestamp + } + } +`; + +export const DELETE_FIRMWARE = gql` + mutation DeleteFirmware($id: ID!) { + deleteFirmware(id: $id) { + id + } + } +`; diff --git a/app/graphql/queries.js b/app/graphql/queries.js index afd422e..9578f87 100644 --- a/app/graphql/queries.js +++ b/app/graphql/queries.js @@ -237,3 +237,14 @@ export const GET_ALL_FIRMWARE = gql` } } `; + +export const GET_TRACK_ASSIGNMENTS = gql` + query GetAllFirmwareTrackAssignment { + getAllFirmwareTrackAssignment { + modelId + firmwareVersionRecordId + trackRecordId + lastModifiedTimestamp + } + } +`; From 3f3959beb8716f21bfbe90953e745100e19b423a Mon Sep 17 00:00:00 2001 From: Irtiza-h30 Date: Fri, 17 Jul 2020 13:34:09 -0400 Subject: [PATCH 04/11] createFirmware/updateFirmware mutations --- .../System/containers/Firmware/index.js | 90 ++++++++++++++++++- app/graphql/mutations.js | 69 ++++++++++++++ app/graphql/queries.js | 3 + 3 files changed, 159 insertions(+), 3 deletions(-) diff --git a/app/containers/System/containers/Firmware/index.js b/app/containers/System/containers/Firmware/index.js index bf25204..eed6ffd 100644 --- a/app/containers/System/containers/Firmware/index.js +++ b/app/containers/System/containers/Firmware/index.js @@ -2,7 +2,12 @@ import React from 'react'; import { useQuery, useMutation } from '@apollo/react-hooks'; import { Alert, notification } from 'antd'; import { GET_ALL_FIRMWARE, GET_TRACK_ASSIGNMENTS } from 'graphql/queries'; -import { DELETE_TRACK_ASSIGNMENT, DELETE_FIRMWARE } from 'graphql/mutations'; +import { + DELETE_TRACK_ASSIGNMENT, + DELETE_FIRMWARE, + CREATE_FIRMWARE, + UPDATE_FIRMWARE, +} from 'graphql/mutations'; import { Firmware as FirmwarePage, Loading } from '@tip-wlan/wlan-cloud-ui-library'; const Firmware = () => { @@ -16,6 +21,8 @@ const Firmware = () => { const [deleteTrackAssignment] = useMutation(DELETE_TRACK_ASSIGNMENT); const [deleteFirmware] = useMutation(DELETE_FIRMWARE); + const [createFirmware] = useMutation(CREATE_FIRMWARE); + const [updateFirmware] = useMutation(UPDATE_FIRMWARE); const handleDeleteTrackAssignment = (firmwareTrackId, firmwareVersionId) => { deleteTrackAssignment({ @@ -38,6 +45,81 @@ const Firmware = () => { }) ); }; + const handleCreateFirmware = ( + modelId, + versionName, + description, + filename, + commit, + releaseDate, + validationCode + ) => { + createFirmware({ + variables: { + modelId, + versionName, + description, + filename, + commit, + releaseDate, + validationCode, + }, + }) + .then(() => { + refetch(); + notification.success({ + message: 'Success', + description: 'Firmware version successfully created.', + }); + }) + .catch(() => + notification.error({ + message: 'Error', + description: 'Firmware version could not be created.', + }) + ); + }; + + const handleUpdateFirmware = ( + id, + modelId, + versionName, + description, + filename, + commit, + releaseDate, + validationCode, + createdTimestamp, + lastModifiedTimestamp + ) => { + updateFirmware({ + variables: { + id, + modelId, + versionName, + description, + filename, + commit, + releaseDate, + validationCode, + createdTimestamp, + lastModifiedTimestamp, + }, + }) + .then(() => { + refetch(); + notification.success({ + message: 'Success', + description: 'Firmware version successfully updated.', + }); + }) + .catch(() => + notification.error({ + message: 'Error', + description: 'Firmware version could not be updated.', + }) + ); + }; const handleDeleteFirmware = id => { deleteFirmware({ @@ -49,13 +131,13 @@ const Firmware = () => { refetch(); notification.success({ message: 'Success', - description: 'Firmware successfully deleted.', + description: 'Firmware version successfully deleted.', }); }) .catch(() => notification.error({ message: 'Error', - description: 'Firmware could not be deleted.', + description: 'Firmware version could not be deleted.', }) ); }; @@ -87,6 +169,8 @@ const Firmware = () => { trackAssignmentData={trackAssignmentData && trackAssignmentData.getAllFirmwareTrackAssignment} onDeleteTrackAssignment={handleDeleteTrackAssignment} onDeleteFirmware={handleDeleteFirmware} + onCreateFirnware={handleCreateFirmware} + onUpdateFirmware={handleUpdateFirmware} /> ); }; diff --git a/app/graphql/mutations.js b/app/graphql/mutations.js index 42eb661..38a0d55 100644 --- a/app/graphql/mutations.js +++ b/app/graphql/mutations.js @@ -122,3 +122,72 @@ export const DELETE_FIRMWARE = gql` } } `; + +export const CREATE_FIRMWARE = gql` + mutation CreateFirmware( + $modelId: String! + $versionName: String + $description: String + $filename: String + $commit: String + $releaseDate: String + $validationCode: String + ) { + createFirmware( + modelId: $modelId + versionName: $versionName + description: $description + filename: $filename + commit: $commit + releaseDate: $releaseDate + validationCode: $validationCode + ) { + modelId + versionName + description + filename + commit + releaseDate + validationCode + } + } +`; + +export const UPDATE_FIRMWARE = gql` + mutation UpdateFirmware( + $id: ID! + $modelId: String! + $versionName: String + $description: String + $filename: String + $commit: String + $releaseDate: String + $validationCode: String + $createdTimestamp: String + $lastModifiedTimestamp: String + ) { + updateFirmware( + id: $id + modelId: $modelId + versionName: $versionName + description: $description + filename: $filename + commit: $commit + releaseDate: $releaseDate + validationCode: $validationCode + createdTimestamp: $createdTimestamp + lastModifiedTimestamp: $lastModifiedTimestamp + ) { + id + modelId + versionName + description + filename + commit + releaseDate + validationCode + createdTimestamp + lastModifiedTimestamp + } + } +`; diff --git a/app/graphql/queries.js b/app/graphql/queries.js index 9578f87..01ac328 100644 --- a/app/graphql/queries.js +++ b/app/graphql/queries.js @@ -234,6 +234,9 @@ export const GET_ALL_FIRMWARE = gql` filename commit releaseDate + validationCode + createdTimestamp + lastModifiedTimestamp } } `; From 7019bb8175d1e495e1d00c7eb0c0cf2e503db3ff Mon Sep 17 00:00:00 2001 From: Irtiza-h30 Date: Fri, 17 Jul 2020 18:27:54 -0400 Subject: [PATCH 05/11] updated changes --- .../System/containers/Firmware/index.js | 31 +++++-------------- app/graphql/mutations.js | 16 +++++----- 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/app/containers/System/containers/Firmware/index.js b/app/containers/System/containers/Firmware/index.js index eed6ffd..997dbff 100644 --- a/app/containers/System/containers/Firmware/index.js +++ b/app/containers/System/containers/Firmware/index.js @@ -1,6 +1,6 @@ import React from 'react'; import { useQuery, useMutation } from '@apollo/react-hooks'; -import { Alert, notification } from 'antd'; +import { notification } from 'antd'; import { GET_ALL_FIRMWARE, GET_TRACK_ASSIGNMENTS } from 'graphql/queries'; import { DELETE_TRACK_ASSIGNMENT, @@ -8,7 +8,7 @@ import { CREATE_FIRMWARE, UPDATE_FIRMWARE, } from 'graphql/mutations'; -import { Firmware as FirmwarePage, Loading } from '@tip-wlan/wlan-cloud-ui-library'; +import { Firmware as FirmwarePage } from '@tip-wlan/wlan-cloud-ui-library'; const Firmware = () => { const { data, error, loading, refetch } = useQuery(GET_ALL_FIRMWARE); @@ -20,9 +20,9 @@ const Firmware = () => { } = useQuery(GET_TRACK_ASSIGNMENTS); const [deleteTrackAssignment] = useMutation(DELETE_TRACK_ASSIGNMENT); - const [deleteFirmware] = useMutation(DELETE_FIRMWARE); const [createFirmware] = useMutation(CREATE_FIRMWARE); const [updateFirmware] = useMutation(UPDATE_FIRMWARE); + const [deleteFirmware] = useMutation(DELETE_FIRMWARE); const handleDeleteTrackAssignment = (firmwareTrackId, firmwareVersionId) => { deleteTrackAssignment({ @@ -142,27 +142,6 @@ const Firmware = () => { ); }; - if (error) { - return ( - - ); - } - - if (trackAssignmentError) { - return ( - - ); - } - - if (loading || trackAssignmentLoading) { - return ; - } - return ( { onDeleteFirmware={handleDeleteFirmware} onCreateFirnware={handleCreateFirmware} onUpdateFirmware={handleUpdateFirmware} + firmwareError={error} + firmwareLoading={loading} + trackAssignmentError={trackAssignmentError} + trackAssignmentLoading={trackAssignmentLoading} /> ); }; diff --git a/app/graphql/mutations.js b/app/graphql/mutations.js index 38a0d55..519c822 100644 --- a/app/graphql/mutations.js +++ b/app/graphql/mutations.js @@ -115,14 +115,6 @@ export const DELETE_TRACK_ASSIGNMENT = gql` } `; -export const DELETE_FIRMWARE = gql` - mutation DeleteFirmware($id: ID!) { - deleteFirmware(id: $id) { - id - } - } -`; - export const CREATE_FIRMWARE = gql` mutation CreateFirmware( $modelId: String! @@ -191,3 +183,11 @@ export const UPDATE_FIRMWARE = gql` } } `; + +export const DELETE_FIRMWARE = gql` + mutation DeleteFirmware($id: ID!) { + deleteFirmware(id: $id) { + id + } + } +`; From 22921f83ef17381b5c2f2affbcfa75e8b8537dab Mon Sep 17 00:00:00 2001 From: Irtiza-h30 Date: Mon, 20 Jul 2020 15:51:37 -0400 Subject: [PATCH 06/11] updated mutations and queries --- .../System/containers/Firmware/index.js | 73 ++++++++++++++++++- app/graphql/mutations.js | 24 ++++++ app/graphql/queries.js | 11 +++ 3 files changed, 105 insertions(+), 3 deletions(-) diff --git a/app/containers/System/containers/Firmware/index.js b/app/containers/System/containers/Firmware/index.js index 997dbff..ea70e31 100644 --- a/app/containers/System/containers/Firmware/index.js +++ b/app/containers/System/containers/Firmware/index.js @@ -1,12 +1,13 @@ import React from 'react'; import { useQuery, useMutation } from '@apollo/react-hooks'; import { notification } from 'antd'; -import { GET_ALL_FIRMWARE, GET_TRACK_ASSIGNMENTS } from 'graphql/queries'; +import { GET_ALL_FIRMWARE, GET_TRACK_ASSIGNMENTS, GET_FIRMWARE_TRACK } from 'graphql/queries'; import { + UPDATE_TRACK_ASSIGNMENT, DELETE_TRACK_ASSIGNMENT, - DELETE_FIRMWARE, CREATE_FIRMWARE, UPDATE_FIRMWARE, + DELETE_FIRMWARE, } from 'graphql/mutations'; import { Firmware as FirmwarePage } from '@tip-wlan/wlan-cloud-ui-library'; @@ -19,11 +20,73 @@ const Firmware = () => { refetch: refetchAssignmentData, } = useQuery(GET_TRACK_ASSIGNMENTS); + const { + data: firmwareTrackData, + error: firmwareTrackError, + loading: firmwareTrackLoading, + } = useQuery(GET_FIRMWARE_TRACK, { + variables: { firmwareTrackName: 'DEFAULT' }, + }); + + const [updateTrackAssignment] = useMutation(UPDATE_TRACK_ASSIGNMENT); const [deleteTrackAssignment] = useMutation(DELETE_TRACK_ASSIGNMENT); const [createFirmware] = useMutation(CREATE_FIRMWARE); const [updateFirmware] = useMutation(UPDATE_FIRMWARE); const [deleteFirmware] = useMutation(DELETE_FIRMWARE); + const handleCreateTrackAssignment = (firmwareVersionRecordId, modelId) => { + updateTrackAssignment({ + variables: { + trackRecordId: firmwareTrackData.getFirmwareTrack.recordId, + firmwareVersionRecordId, + modelId, + }, + }) + .then(() => { + refetchAssignmentData(); + notification.success({ + message: 'Success', + description: 'Track Assignment successfully created.', + }); + }) + .catch(() => + notification.error({ + message: 'Error', + description: 'Track Assignment could not be created.', + }) + ); + }; + + const handleUpdateTrackAssignment = ( + firmwareVersionRecordId, + modelId, + createdTimestamp, + lastModifiedTimestamp + ) => { + updateTrackAssignment({ + variables: { + trackRecordId: firmwareTrackData.getFirmwareTrack.recordId, + firmwareVersionRecordId, + modelId, + createdTimestamp, + lastModifiedTimestamp, + }, + }) + .then(() => { + refetchAssignmentData(); + notification.success({ + message: 'Success', + description: 'Track Assignment successfully updated.', + }); + }) + .catch(() => + notification.error({ + message: 'Error', + description: 'Track Assignment could not be updated.', + }) + ); + }; + const handleDeleteTrackAssignment = (firmwareTrackId, firmwareVersionId) => { deleteTrackAssignment({ variables: { @@ -146,14 +209,18 @@ const Firmware = () => { ); }; diff --git a/app/graphql/mutations.js b/app/graphql/mutations.js index 519c822..93201f4 100644 --- a/app/graphql/mutations.js +++ b/app/graphql/mutations.js @@ -100,6 +100,30 @@ export const UPDATE_EQUIPMENT_FIRMWARE = gql` } `; +export const UPDATE_TRACK_ASSIGNMENT = gql` + mutation UpdateFirmwareTrackAssignment( + $trackRecordId: ID! + $firmwareVersionRecordId: ID! + $modelId: String! + $createdTimestamp: String + $lastModifiedTimestamp: String + ) { + updateFirmwareTrackAssignment( + trackRecordId: $trackRecordId + firmwareVersionRecordId: $firmwareVersionRecordId + modelId: $modelId + createdTimestamp: $createdTimestamp + lastModifiedTimestamp: $lastModifiedTimestamp + ) { + trackRecordId + firmwareVersionRecordId + modelId + createdTimestamp + lastModifiedTimestamp + } + } +`; + export const DELETE_TRACK_ASSIGNMENT = gql` mutation UpdateEquipmentFirmware($firmwareTrackId: ID!, $firmwareVersionId: ID!) { deleteFirmwareTrackAssignment( diff --git a/app/graphql/queries.js b/app/graphql/queries.js index 01ac328..b5fa831 100644 --- a/app/graphql/queries.js +++ b/app/graphql/queries.js @@ -224,6 +224,17 @@ export const GET_ALL_STATUS = gql` } `; +export const GET_FIRMWARE_TRACK = gql` + query GetFirmwareTrack($firmwareTrackName: String!) { + getFirmwareTrack(firmwareTrackName: $firmwareTrackName) { + recordId + trackName + createdTimestamp + lastModifiedTimestamp + } + } +`; + export const GET_ALL_FIRMWARE = gql` query GetAllFirmware { getAllFirmware { From 399a7535c45d4785e292ec39abcc9dc6279bdbb7 Mon Sep 17 00:00:00 2001 From: Sean Macfarlane Date: Mon, 20 Jul 2020 16:10:39 -0400 Subject: [PATCH 07/11] changed ids to type ID --- app/containers/Accounts/index.js | 10 ++++---- app/containers/AddProfile/index.js | 4 ++-- app/containers/Alarms/index.js | 2 +- app/containers/EditAccount/index.js | 6 ++--- .../containers/AccessPointDetails/index.js | 20 ++++++++-------- .../containers/BulkEditAccessPoints/index.js | 4 ++-- .../containers/ClientDeviceDetails/index.js | 4 ++-- app/containers/Network/index.js | 8 +++---- app/containers/ProfileDetails/index.js | 14 +++++------ app/containers/Profiles/index.js | 4 ++-- app/graphql/mutations.js | 18 +++++++------- app/graphql/queries.js | 24 +++++++++---------- 12 files changed, 59 insertions(+), 59 deletions(-) diff --git a/app/containers/Accounts/index.js b/app/containers/Accounts/index.js index 54f4963..36303b8 100644 --- a/app/containers/Accounts/index.js +++ b/app/containers/Accounts/index.js @@ -8,7 +8,7 @@ import { Accounts as AccountsPage, Loading } from '@tip-wlan/wlan-cloud-ui-libra import UserContext from 'contexts/UserContext'; const GET_ALL_USERS = gql` - query GetAllUsers($customerId: Int!, $cursor: String) { + query GetAllUsers($customerId: ID!, $cursor: String) { getAllUsers(customerId: $customerId, cursor: $cursor) { items { id @@ -26,7 +26,7 @@ const GET_ALL_USERS = gql` `; const CREATE_USER = gql` - mutation CreateUser($username: String!, $password: String!, $role: String!, $customerId: Int!) { + mutation CreateUser($username: String!, $password: String!, $role: String!, $customerId: ID!) { createUser(username: $username, password: $password, role: $role, customerId: $customerId) { username role @@ -37,11 +37,11 @@ const CREATE_USER = gql` const UPDATE_USER = gql` mutation UpdateUser( - $id: Int! + $id: ID! $username: String! $password: String! $role: String! - $customerId: Int! + $customerId: ID! $lastModifiedTimestamp: String ) { updateUser( @@ -62,7 +62,7 @@ const UPDATE_USER = gql` `; const DELETE_USER = gql` - mutation DeleteUser($id: Int!) { + mutation DeleteUser($id: ID!) { deleteUser(id: $id) { id } diff --git a/app/containers/AddProfile/index.js b/app/containers/AddProfile/index.js index 4d674ee..9f52c75 100644 --- a/app/containers/AddProfile/index.js +++ b/app/containers/AddProfile/index.js @@ -10,9 +10,9 @@ import { GET_ALL_PROFILES } from 'graphql/queries'; const CREATE_PROFILE = gql` mutation CreateProfile( $profileType: String! - $customerId: Int! + $customerId: ID! $name: String! - $childProfileIds: [Int] + $childProfileIds: [ID] $details: JSONObject ) { createProfile( diff --git a/app/containers/Alarms/index.js b/app/containers/Alarms/index.js index f9479ed..5218731 100644 --- a/app/containers/Alarms/index.js +++ b/app/containers/Alarms/index.js @@ -7,7 +7,7 @@ import { Alarms as AlarmsPage, Loading } from '@tip-wlan/wlan-cloud-ui-library'; import UserContext from 'contexts/UserContext'; const GET_ALL_ALARMS = gql` - query GetAllAlarms($customerId: Int!, $cursor: String) { + query GetAllAlarms($customerId: ID!, $cursor: String) { getAllAlarms(customerId: $customerId, cursor: $cursor) { items { severity diff --git a/app/containers/EditAccount/index.js b/app/containers/EditAccount/index.js index 2efa8b3..aa98c9c 100644 --- a/app/containers/EditAccount/index.js +++ b/app/containers/EditAccount/index.js @@ -7,7 +7,7 @@ import { EditAccount as EditAccountPage, Loading } from '@tip-wlan/wlan-cloud-ui import UserContext from 'contexts/UserContext'; const GET_USER = gql` - query GetUser($id: Int!) { + query GetUser($id: ID!) { getUser(id: $id) { id username @@ -20,11 +20,11 @@ const GET_USER = gql` const UPDATE_USER = gql` mutation UpdateUser( - $id: Int! + $id: ID! $username: String! $password: String! $role: String! - $customerId: Int! + $customerId: ID! $lastModifiedTimestamp: String ) { updateUser( diff --git a/app/containers/Network/containers/AccessPointDetails/index.js b/app/containers/Network/containers/AccessPointDetails/index.js index b46b310..f1151df 100644 --- a/app/containers/Network/containers/AccessPointDetails/index.js +++ b/app/containers/Network/containers/AccessPointDetails/index.js @@ -12,7 +12,7 @@ import { UPDATE_EQUIPMENT_FIRMWARE } from 'graphql/mutations'; import UserContext from 'contexts/UserContext'; const GET_EQUIPMENT = gql` - query GetEquipment($id: Int!) { + query GetEquipment($id: ID!) { getEquipment(id: $id) { id equipmentType @@ -86,12 +86,12 @@ export const GET_ALL_FIRMWARE = gql` const UPDATE_EQUIPMENT = gql` mutation UpdateEquipment( - $id: Int! + $id: ID! $equipmentType: String! $inventoryId: String! - $customerId: Int! - $profileId: Int! - $locationId: Int! + $customerId: ID! + $profileId: ID! + $locationId: ID! $name: String! $latitude: String $longitude: String @@ -130,7 +130,7 @@ const UPDATE_EQUIPMENT = gql` `; export const GET_ALL_PROFILES = gql` - query GetAllProfiles($customerId: Int!, $cursor: String, $type: String) { + query GetAllProfiles($customerId: ID!, $cursor: String, $type: String) { getAllProfiles(customerId: $customerId, cursor: $cursor, type: $type) { items { id @@ -158,7 +158,7 @@ const AccessPointDetails = ({ locations }) => { const { customerId } = useContext(UserContext); const { loading, error, data, refetch } = useQuery(GET_EQUIPMENT, { - variables: { id: parseInt(id, 10) }, + variables: { id }, }); const { data: dataProfiles, error: errorProfiles, loading: landingProfiles } = useQuery( GET_ALL_PROFILES, @@ -174,9 +174,9 @@ const AccessPointDetails = ({ locations }) => { } = useQuery(FILTER_SERVICE_METRICS, { variables: { customerId, - fromTime: fromTime.unix(), - toTime: toTime.unix(), - equipmentIds: [parseInt(id, 10)], + fromTime: fromTime.valueOf().toString(), + toTime: toTime.valueOf().toString(), + equipmentIds: [id], dataTypes: ['ApNode'], }, }); diff --git a/app/containers/Network/containers/BulkEditAccessPoints/index.js b/app/containers/Network/containers/BulkEditAccessPoints/index.js index c408514..1138a30 100644 --- a/app/containers/Network/containers/BulkEditAccessPoints/index.js +++ b/app/containers/Network/containers/BulkEditAccessPoints/index.js @@ -143,7 +143,7 @@ const BulkEditAPs = ({ locations, checkedLocations }) => { const { id } = useParams(); const { customerId } = useContext(UserContext); const locationIds = useMemo(() => { - const locationPath = getLocationPath(parseInt(id, 10), locations); + const locationPath = getLocationPath(id, locations); return locationPath.filter(f => checkedLocations.includes(f)); }, [id, locations, checkedLocations]); @@ -369,7 +369,7 @@ const BulkEditAPs = ({ locations, checkedLocations }) => { equipData.filterEquipment.context.lastPage } onSaveChanges={handleSaveChanges} - breadcrumbPath={getBreadcrumbPath(parseInt(id, 10), locations)} + breadcrumbPath={getBreadcrumbPath(id, locations)} /> ); }; diff --git a/app/containers/Network/containers/ClientDeviceDetails/index.js b/app/containers/Network/containers/ClientDeviceDetails/index.js index e37511b..d3adcfd 100644 --- a/app/containers/Network/containers/ClientDeviceDetails/index.js +++ b/app/containers/Network/containers/ClientDeviceDetails/index.js @@ -28,8 +28,8 @@ const ClientDeviceDetails = () => { } = useQuery(FILTER_SERVICE_METRICS, { variables: { customerId, - fromTime: fromTime.unix(), - toTime: toTime.unix(), + fromTime: fromTime.valueOf().toString(), + toTime: toTime.valueOf().toString(), clientMacs: [id], dataTypes: ['Client'], }, diff --git a/app/containers/Network/index.js b/app/containers/Network/index.js index 5c948bd..364917d 100644 --- a/app/containers/Network/index.js +++ b/app/containers/Network/index.js @@ -60,7 +60,7 @@ const Network = () => { function unflatten(array, p, t) { let tree = typeof t !== 'undefined' ? t : []; - const parent = typeof p !== 'undefined' ? p : { id: 0 }; + const parent = typeof p !== 'undefined' ? p : { id: '0' }; let children = _.filter(array, child => child.parentId === parent.id); children = children.map(c => ({ title: ( @@ -80,7 +80,7 @@ const Network = () => { ...c, })); if (!_.isEmpty(children)) { - if (parent.id === 0) { + if (parent.id === '0') { tree = children; } else { parent.children = children; @@ -96,9 +96,9 @@ const Network = () => { Network ), - id: 0, + id: '0', value: '0', - key: 0, + key: '0', children: unflatten(list), }, ]; diff --git a/app/containers/ProfileDetails/index.js b/app/containers/ProfileDetails/index.js index a4676e1..c28acb2 100644 --- a/app/containers/ProfileDetails/index.js +++ b/app/containers/ProfileDetails/index.js @@ -10,7 +10,7 @@ import { GET_ALL_PROFILES } from 'graphql/queries'; import { FILE_UPLOAD } from 'graphql/mutations'; const GET_PROFILE = gql` - query GetProfile($id: Int!) { + query GetProfile($id: ID!) { getProfile(id: $id) { id profileType @@ -32,11 +32,11 @@ const GET_PROFILE = gql` const UPDATE_PROFILE = gql` mutation UpdateProfile( - $id: Int! + $id: ID! $profileType: String! - $customerId: Int! + $customerId: ID! $name: String! - $childProfileIds: [Int] + $childProfileIds: [ID] $lastModifiedTimestamp: String $details: JSONObject ) { @@ -61,7 +61,7 @@ const UPDATE_PROFILE = gql` `; const DELETE_PROFILE = gql` - mutation DeleteProfile($id: Int!) { + mutation DeleteProfile($id: ID!) { deleteProfile(id: $id) { id } @@ -75,7 +75,7 @@ const ProfileDetails = () => { const [redirect, setRedirect] = useState(false); const { loading, error, data } = useQuery(GET_PROFILE, { - variables: { id: parseInt(id, 10) }, + variables: { id }, }); const { data: ssidProfiles } = useQuery(GET_ALL_PROFILES, { variables: { customerId, type: 'ssid' }, @@ -86,7 +86,7 @@ const ProfileDetails = () => { const [fileUpload] = useMutation(FILE_UPLOAD); const handleDeleteProfile = () => { - deleteProfile({ variables: { id: parseInt(id, 10) } }) + deleteProfile({ variables: { id } }) .then(() => { notification.success({ message: 'Success', diff --git a/app/containers/Profiles/index.js b/app/containers/Profiles/index.js index 4e94ba7..83cbf20 100644 --- a/app/containers/Profiles/index.js +++ b/app/containers/Profiles/index.js @@ -8,7 +8,7 @@ import { Profile as ProfilePage } from '@tip-wlan/wlan-cloud-ui-library'; import UserContext from 'contexts/UserContext'; const GET_ALL_PROFILES = gql` - query GetAllProfiles($customerId: Int!, $cursor: String) { + query GetAllProfiles($customerId: ID!, $cursor: String) { getAllProfiles(customerId: $customerId, cursor: $cursor) { items { id @@ -25,7 +25,7 @@ const GET_ALL_PROFILES = gql` `; const DELETE_PROFILE = gql` - mutation DeleteProfile($id: Int!) { + mutation DeleteProfile($id: ID!) { deleteProfile(id: $id) { id } diff --git a/app/graphql/mutations.js b/app/graphql/mutations.js index b1a4a2b..7f15b51 100644 --- a/app/graphql/mutations.js +++ b/app/graphql/mutations.js @@ -13,8 +13,8 @@ export const REFRESH_TOKEN = gql` export const CREATE_LOCATION = gql` mutation CreateLocation( $locationType: String! - $customerId: Int! - $parentId: Int! + $customerId: ID! + $parentId: ID! $name: String! ) { createLocation( @@ -33,10 +33,10 @@ export const CREATE_LOCATION = gql` export const UPDATE_LOCATION = gql` mutation UpdateLocation( - $id: Int! + $id: ID! $locationType: String! - $customerId: Int! - $parentId: Int! + $customerId: ID! + $parentId: ID! $name: String! $lastModifiedTimestamp: String ) { @@ -59,7 +59,7 @@ export const UPDATE_LOCATION = gql` `; export const DELETE_LOCATION = gql` - mutation DeleteLocation($id: Int!) { + mutation DeleteLocation($id: ID!) { deleteLocation(id: $id) { id } @@ -102,11 +102,11 @@ export const UPDATE_EQUIPMENT_FIRMWARE = gql` export const CREATE_EQUIPMENT = gql` mutation CreateEquipment( - $customerId: Int! + $customerId: ID! $inventoryId: String! - $locationId: Int! + $locationId: ID! $name: String! - $profileId: Int! + $profileId: ID! ) { createEquipment( customerId: $customerId diff --git a/app/graphql/queries.js b/app/graphql/queries.js index 239ef17..a7cd3ba 100644 --- a/app/graphql/queries.js +++ b/app/graphql/queries.js @@ -1,7 +1,7 @@ import gql from 'graphql-tag'; export const GET_ALL_LOCATIONS = gql` - query GetAllLocations($customerId: Int!) { + query GetAllLocations($customerId: ID!) { getAllLocations(customerId: $customerId) { id name @@ -13,8 +13,8 @@ export const GET_ALL_LOCATIONS = gql` export const FILTER_EQUIPMENT = gql` query FilterEquipment( - $locationIds: [Int] - $customerId: Int! + $locationIds: [ID] + $customerId: ID! $equipmentType: String $cursor: String ) { @@ -73,8 +73,8 @@ export const FILTER_EQUIPMENT = gql` export const FILTER_EQUIPMENT_BULK_EDIT_APS = gql` query FilterEquipment( - $locationIds: [Int] - $customerId: Int! + $locationIds: [ID] + $customerId: ID! $equipmentType: String $cursor: String ) { @@ -100,7 +100,7 @@ export const FILTER_EQUIPMENT_BULK_EDIT_APS = gql` `; export const GET_LOCATION = gql` - query GetLocation($id: Int!) { + query GetLocation($id: ID!) { getLocation(id: $id) { id parentId @@ -112,7 +112,7 @@ export const GET_LOCATION = gql` `; export const FILTER_CLIENT_SESSIONS = gql` - query FilterClientSessions($customerId: Int!, $locationIds: [Int], $cursor: String) { + query FilterClientSessions($customerId: ID!, $locationIds: [ID], $cursor: String) { filterClientSessions(customerId: $customerId, locationIds: $locationIds, cursor: $cursor) { items { id @@ -136,7 +136,7 @@ export const FILTER_CLIENT_SESSIONS = gql` `; export const GET_CLIENT_SESSION = gql` - query GetClientSession($customerId: Int!, $macAddress: String!) { + query GetClientSession($customerId: ID!, $macAddress: String!) { getClientSession(customerId: $customerId, macAddress: $macAddress) { id macAddress @@ -156,7 +156,7 @@ export const GET_CLIENT_SESSION = gql` export const FILTER_SERVICE_METRICS = gql` query FilterServiceMetrics( - $customerId: Int! + $customerId: ID! $cursor: String $fromTime: String! $toTime: String! @@ -189,7 +189,7 @@ export const FILTER_SERVICE_METRICS = gql` `; export const GET_ALL_PROFILES = gql` - query GetAllProfiles($customerId: Int!, $cursor: String, $type: String) { + query GetAllProfiles($customerId: ID!, $cursor: String, $type: String) { getAllProfiles(customerId: $customerId, cursor: $cursor, type: $type) { items { id @@ -206,7 +206,7 @@ export const GET_ALL_PROFILES = gql` `; export const GET_ALL_STATUS = gql` - query GetAllStatus($customerId: Int!, $statusDataTypes: [String]) { + query GetAllStatus($customerId: ID!, $statusDataTypes: [String]) { getAllStatus(customerId: $customerId, statusDataTypes: $statusDataTypes) { items { customerId @@ -225,7 +225,7 @@ export const GET_ALL_STATUS = gql` `; export const GET_ALARM_COUNT = gql` - query GetAlarmCount($customerId: Int!) { + query GetAlarmCount($customerId: ID!) { getAlarmCount(customerId: $customerId) } `; From 040d2b2501e048deb0df60e902cac6b8fb92913a Mon Sep 17 00:00:00 2001 From: Irtiza-h30 Date: Mon, 20 Jul 2020 19:04:08 -0400 Subject: [PATCH 08/11] add/edit track assignments --- .../System/containers/Firmware/index.js | 31 +++++++++++++++++-- app/graphql/queries.js | 10 ++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/app/containers/System/containers/Firmware/index.js b/app/containers/System/containers/Firmware/index.js index ea70e31..8ae7da7 100644 --- a/app/containers/System/containers/Firmware/index.js +++ b/app/containers/System/containers/Firmware/index.js @@ -1,7 +1,12 @@ import React from 'react'; -import { useQuery, useMutation } from '@apollo/react-hooks'; +import { useQuery, useMutation, useLazyQuery } from '@apollo/react-hooks'; import { notification } from 'antd'; -import { GET_ALL_FIRMWARE, GET_TRACK_ASSIGNMENTS, GET_FIRMWARE_TRACK } from 'graphql/queries'; +import { + GET_ALL_FIRMWARE, + GET_TRACK_ASSIGNMENTS, + GET_FIRMWARE_TRACK, + GET_ALL_FIRMWARE_MODELS, +} from 'graphql/queries'; import { UPDATE_TRACK_ASSIGNMENT, DELETE_TRACK_ASSIGNMENT, @@ -13,6 +18,12 @@ import { Firmware as FirmwarePage } from '@tip-wlan/wlan-cloud-ui-library'; const Firmware = () => { const { data, error, loading, refetch } = useQuery(GET_ALL_FIRMWARE); + + const [ + getAllFirmware, + { data: firmwareVersionData, loading: firmwareVersionLoading }, + ] = useLazyQuery(GET_ALL_FIRMWARE); + const { data: trackAssignmentData, error: trackAssignmentError, @@ -28,12 +39,22 @@ const Firmware = () => { variables: { firmwareTrackName: 'DEFAULT' }, }); + const { + data: firmwareModelData, + error: firmwareModelError, + loading: firmwareModelLoading, + } = useQuery(GET_ALL_FIRMWARE_MODELS); + const [updateTrackAssignment] = useMutation(UPDATE_TRACK_ASSIGNMENT); const [deleteTrackAssignment] = useMutation(DELETE_TRACK_ASSIGNMENT); const [createFirmware] = useMutation(CREATE_FIRMWARE); const [updateFirmware] = useMutation(UPDATE_FIRMWARE); const [deleteFirmware] = useMutation(DELETE_FIRMWARE); + const handleSearchFirmware = modelId => { + getAllFirmware({ variables: { modelId } }); + }; + const handleCreateTrackAssignment = (firmwareVersionRecordId, modelId) => { updateTrackAssignment({ variables: { @@ -221,6 +242,12 @@ const Firmware = () => { trackAssignmentLoading={trackAssignmentLoading} firmwareTrackLoading={firmwareTrackLoading} firmwareTrackError={firmwareTrackError} + firmwareModelData={firmwareModelData && firmwareModelData.getAllFirmwareModelId} + handleSearchFirmware={handleSearchFirmware} + firmwareVersionData={firmwareVersionData && firmwareVersionData.getAllFirmware} + firmwareVersionLoading={firmwareVersionLoading} + firmwareModelError={firmwareModelError} + firmwareModelLoading={firmwareModelLoading} /> ); }; diff --git a/app/graphql/queries.js b/app/graphql/queries.js index b5fa831..b0241d8 100644 --- a/app/graphql/queries.js +++ b/app/graphql/queries.js @@ -224,6 +224,12 @@ export const GET_ALL_STATUS = gql` } `; +export const GET_ALL_FIRMWARE_MODELS = gql` + query GetAllFirmwareModelId { + getAllFirmwareModelId + } +`; + export const GET_FIRMWARE_TRACK = gql` query GetFirmwareTrack($firmwareTrackName: String!) { getFirmwareTrack(firmwareTrackName: $firmwareTrackName) { @@ -236,8 +242,8 @@ export const GET_FIRMWARE_TRACK = gql` `; export const GET_ALL_FIRMWARE = gql` - query GetAllFirmware { - getAllFirmware { + query GetAllFirmware($modelId: String) { + getAllFirmware(modelId: $modelId) { id modelId versionName From c1145eaa3a9655ff1ce409c81a217cb9f4010227 Mon Sep 17 00:00:00 2001 From: Sean Macfarlane Date: Tue, 21 Jul 2020 12:15:01 -0400 Subject: [PATCH 09/11] fixed filter service metrics --- .../Network/containers/AccessPointDetails/index.js | 5 +++-- .../Network/containers/ClientDeviceDetails/index.js | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/containers/Network/containers/AccessPointDetails/index.js b/app/containers/Network/containers/AccessPointDetails/index.js index f1151df..b6e79fb 100644 --- a/app/containers/Network/containers/AccessPointDetails/index.js +++ b/app/containers/Network/containers/AccessPointDetails/index.js @@ -151,9 +151,10 @@ export const GET_ALL_PROFILES = gql` } `; +const toTime = moment(); +const fromTime = moment().subtract(24, 'hours'); + const AccessPointDetails = ({ locations }) => { - const toTime = moment(); - const fromTime = toTime.subtract(24, 'hours'); const { id } = useParams(); const { customerId } = useContext(UserContext); diff --git a/app/containers/Network/containers/ClientDeviceDetails/index.js b/app/containers/Network/containers/ClientDeviceDetails/index.js index d3adcfd..e08659b 100644 --- a/app/containers/Network/containers/ClientDeviceDetails/index.js +++ b/app/containers/Network/containers/ClientDeviceDetails/index.js @@ -11,10 +11,10 @@ import { import UserContext from 'contexts/UserContext'; import { GET_CLIENT_SESSION, FILTER_SERVICE_METRICS } from 'graphql/queries'; -const ClientDeviceDetails = () => { - const toTime = moment(); - const fromTime = toTime.subtract(24, 'hours'); +const toTime = moment(); +const fromTime = moment().subtract(24, 'hours'); +const ClientDeviceDetails = () => { const { id } = useParams(); const { customerId } = useContext(UserContext); const { loading, error, data, refetch } = useQuery(GET_CLIENT_SESSION, { From d16a73cba6c1c5fafdc11011443a15b64a6c3adb Mon Sep 17 00:00:00 2001 From: Sean Macfarlane Date: Tue, 21 Jul 2020 12:18:57 -0400 Subject: [PATCH 10/11] update version --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 03424c7..bef2e80 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wlan-cloud-ui", - "version": "0.1.4", + "version": "0.2.0", "author": "ConnectUs", "description": "React Portal", "engines": { @@ -20,7 +20,7 @@ "@ant-design/icons": "^4.2.1", "@apollo/react-hoc": "^3.1.4", "@apollo/react-hooks": "^3.1.3", - "@tip-wlan/wlan-cloud-ui-library": "^0.1.23", + "@tip-wlan/wlan-cloud-ui-library": "^0.2.0", "antd": "^4.3.1", "apollo-cache-inmemory": "^1.6.6", "apollo-client": "^2.6.10", From dbaf287cbebedac4fa24dcf397eae5d954b1431d Mon Sep 17 00:00:00 2001 From: Sean Macfarlane Date: Wed, 22 Jul 2020 17:49:14 -0400 Subject: [PATCH 11/11] update version --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0cffa74..0c60f75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "wlan-cloud-ui", - "version": "0.1.4", + "version": "0.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1874,9 +1874,9 @@ } }, "@tip-wlan/wlan-cloud-ui-library": { - "version": "0.1.23", - "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.1.23.tgz", - "integrity": "sha1-U8nPz1M/olJWIw2LsK15q8pgJQc=" + "version": "0.2.0", + "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.2.0.tgz", + "integrity": "sha1-Pth6gnl6Cz51flPuD1OpaOhu/Lw=" }, "@types/anymatch": { "version": "1.3.1",