Skip to content

Commit 716a644

Browse files
committed
feat: add NodeStatusDTO enum and support for Progressing component in GenericSectionErrorState
1 parent 9135029 commit 716a644

File tree

3 files changed

+54
-26
lines changed

3 files changed

+54
-26
lines changed

src/Shared/Components/CICDHistory/types.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,15 @@ export interface StatusFilterButtonType {
571571
handleFilterClick?: (selectedFilter: string) => void
572572
}
573573

574+
export enum NodeStatusDTO {
575+
Healthy = 'Healthy',
576+
Progressing = 'Progressing',
577+
Unknown = 'Unknown',
578+
Suspended = 'Suspended',
579+
Degraded = 'Degraded',
580+
Missing = 'Missing',
581+
}
582+
574583
export enum NodeStatus {
575584
Degraded = 'degraded',
576585
Healthy = 'healthy',

src/Shared/Components/GenericSectionErrorState/GenericSectionErrorState.component.tsx

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import { ComponentSizeType } from '@Shared/constants'
18+
import { Progressing } from '@Common/Progressing'
1819
import { ReactComponent as ErrorIcon } from '../../../Assets/Icon/ic-error-exclamation.svg'
1920
import { ReactComponent as ICInfoOutline } from '../../../Assets/Icon/ic-info-outline.svg'
2021
import { Button, ButtonVariantType } from '../Button'
@@ -29,33 +30,45 @@ const GenericSectionErrorState = ({
2930
buttonText = 'Reload',
3031
rootClassName,
3132
useInfoIcon = false,
32-
}: GenericSectionErrorStateProps) => (
33-
<div className={`flex column dc__gap-8 p-16 ${withBorder ? 'dc__border br-4' : ''} ${rootClassName || ''}`}>
34-
{useInfoIcon ? (
35-
<ICInfoOutline className="icon-dim-24" />
36-
) : (
37-
<ErrorIcon className="icon-dim-24 alert-icon-r5-imp" />
38-
)}
39-
<div className="flex column dc__gap-4 dc__align-center">
40-
<h3 className="fs-13 lh-20 fw-6 cn-9 m-0">{title}</h3>
41-
{(subTitle || description) && (
42-
<div className="flex column fs-13 lh-20 fw-4 cn-7">
43-
{subTitle && <p className="m-0">{subTitle}</p>}
44-
{description && <p className="m-0">{description}</p>}
45-
</div>
33+
progressingProps,
34+
}: GenericSectionErrorStateProps) => {
35+
const renderMarker = () => {
36+
if (progressingProps) {
37+
return <Progressing {...progressingProps} />
38+
}
39+
40+
if (useInfoIcon) {
41+
return <ICInfoOutline className="icon-dim-24" />
42+
}
43+
44+
return <ErrorIcon className="icon-dim-24 alert-icon-r5-imp" />
45+
}
46+
47+
return (
48+
<div className={`flex column dc__gap-8 p-16 ${withBorder ? 'dc__border br-4' : ''} ${rootClassName || ''}`}>
49+
{renderMarker()}
50+
51+
<div className="flex column dc__gap-4 dc__align-center">
52+
<h3 className="fs-13 lh-20 fw-6 cn-9 m-0">{title}</h3>
53+
{(subTitle || description) && (
54+
<div className="flex column fs-13 lh-20 fw-4 cn-7">
55+
{subTitle && <p className="m-0">{subTitle}</p>}
56+
{description && <p className="m-0">{description}</p>}
57+
</div>
58+
)}
59+
</div>
60+
61+
{reload && (
62+
<Button
63+
text={buttonText}
64+
onClick={reload}
65+
variant={ButtonVariantType.text}
66+
size={ComponentSizeType.small}
67+
dataTestId="generic-section-reload-button"
68+
/>
4669
)}
4770
</div>
48-
49-
{reload && (
50-
<Button
51-
text={buttonText}
52-
onClick={reload}
53-
variant={ButtonVariantType.text}
54-
size={ComponentSizeType.small}
55-
dataTestId="generic-section-reload-button"
56-
/>
57-
)}
58-
</div>
59-
)
71+
)
72+
}
6073

6174
export default GenericSectionErrorState

src/Shared/Components/GenericSectionErrorState/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { ProgressingProps } from '@Common/Types'
18+
1719
export interface GenericSectionErrorStateProps {
1820
/**
1921
* Handler for reloading the section
@@ -45,6 +47,10 @@ export interface GenericSectionErrorStateProps {
4547
* to be applied on parent div
4648
*/
4749
rootClassName?: string
50+
/**
51+
* If provided, would render the Progressing component with given props instead of error icon
52+
*/
53+
progressingProps?: ProgressingProps
4854
/**
4955
* If true, info icon would be used instead of error
5056
*

0 commit comments

Comments
 (0)