add loading indicator to topic settings tab (#1746)

Co-authored-by: Oleg Shur <workshur@gmail.com>
This commit is contained in:
Anifah Bhadmus 2022-03-28 11:48:07 +01:00 committed by GitHub
parent e1f31d27c6
commit 4907e187f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,4 @@
import PageLoader from 'components/common/PageLoader/PageLoader';
import { Table } from 'components/common/table/Table/Table.styled';
import TableHeaderCell from 'components/common/table/TableHeaderCell/TableHeaderCell';
import { TopicConfig } from 'generated-sources';
@ -25,7 +26,11 @@ const Settings: React.FC<Props> = ({
fetchTopicConfig(clusterName, topicName);
}, [fetchTopicConfig, clusterName, topicName]);
if (!isFetched || !config) {
if (!isFetched) {
return <PageLoader />;
}
if (!config) {
return null;
}

View file

@ -33,7 +33,7 @@ describe('Settings', () => {
expect(screen.queryByRole('table')).not.toBeInTheDocument();
});
it('should check and return null if it is not fetched and config is given', () => {
it('should show Page loader when it is in fetching state and config is given', () => {
render(
<Settings
clusterName={mockClusterName}
@ -45,6 +45,7 @@ describe('Settings', () => {
);
expect(screen.queryByRole('table')).not.toBeInTheDocument();
expect(screen.getByRole('progressbar')).toBeInTheDocument();
});
it('should check and return null if it is not fetched and config is not given', () => {