Skip to content

Commit 96082e2

Browse files
committed
refactor: Spinner for loading state of korrel8r panel.
Simpler, more visible and more consistent with the "info state" used for errors. Based on patternfly example: https://www.patternfly.org/components/empty-state/#spinner
1 parent fe15d50 commit 96082e2

2 files changed

Lines changed: 22 additions & 109 deletions

File tree

web/src/components/Korrel8rPanel.tsx

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
FlexItem,
1313
Form,
1414
FormGroup,
15+
Spinner,
1516
TextArea,
1617
Title,
1718
Tooltip,
@@ -42,7 +43,6 @@ import './korrel8rpanel.css';
4243
import { SearchFormGroup } from './SearchFormGroup';
4344
import TimeRangeFormGroup from './TimeRangeFormGroup';
4445
import { Korrel8rTopology } from './topology/Korrel8rTopology';
45-
import { LoadingTopology } from './topology/LoadingTopology';
4646

4747
export default function Korrel8rPanel() {
4848
const { t } = useTranslation('plugin__troubleshooting-panel-console-plugin');
@@ -156,14 +156,14 @@ export default function Korrel8rPanel() {
156156
<Tooltip content={locationQuery ? focusTip : cannotFocus}>
157157
<Button
158158
isAriaDisabled={!locationQuery}
159-
onClick={() =>
159+
onClick={() => {
160160
runSearch({
161161
...defaultSearch,
162162
queryStr: locationQuery?.toString(),
163163
constraint: searchResult?.search?.constraint,
164164
period: searchResult?.search?.period,
165-
})
166-
}
165+
});
166+
}}
167167
>
168168
{t('Focus')}
169169
</Button>
@@ -185,7 +185,12 @@ export default function Korrel8rPanel() {
185185

186186
const refreshButton = (
187187
<Tooltip content={t('Refresh the graph using the current settings')}>
188-
<Button isAriaDisabled={!search?.queryStr} onClick={() => runSearch(search)}>
188+
<Button
189+
isAriaDisabled={!search?.queryStr}
190+
onClick={() => {
191+
runSearch(search);
192+
}}
193+
>
189194
<SyncIcon />
190195
</Button>
191196
</Tooltip>
@@ -301,18 +306,20 @@ const Topology: React.FC<TopologyProps> = ({ domains, result, t, constraint }) =
301306
);
302307
};
303308

304-
const Loading: React.FC = () => (
305-
<>
309+
const Loading: React.FC = () => {
310+
const { t } = useTranslation('plugin__troubleshooting-panel-console-plugin');
311+
return (
306312
<div className="tp-plugin__panel-topology-info">
307-
<div className={'co-m-loader co-an-fade-in-out tp-plugin__panel-topology-info'}>
308-
<div className="co-m-loader-dot__one" />
309-
<div className="co-m-loader-dot__two" />
310-
<div className="co-m-loader-dot__three" />
311-
</div>
313+
<EmptyState variant={EmptyStateVariant.sm}>
314+
<EmptyStateHeader
315+
titleText={t('Loading')}
316+
headingLevel="h4"
317+
icon={<EmptyStateIcon icon={Spinner} />}
318+
/>
319+
</EmptyState>
312320
</div>
313-
<LoadingTopology />
314-
</>
315-
);
321+
);
322+
};
316323

317324
interface TopologyInfoStateProps {
318325
titleText: string;

web/src/components/topology/LoadingTopology.tsx

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)