@devtron-labs/devtron-fe-common-lib 0.0.7-beta-49 → 0.0.7-beta-51
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/CIPipeline.Types.d.ts +263 -0
- package/dist/Common/Constants.d.ts +5 -0
- package/dist/Common/Dialogs/Types.d.ts +1 -0
- package/dist/Common/Helper.d.ts +0 -22
- package/dist/Common/Types.d.ts +28 -2
- package/dist/Common/index.d.ts +1 -1
- package/dist/index.js +101 -212
- package/package.json +1 -1
- package/src/Assets/Icon/ic-help.svg +3 -0
- package/src/Common/CIPipeline.Types.ts +275 -0
- package/src/Common/Constants.ts +6 -0
- package/src/Common/Dialogs/DeleteDialog.tsx +45 -27
- package/src/Common/Dialogs/Types.ts +1 -0
- package/src/Common/Helper.tsx +36 -199
- package/src/Common/TippyCustomized.tsx +28 -2
- package/src/Common/Types.ts +30 -2
- package/src/Common/index.ts +1 -1
- package/dist/Common/DeleteComponentModal/DeleteComponent.d.ts +0 -4
- package/dist/Common/DeleteComponentModal/types.d.ts +0 -15
- package/src/Assets/Icon/ic-info-filled.svg +0 -7
- package/src/Assets/Icon/ic-warning.svg +0 -7
- package/src/Common/DeleteComponentModal/DeleteComponent.tsx +0 -95
- package/src/Common/DeleteComponentModal/types.ts +0 -15
- /package/src/Assets/Img/{warning-medium.svg → delete-medium.svg} +0 -0
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import React, { useRef } from 'react'
|
|
1
|
+
import React, { useRef, useState } from 'react'
|
|
2
2
|
import Tippy from '@tippyjs/react'
|
|
3
3
|
import { ReactComponent as CloseIcon } from '../Assets/Icon/ic-cross.svg'
|
|
4
|
+
import { ReactComponent as QuestionFilled } from '../Assets/Icon/ic-help.svg'
|
|
4
5
|
import 'tippy.js/animations/shift-toward-subtle.css'
|
|
5
6
|
import { TippyCustomizedProps, TippyTheme } from './Types'
|
|
7
|
+
import { not } from './Helper'
|
|
6
8
|
|
|
7
9
|
// This component will handle some of the new tippy designs and interactions
|
|
8
10
|
// So this can be updated to support further for new features or interactions
|
|
9
11
|
export function TippyCustomized(props: TippyCustomizedProps) {
|
|
10
12
|
const tippyRef = useRef(null)
|
|
13
|
+
const [showHeadingInfo, setShowHeadingInfo] = useState(false)
|
|
11
14
|
const isWhiteTheme = props.theme === TippyTheme.white
|
|
12
15
|
|
|
13
16
|
const onTippyMount = (tippyInstance) => {
|
|
@@ -24,6 +27,7 @@ export function TippyCustomized(props: TippyCustomizedProps) {
|
|
|
24
27
|
props.onClose()
|
|
25
28
|
}
|
|
26
29
|
}
|
|
30
|
+
setShowHeadingInfo(false)
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
const closeOnEsc = (e) => {
|
|
@@ -32,6 +36,10 @@ export function TippyCustomized(props: TippyCustomizedProps) {
|
|
|
32
36
|
}
|
|
33
37
|
}
|
|
34
38
|
|
|
39
|
+
const toggleHeadingInfo = (e) => {
|
|
40
|
+
setShowHeadingInfo(not)
|
|
41
|
+
}
|
|
42
|
+
|
|
35
43
|
const getTippyContent = () => {
|
|
36
44
|
const {
|
|
37
45
|
Icon,
|
|
@@ -40,6 +48,7 @@ export function TippyCustomized(props: TippyCustomizedProps) {
|
|
|
40
48
|
iconSize,
|
|
41
49
|
onImageLoadError,
|
|
42
50
|
heading,
|
|
51
|
+
headingInfo,
|
|
43
52
|
infoTextHeading,
|
|
44
53
|
infoText,
|
|
45
54
|
showCloseButton,
|
|
@@ -58,7 +67,7 @@ export function TippyCustomized(props: TippyCustomizedProps) {
|
|
|
58
67
|
<img
|
|
59
68
|
className={`icon-dim-${iconSize || 20} mr-6 ${iconClass || ''}`}
|
|
60
69
|
src={iconPath}
|
|
61
|
-
alt={
|
|
70
|
+
alt={heading}
|
|
62
71
|
onError={onImageLoadError}
|
|
63
72
|
/>
|
|
64
73
|
) : (
|
|
@@ -69,6 +78,11 @@ export function TippyCustomized(props: TippyCustomizedProps) {
|
|
|
69
78
|
)
|
|
70
79
|
)}
|
|
71
80
|
{heading && <span className={`fs-14 fw-6 lh-20 ${showCloseButton ? 'mr-6' : ''}`}>{heading}</span>}
|
|
81
|
+
{headingInfo && (
|
|
82
|
+
<div className="icon-dim-20 cursor" onClick={toggleHeadingInfo}>
|
|
83
|
+
<QuestionFilled className="icon-dim-20" />
|
|
84
|
+
</div>
|
|
85
|
+
)}
|
|
72
86
|
{showCloseButton && (
|
|
73
87
|
<div className="icon-dim-16 ml-auto">
|
|
74
88
|
<CloseIcon
|
|
@@ -78,6 +92,18 @@ export function TippyCustomized(props: TippyCustomizedProps) {
|
|
|
78
92
|
</div>
|
|
79
93
|
)}
|
|
80
94
|
</div>
|
|
95
|
+
{showHeadingInfo && (
|
|
96
|
+
<div
|
|
97
|
+
className={`flex left bcv-1 fs-13 fw-4 lh-20 pt-8 pb-8 ${
|
|
98
|
+
isWhiteTheme ? 'pl-12 pr-12' : 'pl-20 pr-20'
|
|
99
|
+
}`}
|
|
100
|
+
>
|
|
101
|
+
<div className="icon-dim-20 mr-8">
|
|
102
|
+
<QuestionFilled className="icon-dim-20 fcv-5" />
|
|
103
|
+
</div>
|
|
104
|
+
<div className="dc__word-break dc__hyphens-auto">{headingInfo}</div>
|
|
105
|
+
</div>
|
|
106
|
+
)}
|
|
81
107
|
{infoTextHeading && (
|
|
82
108
|
<div
|
|
83
109
|
className={`dc__word-break dc__hyphens-auto fs-14 fw-6 lh-20 ${
|
package/src/Common/Types.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode, CSSProperties } from 'react'
|
|
2
2
|
import { Placement } from 'tippy.js'
|
|
3
|
+
import { VariableType } from './CIPipeline.Types'
|
|
3
4
|
export interface ResponseType {
|
|
4
5
|
code: number
|
|
5
6
|
status: string
|
|
@@ -51,7 +52,8 @@ export interface CheckboxProps {
|
|
|
51
52
|
export interface TippyCustomizedProps {
|
|
52
53
|
theme: TippyTheme
|
|
53
54
|
visible?: boolean
|
|
54
|
-
heading?:
|
|
55
|
+
heading?: string
|
|
56
|
+
headingInfo?: string
|
|
55
57
|
infoTextHeading?: string
|
|
56
58
|
placement: Placement
|
|
57
59
|
className?: string
|
|
@@ -257,7 +259,7 @@ export interface CommonNodeAttr {
|
|
|
257
259
|
approvalUsers?: string[]
|
|
258
260
|
userApprovalConfig?: UserApprovalConfigType
|
|
259
261
|
requestedUserId?: number
|
|
260
|
-
|
|
262
|
+
showPluginWarning?: boolean
|
|
261
263
|
}
|
|
262
264
|
|
|
263
265
|
|
|
@@ -318,3 +320,29 @@ export interface CDMaterialResponseType {
|
|
|
318
320
|
userApprovalConfig: UserApprovalConfigType
|
|
319
321
|
requestedUserId: number
|
|
320
322
|
}
|
|
323
|
+
|
|
324
|
+
export enum PluginRequiredStageKeys {
|
|
325
|
+
PRE_CI = 'PRE_CI',
|
|
326
|
+
POST_CI = 'POST_CI',
|
|
327
|
+
PRE_OR_POST_CI = 'PRE_OR_POST_CI'
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export enum PluginRequiredStage {
|
|
331
|
+
PRE_CI = 'preBuildStage',
|
|
332
|
+
POST_CI = 'postBuildStage',
|
|
333
|
+
PRE_OR_POST_CI = 'PRE_OR_POST_CI'
|
|
334
|
+
}
|
|
335
|
+
export interface MandatoryPluginDetailType {
|
|
336
|
+
id: number
|
|
337
|
+
name: string
|
|
338
|
+
description?: string;
|
|
339
|
+
requiredIn: PluginRequiredStage
|
|
340
|
+
applied?: boolean
|
|
341
|
+
inputVariables?: VariableType[]
|
|
342
|
+
outputVariables?: VariableType[]
|
|
343
|
+
}
|
|
344
|
+
export interface MandatoryPluginDataType {
|
|
345
|
+
pluginData: MandatoryPluginDetailType[]
|
|
346
|
+
isValidPre: boolean
|
|
347
|
+
isValidPost: boolean
|
|
348
|
+
}
|
package/src/Common/index.ts
CHANGED
|
@@ -29,4 +29,4 @@ export { default as GenericEmptyState } from './EmptyState/GenericEmptyState'
|
|
|
29
29
|
export { default as Toggle } from './Toggle/Toggle'
|
|
30
30
|
export { default as ScanVulnerabilitiesTable } from './Security/ScanVulnerabilitiesTable'
|
|
31
31
|
export { default as StyledRadioGroup } from './RadioGroup/RadioGroup'
|
|
32
|
-
export
|
|
32
|
+
export * from './CIPipeline.Types'
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { DeleteComponentProps } from './types';
|
|
3
|
-
declare function DeleteComponent({ setDeleting, toggleConfirmation, deleteComponent, title, component, payload, confirmationDialogDescription, redirectTo, url, reload, configuration, closeCustomComponent, }: DeleteComponentProps): JSX.Element;
|
|
4
|
-
export default DeleteComponent;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface DeleteComponentProps {
|
|
2
|
-
setDeleting: (boolean: any) => void;
|
|
3
|
-
toggleConfirmation: any;
|
|
4
|
-
deleteComponent: (any: 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,7 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 32 32">
|
|
2
|
-
<g fill="none" fill-rule="evenodd">
|
|
3
|
-
<path d="M0 0h32v32H0z"/>
|
|
4
|
-
<path fill="#06C" d="M16 2.667C8.64 2.667 2.667 8.64 2.667 16S8.64 29.333 16 29.333 29.333 23.36 29.333 16 23.36 2.667 16 2.667z"/>
|
|
5
|
-
<path fill="#FFF" d="M16 14.667c.736 0 1.333.597 1.333 1.333v5.333a1.333 1.333 0 1 1-2.666 0V16c0-.736.597-1.333 1.333-1.333zm0-5.334A1.333 1.333 0 1 1 16 12a1.333 1.333 0 0 1 0-2.667z"/>
|
|
6
|
-
</g>
|
|
7
|
-
</svg>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
2
|
-
<g fill="none" fill-rule="evenodd">
|
|
3
|
-
<path d="M0 0h32v32H0z"/>
|
|
4
|
-
<path fill="#FFCB5D" d="M18.315 5.052L29.72 25.01A2.667 2.667 0 0 1 27.405 29H4.595a2.667 2.667 0 0 1-2.315-3.99L13.685 5.052a2.667 2.667 0 0 1 4.63 0z"/>
|
|
5
|
-
<path fill="#FFF" d="M16 22.667a1.333 1.333 0 1 1 0 2.666 1.333 1.333 0 0 1 0-2.666zM16 12c.736 0 1.333.597 1.333 1.333v6.334a1.333 1.333 0 1 1-2.666 0v-6.334c0-.736.597-1.333 1.333-1.333z"/>
|
|
6
|
-
</g>
|
|
7
|
-
</svg>
|
|
@@ -1,95 +0,0 @@
|
|
|
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
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
}
|
|
File without changes
|