mirror of
https://github.com/Telecominfraproject/wlan-cloud-ui.git
synced 2025-11-01 19:27:51 +00:00
Merge branch 'master' of github.com:Telecominfraproject/wlan-cloud-ui
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
Loading,
|
||||
} from '@tip-wlan/wlan-cloud-ui-library';
|
||||
|
||||
import { FILTER_SERVICE_METRICS } from 'graphql/queries';
|
||||
import { FILTER_SERVICE_METRICS, GET_ALL_FIRMWARE } 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!
|
||||
@@ -163,14 +149,26 @@ 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,
|
||||
{
|
||||
variables: { customerId, type: 'equipment_ap', limit: 100 },
|
||||
}
|
||||
);
|
||||
|
||||
const {
|
||||
loading: metricsLoading,
|
||||
error: metricsError,
|
||||
@@ -190,10 +188,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();
|
||||
@@ -266,7 +260,7 @@ const AccessPointDetails = ({ locations }) => {
|
||||
})
|
||||
);
|
||||
|
||||
if (loading || landingProfiles || landingFirmware) {
|
||||
if (loading) {
|
||||
return <Loading />;
|
||||
}
|
||||
|
||||
@@ -281,42 +275,24 @@ const AccessPointDetails = ({ locations }) => {
|
||||
);
|
||||
}
|
||||
|
||||
if (errorProfiles) {
|
||||
return (
|
||||
<Alert
|
||||
message="Error"
|
||||
description="Failed to load Access Point profiles."
|
||||
type="error"
|
||||
showIcon
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (errorFirmware) {
|
||||
return (
|
||||
<Alert
|
||||
message="Error"
|
||||
description="Failed to load Access Point firmware."
|
||||
type="error"
|
||||
showIcon
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<AccessPointDetailsPage
|
||||
handleRefresh={refetchData}
|
||||
onUpdateEquipment={handleUpdateEquipment}
|
||||
data={data.getEquipment}
|
||||
profiles={dataProfiles.getAllProfiles.items}
|
||||
data={data?.getEquipment}
|
||||
profiles={dataProfiles?.getAllProfiles?.items}
|
||||
osData={{
|
||||
loading: metricsLoading,
|
||||
error: metricsError,
|
||||
data: metricsData && metricsData.filterServiceMetrics.items,
|
||||
}}
|
||||
firmware={dataFirmware.getAllFirmware}
|
||||
firmware={dataFirmware?.getAllFirmware}
|
||||
locations={locations}
|
||||
onUpdateEquipmentFirmware={handleUpdateEquipmentFirmware}
|
||||
loadingProfiles={loadingProfiles}
|
||||
errorProfiles={errorProfiles}
|
||||
loadingFirmware={loadingFirmware}
|
||||
errorFirmware={errorFirmware}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user