Skip to content

Commit f67bcb9

Browse files
PR changes
Moving function to common file
1 parent 3924a60 commit f67bcb9

File tree

3 files changed

+18
-25
lines changed

3 files changed

+18
-25
lines changed

src/components/ControlPlane/ManagedResources.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
AnalyticalTable,
44
AnalyticalTableColumnDefinition,
55
AnalyticalTableScaleWidthMode,
6-
Icon,
76
Title,
87
} from '@ui5/webcomponents-react';
98
import useResource from '../../lib/api/useApiResource';
@@ -13,7 +12,7 @@ import IllustratedError from '../Shared/IllustratedError';
1312
import '@ui5/webcomponents-icons/dist/sys-enter-2';
1413
import '@ui5/webcomponents-icons/dist/sys-cancel-2';
1514
import { resourcesInterval } from '../../lib/shared/constants';
16-
import { StatusCellProps } from '../../lib/shared/interfaces';
15+
import { ResourceStatusCell } from '../Shared/ResourceStatusCell';
1716

1817
interface CellData<T> {
1918
cell: {
@@ -140,14 +139,3 @@ export function ManagedResources() {
140139
</>
141140
);
142141
}
143-
144-
function ResourceStatusCell({ value, transitionTime }: StatusCellProps) {
145-
return (
146-
<Icon
147-
design={value ? 'Positive' : 'Negative'}
148-
name={value ? 'sys-enter-2' : 'sys-cancel-2'}
149-
showTooltip={true}
150-
accessibleName={timeAgo.format(new Date(transitionTime))}
151-
/>
152-
);
153-
}

src/components/ControlPlane/Providers.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

22
import { useTranslation } from 'react-i18next';
3-
import { AnalyticalTable, AnalyticalTableColumnDefinition, AnalyticalTableScaleWidthMode, Icon, Title } from '@ui5/webcomponents-react';
3+
import { AnalyticalTable, AnalyticalTableColumnDefinition, AnalyticalTableScaleWidthMode, Title } from '@ui5/webcomponents-react';
44
import useResource from '../../lib/api/useApiResource';
55
import IllustratedError from '../Shared/IllustratedError';
66
import '@ui5/webcomponents-icons/dist/sys-enter-2';
77
import '@ui5/webcomponents-icons/dist/sys-cancel-2';
88
import { ProvidersListRequest } from '../../lib/api/types/crossplane/listProviders';
99
import { resourcesInterval } from '../../lib/shared/constants';
1010
import { timeAgo } from '../../utils/i18n/timeAgo';
11-
import { StatusCellProps } from '../../lib/shared/interfaces';
11+
import { ResourceStatusCell } from '../Shared/ResourceStatusCell';
1212

1313
interface CellData<T> {
1414
cell: {
@@ -109,13 +109,4 @@ export function Providers() {
109109
}
110110
</>
111111
)
112-
}
113-
114-
function ResourceStatusCell({ value, transitionTime }: StatusCellProps) {
115-
return <Icon
116-
design={value ? 'Positive' : 'Negative'}
117-
name={value ? 'sys-enter-2' : 'sys-cancel-2'}
118-
showTooltip={true}
119-
accessibleName={timeAgo.format(new Date(transitionTime))}
120-
/>
121-
}
112+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Icon } from "@ui5/webcomponents-react";
2+
import { StatusCellProps } from "../../lib/shared/interfaces";
3+
import { timeAgo } from "../../utils/i18n/timeAgo";
4+
5+
export function ResourceStatusCell({ value, transitionTime }: StatusCellProps) {
6+
return (
7+
<Icon
8+
design={value ? 'Positive' : 'Negative'}
9+
name={value ? 'sys-enter-2' : 'sys-cancel-2'}
10+
showTooltip={true}
11+
accessibleName={timeAgo.format(new Date(transitionTime))}
12+
/>
13+
);
14+
}

0 commit comments

Comments
 (0)