diff --git a/app/containers/Network/containers/AccessPointDetails/index.js b/app/containers/Network/containers/AccessPointDetails/index.js index fa1c6bc..2d27a05 100644 --- a/app/containers/Network/containers/AccessPointDetails/index.js +++ b/app/containers/Network/containers/AccessPointDetails/index.js @@ -10,7 +10,7 @@ import { Loading, } from '@tip-wlan/wlan-cloud-ui-library'; -import { FILTER_SERVICE_METRICS, GET_ALL_PROFILES } from 'graphql/queries'; +import { FILTER_SERVICE_METRICS, GET_ALL_FIRMWARE, GET_ALL_PROFILES } from 'graphql/queries'; import { UPDATE_EQUIPMENT_FIRMWARE } from 'graphql/mutations'; import UserContext from 'contexts/UserContext'; @@ -74,20 +74,6 @@ const GET_EQUIPMENT = gql` } `; -export const GET_ALL_FIRMWARE = gql` - query GetAllFirmware { - getAllFirmware { - id - modelId - versionName - description - filename - commit - releaseDate - } - } -`; - const UPDATE_EQUIPMENT = gql` mutation UpdateEquipment( $id: ID! @@ -141,9 +127,20 @@ const AccessPointDetails = ({ locations }) => { const { customerId } = useContext(UserContext); const { loading, error, data, refetch } = useQuery(GET_EQUIPMENT, { - variables: { id }, + variables: { + id, + }, }); - const { data: dataProfiles, error: errorProfiles, loading: landingProfiles } = useQuery( + + const { data: dataFirmware, error: errorFirmware, loading: loadingFirmware } = useQuery( + GET_ALL_FIRMWARE, + { + skip: !data?.getEquipment?.model, + variables: { modelId: data?.getEquipment?.model?.toLowerCase() }, + } + ); + + const { data: dataProfiles, error: errorProfiles, loading: loadingProfiles } = useQuery( GET_ALL_PROFILES(` childProfiles { id @@ -154,6 +151,7 @@ const AccessPointDetails = ({ locations }) => { variables: { customerId, type: 'equipment_ap', limit: 100 }, } ); + const { loading: metricsLoading, error: metricsError, @@ -173,10 +171,6 @@ const AccessPointDetails = ({ locations }) => { const [updateEquipment] = useMutation(UPDATE_EQUIPMENT); const [updateEquipmentFirmware] = useMutation(UPDATE_EQUIPMENT_FIRMWARE); - const { data: dataFirmware, error: errorFirmware, loading: landingFirmware } = useQuery( - GET_ALL_FIRMWARE - ); - const refetchData = () => { refetch(); metricsRefetch(); @@ -249,7 +243,7 @@ const AccessPointDetails = ({ locations }) => { }) ); - if (loading || landingProfiles || landingFirmware) { + if (loading) { return ; } @@ -264,42 +258,24 @@ const AccessPointDetails = ({ locations }) => { ); } - if (errorProfiles) { - return ( - - ); - } - - if (errorFirmware) { - return ( - - ); - } - return ( ); }; diff --git a/package.json b/package.json index 290d5c4..070b182 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "@apollo/react-hoc": "^3.1.4", "@apollo/react-hooks": "^3.1.3", "@tip-wlan/wlan-cloud-ui-library": "^0.2.9", - "antd": "^4.3.1", + "antd": "^4.5.2", "apollo-cache-inmemory": "^1.6.6", "apollo-client": "^2.6.10", "apollo-link": "^1.2.14",