Skip to content

Commit 25dd2ac

Browse files
feat: removed LoadingInline wrapper and updated the LoadingBox component
1 parent cf80d0a commit 25dd2ac

24 files changed

Lines changed: 168 additions & 158 deletions

src/components/Loading.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ export const Loading: FC<LoadingProps> = ({
1515
ariaLabel,
1616
}) => (
1717
<Bullseye data-test="loading-indicator" className={className}>
18-
<Spinner size={size} isInline={isInline} aria-label={ariaLabel} />
18+
<Spinner size={size ?? 'lg'} isInline={isInline} aria-label={ariaLabel} />
1919
</Bullseye>
2020
);
2121
Loading.displayName = 'Loading';
22-
23-
export const LoadingInline: FC = () => <Loading isInline={true} />;
24-
LoadingInline.displayName = 'LoadingInline';

src/components/common/ResourceDropdown.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,15 @@ import {
2121
SearchInput,
2222
Divider,
2323
} from '@patternfly/react-core';
24-
import { LoadingInline } from '../Loading';
24+
import { Loading } from '../Loading';
2525

2626
type DropdownItemProps = {
2727
name: string;
2828
namespace?: string;
2929
resource: K8sResourceKind;
3030
};
3131

32-
const DropdownItem: FC<DropdownItemProps> = ({
33-
name,
34-
namespace,
35-
resource,
36-
}) => {
32+
const DropdownItem: FC<DropdownItemProps> = ({ name, namespace, resource }) => {
3733
return (
3834
<span className="co-resource-item">
3935
<span className="">
@@ -151,7 +147,7 @@ const ResourceDropdown: FC<ResourceDropdownProps> = (props) => {
151147
loaded ? (
152148
<span className="btn-dropdown__item--placeholder">{placeholder}</span>
153149
) : (
154-
<LoadingInline />
150+
<Loading isInline={true} />
155151
),
156152
);
157153
const [isOpen, setIsOpen] = useState(false);
@@ -263,7 +259,7 @@ const ResourceDropdown: FC<ResourceDropdownProps> = (props) => {
263259
// Handle data updates and initial load
264260
useEffect(() => {
265261
if (!loaded && !loadError) {
266-
setTitle(<LoadingInline />);
262+
setTitle(<Loading isInline={true} />);
267263
return;
268264
}
269265

src/components/common/StorageClassDropdown.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ReactNode, MouseEvent, Ref } from 'react';
22
import { Component } from 'react';
3-
import { LoadingInline } from '../Loading';
3+
import { Loading } from '../Loading';
44
import _ from 'lodash';
55
import {
66
FormGroup,
@@ -105,7 +105,7 @@ export class StorageClassDropdownInnerWithTranslation extends Component<
105105
items: {},
106106
name: this.props.name,
107107
selectedKey: this.props.selectedKey,
108-
title: <LoadingInline />,
108+
title: <Loading isInline={true} />,
109109
defaultClass: this.props.defaultClass,
110110
isOpen: false,
111111
filterValue: '',
@@ -281,7 +281,7 @@ export class StorageClassDropdownInnerWithTranslation extends Component<
281281

282282
// Only show the dropdown if 'no storage class' is not the only option which depends on defaultClass
283283
const itemsAvailableToShow = defaultClass || _.size(this.state.items) > 1;
284-
284+
285285
const toggle = (toggleRef: Ref<MenuToggleElement>) => (
286286
<MenuToggle
287287
ref={toggleRef}

src/components/common/button-bar.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import classNames from 'classnames';
55
import * as PropTypes from 'prop-types';
66
import { Alert, AlertGroup } from '@patternfly/react-core';
77
import { useTranslation } from 'react-i18next';
8-
import { LoadingInline } from '../status/status-box';
8+
import { Loading } from '../Loading';
99

1010
const injectDisabled = (children, disabled) => {
1111
return Children.map(children, (c) => {
@@ -67,7 +67,7 @@ export const ButtonBar = ({
6767
{successMessage && <SuccessMessage message={successMessage} />}
6868
{errorMessage && <ErrorMessage message={errorMessage} />}
6969
{injectDisabled(children, inProgress)}
70-
{inProgress && <LoadingInline />}
70+
{inProgress && <Loading isInline={true} />}
7171
{infoMessage && <InfoMessage message={infoMessage} />}
7272
</AlertGroup>
7373
</div>

src/components/logs/LogSnippetFromPod.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { ReactNode, FC } from 'react';
22
import { useState, useEffect } from 'react';
33
import { Alert } from '@patternfly/react-core';
44
import { useTranslation } from 'react-i18next';
5-
import { LoadingInline } from '../Loading';
5+
import { Loading } from '../Loading';
66
import { consoleFetchText } from '@openshift-console/dynamic-plugin-sdk';
77
import { PodModel } from '../../models';
88
import { resourceURL } from '../utils/k8s-utils';
@@ -87,7 +87,7 @@ const LogSnippetFromPod: FC<LogSnippetFromPodProps> = ({
8787
}
8888

8989
if (!logSnippet) {
90-
return <LoadingInline />;
90+
return <Loading isInline={true} />;
9191
}
9292

9393
return <>{children(logSnippet)}</>;

src/components/logs/Logs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ContainerSpec, ContainerStatus, PodKind } from '../../types';
1111
import { PodModel } from '../../models';
1212
import { resourceURL } from '../utils/k8s-utils';
1313
import { containerToLogSourceStatus } from '../utils/pipeline-utils';
14-
import { LoadingInline } from '../Loading';
14+
import { Loading } from '../Loading';
1515
import {
1616
getMultiClusterLogsUrl,
1717
getMultiClusterLogsStreamPath,
@@ -428,7 +428,7 @@ const Logs: FC<LogsProps> = ({
428428
</span>
429429
{stillFetching ? (
430430
<span data-test-id="loading-indicator">
431-
<LoadingInline />
431+
<Loading isInline={true} />
432432
</span>
433433
) : null}
434434
</Banner>

src/components/logs/LogsWrapperComponent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { PodKind, TaskRunKind } from '../../types';
1818
import { MultiStreamLogs } from './MultiStreamLogs';
1919
import { TektonTaskRunLog } from './TektonTaskRunLog';
2020
import { useFullscreen } from './fullscreen';
21-
import { LoadingInline } from '../Loading';
21+
import { Loading } from '../Loading';
2222
import { TektonResourceLabel } from '../../consts';
2323
import { getMultiClusterPods } from '../utils/multi-cluster-api';
2424
import { usePoll } from '../pipelines-metrics/poll-hook';
@@ -175,7 +175,7 @@ const LogsWrapperComponent: FC<
175175
<span className="pf-v6-l-flex pf-m-row pf-m-gap-sm pf-m-align-items-center">
176176
<DownloadIcon />
177177
<span>{downloadAllLabel || t('Download all')}</span>
178-
{downloadAllStatus && <LoadingInline />}
178+
{downloadAllStatus && <Loading isInline={true} />}
179179
</span>
180180
</Button>
181181
<div>|</div>

src/components/logs/TektonTaskRunLog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { LogViewer } from '@patternfly/react-log-viewer';
44
import { HttpError } from '@openshift-console/dynamic-plugin-sdk/lib/utils/error/http-error';
55
import { TaskRunKind } from '../../types';
66
import { TektonResourceLabel } from '../../consts';
7-
import { LoadingInline } from '../Loading';
7+
import { Loading } from '../Loading';
88
import { useTRTaskRunLog } from '../hooks/useTektonResult';
99
import { Banner } from '@patternfly/react-core';
1010
import './TektonTaskRunLog.scss';
@@ -68,7 +68,7 @@ export const TektonTaskRunLog: FC<TektonTaskRunLogProps> = ({
6868
</span>
6969
{!trLoaded && !errorMessage ? (
7070
<span data-test-id="loading-indicator">
71-
<LoadingInline />
71+
<Loading isInline={true} />
7272
</span>
7373
) : null}
7474
</Banner>

src/components/pipelineRuns-details/PipelineRunVisualization.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
44
import { usePipelineFromPipelineRun } from '../hooks/usePipelineFromPipelineRun';
55
import { useTaskRuns } from '../hooks/useTaskRuns';
66
import { ComputedStatus, PipelineKind, PipelineRunKind } from '../../types';
7-
import { LoadingInline } from '../Loading';
7+
import { LoadingBox } from '../status/status-box';
88
import PipelineVisualization from '../pipelines-details/PipelineVisualization';
99
import { pipelineRunFilterReducer } from '../utils/pipeline-filter-reducer';
1010
import './PipelineRunVisualization.scss';
@@ -37,10 +37,10 @@ const PipelineRunVisualization: FC<PipelineRunVisualizationProps> = ({
3737
/* this needs decoupling */
3838
const taskRunsLoaded = k8sLoaded || trLoaded;
3939
const pipeline: PipelineKind = usePipelineFromPipelineRun(pipelineRun);
40-
if (!pipeline) {
40+
if (!pipeline || !taskRunsLoaded) {
4141
return (
4242
<div className="pipeline-plr-loader">
43-
<LoadingInline />
43+
<LoadingBox />
4444
</div>
4545
);
4646
}

src/components/pipelines-list/status/LinkedPipelineRunTaskStatus.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
33
import { Link } from 'react-router';
44
import { PipelineRunKind, TaskRunKind } from '../../../types';
55
import { PipelineBars, PipelineBarsForTaskRunsStatus } from './PipelineBars';
6-
import { LoadingInline } from '../../Loading';
6+
import { Loading } from '../../Loading';
77
import { PipelineRunModel } from '../../../models';
88
import { getReferenceForModel } from '../../pipelines-overview/utils';
99
import { TaskStatus } from '../../utils/pipeline-augment';
@@ -51,7 +51,7 @@ const LinkedPipelineRunTaskStatus: FC<LinkedPipelineRunTaskStatusProps> = ({
5151
) : taskRunsLoaded && taskRuns?.length === 0 && !taskRunStatusObj ? (
5252
<>{'-'}</>
5353
) : (
54-
<LoadingInline />
54+
<Loading isInline={true} />
5555
);
5656

5757
if (pipelineRun.metadata?.name && pipelineRun.metadata?.namespace) {

0 commit comments

Comments
 (0)