@devtron-labs/devtron-fe-common-lib 0.0.9-beta-10 → 0.0.9-beta-11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.9-beta-10",
3
+ "version": "0.0.9-beta-11",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -33,7 +33,6 @@
33
33
  "@svgr/rollup": "6.5.1",
34
34
  "@rollup/plugin-url": "8.0.1",
35
35
  "@rollup/plugin-commonjs": "24.0.1",
36
- "moment": "^2.29.4",
37
36
  "typescript": "^4.9.4",
38
37
  "react-toastify": "^8.2.0",
39
38
  "@tippyjs/react": "^4.2.0",
@@ -57,10 +57,4 @@ export const TOKEN_COOKIE_NAME = 'argocd.token'
57
57
  export const TriggerTypeMap = {
58
58
  automatic: 'Auto',
59
59
  manual: 'Manual',
60
- }
61
-
62
- export const BuildStageVariable = {
63
- PreBuild: 'preBuildStage',
64
- Build: 'buildStage',
65
- PostBuild: 'postBuildStage',
66
60
  }
@@ -1,53 +1,35 @@
1
- import React from 'react'
2
- import warn from '../../Assets/Img/delete-medium.svg'
1
+ import React from 'react';
2
+ import warn from '../../Assets/Img/warning-medium.svg';
3
3
  import { Progressing } from '../Progressing'
4
- import ConfirmationDialog from './ConfirmationDialog'
5
- import { DeleteDialogProps } from './Types'
4
+ import ConfirmationDialog from './ConfirmationDialog';
5
+ import { DeleteDialogProps } from './Types';
6
6
 
7
7
  export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.FC<any> } = function (props) {
8
- return (
9
- <ConfirmationDialog className="confirmation-dialog__body--w-400">
10
- <ConfirmationDialog.Icon src={warn} />
11
- <ConfirmationDialog.Body title={props.title}>
12
- <div className="fs-13 cn-7 lh-1-54 w-100">
13
- {props.description ? props.description : null}
14
- {props.children}
15
- </div>
16
- </ConfirmationDialog.Body>
17
- <ConfirmationDialog.ButtonGroup>
18
- <div className="flex right">
19
- <button
20
- type="button"
21
- className="cta cancel cta-cd-delete-modal ml-16"
22
- onClick={props.closeDelete}
23
- disabled={props.apiCallInProgress}
24
- data-testid="dialog-cancel"
25
- >
26
- Cancel
27
- </button>
28
- <button
29
- type="button"
30
- className="cta delete cta-cd-delete-modal ml-16"
31
- onClick={() => props.delete()}
32
- disabled={props.apiCallInProgress}
33
- data-testid="dialog-delete"
34
- >
35
- {props.apiCallInProgress ? (
36
- <Progressing />
37
- ) : (
38
- `${props.deletePrefix || ''}${
39
- props.buttonPrimaryText ? props.buttonPrimaryText : 'Delete'
40
- }${props.deletePostfix || ''}`
41
- )}
42
- </button>
43
- </div>
44
- </ConfirmationDialog.ButtonGroup>
45
- </ConfirmationDialog>
46
- )
8
+
9
+ return <ConfirmationDialog className="confirmation-dialog__body--w-400">
10
+ <ConfirmationDialog.Icon src={warn} />
11
+ <ConfirmationDialog.Body title={props.title}>
12
+ <div className="fs-13 cn-7 lh-1-54 w-100">
13
+ {props.description ? props.description : null}
14
+ {props.children}
15
+ </div>
16
+ </ConfirmationDialog.Body>
17
+ <ConfirmationDialog.ButtonGroup>
18
+ <div className="flex right">
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
+ {props.apiCallInProgress ? <Progressing /> : `${props.deletePrefix || ''}Delete${props.deletePostfix || ''}`}
22
+ </button>
23
+ </div>
24
+ </ConfirmationDialog.ButtonGroup>
25
+ </ConfirmationDialog >
47
26
  }
48
27
 
49
28
  function DeleteDialogDescription(props) {
50
- return <>{props.children}</>
29
+
30
+ return <>
31
+ {props.children}
32
+ </>
51
33
  }
52
34
 
53
- DeleteDialog.Description = DeleteDialogDescription
35
+ DeleteDialog.Description = DeleteDialogDescription;
@@ -9,7 +9,6 @@ export interface DeleteDialogProps {
9
9
  deletePostfix?: string
10
10
  apiCallInProgress?: boolean
11
11
  dataTestId?: string
12
- buttonPrimaryText?: string
13
12
  }
14
13
 
15
14
  export interface ForceDeleteDialogType {
@@ -5,7 +5,6 @@ import * as Sentry from '@sentry/browser'
5
5
  import { toastAccessDenied } from './ToastBody'
6
6
  import { ERROR_EMPTY_SCREEN, TOKEN_COOKIE_NAME } from './Constants'
7
7
  import { ReactComponent as FormError } from '../Assets/Icon/ic-warning.svg'
8
- import moment from 'moment';
9
8
 
10
9
  toast.configure({
11
10
  autoClose: 3000,
@@ -332,17 +331,3 @@ export function CustomInput({
332
331
  </div>
333
332
  )
334
333
  }
335
-
336
- export function handleUTCTime(ts: string, isRelativeTime = false) {
337
- let timestamp = "";
338
- try {
339
- if (ts && ts.length) {
340
- let date = moment(ts);
341
- if (isRelativeTime) timestamp = date.fromNow();
342
- else timestamp = date.format("ddd DD MMM YYYY HH:mm:ss");
343
- }
344
- } catch (error) {
345
- console.error("Error Parsing Date:", ts);
346
- }
347
- return timestamp;
348
- }
@@ -1,17 +1,13 @@
1
- import React, { useRef, useState } from 'react'
1
+ import React, { useRef } 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'
5
- import { ReactComponent as Question } from '../Assets/Icon/ic-help-outline.svg'
6
4
  import 'tippy.js/animations/shift-toward-subtle.css'
7
5
  import { TippyCustomizedProps, TippyTheme } from './Types'
8
- import { not } from './Helper'
9
6
 
10
7
  // This component will handle some of the new tippy designs and interactions
11
8
  // So this can be updated to support further for new features or interactions
12
9
  export function TippyCustomized(props: TippyCustomizedProps) {
13
10
  const tippyRef = useRef(null)
14
- const [showHeadingInfo, setShowHeadingInfo] = useState(false)
15
11
  const isWhiteTheme = props.theme === TippyTheme.white
16
12
 
17
13
  const onTippyMount = (tippyInstance) => {
@@ -28,7 +24,6 @@ export function TippyCustomized(props: TippyCustomizedProps) {
28
24
  props.onClose()
29
25
  }
30
26
  }
31
- setShowHeadingInfo(false)
32
27
  }
33
28
 
34
29
  const closeOnEsc = (e) => {
@@ -37,10 +32,6 @@ export function TippyCustomized(props: TippyCustomizedProps) {
37
32
  }
38
33
  }
39
34
 
40
- const toggleHeadingInfo = (e) => {
41
- setShowHeadingInfo(not)
42
- }
43
-
44
35
  const getTippyContent = () => {
45
36
  const {
46
37
  Icon,
@@ -49,7 +40,6 @@ export function TippyCustomized(props: TippyCustomizedProps) {
49
40
  iconSize,
50
41
  onImageLoadError,
51
42
  heading,
52
- headingInfo,
53
43
  infoTextHeading,
54
44
  infoText,
55
45
  showCloseButton,
@@ -61,9 +51,7 @@ export function TippyCustomized(props: TippyCustomizedProps) {
61
51
  <>
62
52
  <div
63
53
  className={`dc__word-break dc__hyphens-auto flex left ${
64
- isWhiteTheme
65
- ? `p-12 cn-9 ${props.noHeadingBorder ? '' : 'dc__border-bottom-n1'}`
66
- : 'pt-20 pb-12 pr-20 pl-20 cn-0 top'
54
+ isWhiteTheme ? 'p-12 dc__border-bottom-n1 cn-9' : 'pt-20 pb-12 pr-20 pl-20 cn-0 top'
67
55
  }`}
68
56
  >
69
57
  {iconPath ? (
@@ -81,11 +69,6 @@ export function TippyCustomized(props: TippyCustomizedProps) {
81
69
  )
82
70
  )}
83
71
  {heading && <span className={`fs-14 fw-6 lh-20 ${showCloseButton ? 'mr-6' : ''}`}>{heading}</span>}
84
- {headingInfo && (
85
- <div className="icon-dim-20 cursor" onClick={toggleHeadingInfo}>
86
- <Question className="icon-dim-20" />
87
- </div>
88
- )}
89
72
  {showCloseButton && (
90
73
  <div className="icon-dim-16 ml-auto">
91
74
  <CloseIcon
@@ -95,18 +78,6 @@ export function TippyCustomized(props: TippyCustomizedProps) {
95
78
  </div>
96
79
  )}
97
80
  </div>
98
- {showHeadingInfo && (
99
- <div
100
- className={`flex left top bcv-1 fs-13 fw-4 lh-20 pt-8 pb-8 ${
101
- isWhiteTheme ? 'pl-12 pr-12' : 'pl-20 pr-20'
102
- }`}
103
- >
104
- <div className="icon-dim-20 mr-8">
105
- <QuestionFilled className="icon-dim-20 fcv-5" />
106
- </div>
107
- <div className="dc__word-break dc__hyphens-auto">{headingInfo}</div>
108
- </div>
109
- )}
110
81
  {infoTextHeading && (
111
82
  <div
112
83
  className={`dc__word-break dc__hyphens-auto fs-14 fw-6 lh-20 ${
@@ -52,8 +52,6 @@ export interface TippyCustomizedProps {
52
52
  theme: TippyTheme
53
53
  visible?: boolean
54
54
  heading?: ReactNode | string
55
- headingInfo?: ReactNode | string
56
- noHeadingBorder?: boolean
57
55
  infoTextHeading?: string
58
56
  placement: Placement
59
57
  className?: string
@@ -188,7 +186,7 @@ export enum DeploymentNodeType {
188
186
  PRECD = 'PRECD',
189
187
  CD = 'CD',
190
188
  POSTCD = 'POSTCD',
191
- APPROVAL = 'APPROVAL',
189
+ APPROVAL = 'APPROVAL'
192
190
  }
193
191
 
194
192
  export interface UserApprovalConfigType {
@@ -211,6 +209,33 @@ export interface UserApprovalMetadataType {
211
209
  requestedUserData: ApprovalUserDataType
212
210
  }
213
211
 
212
+
213
+ export interface CDMaterialType {
214
+ index: number
215
+ id: string
216
+ materialInfo: MaterialInfo[]
217
+ tab: CDModalTabType
218
+ scanEnabled: boolean
219
+ scanned: boolean
220
+ vulnerabilitiesLoading: boolean
221
+ lastExecution: string //timestamp
222
+ vulnerabilities: VulnerabilityType[]
223
+ vulnerable: boolean
224
+ deployedTime: string
225
+ deployedBy?: string
226
+ wfrId?: number
227
+ buildTime: string
228
+ image: string
229
+ isSelected: boolean
230
+ showSourceInfo: boolean
231
+ latest: boolean
232
+ runningOnParentCd?: boolean
233
+ userApprovalMetadata?: UserApprovalMetadataType
234
+ triggeredBy?: number
235
+ imageComment?: ImageComment
236
+ imageReleaseTags?: ReleaseTag[]
237
+ }
238
+
214
239
  export interface CommonNodeAttr {
215
240
  connectingCiPipelineId?: number
216
241
  parents: string | number[] | string[]
@@ -259,28 +284,25 @@ export interface CommonNodeAttr {
259
284
  approvalUsers?: string[]
260
285
  userApprovalConfig?: UserApprovalConfigType
261
286
  requestedUserId?: number
262
- showPluginWarning?: boolean
263
287
  helmPackageName?: string
264
288
  isVirtualEnvironment?: boolean
265
- isCITriggerBlocked?: boolean
266
- ciBlockState?: {
267
- action: any,
268
- metadataField: string
269
- }
289
+ appReleaseTagNames?: string[]
290
+ tagsEditable?: boolean
270
291
  }
271
292
 
293
+
272
294
  export interface VulnerabilityType {
273
- name: string
274
- severity: 'CRITICAL' | 'MODERATE' | 'LOW'
275
- package: string
276
- version: string
277
- fixedVersion: string
278
- policy: string
279
- url?: string
295
+ name: string;
296
+ severity: "CRITICAL" | "MODERATE" | "LOW";
297
+ package: string;
298
+ version: string;
299
+ fixedVersion: string;
300
+ policy: string;
301
+ url?: string;
280
302
  }
281
303
 
282
304
  export interface ScanVulnerabilitiesTableProps {
283
- vulnerabilities: VulnerabilityType[]
305
+ vulnerabilities: VulnerabilityType[];
284
306
  }
285
307
 
286
308
  export interface MaterialInfo {
@@ -296,33 +318,28 @@ export interface MaterialInfo {
296
318
  type?: string
297
319
  }
298
320
 
299
- export interface CDMaterialType {
300
- index: number
301
- id: string
302
- materialInfo: MaterialInfo[]
303
- tab: CDModalTabType
304
- scanEnabled: boolean
305
- scanned: boolean
306
- vulnerabilitiesLoading: boolean
307
- lastExecution: string //timestamp
308
- vulnerabilities: VulnerabilityType[]
309
- vulnerable: boolean
310
- deployedTime: string
311
- deployedBy?: string
312
- wfrId?: number
313
- buildTime: string
314
- image: string
315
- isSelected: boolean
316
- showSourceInfo: boolean
317
- latest: boolean
318
- runningOnParentCd?: boolean
319
- userApprovalMetadata?: UserApprovalMetadataType
320
- triggeredBy?: number
321
- }
322
-
323
321
  export interface CDMaterialResponseType {
324
322
  approvalUsers: string[]
325
323
  materials: any[]
326
324
  userApprovalConfig: UserApprovalConfigType
327
325
  requestedUserId: number
328
- }
326
+ tagsEditable: boolean
327
+ appReleaseTagNames: string[]
328
+ }
329
+
330
+ export interface ReleaseTag {
331
+ id: number
332
+ tagName: string
333
+ appId: number
334
+ deleted: boolean
335
+ artifactId: number
336
+ }
337
+
338
+ export interface ImageComment {
339
+ id: number
340
+ comment: string
341
+ artifactId: number
342
+ }
343
+
344
+
345
+
@@ -29,6 +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 * from './CIPipeline.Types'
33
- export * from './Policy.Types'
34
32
  export { default as DeleteComponent } from './DeleteComponentModal/DeleteComponent'
@@ -1,265 +0,0 @@
1
- export interface MaterialType {
2
- name: string;
3
- type: string;
4
- value: string;
5
- gitMaterialId: number;
6
- id: number;
7
- isSelected: boolean;
8
- gitHostId: number;
9
- gitProviderId: number;
10
- regex?: string;
11
- isRegex: boolean;
12
- }
13
- export interface Githost {
14
- id: number;
15
- name: string;
16
- active: boolean;
17
- webhookSecret: string;
18
- webhookUrl: string;
19
- }
20
- export interface WebhookEvent {
21
- id: number;
22
- gitHostId: number;
23
- name: string;
24
- isActive: boolean;
25
- selectors: WebhookEventSelectors[];
26
- }
27
- interface WebhookEventSelectors {
28
- id: number;
29
- eventId: number;
30
- name: string;
31
- selector: string;
32
- toShowInCiFilter: boolean;
33
- fixValue: string;
34
- toShow: boolean;
35
- possibleValues: string;
36
- isActive: boolean;
37
- }
38
- export interface CiPipelineSourceTypeOption {
39
- label: string;
40
- value: string;
41
- isDisabled: boolean;
42
- isSelected: boolean;
43
- isWebhook: boolean;
44
- }
45
- export declare enum RefVariableType {
46
- GLOBAL = "GLOBAL",
47
- FROM_PREVIOUS_STEP = "FROM_PREVIOUS_STEP",
48
- NEW = "NEW"
49
- }
50
- export declare enum PluginType {
51
- INLINE = "INLINE",
52
- PLUGIN_REF = "REF_PLUGIN"
53
- }
54
- export declare enum ScriptType {
55
- SHELL = "SHELL",
56
- DOCKERFILE = "DOCKERFILE",
57
- CONTAINERIMAGE = "CONTAINER_IMAGE"
58
- }
59
- export declare enum MountPath {
60
- TRUE = "Yes",
61
- FALSE = "No"
62
- }
63
- export declare enum ConditionType {
64
- SKIP = "SKIP",
65
- TRIGGER = "TRIGGER",
66
- PASS = "PASS",
67
- FAIL = "FAIL"
68
- }
69
- export declare enum RefVariableStageType {
70
- PRE_CI = "PRE_CI",
71
- POST_CI = "POST_CI"
72
- }
73
- export interface VariableType {
74
- id: number;
75
- name: string;
76
- value: string;
77
- format: string;
78
- description: string;
79
- defaultValue: string;
80
- variableType: RefVariableType;
81
- refVariableStepIndex: number;
82
- refVariableName: string;
83
- refVariableStage?: RefVariableStageType;
84
- variableStepIndexInPlugin?: number;
85
- }
86
- interface CommandArgsMap {
87
- command: string;
88
- args: string[];
89
- }
90
- export interface PortMapType {
91
- portOnLocal: number;
92
- portOnContainer: number;
93
- }
94
- interface ConditionDetails {
95
- id: number;
96
- conditionOnVariable: string;
97
- conditionOperator: string;
98
- conditionType: ConditionType;
99
- conditionalValue: string;
100
- }
101
- interface InlineStepDetailType {
102
- scriptType: ScriptType;
103
- isMountCustomScript?: boolean;
104
- script?: string;
105
- dockerFileExists?: boolean;
106
- mountPath?: string;
107
- mountCodeToContainer?: boolean;
108
- mountDirectoryFromHost?: boolean;
109
- containerImagePath?: string;
110
- imagePullSecret?: string;
111
- commandArgsMap?: CommandArgsMap[];
112
- portMap?: PortMapType[];
113
- mountPathMap?: {
114
- filePathOnDisk: string;
115
- filePathOnContainer: string;
116
- }[];
117
- inputVariables?: VariableType[];
118
- outputVariables?: VariableType[];
119
- conditionDetails: ConditionDetails[];
120
- }
121
- interface PluginRefStepDetailType {
122
- id: number;
123
- pluginId: number;
124
- inputVariables?: VariableType[];
125
- outputVariables?: VariableType[];
126
- conditionDetails?: ConditionDetails[];
127
- }
128
- export interface StepType {
129
- id: number;
130
- index: number;
131
- name: string;
132
- description: string;
133
- stepType: PluginType;
134
- outputDirectoryPath: string[];
135
- inlineStepDetail?: InlineStepDetailType;
136
- pluginRefStepDetail?: PluginRefStepDetailType;
137
- triggerIfParentStageFail: boolean;
138
- isMandatory?: boolean;
139
- }
140
- export interface BuildStageType {
141
- id: number;
142
- steps: StepType[];
143
- }
144
- export declare enum CIBuildType {
145
- SELF_DOCKERFILE_BUILD_TYPE = "self-dockerfile-build",
146
- MANAGED_DOCKERFILE_BUILD_TYPE = "managed-dockerfile-build",
147
- BUILDPACK_BUILD_TYPE = "buildpack-build"
148
- }
149
- export interface BuildPackConfigType {
150
- builderId: string;
151
- language: string;
152
- languageVersion: string;
153
- projectPath: string;
154
- builderLangEnvParam?: string;
155
- currentBuilderLangEnvParam?: string;
156
- buildPacks?: any;
157
- args?: Record<string, string>;
158
- }
159
- export interface DockerBuildConfigType {
160
- dockerfileContent: string;
161
- dockerfileRelativePath: string;
162
- buildContext: string;
163
- dockerfilePath?: string;
164
- dockerfileRepository?: string;
165
- args?: Record<string, string>;
166
- targetPlatform?: any;
167
- language?: string;
168
- languageFramework?: string;
169
- }
170
- export interface CIBuildConfigType {
171
- buildPackConfig: BuildPackConfigType;
172
- ciBuildType: CIBuildType;
173
- dockerBuildConfig: DockerBuildConfigType;
174
- gitMaterialId: number;
175
- buildContextGitMaterialId: number;
176
- id?: number;
177
- useRootBuildContext: boolean;
178
- }
179
- export interface DockerConfigOverrideType {
180
- dockerRegistry: string;
181
- dockerRepository: string;
182
- ciBuildConfig: CIBuildConfigType;
183
- }
184
- export interface FormType {
185
- name: string;
186
- args: {
187
- key: string;
188
- value: string;
189
- }[];
190
- materials: MaterialType[];
191
- gitHost: Githost;
192
- webhookEvents: WebhookEvent[];
193
- ciPipelineSourceTypeOptions: CiPipelineSourceTypeOption[];
194
- webhookConditionList: {
195
- selectorId: number;
196
- value: string;
197
- }[];
198
- triggerType: string;
199
- scanEnabled?: boolean;
200
- beforeDockerBuildScripts?: {
201
- id: number;
202
- name: string;
203
- outputLocation: string;
204
- script: string;
205
- isCollapsed: boolean;
206
- index: number;
207
- }[];
208
- afterDockerBuildScripts?: {
209
- id: number;
210
- name: string;
211
- outputLocation: string;
212
- script: string;
213
- isCollapsed: boolean;
214
- index: number;
215
- }[];
216
- ciPipelineEditable: true;
217
- preBuildStage?: BuildStageType;
218
- postBuildStage?: BuildStageType;
219
- isDockerConfigOverridden?: boolean;
220
- dockerConfigOverride?: DockerConfigOverrideType;
221
- isOffendingMandatoryPlugin?: boolean;
222
- }
223
- export interface ErrorObj {
224
- isValid: boolean;
225
- message: string | null;
226
- }
227
- export interface TaskErrorObj {
228
- isValid: boolean;
229
- name: ErrorObj;
230
- inlineStepDetail?: {
231
- inputVariables?: ErrorObj[];
232
- outputVariables?: ErrorObj[];
233
- };
234
- pluginRefStepDetail?: {
235
- inputVariables?: ErrorObj[];
236
- outputVariables?: ErrorObj[];
237
- };
238
- }
239
- export interface FormErrorObjectType {
240
- name: ErrorObj;
241
- materials?: MaterialType[];
242
- preBuildStage?: {
243
- isValid: boolean;
244
- steps: TaskErrorObj[];
245
- };
246
- buildStage?: {
247
- isValid: boolean;
248
- name: ErrorObj;
249
- };
250
- postBuildStage?: {
251
- isValid: boolean;
252
- steps: TaskErrorObj[];
253
- };
254
- }
255
- export interface PluginDetailType {
256
- id: number;
257
- name: string;
258
- type: string;
259
- description: string;
260
- icon: string;
261
- tags: string[];
262
- inputVariables?: VariableType[];
263
- outputVariables?: VariableType[];
264
- }
265
- export {};