mirror of
https://github.com/Telecominfraproject/wlan-cloud-ui.git
synced 2025-11-01 11:17:59 +00:00
fixed error and loading message display for NetworkTable component
This commit is contained in:
@@ -2,9 +2,9 @@ import React, { useEffect, useContext } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { useLazyQuery } from '@apollo/react-hooks';
|
import { useLazyQuery } from '@apollo/react-hooks';
|
||||||
import { Alert, notification } from 'antd';
|
import { notification } from 'antd';
|
||||||
import { floor, padStart } from 'lodash';
|
import { floor, padStart } from 'lodash';
|
||||||
import { NetworkTableContainer, Loading } from '@tip-wlan/wlan-cloud-ui-library';
|
import { NetworkTableContainer } from '@tip-wlan/wlan-cloud-ui-library';
|
||||||
|
|
||||||
import UserContext from 'contexts/UserContext';
|
import UserContext from 'contexts/UserContext';
|
||||||
import { FILTER_EQUIPMENT } from 'graphql/queries';
|
import { FILTER_EQUIPMENT } from 'graphql/queries';
|
||||||
@@ -155,14 +155,6 @@ const AccessPoints = ({ checkedLocations }) => {
|
|||||||
fetchFilterEquipment();
|
fetchFilterEquipment();
|
||||||
}, [checkedLocations]);
|
}, [checkedLocations]);
|
||||||
|
|
||||||
if (loading) {
|
|
||||||
return <Loading />;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error && !equipData?.filterEquipment?.items) {
|
|
||||||
return <Alert message="Error" description="Failed to load equipment." type="error" showIcon />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NetworkTableContainer
|
<NetworkTableContainer
|
||||||
activeTab="/network/access-points"
|
activeTab="/network/access-points"
|
||||||
@@ -173,6 +165,9 @@ const AccessPoints = ({ checkedLocations }) => {
|
|||||||
isLastPage={
|
isLastPage={
|
||||||
equipData && equipData.filterEquipment && equipData.filterEquipment.context.lastPage
|
equipData && equipData.filterEquipment && equipData.filterEquipment.context.lastPage
|
||||||
}
|
}
|
||||||
|
onLoading={loading}
|
||||||
|
onError={error}
|
||||||
|
errorDescription="Failed to load equipment."
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import React, { useEffect, useContext } from 'react';
|
import React, { useEffect, useContext } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useLazyQuery } from '@apollo/react-hooks';
|
import { useLazyQuery } from '@apollo/react-hooks';
|
||||||
import { Alert, notification } from 'antd';
|
import { notification } from 'antd';
|
||||||
|
|
||||||
import { NetworkTableContainer, Loading } from '@tip-wlan/wlan-cloud-ui-library';
|
import { NetworkTableContainer } from '@tip-wlan/wlan-cloud-ui-library';
|
||||||
|
|
||||||
import UserContext from 'contexts/UserContext';
|
import UserContext from 'contexts/UserContext';
|
||||||
import { FILTER_CLIENT_SESSIONS } from 'graphql/queries';
|
import { FILTER_CLIENT_SESSIONS } from 'graphql/queries';
|
||||||
@@ -82,16 +82,6 @@ const ClientDevices = ({ checkedLocations }) => {
|
|||||||
fetchFilterClientSessions();
|
fetchFilterClientSessions();
|
||||||
}, [checkedLocations]);
|
}, [checkedLocations]);
|
||||||
|
|
||||||
if (loading) {
|
|
||||||
return <Loading />;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error && !data?.filterClientSessions?.items) {
|
|
||||||
return (
|
|
||||||
<Alert message="Error" description="Failed to load client devices." type="error" showIcon />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NetworkTableContainer
|
<NetworkTableContainer
|
||||||
activeTab="/network/client-devices"
|
activeTab="/network/client-devices"
|
||||||
@@ -100,6 +90,9 @@ const ClientDevices = ({ checkedLocations }) => {
|
|||||||
tableData={data && data.filterClientSessions && data.filterClientSessions.items}
|
tableData={data && data.filterClientSessions && data.filterClientSessions.items}
|
||||||
onLoadMore={handleLoadMore}
|
onLoadMore={handleLoadMore}
|
||||||
isLastPage={data && data.filterClientSessions && data.filterClientSessions.context.lastPage}
|
isLastPage={data && data.filterClientSessions && data.filterClientSessions.context.lastPage}
|
||||||
|
onLoading={loading}
|
||||||
|
onError={error}
|
||||||
|
errorDescription="Failed to load client devices."
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user