fixed error and loading message display for NetworkTable component

This commit is contained in:
Alidev123
2020-08-04 11:44:50 -04:00
parent 2dd3bff53c
commit b2bee67551
2 changed files with 10 additions and 22 deletions

View File

@@ -2,9 +2,9 @@ import React, { useEffect, useContext } from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';
import { useLazyQuery } from '@apollo/react-hooks';
import { Alert, notification } from 'antd';
import { notification } from 'antd';
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 { FILTER_EQUIPMENT } from 'graphql/queries';
@@ -155,14 +155,6 @@ const AccessPoints = ({ checkedLocations }) => {
fetchFilterEquipment();
}, [checkedLocations]);
if (loading) {
return <Loading />;
}
if (error && !equipData?.filterEquipment?.items) {
return <Alert message="Error" description="Failed to load equipment." type="error" showIcon />;
}
return (
<NetworkTableContainer
activeTab="/network/access-points"
@@ -173,6 +165,9 @@ const AccessPoints = ({ checkedLocations }) => {
isLastPage={
equipData && equipData.filterEquipment && equipData.filterEquipment.context.lastPage
}
onLoading={loading}
onError={error}
errorDescription="Failed to load equipment."
/>
);
};

View File

@@ -1,9 +1,9 @@
import React, { useEffect, useContext } from 'react';
import PropTypes from 'prop-types';
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 { FILTER_CLIENT_SESSIONS } from 'graphql/queries';
@@ -82,16 +82,6 @@ const ClientDevices = ({ checkedLocations }) => {
fetchFilterClientSessions();
}, [checkedLocations]);
if (loading) {
return <Loading />;
}
if (error && !data?.filterClientSessions?.items) {
return (
<Alert message="Error" description="Failed to load client devices." type="error" showIcon />
);
}
return (
<NetworkTableContainer
activeTab="/network/client-devices"
@@ -100,6 +90,9 @@ const ClientDevices = ({ checkedLocations }) => {
tableData={data && data.filterClientSessions && data.filterClientSessions.items}
onLoadMore={handleLoadMore}
isLastPage={data && data.filterClientSessions && data.filterClientSessions.context.lastPage}
onLoading={loading}
onError={error}
errorDescription="Failed to load client devices."
/>
);
};