@devtron-labs/devtron-fe-common-lib 0.0.52-beta-3 → 0.0.52-beta-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +17 -0
- package/.husky/pre-commit +0 -0
- package/.lintstagedrc +1 -1
- package/dist/Common/BreadCrumb/BreadCrumb.d.ts +1 -1
- package/dist/Common/BreadCrumb/BreadcrumbStore.d.ts +2 -2
- package/dist/Common/Constants.d.ts +1 -1
- package/dist/Common/CustomInput/CustomInput.d.ts +1 -1
- package/dist/Common/CustomInput/Types.d.ts +1 -2
- package/dist/Common/CustomTagSelector/ResizableTagTextArea.d.ts +1 -1
- package/dist/Common/DeleteComponentModal/DeleteComponent.d.ts +1 -1
- package/dist/Common/DevtronProgressing/DevtronProgressing.d.ts +1 -1
- package/dist/Common/Dialogs/ConfirmationDialog.d.ts +6 -6
- package/dist/Common/Dialogs/DeleteDialog.d.ts +1 -1
- package/dist/Common/Dialogs/ForceDeleteDialog.d.ts +1 -1
- package/dist/Common/Dialogs/Types.d.ts +1 -1
- package/dist/Common/EmptyState/EmptyState.d.ts +17 -20
- package/dist/Common/EmptyState/GenericEmptyState.d.ts +1 -1
- package/dist/Common/Error.d.ts +1 -2
- package/dist/Common/ErrorScreenNotFound.d.ts +1 -1
- package/dist/Common/Helper.d.ts +1 -1
- package/dist/Common/ImageTags.d.ts +1 -1
- package/dist/Common/InfoColorBar/InfoColourbar.d.ts +1 -1
- package/dist/Common/Modals/Modal.d.ts +2 -2
- package/dist/Common/Modals/OpaqueModal.d.ts +3 -3
- package/dist/Common/Modals/VisibleModal.d.ts +3 -3
- package/dist/Common/Modals/VisibleModal2.d.ts +3 -3
- package/dist/Common/MultiSelectCustomization.d.ts +1 -1
- package/dist/Common/Policy.Types.d.ts +2 -2
- package/dist/Common/PopupMenu.d.ts +5 -5
- package/dist/Common/Progressing.d.ts +2 -2
- package/dist/Common/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/Common/ResizableTextarea.d.ts +1 -1
- package/dist/Common/TippyCustomized.d.ts +1 -1
- package/dist/Common/ToastBody.d.ts +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +315 -239
- package/package.json +1 -1
- package/src/Common/AddCDButton/AddCDButton.tsx +2 -1
- package/src/Common/Api.ts +25 -20
- package/src/Common/AppStatus/AppStatus.tsx +12 -12
- package/src/Common/AppStatus/utils.ts +5 -6
- package/src/Common/BreadCrumb/BreadCrumb.tsx +28 -32
- package/src/Common/BreadCrumb/BreadcrumbStore.tsx +2 -2
- package/src/Common/BreadCrumb/Types.ts +12 -11
- package/src/Common/ChartVersionAndTypeSelector.tsx +1 -1
- package/src/Common/Checkbox.tsx +19 -17
- package/src/Common/ClipboardButton/ClipboardButton.tsx +1 -1
- package/src/Common/ClipboardButton/__tests__/ClipboardButton.test.tsx +1 -0
- package/src/Common/Common.service.ts +65 -60
- package/src/Common/Constants.ts +9 -9
- package/src/Common/CustomInput/CustomInput.tsx +28 -22
- package/src/Common/CustomInput/Types.ts +3 -4
- package/src/Common/CustomInput/index.ts +1 -1
- package/src/Common/CustomTagSelector/PropagateTagInfo.tsx +18 -15
- package/src/Common/CustomTagSelector/ResizableTagTextArea.tsx +9 -9
- package/src/Common/CustomTagSelector/TagDetails.tsx +3 -9
- package/src/Common/CustomTagSelector/TagLabelSelect.tsx +9 -7
- package/src/Common/CustomTagSelector/TagLabelValueSelector.tsx +35 -31
- package/src/Common/CustomTagSelector/TagSelector.utils.ts +3 -2
- package/src/Common/CustomTagSelector/Types.ts +1 -1
- package/src/Common/CustomTagSelector/ValidationRules.ts +22 -18
- package/src/Common/CustomTagSelector/index.ts +2 -2
- package/src/Common/DebouncedSearch/DebouncedSearch.tsx +1 -2
- package/src/Common/DebouncedSearch/__tests__/DebouncedSearch.test.tsx +1 -0
- package/src/Common/DeleteComponentModal/DeleteComponent.tsx +32 -27
- package/src/Common/DeleteComponentModal/types.ts +1 -1
- package/src/Common/DevtronProgressing/DevtronProgressing.tsx +8 -5
- package/src/Common/Dialogs/ConfirmationDialog.tsx +24 -24
- package/src/Common/Dialogs/DeleteDialog.tsx +5 -3
- package/src/Common/Dialogs/DialogForm.tsx +35 -31
- package/src/Common/Dialogs/ForceDeleteDialog.tsx +7 -13
- package/src/Common/Dialogs/Types.ts +12 -12
- package/src/Common/Dialogs/index.ts +1 -1
- package/src/Common/Drawer/Drawer.tsx +1 -1
- package/src/Common/EmptyState/EmptyState.tsx +17 -13
- package/src/Common/EmptyState/GenericEmptyState.tsx +15 -25
- package/src/Common/Error.tsx +5 -5
- package/src/Common/ErrorScreenNotFound.tsx +12 -9
- package/src/Common/Grid/Grid.tsx +2 -1
- package/src/Common/Helper.tsx +37 -36
- package/src/Common/Hooks/UseClickOutside/UseClickOutside.tsx +1 -1
- package/src/Common/Hooks/UseSuperAdmin/UseSuperAdmin.tsx +1 -1
- package/src/Common/Hooks/UseWindowSize/UseWindowSize.tsx +7 -5
- package/src/Common/ImageTags.Types.ts +3 -2
- package/src/Common/ImageTags.tsx +66 -61
- package/src/Common/InfoColorBar/InfoColourbar.tsx +5 -10
- package/src/Common/Modals/Modal.tsx +3 -3
- package/src/Common/Modals/OpaqueModal.tsx +18 -25
- package/src/Common/Modals/VisibleModal.tsx +3 -7
- package/src/Common/Modals/VisibleModal2.tsx +15 -20
- package/src/Common/MultiSelectCustomization.tsx +13 -9
- package/src/Common/Policy.Types.ts +38 -38
- package/src/Common/PopupMenu.tsx +9 -10
- package/src/Common/Progressing.tsx +18 -15
- package/src/Common/RJSF/Form.tsx +1 -0
- package/src/Common/RJSF/common/FieldRow.tsx +1 -0
- package/src/Common/RJSF/config.ts +1 -0
- package/src/Common/RJSF/templates/ArrayFieldItemTemplate.tsx +1 -1
- package/src/Common/RJSF/templates/ArrayFieldTemplate.tsx +1 -0
- package/src/Common/RJSF/templates/BaseInput.tsx +1 -0
- package/src/Common/RJSF/templates/ButtonTemplates/AddButton.tsx +1 -0
- package/src/Common/RJSF/templates/ButtonTemplates/RemoveButton.tsx +1 -0
- package/src/Common/RJSF/templates/ButtonTemplates/SubmitButton.tsx +6 -1
- package/src/Common/RJSF/templates/Description.tsx +1 -0
- package/src/Common/RJSF/templates/Field.tsx +3 -14
- package/src/Common/RJSF/templates/FieldErrorTemplate.tsx +9 -6
- package/src/Common/RJSF/templates/ObjectFieldTemplate.tsx +7 -5
- package/src/Common/RJSF/templates/TitleField.tsx +1 -0
- package/src/Common/RJSF/templates/WrapIfAdditionalTemplate.tsx +1 -0
- package/src/Common/RJSF/utils.ts +57 -53
- package/src/Common/RJSF/widgets/Checkbox.tsx +2 -2
- package/src/Common/RJSF/widgets/Select.tsx +1 -0
- package/src/Common/RadioGroup/RadioGroup.tsx +23 -18
- package/src/Common/RadioGroup.tsx +23 -24
- package/src/Common/Reload.tsx +1 -0
- package/src/Common/ResizableTextarea.tsx +17 -18
- package/src/Common/Security/ScanVulnerabilitiesTable.tsx +34 -29
- package/src/Common/ServerError.ts +1 -5
- package/src/Common/TippyCustomized.tsx +38 -41
- package/src/Common/ToastBody.tsx +7 -6
- package/src/Common/Toggle/Toggle.tsx +3 -3
- package/src/Common/Types.ts +19 -19
- package/src/custom.d.ts +7 -7
- package/src/index.ts +1 -1
|
@@ -1,32 +1,32 @@
|
|
|
1
|
+
import React from 'react'
|
|
1
2
|
import { VisibleModal2 } from '../Modals/VisibleModal2'
|
|
2
|
-
import {
|
|
3
|
-
ConfirmationDialogBodyType,
|
|
4
|
-
ConfirmationDialogButtonGroupType,
|
|
5
|
-
ConfirmationDialogIconType,
|
|
6
|
-
ConfirmationDialogType,
|
|
7
|
-
} from './Types'
|
|
3
|
+
import { ConfirmationDialogBodyType, ConfirmationDialogButtonGroupType, ConfirmationDialogIconType, ConfirmationDialogType } from './Types'
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
function ConfirmationDialog({ className = '', children }: ConfirmationDialogType) {
|
|
6
|
+
return (
|
|
7
|
+
<VisibleModal2 className="confirmation-dialog">
|
|
8
|
+
<div className={`confirmation-dialog__body ${className}`}>{children}</div>
|
|
9
|
+
</VisibleModal2>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
<img src={src} className={`confirmation-dialog__icon ${className}`} alt="" />
|
|
17
|
-
|
|
13
|
+
function Icon({ src, className = '' }: ConfirmationDialogIconType) {
|
|
14
|
+
return <img src={src} className={`confirmation-dialog__icon ${className}`} alt="" />
|
|
15
|
+
}
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
function Body({ title, subtitle = null, children = null }: ConfirmationDialogBodyType) {
|
|
18
|
+
return (
|
|
19
|
+
<div className="flex left column ">
|
|
20
|
+
<h3 className="confirmation-dialog__title lh-1-5 dc__break-word w-100">{title}</h3>
|
|
21
|
+
{subtitle && <div className="confirmation-dialog__subtitle">{subtitle}</div>}
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
<div className="flex right confirmation-dialog__button-group">{children}</div>
|
|
29
|
-
|
|
27
|
+
function ButtonGroup({ children }: ConfirmationDialogButtonGroupType) {
|
|
28
|
+
return <div className="flex right confirmation-dialog__button-group">{children}</div>
|
|
29
|
+
}
|
|
30
30
|
|
|
31
31
|
ConfirmationDialog.Icon = Icon
|
|
32
32
|
ConfirmationDialog.Body = Body
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react'
|
|
2
2
|
import warn from '../../Assets/Img/delete-medium.svg'
|
|
3
3
|
import { Progressing } from '../Progressing'
|
|
4
4
|
import ConfirmationDialog from './ConfirmationDialog'
|
|
5
5
|
import { DeleteDialogProps } from './Types'
|
|
6
6
|
|
|
7
|
-
export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.FC<any> } = (props)
|
|
7
|
+
export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.FC<any> } = function (props) {
|
|
8
8
|
const handleDelete = (e: React.MouseEvent) => {
|
|
9
9
|
if (props.shouldStopPropagation) {
|
|
10
10
|
e.stopPropagation()
|
|
@@ -62,6 +62,8 @@ export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.F
|
|
|
62
62
|
)
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
function DeleteDialogDescription(props) {
|
|
66
|
+
return <>{props.children}</>
|
|
67
|
+
}
|
|
66
68
|
|
|
67
69
|
DeleteDialog.Description = DeleteDialogDescription
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { Component, createContext } from 'react'
|
|
2
|
-
import { VisibleModal } from '../Modals/VisibleModal'
|
|
3
|
-
import close from '../../Assets/Icon/ic-cross.svg'
|
|
1
|
+
import React, { Component, createContext } from 'react';
|
|
2
|
+
import { VisibleModal } from '../Modals/VisibleModal';
|
|
3
|
+
import close from '../../Assets/Icon/ic-cross.svg';
|
|
4
4
|
import { Progressing } from '../Progressing'
|
|
5
|
-
import { DialogFormProps } from './Types'
|
|
6
|
-
//
|
|
7
|
-
const DialogFormContext = createContext({ title: '', isLoading: false, close: (event) => {}, onSave: (event) => {} })
|
|
5
|
+
import { DialogFormProps } from './Types';
|
|
6
|
+
//TODO: may not need context
|
|
7
|
+
const DialogFormContext = createContext({ title: '', isLoading: false, close: (event) => {}, onSave: (event) => {} });
|
|
8
8
|
|
|
9
9
|
export class DialogForm extends Component<DialogFormProps> {
|
|
10
10
|
constructor(props) {
|
|
11
|
-
super(props)
|
|
12
|
-
this.escFunction = this.escFunction.bind(this)
|
|
11
|
+
super(props);
|
|
12
|
+
this.escFunction = this.escFunction.bind(this);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
componentDidMount() {
|
|
16
|
-
document.addEventListener('keydown', this.escFunction)
|
|
16
|
+
document.addEventListener('keydown', this.escFunction);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
componentWillUnmount() {
|
|
20
|
-
document.removeEventListener('keydown', this.escFunction)
|
|
20
|
+
document.removeEventListener('keydown', this.escFunction);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
escFunction(event) {
|
|
24
24
|
if (event.keyCode === 27 && this.props.closeOnESC) {
|
|
25
|
-
this.props.close(event)
|
|
25
|
+
this.props.close(event);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -46,24 +46,26 @@ export class DialogForm extends Component<DialogFormProps> {
|
|
|
46
46
|
</button>
|
|
47
47
|
</div>
|
|
48
48
|
<DialogFormContext.Consumer>
|
|
49
|
-
{(context) =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
e
|
|
54
|
-
|
|
55
|
-
context.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
{(context) => {
|
|
50
|
+
return (
|
|
51
|
+
<form
|
|
52
|
+
noValidate
|
|
53
|
+
onSubmit={(e) => {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
if (!context.isLoading) {
|
|
56
|
+
context.onSave(e);
|
|
57
|
+
}
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
{this.props.children}
|
|
61
|
+
</form>
|
|
62
|
+
);
|
|
63
|
+
}}
|
|
62
64
|
</DialogFormContext.Consumer>
|
|
63
65
|
</div>
|
|
64
66
|
</VisibleModal>
|
|
65
67
|
</DialogFormContext.Provider>
|
|
66
|
-
)
|
|
68
|
+
);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
|
|
@@ -71,12 +73,14 @@ export class DialogFormSubmit extends Component<{ tabIndex: number }> {
|
|
|
71
73
|
render() {
|
|
72
74
|
return (
|
|
73
75
|
<DialogFormContext.Consumer>
|
|
74
|
-
{(context) =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
{(context) => {
|
|
77
|
+
return (
|
|
78
|
+
<button type="submit" className="cta dc__align-right" tabIndex={this.props.tabIndex}>
|
|
79
|
+
{context.isLoading ? <Progressing /> : this.props.children}
|
|
80
|
+
</button>
|
|
81
|
+
);
|
|
82
|
+
}}
|
|
79
83
|
</DialogFormContext.Consumer>
|
|
80
|
-
)
|
|
84
|
+
);
|
|
81
85
|
}
|
|
82
86
|
}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ForceDeleteDialogType } from './Types';
|
|
3
|
+
import { DeleteDialog } from './DeleteDialog';
|
|
3
4
|
|
|
4
|
-
export default function ForceDeleteDialog({
|
|
5
|
-
onClickDelete,
|
|
6
|
-
closeDeleteModal,
|
|
7
|
-
forceDeleteDialogTitle,
|
|
8
|
-
forceDeleteDialogMessage,
|
|
9
|
-
}: ForceDeleteDialogType) {
|
|
5
|
+
export default function ForceDeleteDialog({ onClickDelete, closeDeleteModal, forceDeleteDialogTitle, forceDeleteDialogMessage }: ForceDeleteDialogType) {
|
|
10
6
|
return (
|
|
11
7
|
<div>
|
|
12
|
-
<DeleteDialog
|
|
13
|
-
title={forceDeleteDialogTitle}
|
|
8
|
+
<DeleteDialog title={forceDeleteDialogTitle}
|
|
14
9
|
delete={onClickDelete}
|
|
15
10
|
closeDelete={closeDeleteModal}
|
|
16
|
-
deletePrefix="Force "
|
|
17
|
-
|
|
18
|
-
<DeleteDialog.Description>
|
|
11
|
+
deletePrefix="Force ">
|
|
12
|
+
<DeleteDialog.Description >
|
|
19
13
|
<p className="mt-12 mb-12 p-8 dc__break-word dc__window-bg">Error: {forceDeleteDialogMessage}</p>
|
|
20
14
|
<p>Do you want to force delete?</p>
|
|
21
15
|
</DeleteDialog.Description>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
1
|
+
import { ReactNode } from "react"
|
|
2
2
|
|
|
3
3
|
export interface DeleteDialogProps {
|
|
4
4
|
title: string
|
|
@@ -15,10 +15,10 @@ export interface DeleteDialogProps {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface ForceDeleteDialogType {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
onClickDelete: () => void
|
|
19
|
+
closeDeleteModal: () => void
|
|
20
|
+
forceDeleteDialogTitle: string
|
|
21
|
+
forceDeleteDialogMessage: string
|
|
22
22
|
}
|
|
23
23
|
export interface ConfirmationDialogType {
|
|
24
24
|
className?: string
|
|
@@ -37,11 +37,11 @@ export interface ConfirmationDialogButtonGroupType {
|
|
|
37
37
|
children: any
|
|
38
38
|
}
|
|
39
39
|
export interface DialogFormProps {
|
|
40
|
-
className: string
|
|
41
|
-
title: string
|
|
42
|
-
isLoading: boolean
|
|
43
|
-
closeOnESC?: boolean
|
|
44
|
-
close: (event) => void
|
|
45
|
-
onSave: (event) => void
|
|
46
|
-
headerClassName?: string
|
|
40
|
+
className: string;
|
|
41
|
+
title: string;
|
|
42
|
+
isLoading: boolean;
|
|
43
|
+
closeOnESC?: boolean;
|
|
44
|
+
close: (event) => void;
|
|
45
|
+
onSave: (event) => void;
|
|
46
|
+
headerClassName?: string;
|
|
47
47
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import './emptyState.scss'
|
|
3
|
-
import { ReactComponent as Progressing } from '../../Assets/Icon/ic-progressing.svg'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './emptyState.scss';
|
|
3
|
+
import { ReactComponent as Progressing } from '../../Assets/Icon/ic-progressing.svg';
|
|
4
|
+
|
|
5
|
+
function EmptyState({ children, className = '' }) {
|
|
6
|
+
return (
|
|
7
|
+
<div className={`flex column empty-state w-100 h-100 ${className}`}>
|
|
8
|
+
{children}
|
|
9
|
+
</div>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
8
12
|
|
|
9
13
|
function Image({ children }) {
|
|
10
14
|
return children
|
|
@@ -14,20 +18,20 @@ function Title({ children }) {
|
|
|
14
18
|
return children
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
<p className={`subtitle ${className || ''}`}>{children}</p>
|
|
19
|
-
|
|
21
|
+
function Subtitle({ children, className }: { children: any; className?: string }) {
|
|
22
|
+
return <p className={`subtitle ${className || ''}`}>{children}</p>
|
|
23
|
+
}
|
|
20
24
|
|
|
21
25
|
function Button({ children }) {
|
|
22
26
|
return children
|
|
23
27
|
}
|
|
24
28
|
|
|
25
|
-
const Loading: React.FC<{ text: string }> = (props)
|
|
26
|
-
<>
|
|
29
|
+
const Loading: React.FC<{ text: string }> = function (props) {
|
|
30
|
+
return <>
|
|
27
31
|
<Progressing className="dc__block empty-state__loader" />
|
|
28
32
|
<p className="empty-state__loading-text">{props.text}</p>
|
|
29
33
|
</>
|
|
30
|
-
|
|
34
|
+
}
|
|
31
35
|
|
|
32
36
|
EmptyState.Image = Image
|
|
33
37
|
EmptyState.Title = Title
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import AppNotDeployed from '../../Assets/Img/app-not-deployed.png'
|
|
2
3
|
import { GenericEmptyStateType, ImageType } from '../Types'
|
|
3
4
|
|
|
4
5
|
import './emptyState.scss'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
function GenericEmptyState({
|
|
7
8
|
title,
|
|
8
9
|
image,
|
|
9
10
|
subTitle,
|
|
@@ -18,35 +19,24 @@ const GenericEmptyState = ({
|
|
|
18
19
|
SvgImage,
|
|
19
20
|
noImage,
|
|
20
21
|
layout = 'column',
|
|
21
|
-
contentClassName = ''
|
|
22
|
-
}: GenericEmptyStateType): JSX.Element
|
|
23
|
-
const isRowLayout = layout === 'row'
|
|
24
|
-
|
|
22
|
+
contentClassName = ''
|
|
23
|
+
}: GenericEmptyStateType): JSX.Element {
|
|
24
|
+
const isRowLayout = layout === 'row';
|
|
25
|
+
|
|
25
26
|
return (
|
|
26
27
|
<div
|
|
27
|
-
className={`flex ${isRowLayout ? 'dc__gap-32' : 'column dc__gap-20'} empty-state ${classname
|
|
28
|
+
className={`flex ${isRowLayout ? 'dc__gap-32' : 'column dc__gap-20'} empty-state ${classname ? classname : ''}`}
|
|
28
29
|
style={styles}
|
|
29
30
|
data-testid="generic-empty-state"
|
|
30
31
|
{...(heightToDeduct >= 0 && { style: { ...styles, height: `calc(100vh - ${heightToDeduct}px)` } })}
|
|
31
|
-
>
|
|
32
|
-
{!SvgImage ?
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
alt="empty-state"
|
|
40
|
-
/>
|
|
41
|
-
)
|
|
42
|
-
) : (
|
|
43
|
-
<SvgImage />
|
|
44
|
-
)}
|
|
45
|
-
<div
|
|
46
|
-
className={`flex column dc__gap-10 dc__mxw-300 ${
|
|
47
|
-
isRowLayout ? 'dc__align-start' : ''
|
|
48
|
-
} ${contentClassName}`}
|
|
49
|
-
>
|
|
32
|
+
>
|
|
33
|
+
{!SvgImage ? !noImage && <img className={imageClassName ? imageClassName : ''}
|
|
34
|
+
src={image || AppNotDeployed}
|
|
35
|
+
width={imageType === ImageType.Medium ? '200' : '250'}
|
|
36
|
+
height={imageType === ImageType.Medium ? '160' : '200'}
|
|
37
|
+
alt="empty-state"
|
|
38
|
+
/> : <SvgImage />}
|
|
39
|
+
<div className={`flex column dc__gap-10 dc__mxw-300 ${isRowLayout ? 'dc__align-start' : ''} ${contentClassName}`}>
|
|
50
40
|
<h4 className="title fw-6 cn-9 mt-0 mb-0">{title}</h4>
|
|
51
41
|
{subTitle && <p className={`subtitle ${isRowLayout ? 'subtitle--text-start' : ''}`}>{subTitle}</p>}
|
|
52
42
|
{isButtonAvailable && renderButton()}
|
package/src/Common/Error.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Component } from 'react'
|
|
2
|
-
import * as React from 'react'
|
|
1
|
+
import React, { Component } from 'react'
|
|
3
2
|
import EmptyState from './EmptyState/EmptyState'
|
|
4
3
|
import notAuthorized from '../Assets/Img/ic-not-authorized.svg'
|
|
5
4
|
import ErrorScreenNotFound from './ErrorScreenNotFound'
|
|
@@ -21,7 +20,9 @@ export class ErrorScreenManager extends Component<{
|
|
|
21
20
|
case 401:
|
|
22
21
|
return 'Unauthorized'
|
|
23
22
|
case 403:
|
|
24
|
-
return
|
|
23
|
+
return (
|
|
24
|
+
<ErrorScreenNotAuthorized subtitle={this.props.subtitle} />
|
|
25
|
+
)
|
|
25
26
|
case 404:
|
|
26
27
|
return <ErrorScreenNotFound />
|
|
27
28
|
case 500:
|
|
@@ -34,9 +35,8 @@ export class ErrorScreenManager extends Component<{
|
|
|
34
35
|
return <Reload className={this.props.reloadClass} />
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
|
|
38
38
|
render() {
|
|
39
|
-
|
|
39
|
+
let msg = this.getMessage()
|
|
40
40
|
return (
|
|
41
41
|
<div>
|
|
42
42
|
<h1>{msg}</h1>
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react'
|
|
2
2
|
import notFound from '../Assets/Img/ic-empty-error@2x.png'
|
|
3
|
+
import { useHistory } from 'react-router-dom'
|
|
3
4
|
import { ERROR_EMPTY_SCREEN } from './Constants'
|
|
4
5
|
import GenericEmptyState from './EmptyState/GenericEmptyState'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
const {
|
|
7
|
+
function ErrorScreenNotFound() {
|
|
8
|
+
const {push} = useHistory()
|
|
8
9
|
const redirectToHome = () => {
|
|
9
10
|
push('/app/list')
|
|
10
11
|
}
|
|
11
|
-
const renderGenerateButton = () =>
|
|
12
|
-
|
|
13
|
-
{
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const renderGenerateButton = () => {
|
|
13
|
+
return (
|
|
14
|
+
<button className="flex cta h-32" onClick={redirectToHome} data-testid="empty-screen-take-me-home">
|
|
15
|
+
{ERROR_EMPTY_SCREEN.TAKE_BACK_HOME}
|
|
16
|
+
</button>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
16
19
|
|
|
17
20
|
return (
|
|
18
21
|
<GenericEmptyState
|
|
19
22
|
image={notFound}
|
|
20
23
|
title={ERROR_EMPTY_SCREEN.PAGE_NOT_FOUND}
|
|
21
24
|
subTitle={ERROR_EMPTY_SCREEN.PAGE_NOT_EXIST}
|
|
22
|
-
isButtonAvailable
|
|
25
|
+
isButtonAvailable={true}
|
|
23
26
|
renderButton={renderGenerateButton}
|
|
24
27
|
/>
|
|
25
28
|
)
|
package/src/Common/Grid/Grid.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react'
|
|
1
2
|
import { GridProps } from './types'
|
|
2
3
|
|
|
3
4
|
// This is meant to be a reusable component that will provide a grid like dynamic layout where xs is the number of columns out of 12 that the item will take up
|
|
@@ -11,7 +12,7 @@ export default function Grid({
|
|
|
11
12
|
children,
|
|
12
13
|
...containerDivProps
|
|
13
14
|
}: GridProps) {
|
|
14
|
-
const containerStyles = container ? { gap:
|
|
15
|
+
const containerStyles = container ? { gap: spacing + 'px' } : {}
|
|
15
16
|
|
|
16
17
|
if (item) {
|
|
17
18
|
const getColumnWidth = () => {
|