@devtron-labs/devtron-fe-common-lib 0.0.7 → 0.0.9
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/dist/Common/BreadCrumb/BreadCrumb.d.ts +1 -29
- package/dist/Common/BreadCrumb/Types.d.ts +28 -0
- package/dist/Common/Checkbox.d.ts +1 -14
- package/dist/Common/Constants.d.ts +13 -0
- package/dist/Common/CustomTagSelector/ResizableTagTextArea.d.ts +1 -1
- package/dist/Common/CustomTagSelector/TagLabelValueSelector.d.ts +1 -1
- package/dist/Common/CustomTagSelector/Types.d.ts +11 -3
- package/dist/Common/CustomTagSelector/ValidationRules.d.ts +1 -1
- package/dist/Common/DeleteComponentModal/DeleteComponent.d.ts +4 -0
- package/dist/Common/DeleteComponentModal/types.d.ts +15 -0
- package/dist/Common/Dialogs/ConfirmationDialog.d.ts +5 -16
- package/dist/Common/Dialogs/DialogForm.d.ts +1 -9
- package/dist/Common/Dialogs/Types.d.ts +27 -0
- package/dist/Common/EmptyState/EmptyState.d.ts +2 -1
- package/dist/Common/EmptyState/GenericEmptyState.d.ts +5 -0
- package/dist/Common/Error.d.ts +2 -2
- package/dist/Common/Helper.d.ts +31 -1
- package/dist/Common/InfoColorBar/InfoColourbar.d.ts +2 -15
- package/dist/Common/Modals/Modal.d.ts +2 -9
- package/dist/Common/MultiSelectCustomization.d.ts +1 -2
- package/dist/Common/PopupMenu.d.ts +4 -21
- package/dist/Common/Progressing.d.ts +4 -13
- package/dist/Common/RadioGroup/RadioGroup.d.ts +17 -0
- package/dist/Common/RadioGroup.d.ts +1 -10
- package/dist/Common/Reload.d.ts +2 -4
- package/dist/Common/Security/ScanVulnerabilitiesTable.d.ts +4 -0
- package/dist/Common/TippyCustomized.d.ts +2 -30
- package/dist/Common/Toggle/Toggle.d.ts +12 -0
- package/dist/Common/Types.d.ts +266 -0
- package/dist/Common/index.d.ts +6 -1
- package/dist/index.js +2388 -1943
- package/package.json +2 -2
- package/rollup.config.js +3 -3
- package/src/Assets/Icon/ic-info-filled.svg +7 -0
- package/src/Assets/Icon/ic-warning.svg +7 -0
- package/src/Assets/Img/app-not-deployed.png +0 -0
- package/src/Common/Api.ts +7 -1
- package/src/Common/BreadCrumb/BreadCrumb.tsx +1 -30
- package/src/Common/BreadCrumb/Types.ts +30 -0
- package/src/Common/Checkbox.tsx +3 -16
- package/src/Common/Constants.ts +15 -0
- package/src/Common/CustomTagSelector/ResizableTagTextArea.tsx +6 -4
- package/src/Common/CustomTagSelector/TagDetails.tsx +15 -2
- package/src/Common/CustomTagSelector/TagLabelSelect.tsx +7 -3
- package/src/Common/CustomTagSelector/TagLabelValueSelector.tsx +66 -26
- package/src/Common/CustomTagSelector/Types.ts +11 -3
- package/src/Common/CustomTagSelector/ValidationRules.ts +21 -18
- package/src/Common/DeleteComponentModal/DeleteComponent.tsx +95 -0
- package/src/Common/DeleteComponentModal/types.ts +15 -0
- package/src/Common/Dialogs/ConfirmationDialog.tsx +6 -4
- package/src/Common/Dialogs/DeleteDialog.tsx +2 -2
- package/src/Common/Dialogs/DialogForm.tsx +2 -11
- package/src/Common/Dialogs/Types.ts +28 -0
- package/src/Common/Drawer/Drawer.scss +12 -11
- package/src/Common/EmptyState/EmptyState.tsx +5 -5
- package/src/Common/EmptyState/GenericEmptyState.tsx +41 -0
- package/src/Common/EmptyState/emptyState.scss +4 -15
- package/src/Common/Error.tsx +13 -16
- package/src/Common/ErrorScreenNotFound.tsx +23 -30
- package/src/Common/Helper.tsx +258 -2
- package/src/Common/InfoColorBar/InfoColourbar.tsx +6 -18
- package/src/Common/Modals/Modal.tsx +7 -1
- package/src/Common/Modals/OpaqueModal.tsx +2 -2
- package/src/Common/Modals/VisibleModal.tsx +1 -1
- package/src/Common/Modals/VisibleModal2.tsx +1 -1
- package/src/Common/MultiSelectCustomization.tsx +3 -3
- package/src/Common/PopupMenu.tsx +23 -6
- package/src/Common/Progressing.tsx +8 -15
- package/src/Common/RadioGroup/RadioGroup.tsx +88 -0
- package/src/Common/RadioGroup/radioGroup.scss +46 -0
- package/src/Common/RadioGroup.tsx +3 -13
- package/src/Common/Reload.tsx +15 -10
- package/src/Common/Security/ScanVulnerabilitiesTable.tsx +55 -0
- package/src/Common/Security/scanVulnerabilities.css +67 -0
- package/src/Common/TippyCustomized.tsx +3 -31
- package/src/Common/Toggle/Toggle.scss +70 -0
- package/src/Common/Toggle/Toggle.tsx +38 -0
- package/src/Common/Types.ts +290 -0
- package/src/Common/index.ts +6 -1
- package/dist/27bfa7a87d0b7039.png +0 -0
- package/dist/b5d52f036bdcd3ed.png +0 -0
- package/src/Assets/Icon/ic-close.svg +0 -9
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { useHistory } from 'react-router-dom'
|
|
3
|
+
import { toast } from 'react-toastify'
|
|
4
|
+
import info from '../../Assets/Icon/ic-info-filled.svg'
|
|
5
|
+
import { ConfirmationDialog, DeleteDialog } from '../Dialogs'
|
|
6
|
+
import { ServerErrors } from '../ServerError'
|
|
7
|
+
import { DeleteComponentProps } from './types'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
function DeleteComponent({
|
|
11
|
+
setDeleting,
|
|
12
|
+
toggleConfirmation,
|
|
13
|
+
deleteComponent,
|
|
14
|
+
title,
|
|
15
|
+
component,
|
|
16
|
+
payload,
|
|
17
|
+
confirmationDialogDescription = '',
|
|
18
|
+
redirectTo = false,
|
|
19
|
+
url = '',
|
|
20
|
+
reload,
|
|
21
|
+
configuration = '',
|
|
22
|
+
closeCustomComponent,
|
|
23
|
+
}: DeleteComponentProps) {
|
|
24
|
+
const [showCannotDeleteDialogModal, setCannotDeleteDialogModal] = useState(false)
|
|
25
|
+
const { push } = useHistory()
|
|
26
|
+
|
|
27
|
+
async function handleDelete() {
|
|
28
|
+
setDeleting(true)
|
|
29
|
+
try {
|
|
30
|
+
await deleteComponent(payload)
|
|
31
|
+
toast.success('Successfully deleted')
|
|
32
|
+
toggleConfirmation(false)
|
|
33
|
+
if (redirectTo) {
|
|
34
|
+
push(url)
|
|
35
|
+
} else {
|
|
36
|
+
reload()
|
|
37
|
+
}
|
|
38
|
+
if (typeof closeCustomComponent === 'function') {
|
|
39
|
+
closeCustomComponent()
|
|
40
|
+
}
|
|
41
|
+
} catch (serverError) {
|
|
42
|
+
if (serverError instanceof ServerErrors && serverError.code === 500) {
|
|
43
|
+
setCannotDeleteDialogModal(true)
|
|
44
|
+
}
|
|
45
|
+
} finally {
|
|
46
|
+
setDeleting(false)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const handleConfirmation = () => {
|
|
51
|
+
setCannotDeleteDialogModal(false)
|
|
52
|
+
toggleConfirmation(false)
|
|
53
|
+
if (typeof closeCustomComponent === 'function') {
|
|
54
|
+
closeCustomComponent()
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const renderCannotDeleteDialogModal = () => {
|
|
59
|
+
return (
|
|
60
|
+
<ConfirmationDialog className="confirmation-dialog__body--w-360">
|
|
61
|
+
<ConfirmationDialog.Icon src={info} />
|
|
62
|
+
<ConfirmationDialog.Body title={`Cannot delete ${component} '${title}'`} />
|
|
63
|
+
<p className="fs-13 cn-7 ">{confirmationDialogDescription}</p>
|
|
64
|
+
<ConfirmationDialog.ButtonGroup>
|
|
65
|
+
<button type="button" className="cta" onClick={handleConfirmation}>
|
|
66
|
+
Okay
|
|
67
|
+
</button>
|
|
68
|
+
</ConfirmationDialog.ButtonGroup>
|
|
69
|
+
</ConfirmationDialog>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const renderDeleteDialog = () => {
|
|
74
|
+
return (
|
|
75
|
+
<DeleteDialog
|
|
76
|
+
title={`Delete ${component} '${title}'`}
|
|
77
|
+
delete={handleDelete}
|
|
78
|
+
closeDelete={() => toggleConfirmation(false)}
|
|
79
|
+
dataTestId="delete-dialog"
|
|
80
|
+
>
|
|
81
|
+
<DeleteDialog.Description>
|
|
82
|
+
<p>Are you sure you want to delete this {configuration ? configuration : component}? </p>
|
|
83
|
+
</DeleteDialog.Description>
|
|
84
|
+
</DeleteDialog>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
return (
|
|
88
|
+
<div>
|
|
89
|
+
{!showCannotDeleteDialogModal && renderDeleteDialog()}
|
|
90
|
+
{showCannotDeleteDialogModal && renderCannotDeleteDialogModal()}
|
|
91
|
+
</div>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default DeleteComponent
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface DeleteComponentProps {
|
|
2
|
+
setDeleting: (boolean) => void
|
|
3
|
+
toggleConfirmation: any
|
|
4
|
+
deleteComponent: (any) => Promise<any>
|
|
5
|
+
title: string
|
|
6
|
+
component: string
|
|
7
|
+
payload: any
|
|
8
|
+
confirmationDialogDescription?: string
|
|
9
|
+
redirectTo?: boolean
|
|
10
|
+
url?: string
|
|
11
|
+
reload?: () => void
|
|
12
|
+
configuration?: string
|
|
13
|
+
dataTestid?: string
|
|
14
|
+
closeCustomComponent?: () => void
|
|
15
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { VisibleModal2 } from '../Modals/VisibleModal2'
|
|
3
|
-
|
|
3
|
+
import { ConfirmationDialogBodyType, ConfirmationDialogButtonGroupType, ConfirmationDialogIconType, ConfirmationDialogType } from './Types'
|
|
4
|
+
|
|
5
|
+
function ConfirmationDialog({ className = '', children }: ConfirmationDialogType) {
|
|
4
6
|
return (
|
|
5
7
|
<VisibleModal2 className="confirmation-dialog">
|
|
6
8
|
<div className={`confirmation-dialog__body ${className}`}>{children}</div>
|
|
@@ -8,11 +10,11 @@ function ConfirmationDialog({ className = '', children }) {
|
|
|
8
10
|
)
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
function Icon({ src, className = '' }) {
|
|
13
|
+
function Icon({ src, className = '' }: ConfirmationDialogIconType) {
|
|
12
14
|
return <img src={src} className={`confirmation-dialog__icon ${className}`} alt="" />
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
function Body({ title, subtitle = null, children = null }) {
|
|
17
|
+
function Body({ title, subtitle = null, children = null }: ConfirmationDialogBodyType) {
|
|
16
18
|
return (
|
|
17
19
|
<div className="flex left column ">
|
|
18
20
|
<h3 className="confirmation-dialog__title lh-1-25 dc__break-word w-100">{title}</h3>
|
|
@@ -22,7 +24,7 @@ function Body({ title, subtitle = null, children = null }) {
|
|
|
22
24
|
)
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
function ButtonGroup({ children }) {
|
|
27
|
+
function ButtonGroup({ children }: ConfirmationDialogButtonGroupType) {
|
|
26
28
|
return <div className="flex right confirmation-dialog__button-group">{children}</div>
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -16,8 +16,8 @@ export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.F
|
|
|
16
16
|
</ConfirmationDialog.Body>
|
|
17
17
|
<ConfirmationDialog.ButtonGroup>
|
|
18
18
|
<div className="flex right">
|
|
19
|
-
<button type="button" className="cta cancel cta-cd-delete-modal ml-16" onClick={props.closeDelete} disabled={props.apiCallInProgress}>Cancel</button>
|
|
20
|
-
<button type="button" className="cta delete cta-cd-delete-modal ml-16" onClick={() => props.delete()} disabled={props.apiCallInProgress}>
|
|
19
|
+
<button type="button" className="cta cancel cta-cd-delete-modal ml-16" onClick={props.closeDelete} disabled={props.apiCallInProgress} data-testid="dialog-cancel">Cancel</button>
|
|
20
|
+
<button type="button" className="cta delete cta-cd-delete-modal ml-16" onClick={() => props.delete()} disabled={props.apiCallInProgress} data-testid="dialog-delete">
|
|
21
21
|
{props.apiCallInProgress ? <Progressing /> : `${props.deletePrefix || ''}Delete${props.deletePostfix || ''}`}
|
|
22
22
|
</button>
|
|
23
23
|
</div>
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import React, { Component, createContext } from 'react';
|
|
2
2
|
import { VisibleModal } from '../Modals/VisibleModal';
|
|
3
|
-
import close from '../../Assets/Icon/ic-
|
|
3
|
+
import close from '../../Assets/Icon/ic-cross.svg';
|
|
4
4
|
import { Progressing } from '../Progressing'
|
|
5
|
+
import { DialogFormProps } from './Types';
|
|
5
6
|
//TODO: may not need context
|
|
6
7
|
const DialogFormContext = createContext({ title: '', isLoading: false, close: (event) => {}, onSave: (event) => {} });
|
|
7
8
|
|
|
8
|
-
export interface DialogFormProps {
|
|
9
|
-
className: string;
|
|
10
|
-
title: string;
|
|
11
|
-
isLoading: boolean;
|
|
12
|
-
closeOnESC?: boolean;
|
|
13
|
-
close: (event) => void;
|
|
14
|
-
onSave: (event) => void;
|
|
15
|
-
headerClassName?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
9
|
export class DialogForm extends Component<DialogFormProps> {
|
|
19
10
|
constructor(props) {
|
|
20
11
|
super(props);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ReactNode } from "react"
|
|
2
|
+
|
|
1
3
|
export interface DeleteDialogProps {
|
|
2
4
|
title: string
|
|
3
5
|
description?: string
|
|
@@ -6,6 +8,7 @@ export interface DeleteDialogProps {
|
|
|
6
8
|
deletePrefix?: string
|
|
7
9
|
deletePostfix?: string
|
|
8
10
|
apiCallInProgress?: boolean
|
|
11
|
+
dataTestId?: string
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
export interface ForceDeleteDialogType {
|
|
@@ -14,3 +17,28 @@ export interface ForceDeleteDialogType {
|
|
|
14
17
|
forceDeleteDialogTitle: string
|
|
15
18
|
forceDeleteDialogMessage: string
|
|
16
19
|
}
|
|
20
|
+
export interface ConfirmationDialogType {
|
|
21
|
+
className?: string
|
|
22
|
+
children: any
|
|
23
|
+
}
|
|
24
|
+
export interface ConfirmationDialogIconType {
|
|
25
|
+
src: string
|
|
26
|
+
className?: string
|
|
27
|
+
}
|
|
28
|
+
export interface ConfirmationDialogBodyType {
|
|
29
|
+
title: string
|
|
30
|
+
subtitle?: ReactNode
|
|
31
|
+
children?: any
|
|
32
|
+
}
|
|
33
|
+
export interface ConfirmationDialogButtonGroupType {
|
|
34
|
+
children: any
|
|
35
|
+
}
|
|
36
|
+
export interface DialogFormProps {
|
|
37
|
+
className: string;
|
|
38
|
+
title: string;
|
|
39
|
+
isLoading: boolean;
|
|
40
|
+
closeOnESC?: boolean;
|
|
41
|
+
close: (event) => void;
|
|
42
|
+
onSave: (event) => void;
|
|
43
|
+
headerClassName?: string;
|
|
44
|
+
}
|
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
.drawer{
|
|
1
|
+
.drawer {
|
|
2
2
|
position: absolute;
|
|
3
3
|
overflow: hidden;
|
|
4
|
-
&.left,
|
|
4
|
+
&.left,
|
|
5
|
+
&.right {
|
|
5
6
|
top: 0;
|
|
6
7
|
bottom: 0;
|
|
7
8
|
width: 0;
|
|
8
9
|
transition: width 200ms;
|
|
9
|
-
&.show{
|
|
10
|
+
&.show {
|
|
10
11
|
min-width: var(--minWidth);
|
|
11
12
|
width: var(--width);
|
|
12
13
|
max-width: var(--maxWidth);
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
&.top,
|
|
17
|
+
&.top,
|
|
18
|
+
&.bottom {
|
|
17
19
|
left: 0;
|
|
18
20
|
right: 0;
|
|
19
21
|
height: 0;
|
|
20
22
|
transition: height 200ms;
|
|
21
|
-
&.show{
|
|
23
|
+
&.show {
|
|
22
24
|
height: var(--height);
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
|
-
&.right{
|
|
27
|
+
&.right {
|
|
26
28
|
right: 0;
|
|
27
29
|
}
|
|
28
|
-
&.left{
|
|
30
|
+
&.left {
|
|
29
31
|
left: 0;
|
|
30
|
-
|
|
31
32
|
}
|
|
32
|
-
&.top{
|
|
33
|
+
&.top {
|
|
33
34
|
top: 0;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
&.bottom{
|
|
37
|
+
&.bottom {
|
|
37
38
|
bottom: 0;
|
|
38
39
|
}
|
|
39
|
-
}
|
|
40
|
+
}
|
|
@@ -2,9 +2,9 @@ import React from 'react'
|
|
|
2
2
|
import './emptyState.scss';
|
|
3
3
|
import { ReactComponent as Progressing } from '../../Assets/Icon/ic-progressing.svg';
|
|
4
4
|
|
|
5
|
-
function EmptyState({ children }) {
|
|
5
|
+
function EmptyState({ children, className = '' }) {
|
|
6
6
|
return (
|
|
7
|
-
<div className=
|
|
7
|
+
<div className={`flex column empty-state w-100 h-100 ${className}`}>
|
|
8
8
|
{children}
|
|
9
9
|
</div>
|
|
10
10
|
)
|
|
@@ -18,8 +18,8 @@ function Title({ children }) {
|
|
|
18
18
|
return children
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
function Subtitle({ children, className }:{children: any
|
|
22
|
-
return <p className={`subtitle ${className}`}>{children}</p>
|
|
21
|
+
function Subtitle({ children, className }: { children: any; className?: string }) {
|
|
22
|
+
return <p className={`subtitle ${className || ''}`}>{children}</p>
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function Button({ children }) {
|
|
@@ -39,4 +39,4 @@ EmptyState.Subtitle = Subtitle
|
|
|
39
39
|
EmptyState.Button = Button
|
|
40
40
|
EmptyState.Loading = Loading
|
|
41
41
|
|
|
42
|
-
export default EmptyState
|
|
42
|
+
export default EmptyState
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import AppNotDeployed from '../../Assets/Img/app-not-deployed.png'
|
|
3
|
+
import { GenericEmptyStateType, ImageType } from '../Types'
|
|
4
|
+
import './emptyState.scss'
|
|
5
|
+
|
|
6
|
+
function GenericEmptyState({
|
|
7
|
+
title,
|
|
8
|
+
image,
|
|
9
|
+
subTitle,
|
|
10
|
+
isButtonAvailable,
|
|
11
|
+
classname,
|
|
12
|
+
styles,
|
|
13
|
+
heightToDeduct,
|
|
14
|
+
imageType,
|
|
15
|
+
renderButton,
|
|
16
|
+
imageClassName,
|
|
17
|
+
children,
|
|
18
|
+
noImage
|
|
19
|
+
}: GenericEmptyStateType): JSX.Element {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
className={`flex column empty-state dc__align-reload-center ${classname ? classname : ''}`}
|
|
23
|
+
style={styles}
|
|
24
|
+
data-testid="generic-empty-state"
|
|
25
|
+
{...(heightToDeduct >= 0 && { style: { ...styles, height: `calc(100vh - ${heightToDeduct}px)` } })}
|
|
26
|
+
>
|
|
27
|
+
{!noImage && <img className={imageClassName ? imageClassName : ''}
|
|
28
|
+
src={image || AppNotDeployed}
|
|
29
|
+
width={imageType === ImageType.Medium ? '200' : '250'}
|
|
30
|
+
height={imageType === ImageType.Medium ? '160' : '200'}
|
|
31
|
+
alt="empty-state"
|
|
32
|
+
/>}
|
|
33
|
+
<h4 className="title fw-6 cn-9 mb-8 mt-20">{title}</h4>
|
|
34
|
+
{subTitle && <p className="subtitle">{subTitle}</p>}
|
|
35
|
+
{isButtonAvailable && renderButton()}
|
|
36
|
+
{children}
|
|
37
|
+
</div>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default GenericEmptyState
|
|
@@ -19,12 +19,9 @@
|
|
|
19
19
|
h6 {
|
|
20
20
|
color: var(--N900);
|
|
21
21
|
}
|
|
22
|
-
.title {
|
|
23
|
-
font-weight: 600;
|
|
24
|
-
}
|
|
25
22
|
.subtitle {
|
|
26
23
|
font-size: 13px;
|
|
27
|
-
width:
|
|
24
|
+
width: 300px;
|
|
28
25
|
font-weight: 400;
|
|
29
26
|
text-align: center;
|
|
30
27
|
line-height: 1.5;
|
|
@@ -34,7 +31,7 @@
|
|
|
34
31
|
height: 36px;
|
|
35
32
|
}
|
|
36
33
|
p {
|
|
37
|
-
width:
|
|
34
|
+
width: 300px;
|
|
38
35
|
text-align: center;
|
|
39
36
|
font-size: 13px;
|
|
40
37
|
color: var(--N700);
|
|
@@ -68,16 +65,8 @@
|
|
|
68
65
|
color: var(--N900);
|
|
69
66
|
}
|
|
70
67
|
.button__icon {
|
|
71
|
-
width:16px;
|
|
72
|
-
height:16px;
|
|
68
|
+
width: 16px;
|
|
69
|
+
height: 16px;
|
|
73
70
|
margin-left: 8px;
|
|
74
71
|
}
|
|
75
|
-
//TODO: use name
|
|
76
|
-
// .subtitle a {
|
|
77
|
-
// color: inherit;
|
|
78
|
-
// }
|
|
79
|
-
// .subtitle a:focus,
|
|
80
|
-
// .subtitle a:hover {
|
|
81
|
-
// color: inherit;
|
|
82
|
-
// }
|
|
83
72
|
}
|
package/src/Common/Error.tsx
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React, { Component } from 'react'
|
|
2
2
|
import EmptyState from './EmptyState/EmptyState'
|
|
3
3
|
import notAuthorized from '../Assets/Img/ic-not-authorized.svg'
|
|
4
|
-
import Reload from './Reload'
|
|
5
4
|
import ErrorScreenNotFound from './ErrorScreenNotFound'
|
|
5
|
+
import { ERROR_EMPTY_SCREEN } from './Constants'
|
|
6
|
+
import GenericEmptyState from './EmptyState/GenericEmptyState'
|
|
7
|
+
import Reload from './Reload'
|
|
6
8
|
|
|
7
9
|
export class ErrorScreenManager extends Component<{
|
|
8
10
|
code?: number
|
|
@@ -19,7 +21,7 @@ export class ErrorScreenManager extends Component<{
|
|
|
19
21
|
return 'Unauthorized'
|
|
20
22
|
case 403:
|
|
21
23
|
return (
|
|
22
|
-
<ErrorScreenNotAuthorized subtitle={this.props.subtitle}
|
|
24
|
+
<ErrorScreenNotAuthorized subtitle={this.props.subtitle} />
|
|
23
25
|
)
|
|
24
26
|
case 404:
|
|
25
27
|
return <ErrorScreenNotFound />
|
|
@@ -43,22 +45,17 @@ export class ErrorScreenManager extends Component<{
|
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
export class ErrorScreenNotAuthorized extends Component<{
|
|
48
|
+
export class ErrorScreenNotAuthorized extends Component<{
|
|
49
|
+
subtitle?: React.ReactChild
|
|
50
|
+
title?: string
|
|
51
|
+
}> {
|
|
47
52
|
render() {
|
|
48
53
|
return (
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<h3 className="title">Not authorized</h3>
|
|
55
|
-
</EmptyState.Title>
|
|
56
|
-
<EmptyState.Subtitle className={this.props.subtitleClass}>
|
|
57
|
-
{this.props.subtitle
|
|
58
|
-
? this.props.subtitle
|
|
59
|
-
: "Looks like you don't have access to information on this page. Please contact your manager to request access."}
|
|
60
|
-
</EmptyState.Subtitle>
|
|
61
|
-
</EmptyState>
|
|
54
|
+
<GenericEmptyState
|
|
55
|
+
image={notAuthorized}
|
|
56
|
+
title={this.props.title ?? ERROR_EMPTY_SCREEN.NOT_AUTHORIZED}
|
|
57
|
+
subTitle={this.props.subtitle ?? ERROR_EMPTY_SCREEN.ONLY_FOR_SUPERADMIN}
|
|
58
|
+
/>
|
|
62
59
|
)
|
|
63
60
|
}
|
|
64
61
|
}
|
|
@@ -1,38 +1,31 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import notFound from '../Assets/Img/ic-empty-error@2x.png'
|
|
3
|
-
import { useHistory } from 'react-router'
|
|
4
|
-
import EmptyState from './EmptyState/EmptyState'
|
|
3
|
+
import { useHistory } from 'react-router-dom'
|
|
5
4
|
import { ERROR_EMPTY_SCREEN } from './Constants'
|
|
5
|
+
import GenericEmptyState from './EmptyState/GenericEmptyState'
|
|
6
6
|
|
|
7
7
|
function ErrorScreenNotFound() {
|
|
8
|
-
|
|
8
|
+
const {push} = useHistory()
|
|
9
|
+
const redirectToHome = () => {
|
|
10
|
+
push('/app/list')
|
|
11
|
+
}
|
|
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
|
+
}
|
|
9
19
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</EmptyState.Image>
|
|
20
|
-
<EmptyState.Title>
|
|
21
|
-
<h3 className="title">{ERROR_EMPTY_SCREEN.PAGE_NOT_FOUND}</h3>
|
|
22
|
-
</EmptyState.Title>
|
|
23
|
-
<EmptyState.Subtitle >
|
|
24
|
-
<p>{ERROR_EMPTY_SCREEN.PAGE_NOT_EXIST}</p>
|
|
25
|
-
</EmptyState.Subtitle>
|
|
26
|
-
<EmptyState.Button>
|
|
27
|
-
<button className="flex cta h-32"
|
|
28
|
-
onClick={redirectToHome}
|
|
29
|
-
>
|
|
30
|
-
{ERROR_EMPTY_SCREEN.TAKE_BACK_HOME}
|
|
31
|
-
</button>
|
|
32
|
-
</EmptyState.Button>
|
|
33
|
-
</EmptyState>
|
|
34
|
-
</div>
|
|
35
|
-
)
|
|
20
|
+
return (
|
|
21
|
+
<GenericEmptyState
|
|
22
|
+
image={notFound}
|
|
23
|
+
title={ERROR_EMPTY_SCREEN.PAGE_NOT_FOUND}
|
|
24
|
+
subTitle={ERROR_EMPTY_SCREEN.PAGE_NOT_EXIST}
|
|
25
|
+
isButtonAvailable={true}
|
|
26
|
+
renderButton={renderGenerateButton}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
36
29
|
}
|
|
37
30
|
|
|
38
|
-
export default ErrorScreenNotFound
|
|
31
|
+
export default ErrorScreenNotFound
|