Skip to content

Commit 6cfa930

Browse files
addressed review comments
1 parent e0a0526 commit 6cfa930

File tree

18 files changed

+119
-62
lines changed

18 files changed

+119
-62
lines changed

.changeset/ninety-news-boil.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
"@aonic-ui/pipelines": major
2+
"@aonic-ui/pipelines": minor
33
---
44

55
Added tekton and topology types, utils, hooks & components

packages/core/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@
3737
"url": "https://github.com/redhat-developer/aonic-ui/issues"
3838
},
3939
"homepage": "https://github.com/redhat-developer/aonic-ui#readme",
40+
"dependencies": {
41+
"@backstage/catalog-model": "^1.7.3",
42+
"@backstage/core-components": "^0.16.3",
43+
"@backstage/core-plugin-api": "^1.10.3",
44+
"@backstage/plugin-kubernetes-common": "^0.9.2",
45+
"@backstage/plugin-kubernetes-react": "^0.5.3",
46+
"@material-ui/core": "^4.12.4",
47+
"@mui/icons-material": "5.15.17",
48+
"@mui/material": "^5.15.17",
49+
"classnames": "^2.3.2",
50+
"lodash-es": "^4.17.21",
51+
"react-use": "^17.5.0"
52+
},
4053
"devDependencies": {
4154
"@aonic-ui/eslint-config": "*",
4255
"@aonic-ui/jest-config": "*",

packages/pipelines/src/components/common/Status.tsx renamed to packages/core/src/components/common/Status.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,27 @@ const DASH = '-';
3737
const useStatusStyles = makeStyles((theme) => ({
3838
success: {
3939
'& svg': {
40-
fill: theme.palette.status.ok,
40+
fill: theme.palette.status?.ok || theme.palette.success?.main || '#4caf50',
4141
},
4242
},
4343
running: {
4444
'& svg': {
45-
fill: theme.palette.status.running,
45+
fill: theme.palette.status?.running || theme.palette.info?.main || '#2196f3',
4646
},
4747
},
4848
pending: {
4949
'& svg': {
50-
fill: theme.palette.status.pending,
50+
fill: theme.palette.status?.pending || theme.palette.warning?.main || '#ff9800',
5151
},
5252
},
5353
warning: {
5454
'& svg': {
55-
fill: theme.palette.status.warning,
55+
fill: theme.palette.status?.warning || theme.palette.warning?.main || '#ff9800',
5656
},
5757
},
5858
error: {
5959
'& svg': {
60-
fill: theme.palette.status.error,
60+
fill: theme.palette.status?.error || theme.palette.error?.main || '#f44336',
6161
},
6262
},
6363
}));
@@ -116,10 +116,10 @@ const StatusIcon = ({
116116
117117
* @example
118118
* ```tsx
119-
* <StatusDisplay status='Warning' />
119+
* <Status status='Warning' />
120120
* ```
121121
*/
122-
export const StatusDisplay = ({
122+
export const Status = ({
123123
status,
124124
iconOnly,
125125
className,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export { CamelCaseWrap } from './CamelCaseWrap';
2-
export { StatusDisplay } from './Status';
2+
export { Status } from './Status';
33
export { StatusIconAndText } from './StatusIconAndText';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export { default as Button } from './Button';
2+
export { Status, CamelCaseWrap, StatusIconAndText } from './common';

packages/core/src/hooks/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from './useDebounceCallback';
2+
export * from './useKubernetesObjects';
3+
export * from './useDeepCompareMemoize';

packages/pipelines/src/hooks/useDebounceCallback.ts renamed to packages/core/src/hooks/useDebounceCallback.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22

3-
import { debounce } from 'lodash';
3+
import { debounce } from 'lodash-es';
44

5-
import { useDeepCompareMemoize } from '../utils/common-utils';
5+
import { useDeepCompareMemoize } from './useDeepCompareMemoize';
66

77
interface Cancelable {
88
cancel(): void;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
3+
import { isEqual } from 'lodash-es';
4+
5+
export const useDeepCompareMemoize = <T = any>(
6+
value: T,
7+
stringify?: boolean,
8+
): T => {
9+
const ref = React.useRef<T>();
10+
11+
if (
12+
stringify
13+
? JSON.stringify(value) !== JSON.stringify(ref.current)
14+
: !isEqual(value, ref.current)
15+
) {
16+
ref.current = value;
17+
}
18+
19+
return ref.current as T;
20+
};

0 commit comments

Comments
 (0)