@devtron-labs/devtron-fe-common-lib 0.0.48-beta-6 → 0.0.48-beta-8
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 +75 -0
- package/.eslintrc.js +84 -16
- package/.github/pull_request_template.md +25 -0
- package/.github/workflows/ci.yml +31 -0
- package/.github/workflows/release-package.yml +2 -3
- package/.husky/pre-commit +5 -0
- package/.lintstagedrc +3 -0
- package/.nvmrc +1 -0
- package/dist/Common/BreadCrumb/BreadCrumb.d.ts +1 -1
- package/dist/Common/BreadCrumb/BreadcrumbStore.d.ts +2 -2
- package/dist/Common/Common.service.d.ts +0 -1
- package/dist/Common/Constants.d.ts +1 -2
- package/dist/Common/CustomInput/CustomInput.d.ts +1 -1
- package/dist/Common/CustomInput/Types.d.ts +2 -1
- 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 +20 -17
- package/dist/Common/EmptyState/GenericEmptyState.d.ts +1 -1
- package/dist/Common/Error.d.ts +2 -1
- package/dist/Common/ErrorScreenNotFound.d.ts +1 -1
- package/dist/Common/Helper.d.ts +1 -10
- 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/Common/Types.d.ts +0 -64
- package/dist/Common/index.d.ts +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +380 -2083
- package/package.json +19 -4
- package/src/Common/AddCDButton/AddCDButton.tsx +1 -2
- package/src/Common/Api.ts +21 -26
- package/src/Common/AppStatus/AppStatus.tsx +12 -12
- package/src/Common/AppStatus/utils.ts +6 -5
- package/src/Common/BreadCrumb/BreadCrumb.tsx +32 -28
- package/src/Common/BreadCrumb/BreadcrumbStore.tsx +2 -2
- package/src/Common/BreadCrumb/Types.ts +11 -12
- package/src/Common/Checkbox.tsx +17 -19
- package/src/Common/ClipboardButton/ClipboardButton.tsx +1 -1
- package/src/Common/ClipboardButton/__tests__/ClipboardButton.test.tsx +0 -1
- package/src/Common/Common.service.ts +59 -68
- package/src/Common/Constants.ts +9 -10
- package/src/Common/CustomInput/CustomInput.tsx +22 -28
- package/src/Common/CustomInput/Types.ts +4 -3
- package/src/Common/CustomInput/index.ts +1 -1
- package/src/Common/CustomTagSelector/PropagateTagInfo.tsx +15 -18
- package/src/Common/CustomTagSelector/ResizableTagTextArea.tsx +9 -9
- package/src/Common/CustomTagSelector/TagDetails.tsx +9 -3
- package/src/Common/CustomTagSelector/TagLabelSelect.tsx +7 -9
- package/src/Common/CustomTagSelector/TagLabelValueSelector.tsx +31 -35
- package/src/Common/CustomTagSelector/TagSelector.utils.ts +2 -3
- package/src/Common/CustomTagSelector/Types.ts +1 -1
- package/src/Common/CustomTagSelector/ValidationRules.ts +18 -22
- package/src/Common/CustomTagSelector/index.ts +2 -2
- package/src/Common/DebouncedSearch/DebouncedSearch.tsx +2 -1
- package/src/Common/DebouncedSearch/__tests__/DebouncedSearch.test.tsx +0 -1
- package/src/Common/DeleteComponentModal/DeleteComponent.tsx +27 -32
- package/src/Common/DeleteComponentModal/types.ts +1 -1
- package/src/Common/DevtronProgressing/DevtronProgressing.tsx +5 -8
- package/src/Common/Dialogs/ConfirmationDialog.tsx +24 -24
- package/src/Common/Dialogs/DeleteDialog.tsx +3 -5
- package/src/Common/Dialogs/DialogForm.tsx +31 -35
- package/src/Common/Dialogs/ForceDeleteDialog.tsx +13 -7
- 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 +13 -17
- package/src/Common/EmptyState/GenericEmptyState.tsx +25 -15
- package/src/Common/Error.tsx +5 -5
- package/src/Common/ErrorScreenNotFound.tsx +9 -12
- package/src/Common/Grid/Grid.tsx +1 -2
- package/src/Common/Helper.tsx +23 -125
- package/src/Common/Hooks/UseClickOutside/UseClickOutside.tsx +1 -1
- package/src/Common/Hooks/UseSuperAdmin/UseSuperAdmin.tsx +1 -1
- package/src/Common/ImageTags.Types.ts +2 -3
- package/src/Common/ImageTags.tsx +61 -66
- package/src/Common/InfoColorBar/InfoColourbar.tsx +10 -5
- package/src/Common/Modals/Modal.tsx +3 -3
- package/src/Common/Modals/OpaqueModal.tsx +25 -18
- package/src/Common/Modals/VisibleModal.tsx +7 -3
- package/src/Common/Modals/VisibleModal2.tsx +20 -15
- package/src/Common/MultiSelectCustomization.tsx +9 -13
- package/src/Common/Policy.Types.ts +38 -38
- package/src/Common/PopupMenu.tsx +10 -9
- package/src/Common/Progressing.tsx +15 -18
- package/src/Common/RJSF/Form.tsx +0 -1
- package/src/Common/RJSF/common/FieldRow.tsx +0 -1
- package/src/Common/RJSF/config.ts +0 -1
- package/src/Common/RJSF/templates/ArrayFieldItemTemplate.tsx +1 -1
- package/src/Common/RJSF/templates/ArrayFieldTemplate.tsx +0 -1
- package/src/Common/RJSF/templates/BaseInput.tsx +0 -1
- package/src/Common/RJSF/templates/ButtonTemplates/AddButton.tsx +0 -1
- package/src/Common/RJSF/templates/ButtonTemplates/RemoveButton.tsx +0 -1
- package/src/Common/RJSF/templates/ButtonTemplates/SubmitButton.tsx +1 -6
- package/src/Common/RJSF/templates/Description.tsx +0 -1
- package/src/Common/RJSF/templates/Field.tsx +14 -3
- package/src/Common/RJSF/templates/FieldErrorTemplate.tsx +6 -9
- package/src/Common/RJSF/templates/ObjectFieldTemplate.tsx +5 -7
- package/src/Common/RJSF/templates/TitleField.tsx +0 -1
- package/src/Common/RJSF/templates/WrapIfAdditionalTemplate.tsx +0 -1
- package/src/Common/RJSF/utils.ts +53 -57
- package/src/Common/RJSF/widgets/Checkbox.tsx +2 -2
- package/src/Common/RJSF/widgets/Select.tsx +0 -1
- package/src/Common/RadioGroup/RadioGroup.tsx +18 -23
- package/src/Common/RadioGroup.tsx +24 -23
- package/src/Common/Reload.tsx +0 -1
- package/src/Common/ResizableTextarea.tsx +18 -17
- package/src/Common/Security/ScanVulnerabilitiesTable.tsx +29 -34
- package/src/Common/ServerError.ts +5 -1
- package/src/Common/TippyCustomized.tsx +41 -38
- package/src/Common/ToastBody.tsx +6 -7
- package/src/Common/Toggle/Toggle.tsx +3 -3
- package/src/Common/Types.ts +12 -81
- package/src/Common/index.ts +0 -1
- package/src/custom.d.ts +7 -7
- package/src/index.ts +1 -1
- package/dist/Common/ChartVersionAndTypeSelector.d.ts +0 -4
- package/src/Common/ChartVersionAndTypeSelector.tsx +0 -78
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
import { VisibleModal2 } from '../Modals/VisibleModal2'
|
|
3
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ConfirmationDialogBodyType,
|
|
4
|
+
ConfirmationDialogButtonGroupType,
|
|
5
|
+
ConfirmationDialogIconType,
|
|
6
|
+
ConfirmationDialogType,
|
|
7
|
+
} from './Types'
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
)
|
|
11
|
-
}
|
|
9
|
+
const ConfirmationDialog = ({ className = '', children }: ConfirmationDialogType) => (
|
|
10
|
+
<VisibleModal2 className="confirmation-dialog">
|
|
11
|
+
<div className={`confirmation-dialog__body ${className}`}>{children}</div>
|
|
12
|
+
</VisibleModal2>
|
|
13
|
+
)
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
const Icon = ({ src, className = '' }: ConfirmationDialogIconType) => (
|
|
16
|
+
<img src={src} className={`confirmation-dialog__icon ${className}`} alt="" />
|
|
17
|
+
)
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
)
|
|
25
|
-
}
|
|
19
|
+
const Body = ({ title, subtitle = null, children = null }: ConfirmationDialogBodyType) => (
|
|
20
|
+
<div className="flex left column ">
|
|
21
|
+
<h3 className="confirmation-dialog__title lh-1-5 dc__break-word w-100">{title}</h3>
|
|
22
|
+
{subtitle && <div className="confirmation-dialog__subtitle">{subtitle}</div>}
|
|
23
|
+
{children}
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const ButtonGroup = ({ children }: ConfirmationDialogButtonGroupType) => (
|
|
28
|
+
<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 React from 'react'
|
|
1
|
+
import * as 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> } =
|
|
7
|
+
export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.FC<any> } = (props) => {
|
|
8
8
|
const handleDelete = (e: React.MouseEvent) => {
|
|
9
9
|
if (props.shouldStopPropagation) {
|
|
10
10
|
e.stopPropagation()
|
|
@@ -62,8 +62,6 @@ export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.F
|
|
|
62
62
|
)
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
return <>{props.children}</>
|
|
67
|
-
}
|
|
65
|
+
const DeleteDialogDescription = (props) => <>{props.children}</>
|
|
68
66
|
|
|
69
67
|
DeleteDialog.Description = DeleteDialogDescription
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { VisibleModal } from '../Modals/VisibleModal'
|
|
3
|
-
import close from '../../Assets/Icon/ic-cross.svg'
|
|
1
|
+
import { 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
|
-
//TODO: may not need context
|
|
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,26 +46,24 @@ export class DialogForm extends Component<DialogFormProps> {
|
|
|
46
46
|
</button>
|
|
47
47
|
</div>
|
|
48
48
|
<DialogFormContext.Consumer>
|
|
49
|
-
{(context) =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
);
|
|
63
|
-
}}
|
|
49
|
+
{(context) => (
|
|
50
|
+
<form
|
|
51
|
+
noValidate
|
|
52
|
+
onSubmit={(e) => {
|
|
53
|
+
e.preventDefault()
|
|
54
|
+
if (!context.isLoading) {
|
|
55
|
+
context.onSave(e)
|
|
56
|
+
}
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
{this.props.children}
|
|
60
|
+
</form>
|
|
61
|
+
)}
|
|
64
62
|
</DialogFormContext.Consumer>
|
|
65
63
|
</div>
|
|
66
64
|
</VisibleModal>
|
|
67
65
|
</DialogFormContext.Provider>
|
|
68
|
-
)
|
|
66
|
+
)
|
|
69
67
|
}
|
|
70
68
|
}
|
|
71
69
|
|
|
@@ -73,14 +71,12 @@ export class DialogFormSubmit extends Component<{ tabIndex: number }> {
|
|
|
73
71
|
render() {
|
|
74
72
|
return (
|
|
75
73
|
<DialogFormContext.Consumer>
|
|
76
|
-
{(context) =>
|
|
77
|
-
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
);
|
|
82
|
-
}}
|
|
74
|
+
{(context) => (
|
|
75
|
+
<button type="submit" className="cta dc__align-right" tabIndex={this.props.tabIndex}>
|
|
76
|
+
{context.isLoading ? <Progressing /> : this.props.children}
|
|
77
|
+
</button>
|
|
78
|
+
)}
|
|
83
79
|
</DialogFormContext.Consumer>
|
|
84
|
-
)
|
|
80
|
+
)
|
|
85
81
|
}
|
|
86
82
|
}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { DeleteDialog } from './DeleteDialog';
|
|
1
|
+
import { ForceDeleteDialogType } from './Types'
|
|
2
|
+
import { DeleteDialog } from './DeleteDialog'
|
|
4
3
|
|
|
5
|
-
export default function ForceDeleteDialog({
|
|
4
|
+
export default function ForceDeleteDialog({
|
|
5
|
+
onClickDelete,
|
|
6
|
+
closeDeleteModal,
|
|
7
|
+
forceDeleteDialogTitle,
|
|
8
|
+
forceDeleteDialogMessage,
|
|
9
|
+
}: ForceDeleteDialogType) {
|
|
6
10
|
return (
|
|
7
11
|
<div>
|
|
8
|
-
<DeleteDialog
|
|
12
|
+
<DeleteDialog
|
|
13
|
+
title={forceDeleteDialogTitle}
|
|
9
14
|
delete={onClickDelete}
|
|
10
15
|
closeDelete={closeDeleteModal}
|
|
11
|
-
deletePrefix="Force "
|
|
12
|
-
|
|
16
|
+
deletePrefix="Force "
|
|
17
|
+
>
|
|
18
|
+
<DeleteDialog.Description>
|
|
13
19
|
<p className="mt-12 mb-12 p-8 dc__break-word dc__window-bg">Error: {forceDeleteDialogMessage}</p>
|
|
14
20
|
<p>Do you want to force delete?</p>
|
|
15
21
|
</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,14 +1,10 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import './emptyState.scss'
|
|
3
|
-
import { ReactComponent as Progressing } from '../../Assets/Icon/ic-progressing.svg'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
{children}
|
|
9
|
-
</div>
|
|
10
|
-
)
|
|
11
|
-
}
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import './emptyState.scss'
|
|
3
|
+
import { ReactComponent as Progressing } from '../../Assets/Icon/ic-progressing.svg'
|
|
4
|
+
|
|
5
|
+
const EmptyState = ({ children, className = '' }) => (
|
|
6
|
+
<div className={`flex column empty-state w-100 h-100 ${className}`}>{children}</div>
|
|
7
|
+
)
|
|
12
8
|
|
|
13
9
|
function Image({ children }) {
|
|
14
10
|
return children
|
|
@@ -18,20 +14,20 @@ function Title({ children }) {
|
|
|
18
14
|
return children
|
|
19
15
|
}
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
const Subtitle = ({ children, className }: { children: any; className?: string }) => (
|
|
18
|
+
<p className={`subtitle ${className || ''}`}>{children}</p>
|
|
19
|
+
)
|
|
24
20
|
|
|
25
21
|
function Button({ children }) {
|
|
26
22
|
return children
|
|
27
23
|
}
|
|
28
24
|
|
|
29
|
-
const Loading: React.FC<{ text: string }> =
|
|
30
|
-
|
|
25
|
+
const Loading: React.FC<{ text: string }> = (props) => (
|
|
26
|
+
<>
|
|
31
27
|
<Progressing className="dc__block empty-state__loader" />
|
|
32
28
|
<p className="empty-state__loading-text">{props.text}</p>
|
|
33
29
|
</>
|
|
34
|
-
|
|
30
|
+
)
|
|
35
31
|
|
|
36
32
|
EmptyState.Image = Image
|
|
37
33
|
EmptyState.Title = Title
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import AppNotDeployed from '../../Assets/Img/app-not-deployed.png'
|
|
3
2
|
import { GenericEmptyStateType, ImageType } from '../Types'
|
|
4
3
|
|
|
5
4
|
import './emptyState.scss'
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
const GenericEmptyState = ({
|
|
8
7
|
title,
|
|
9
8
|
image,
|
|
10
9
|
subTitle,
|
|
@@ -19,24 +18,35 @@ function GenericEmptyState({
|
|
|
19
18
|
SvgImage,
|
|
20
19
|
noImage,
|
|
21
20
|
layout = 'column',
|
|
22
|
-
contentClassName = ''
|
|
23
|
-
}: GenericEmptyStateType): JSX.Element {
|
|
24
|
-
const isRowLayout = layout === 'row'
|
|
25
|
-
|
|
21
|
+
contentClassName = '',
|
|
22
|
+
}: GenericEmptyStateType): JSX.Element => {
|
|
23
|
+
const isRowLayout = layout === 'row'
|
|
24
|
+
|
|
26
25
|
return (
|
|
27
26
|
<div
|
|
28
|
-
className={`flex ${isRowLayout ? 'dc__gap-32' : 'column dc__gap-20'} empty-state ${classname
|
|
27
|
+
className={`flex ${isRowLayout ? 'dc__gap-32' : 'column dc__gap-20'} empty-state ${classname || ''}`}
|
|
29
28
|
style={styles}
|
|
30
29
|
data-testid="generic-empty-state"
|
|
31
30
|
{...(heightToDeduct >= 0 && { style: { ...styles, height: `calc(100vh - ${heightToDeduct}px)` } })}
|
|
32
|
-
>
|
|
33
|
-
{!SvgImage ?
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
>
|
|
32
|
+
{!SvgImage ? (
|
|
33
|
+
!noImage && (
|
|
34
|
+
<img
|
|
35
|
+
className={imageClassName || ''}
|
|
36
|
+
src={image || AppNotDeployed}
|
|
37
|
+
width={imageType === ImageType.Medium ? '200' : '250'}
|
|
38
|
+
height={imageType === ImageType.Medium ? '160' : '200'}
|
|
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
|
+
>
|
|
40
50
|
<h4 className="title fw-6 cn-9 mt-0 mb-0">{title}</h4>
|
|
41
51
|
{subTitle && <p className={`subtitle ${isRowLayout ? 'subtitle--text-start' : ''}`}>{subTitle}</p>}
|
|
42
52
|
{isButtonAvailable && renderButton()}
|
package/src/Common/Error.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Component } from 'react'
|
|
2
|
+
import * as React from 'react'
|
|
2
3
|
import EmptyState from './EmptyState/EmptyState'
|
|
3
4
|
import notAuthorized from '../Assets/Img/ic-not-authorized.svg'
|
|
4
5
|
import ErrorScreenNotFound from './ErrorScreenNotFound'
|
|
@@ -20,9 +21,7 @@ export class ErrorScreenManager extends Component<{
|
|
|
20
21
|
case 401:
|
|
21
22
|
return 'Unauthorized'
|
|
22
23
|
case 403:
|
|
23
|
-
return
|
|
24
|
-
<ErrorScreenNotAuthorized subtitle={this.props.subtitle} />
|
|
25
|
-
)
|
|
24
|
+
return <ErrorScreenNotAuthorized subtitle={this.props.subtitle} />
|
|
26
25
|
case 404:
|
|
27
26
|
return <ErrorScreenNotFound />
|
|
28
27
|
case 500:
|
|
@@ -35,8 +34,9 @@ export class ErrorScreenManager extends Component<{
|
|
|
35
34
|
return <Reload className={this.props.reloadClass} />
|
|
36
35
|
}
|
|
37
36
|
}
|
|
37
|
+
|
|
38
38
|
render() {
|
|
39
|
-
|
|
39
|
+
const msg = this.getMessage()
|
|
40
40
|
return (
|
|
41
41
|
<div>
|
|
42
42
|
<h1>{msg}</h1>
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import notFound from '../Assets/Img/ic-empty-error@2x.png'
|
|
3
1
|
import { useHistory } from 'react-router-dom'
|
|
2
|
+
import notFound from '../Assets/Img/ic-empty-error@2x.png'
|
|
4
3
|
import { ERROR_EMPTY_SCREEN } from './Constants'
|
|
5
4
|
import GenericEmptyState from './EmptyState/GenericEmptyState'
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
const {push} = useHistory()
|
|
6
|
+
const ErrorScreenNotFound = () => {
|
|
7
|
+
const { push } = useHistory()
|
|
9
8
|
const redirectToHome = () => {
|
|
10
9
|
push('/app/list')
|
|
11
10
|
}
|
|
12
|
-
const renderGenerateButton = () =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
)
|
|
18
|
-
}
|
|
11
|
+
const renderGenerateButton = () => (
|
|
12
|
+
<button className="flex cta h-32" onClick={redirectToHome} data-testid="empty-screen-take-me-home">
|
|
13
|
+
{ERROR_EMPTY_SCREEN.TAKE_BACK_HOME}
|
|
14
|
+
</button>
|
|
15
|
+
)
|
|
19
16
|
|
|
20
17
|
return (
|
|
21
18
|
<GenericEmptyState
|
|
22
19
|
image={notFound}
|
|
23
20
|
title={ERROR_EMPTY_SCREEN.PAGE_NOT_FOUND}
|
|
24
21
|
subTitle={ERROR_EMPTY_SCREEN.PAGE_NOT_EXIST}
|
|
25
|
-
isButtonAvailable
|
|
22
|
+
isButtonAvailable
|
|
26
23
|
renderButton={renderGenerateButton}
|
|
27
24
|
/>
|
|
28
25
|
)
|
package/src/Common/Grid/Grid.tsx
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
import { GridProps } from './types'
|
|
3
2
|
|
|
4
3
|
// 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 +10,7 @@ export default function Grid({
|
|
|
11
10
|
itemClass = '',
|
|
12
11
|
children,
|
|
13
12
|
}: GridProps) {
|
|
14
|
-
const containerStyles = container ? { gap: spacing
|
|
13
|
+
const containerStyles = container ? { gap: `${spacing}px` } : {}
|
|
15
14
|
|
|
16
15
|
if (item) {
|
|
17
16
|
const getColumnWidth = () => {
|