@devtron-labs/devtron-fe-common-lib 0.0.48-beta-9 → 0.0.48-beta-10
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/Constants.d.ts +1 -5
- package/dist/Common/CustomInput/CustomInput.d.ts +1 -1
- package/dist/Common/CustomInput/Types.d.ts +2 -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 +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 -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 +266 -351
- package/package.json +19 -2
- 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 -64
- package/src/Common/Constants.ts +9 -14
- package/src/Common/CustomInput/CustomInput.tsx +22 -29
- package/src/Common/CustomInput/Types.ts +4 -4
- 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 +7 -21
- 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 -24
- 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 -12
- package/src/custom.d.ts +7 -7
- package/src/index.ts +1 -1
|
@@ -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,
|
|
@@ -20,25 +19,12 @@ function GenericEmptyState({
|
|
|
20
19
|
noImage,
|
|
21
20
|
layout = 'column',
|
|
22
21
|
contentClassName = '',
|
|
23
|
-
}: GenericEmptyStateType): JSX.Element {
|
|
22
|
+
}: GenericEmptyStateType): JSX.Element => {
|
|
24
23
|
const isRowLayout = layout === 'row'
|
|
25
24
|
|
|
26
|
-
const getImageSize = () => {
|
|
27
|
-
switch (imageType) {
|
|
28
|
-
case ImageType.Medium:
|
|
29
|
-
return { width: '200', height: '160' }
|
|
30
|
-
case ImageType.Large:
|
|
31
|
-
return { width: '250', height: '200' }
|
|
32
|
-
default:
|
|
33
|
-
return { width: '200', height: '160' }
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
25
|
return (
|
|
38
26
|
<div
|
|
39
|
-
className={`flex ${isRowLayout ? 'dc__gap-32' : 'column dc__gap-20'} empty-state ${
|
|
40
|
-
classname ? classname : ''
|
|
41
|
-
}`}
|
|
27
|
+
className={`flex ${isRowLayout ? 'dc__gap-32' : 'column dc__gap-20'} empty-state ${classname || ''}`}
|
|
42
28
|
style={styles}
|
|
43
29
|
data-testid="generic-empty-state"
|
|
44
30
|
{...(heightToDeduct >= 0 && { style: { ...styles, height: `calc(100vh - ${heightToDeduct}px)` } })}
|
|
@@ -46,15 +32,15 @@ function GenericEmptyState({
|
|
|
46
32
|
{!SvgImage ? (
|
|
47
33
|
!noImage && (
|
|
48
34
|
<img
|
|
49
|
-
className={imageClassName
|
|
35
|
+
className={imageClassName || ''}
|
|
50
36
|
src={image || AppNotDeployed}
|
|
51
|
-
width={
|
|
52
|
-
height={
|
|
37
|
+
width={imageType === ImageType.Medium ? '200' : '250'}
|
|
38
|
+
height={imageType === ImageType.Medium ? '160' : '200'}
|
|
53
39
|
alt="empty-state"
|
|
54
40
|
/>
|
|
55
41
|
)
|
|
56
42
|
) : (
|
|
57
|
-
<SvgImage
|
|
43
|
+
<SvgImage />
|
|
58
44
|
)}
|
|
59
45
|
<div
|
|
60
46
|
className={`flex column dc__gap-10 dc__mxw-300 ${
|
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 = () => {
|
package/src/Common/Helper.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Sentry from '@sentry/browser'
|
|
2
2
|
import moment from 'moment'
|
|
3
|
-
import
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
4
|
+
import * as React from 'react'
|
|
4
5
|
import { useLocation } from 'react-router-dom'
|
|
5
6
|
import { toast } from 'react-toastify'
|
|
6
7
|
import { ERROR_EMPTY_SCREEN, TOKEN_COOKIE_NAME } from './Constants'
|
|
@@ -77,16 +78,19 @@ export const stopPropagation = (event): void => {
|
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
export function useThrottledEffect(callback, delay, deps = []) {
|
|
80
|
-
//function will be executed only once in a given time interval.
|
|
81
|
+
// function will be executed only once in a given time interval.
|
|
81
82
|
const lastRan = useRef(Date.now())
|
|
82
83
|
|
|
83
84
|
useEffect(() => {
|
|
84
|
-
const handler = setTimeout(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
const handler = setTimeout(
|
|
86
|
+
() => {
|
|
87
|
+
if (Date.now() - lastRan.current >= delay) {
|
|
88
|
+
callback()
|
|
89
|
+
lastRan.current = Date.now()
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
delay - (Date.now() - lastRan.current),
|
|
93
|
+
)
|
|
90
94
|
|
|
91
95
|
return () => {
|
|
92
96
|
clearTimeout(handler)
|
|
@@ -115,7 +119,7 @@ export function getRandomColor(email: string): string {
|
|
|
115
119
|
return colors[sum % colors.length]
|
|
116
120
|
}
|
|
117
121
|
|
|
118
|
-
export const getAlphabetIcon = (str: string, rootClassName: string =
|
|
122
|
+
export const getAlphabetIcon = (str: string, rootClassName: string = '') => {
|
|
119
123
|
if (!str) return null
|
|
120
124
|
return (
|
|
121
125
|
<span
|
|
@@ -127,9 +131,7 @@ export const getAlphabetIcon = (str: string, rootClassName: string = "") => {
|
|
|
127
131
|
)
|
|
128
132
|
}
|
|
129
133
|
|
|
130
|
-
export const getEmptyArrayOfLength = (length: number) => {
|
|
131
|
-
return Array.from({ length })
|
|
132
|
-
}
|
|
134
|
+
export const getEmptyArrayOfLength = (length: number) => Array.from({ length })
|
|
133
135
|
|
|
134
136
|
export function noop(...args): any {}
|
|
135
137
|
|
|
@@ -153,7 +155,7 @@ export function getCookie(sKey) {
|
|
|
153
155
|
}
|
|
154
156
|
return (
|
|
155
157
|
document.cookie.replace(
|
|
156
|
-
new RegExp(
|
|
158
|
+
new RegExp(`(?:(?:^|.*;)\\s*${sKey.replace(/[\-\.\+\*]/g, '\\$&')}\\s*\\=\\s*([^;]*).*$)|^.*$`),
|
|
157
159
|
'$1',
|
|
158
160
|
) || null
|
|
159
161
|
)
|
|
@@ -196,7 +198,7 @@ export function useForm(stateSchema, validationSchema = {}, callback) {
|
|
|
196
198
|
// in every re-render in component
|
|
197
199
|
const validateState = useCallback(
|
|
198
200
|
(state) => {
|
|
199
|
-
//check errors in all fields
|
|
201
|
+
// check errors in all fields
|
|
200
202
|
const hasErrorInState = Object.keys(validationSchema).some((key) => {
|
|
201
203
|
const isInputFieldRequired = validationSchema[key].required
|
|
202
204
|
const stateValue = state[key].value // state value
|
|
@@ -223,7 +225,7 @@ export function useForm(stateSchema, validationSchema = {}, callback) {
|
|
|
223
225
|
}
|
|
224
226
|
|
|
225
227
|
// single validator
|
|
226
|
-
|
|
228
|
+
const _validator = validationSchema[name].validator
|
|
227
229
|
if (_validator && typeof _validator === 'object') {
|
|
228
230
|
if (!_validateSingleValidator(_validator, value)) {
|
|
229
231
|
return _validator.error
|
|
@@ -231,9 +233,9 @@ export function useForm(stateSchema, validationSchema = {}, callback) {
|
|
|
231
233
|
}
|
|
232
234
|
|
|
233
235
|
// multiple validators
|
|
234
|
-
|
|
236
|
+
const _validators = validationSchema[name].validators
|
|
235
237
|
if (_validators && typeof _validators === 'object' && Array.isArray(_validators)) {
|
|
236
|
-
|
|
238
|
+
const errors = []
|
|
237
239
|
_validators.forEach((_validator) => {
|
|
238
240
|
if (!_validateSingleValidator(_validator, value)) {
|
|
239
241
|
errors.push(_validator.error)
|
|
@@ -252,7 +254,7 @@ export function useForm(stateSchema, validationSchema = {}, callback) {
|
|
|
252
254
|
setIsDirty(true)
|
|
253
255
|
|
|
254
256
|
const { name, value } = event.target
|
|
255
|
-
|
|
257
|
+
const error = validateField(name, value)
|
|
256
258
|
setState((prevState) => ({
|
|
257
259
|
...prevState,
|
|
258
260
|
[name]: { value, error },
|
|
@@ -280,7 +282,7 @@ export function handleUTCTime(ts: string, isRelativeTime = false) {
|
|
|
280
282
|
let timestamp = ''
|
|
281
283
|
try {
|
|
282
284
|
if (ts && ts.length) {
|
|
283
|
-
|
|
285
|
+
const date = moment(ts)
|
|
284
286
|
if (isRelativeTime) timestamp = date.fromNow()
|
|
285
287
|
else timestamp = date.format('ddd DD MMM YYYY HH:mm:ss')
|
|
286
288
|
}
|
|
@@ -364,9 +366,7 @@ export function useAsync<T>(
|
|
|
364
366
|
dependencies: dependencyArray,
|
|
365
367
|
})
|
|
366
368
|
const mounted = useRef(true)
|
|
367
|
-
const dependencies: any[] = useMemo(() =>
|
|
368
|
-
return [...dependencyArray, shouldRun]
|
|
369
|
-
}, [...dependencyArray, shouldRun])
|
|
369
|
+
const dependencies: any[] = useMemo(() => [...dependencyArray, shouldRun], [...dependencyArray, shouldRun])
|
|
370
370
|
|
|
371
371
|
const reload = () => {
|
|
372
372
|
async function call() {
|
|
@@ -432,9 +432,8 @@ export function useAsync<T>(
|
|
|
432
432
|
export const processDeployedTime = (lastDeployed, isArgoInstalled) => {
|
|
433
433
|
if (lastDeployed) {
|
|
434
434
|
return handleUTCTime(lastDeployed, true)
|
|
435
|
-
} else {
|
|
436
|
-
return isArgoInstalled ? '' : 'Not deployed'
|
|
437
435
|
}
|
|
436
|
+
return isArgoInstalled ? '' : 'Not deployed'
|
|
438
437
|
}
|
|
439
438
|
|
|
440
439
|
/**
|
|
@@ -13,13 +13,12 @@ export interface ImageComment {
|
|
|
13
13
|
artifactId: number
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
export interface ImageTaggingContainerType {
|
|
18
17
|
ciPipelineId?: number
|
|
19
18
|
artifactId?: number
|
|
20
19
|
imageComment?: ImageComment
|
|
21
20
|
imageReleaseTags?: ReleaseTag[]
|
|
22
|
-
updateCurrentAppMaterial
|
|
21
|
+
updateCurrentAppMaterial?: (matId: number, releaseTags?: ReleaseTag[], imageComment?: ImageComment) => void
|
|
23
22
|
appReleaseTagNames?: string[]
|
|
24
23
|
tagsEditable?: boolean
|
|
25
24
|
forceReInit?: boolean
|
|
@@ -41,4 +40,4 @@ export interface ImageButtonType {
|
|
|
41
40
|
isSuperAdmin: any
|
|
42
41
|
duplicateTag?: boolean
|
|
43
42
|
hideHardDelete?: boolean
|
|
44
|
-
}
|
|
43
|
+
}
|