@devtron-labs/devtron-fe-common-lib 0.0.48-beta-4 → 0.0.48-beta-6

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.
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { AddCDButtonProps } from './types';
3
+ export default function AddCDButton({ position, addCDButtons, endNode, startNode, handleAddCD, tooltipContent, }: Readonly<AddCDButtonProps>): JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { default as AddCDButton } from './AddCDButton';
2
+ export { handleAddCD } from './utils';
@@ -0,0 +1,26 @@
1
+ import { AddCDPositions, AddPipelineType, EdgeEndNodeType, EdgeNodeType, Point } from '../Types';
2
+ export interface AddCDButtonProps {
3
+ position: AddCDPositions;
4
+ addCDButtons: AddCDPositions[];
5
+ endNode: Point & EdgeEndNodeType;
6
+ startNode: Point & EdgeNodeType;
7
+ handleAddCD: (position: AddCDPositions) => void;
8
+ tooltipContent?: string;
9
+ }
10
+ export interface HandleAddCD {
11
+ position: AddCDPositions;
12
+ handleCDSelect: (workflowId: number | string, ciPipelineId: number | string, parentPipelineType: string, parentPipelineId: number | string, isWebhookCD?: boolean, childPipelineId?: number | string, addType?: AddPipelineType) => void;
13
+ startNode: EdgeNodeType;
14
+ endNode: EdgeEndNodeType;
15
+ workflowId: number | string;
16
+ ciPipelineId: number | string;
17
+ isWebhookCD: boolean;
18
+ isParallelEdge: boolean;
19
+ }
20
+ export interface GetPipelineType {
21
+ isWebhookCD: boolean;
22
+ startNode: EdgeNodeType;
23
+ }
24
+ export interface TooltipContentProps {
25
+ tooltipContent?: string;
26
+ }
@@ -0,0 +1,2 @@
1
+ import { HandleAddCD } from './types';
2
+ export declare const handleAddCD: ({ position, handleCDSelect, startNode, endNode, workflowId, ciPipelineId, isWebhookCD, isParallelEdge, }: HandleAddCD) => void;
@@ -10,6 +10,7 @@ export interface DeleteDialogProps {
10
10
  dataTestId?: string;
11
11
  buttonPrimaryText?: string;
12
12
  shouldStopPropagation?: boolean;
13
+ disabled?: boolean;
13
14
  }
14
15
  export interface ForceDeleteDialogType {
15
16
  onClickDelete: () => void;
@@ -261,6 +261,10 @@ export interface CDMaterialServiceQueryParams {
261
261
  resource?: CDMaterialResourceQuery;
262
262
  filter?: CDMaterialFilterQuery;
263
263
  }
264
+ export interface DownstreamNodesEnvironmentsType {
265
+ environmentId: number;
266
+ environmentName: string;
267
+ }
264
268
  export interface CommonNodeAttr {
265
269
  connectingCiPipelineId?: number;
266
270
  parents: string | number[] | string[];
@@ -322,6 +326,9 @@ export interface CommonNodeAttr {
322
326
  };
323
327
  appReleaseTagNames?: string[];
324
328
  tagsEditable?: boolean;
329
+ deploymentAppCreated?: boolean;
330
+ isLast?: boolean;
331
+ downstreamEnvironments?: DownstreamNodesEnvironmentsType[];
325
332
  }
326
333
  export declare enum DeploymentAppTypes {
327
334
  HELM = "helm",
@@ -563,15 +570,6 @@ export interface CiPipeline {
563
570
  isOffendingMandatoryPlugin?: boolean;
564
571
  pipelineType?: string;
565
572
  }
566
- export interface DeploymentChartVersionType {
567
- chartRefId: number;
568
- chartVersion: string;
569
- chartType: string;
570
- type: number;
571
- }
572
- export interface ChartVersionAndTypeSelectorProps {
573
- setSelectedChartRefId: React.Dispatch<React.SetStateAction<number>>;
574
- }
575
573
  export interface InformationBarProps {
576
574
  text: string;
577
575
  className?: string;
@@ -586,7 +584,7 @@ export interface CodeEditorInterface {
586
584
  onFocus?: () => void;
587
585
  children?: any;
588
586
  defaultValue?: string;
589
- mode?: 'json' | 'yaml' | 'shell' | 'dockerfile' | 'plaintext';
587
+ mode?: 'json' | 'yaml' | 'shell' | 'dockerfile';
590
588
  tabSize?: number;
591
589
  readOnly?: boolean;
592
590
  noParsing?: boolean;
@@ -627,4 +625,53 @@ export interface CodeEditorHeaderInterface {
627
625
  className?: string;
628
626
  hideDefaultSplitHeader?: boolean;
629
627
  }
628
+ export interface DeploymentChartVersionType {
629
+ chartRefId: number;
630
+ chartVersion: string;
631
+ chartType: string;
632
+ type: number;
633
+ }
634
+ export interface ChartVersionAndTypeSelectorProps {
635
+ setSelectedChartRefId: React.Dispatch<React.SetStateAction<number>>;
636
+ }
637
+ export declare enum PipelineType {
638
+ CI_PIPELINE = "CI_PIPELINE",
639
+ CD_PIPELINE = "CD_PIPELINE",
640
+ WEBHOOK = "WEBHOOK",
641
+ LINKED_CD = "LINKED_CD"
642
+ }
643
+ export declare enum WorkflowNodeType {
644
+ GIT = "GIT",
645
+ CI = "CI",
646
+ WEBHOOK = "WEBHOOK",
647
+ PRE_CD = "PRECD",
648
+ CD = "CD",
649
+ POST_CD = "POSTCD"
650
+ }
651
+ export declare enum AddCDPositions {
652
+ LEFT = "left",
653
+ RIGHT = "right"
654
+ }
655
+ export interface SelectedNode {
656
+ nodeType: WorkflowNodeType;
657
+ id: string;
658
+ }
659
+ export declare enum AddPipelineType {
660
+ SEQUENTIAL = "SEQUENTIAL",
661
+ PARALLEL = "PARALLEL"
662
+ }
663
+ export interface Point {
664
+ x: number;
665
+ y: number;
666
+ }
667
+ export interface EdgeNodeType {
668
+ height: number;
669
+ width: number;
670
+ userApprovalConfig?: UserApprovalConfigType;
671
+ type?: any;
672
+ id?: number | string;
673
+ }
674
+ export interface EdgeEndNodeType extends EdgeNodeType {
675
+ userApprovalConfig?: UserApprovalConfigType;
676
+ }
630
677
  export {};
@@ -43,4 +43,5 @@ export { AppStatus } from './AppStatus';
43
43
  export * from './RJSF';
44
44
  export * from './DevtronProgressing';
45
45
  export { default as ChartVersionAndTypeSelector } from './ChartVersionAndTypeSelector';
46
+ export * from './AddCDButton';
46
47
  export * from './CustomInput';
package/dist/index.js CHANGED
@@ -465,7 +465,33 @@ exports.FilterConditionType = void 0;
465
465
  (function (FilterConditionType) {
466
466
  FilterConditionType[FilterConditionType["PASS"] = 1] = "PASS";
467
467
  FilterConditionType[FilterConditionType["FAIL"] = 0] = "FAIL";
468
- })(exports.FilterConditionType || (exports.FilterConditionType = {}));
468
+ })(exports.FilterConditionType || (exports.FilterConditionType = {}));
469
+ exports.PipelineType = void 0;
470
+ (function (PipelineType) {
471
+ PipelineType["CI_PIPELINE"] = "CI_PIPELINE";
472
+ PipelineType["CD_PIPELINE"] = "CD_PIPELINE";
473
+ PipelineType["WEBHOOK"] = "WEBHOOK";
474
+ PipelineType["LINKED_CD"] = "LINKED_CD";
475
+ })(exports.PipelineType || (exports.PipelineType = {}));
476
+ exports.WorkflowNodeType = void 0;
477
+ (function (WorkflowNodeType) {
478
+ WorkflowNodeType["GIT"] = "GIT";
479
+ WorkflowNodeType["CI"] = "CI";
480
+ WorkflowNodeType["WEBHOOK"] = "WEBHOOK";
481
+ WorkflowNodeType["PRE_CD"] = "PRECD";
482
+ WorkflowNodeType["CD"] = "CD";
483
+ WorkflowNodeType["POST_CD"] = "POSTCD";
484
+ })(exports.WorkflowNodeType || (exports.WorkflowNodeType = {}));
485
+ exports.AddCDPositions = void 0;
486
+ (function (AddCDPositions) {
487
+ AddCDPositions["LEFT"] = "left";
488
+ AddCDPositions["RIGHT"] = "right";
489
+ })(exports.AddCDPositions || (exports.AddCDPositions = {}));
490
+ exports.AddPipelineType = void 0;
491
+ (function (AddPipelineType) {
492
+ AddPipelineType["SEQUENTIAL"] = "SEQUENTIAL";
493
+ AddPipelineType["PARALLEL"] = "PARALLEL";
494
+ })(exports.AddPipelineType || (exports.AddPipelineType = {}));
469
495
 
470
496
  var responseMessages = {
471
497
  100: 'Continue',
@@ -16673,7 +16699,7 @@ var DeleteDialog = function (props) {
16673
16699
  }
16674
16700
  props.closeDelete();
16675
16701
  };
16676
- return (jsxRuntime.jsxs(ConfirmationDialog, __assign({ className: "confirmation-dialog__body--w-400" }, { children: [jsxRuntime.jsx(ConfirmationDialog.Icon, { src: warn }), jsxRuntime.jsx(ConfirmationDialog.Body, __assign({ title: props.title }, { children: jsxRuntime.jsxs("div", __assign({ className: "fs-13 cn-7 lh-1-54 w-100" }, { children: [props.description ? props.description : null, props.children] })) })), jsxRuntime.jsx(ConfirmationDialog.ButtonGroup, { children: jsxRuntime.jsxs("div", __assign({ className: "flex right" }, { children: [jsxRuntime.jsx("button", __assign({ type: "button", className: "cta cancel cta-cd-delete-modal ml-16", onClick: handleModalClose, disabled: props.apiCallInProgress, "data-testid": "dialog-cancel" }, { children: "Cancel" })), jsxRuntime.jsx("button", __assign({ type: "button", className: "cta delete cta-cd-delete-modal ml-16", onClick: handleDelete, disabled: props.apiCallInProgress, "data-testid": "dialog-delete" }, { children: props.apiCallInProgress ? (jsxRuntime.jsx(Progressing, {})) : ("".concat(props.deletePrefix || '').concat(props.buttonPrimaryText ? props.buttonPrimaryText : 'Delete').concat(props.deletePostfix || '')) }))] })) })] })));
16702
+ return (jsxRuntime.jsxs(ConfirmationDialog, __assign({ className: "confirmation-dialog__body--w-400" }, { children: [jsxRuntime.jsx(ConfirmationDialog.Icon, { src: warn }), jsxRuntime.jsx(ConfirmationDialog.Body, __assign({ title: props.title }, { children: jsxRuntime.jsxs("div", __assign({ className: "fs-13 cn-7 lh-1-54 w-100" }, { children: [props.description ? props.description : null, props.children] })) })), jsxRuntime.jsx(ConfirmationDialog.ButtonGroup, { children: jsxRuntime.jsxs("div", __assign({ className: "flex right" }, { children: [jsxRuntime.jsx("button", __assign({ type: "button", className: "cta cancel cta-cd-delete-modal ml-16", onClick: handleModalClose, disabled: props.apiCallInProgress, "data-testid": "dialog-cancel" }, { children: "Cancel" })), jsxRuntime.jsx("button", __assign({ type: "button", className: "cta delete cta-cd-delete-modal ml-16", onClick: handleDelete, disabled: props.apiCallInProgress || props.disabled, "data-testid": "dialog-delete" }, { children: props.apiCallInProgress ? (jsxRuntime.jsx(Progressing, {})) : ("".concat(props.deletePrefix || '').concat(props.buttonPrimaryText ? props.buttonPrimaryText : 'Delete').concat(props.deletePostfix || '')) }))] })) })] })));
16677
16703
  };
16678
16704
  function DeleteDialogDescription(props) {
16679
16705
  return jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children });
@@ -28250,6 +28276,48 @@ var ChartVersionAndTypeSelector = function (_a) {
28250
28276
  return (jsxRuntime.jsxs("div", __assign({ className: "flex" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "chart-type-options flex", "data-testid": "chart-type-options" }, { children: [jsxRuntime.jsx("span", __assign({ className: "chart-type-options-label mr-4" }, { children: "Chart Type" })), jsxRuntime.jsx(ReactSelect, { value: selectedChartType !== null && selectedChartType !== void 0 ? selectedChartType : chartTypeOptions[0], options: chartTypeOptions, onChange: handleChartTypeChange, styles: customStyles })] })), jsxRuntime.jsxs("div", __assign({ className: "chart-version-options flex", "data-testid": "chart-version-options" }, { children: [jsxRuntime.jsx("span", __assign({ className: "chart-version-options-label mr-4" }, { children: "Chart Version" })), jsxRuntime.jsx(ReactSelect, { value: selectedChartVersion !== null && selectedChartVersion !== void 0 ? selectedChartVersion : chartVersionOptions[0], options: chartVersionOptions, onChange: handleChartVersionChange, styles: customStyles })] }))] })));
28251
28277
  };
28252
28278
 
28279
+ function TooltipContent(_a) {
28280
+ var tooltipContent = _a.tooltipContent;
28281
+ if (tooltipContent) {
28282
+ return (jsxRuntime.jsxs("div", __assign({ className: "dc__white-space-pre-wrap" }, { children: [jsxRuntime.jsx("p", __assign({ className: "m-0 cn-0 fs-12 fw-6 lh-18" }, { children: "Click to add" })), tooltipContent] })));
28283
+ }
28284
+ return jsxRuntime.jsx("div", __assign({ className: "dc__white-space-pre-wrap" }, { children: "Click to add here" }));
28285
+ }
28286
+ function AddCDButton(_a) {
28287
+ var position = _a.position, addCDButtons = _a.addCDButtons, endNode = _a.endNode, startNode = _a.startNode, handleAddCD = _a.handleAddCD, tooltipContent = _a.tooltipContent;
28288
+ var referenceNode = position === exports.AddCDPositions.RIGHT ? endNode : startNode;
28289
+ var handleAddCDClick = function () {
28290
+ handleAddCD(position);
28291
+ };
28292
+ if (addCDButtons === null || addCDButtons === void 0 ? void 0 : addCDButtons.includes(position)) {
28293
+ return (jsxRuntime.jsx(Tippy, __assign({ placement: "top", content: jsxRuntime.jsx(TooltipContent, { tooltipContent: tooltipContent }), className: "default-tt", arrow: false }, { children: jsxRuntime.jsxs("svg", __assign({ x: referenceNode.x + (position === exports.AddCDPositions.RIGHT ? -20 - 5 : referenceNode.width + 5),
28294
+ // Here 10 is the height of the button / 2
28295
+ y: referenceNode.y + referenceNode.height / 2 - 10, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", "data-testid": "add-cd-to-".concat(position), onClick: handleAddCDClick, className: "dc__outline-none-imp" }, { children: [jsxRuntime.jsx("rect", { width: "20", height: "20", rx: "10", fill: "#664BEE", className: "add-cd-edge-btn" }), jsxRuntime.jsx("path", { d: "M6.5 10H13.5M10 6.5V13.5", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })) })));
28296
+ }
28297
+ return null;
28298
+ }
28299
+
28300
+ var getPipelineType = function (_a) {
28301
+ var isWebhookCD = _a.isWebhookCD, startNode = _a.startNode;
28302
+ if (isWebhookCD) {
28303
+ return exports.PipelineType.WEBHOOK;
28304
+ }
28305
+ if (startNode.type === exports.WorkflowNodeType.CI) {
28306
+ return exports.PipelineType.CI_PIPELINE;
28307
+ }
28308
+ return exports.PipelineType.CD_PIPELINE;
28309
+ };
28310
+ var handleAddCD = function (_a) {
28311
+ var position = _a.position, handleCDSelect = _a.handleCDSelect, startNode = _a.startNode, endNode = _a.endNode, workflowId = _a.workflowId, ciPipelineId = _a.ciPipelineId, isWebhookCD = _a.isWebhookCD, isParallelEdge = _a.isParallelEdge;
28312
+ if (!handleCDSelect) {
28313
+ return;
28314
+ }
28315
+ var pipelineType = getPipelineType({ isWebhookCD: isWebhookCD, startNode: startNode });
28316
+ var addPipelineType = isParallelEdge && position === exports.AddCDPositions.RIGHT ? exports.AddPipelineType.PARALLEL : exports.AddPipelineType.SEQUENTIAL;
28317
+ var endNodeId = !isParallelEdge && position === exports.AddCDPositions.RIGHT ? endNode.id : null;
28318
+ handleCDSelect(workflowId, ciPipelineId, pipelineType, startNode.id, isWebhookCD, endNodeId, addPipelineType);
28319
+ };
28320
+
28253
28321
  function CustomInput(_a) {
28254
28322
  var name = _a.name, value = _a.value, error = _a.error, onChange = _a.onChange, _b = _a.onFocus, onFocus = _b === void 0 ? function (e) { } : _b, label = _a.label, _c = _a.type, type = _c === void 0 ? 'text' : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.labelClassName, labelClassName = _e === void 0 ? '' : _e, _f = _a.placeholder, placeholder = _f === void 0 ? '' : _f, _g = _a.tabIndex, tabIndex = _g === void 0 ? 1 : _g, _h = _a.dataTestid, dataTestid = _h === void 0 ? '' : _h, _j = _a.isRequiredField, isRequiredField = _j === void 0 ? false : _j, _k = _a.autoFocus, autoFocus = _k === void 0 ? false : _k, _l = _a.rootClassName, rootClassName = _l === void 0 ? '' : _l, _m = _a.autoComplete, autoComplete = _m === void 0 ? 'off' : _m, _o = _a.helperText, helperText = _o === void 0 ? '' : _o, handleOnBlur = _a.handleOnBlur, _p = _a.readOnly, readOnly = _p === void 0 ? false : _p, _q = _a.noTrim, noTrim = _q === void 0 ? false : _q, ref = _a.ref, onKeyPress = _a.onKeyPress, defaultValue = _a.defaultValue, onKeyDown = _a.onKeyDown, required = _a.required, additionalErrorInfo = _a.additionalErrorInfo;
28255
28323
  function handleError(error) {
@@ -28306,6 +28374,7 @@ function CustomInput(_a) {
28306
28374
  }, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, value: value, disabled: disabled, tabIndex: tabIndex, autoFocus: autoFocus, readOnly: readOnly, ref: ref, onKeyPress: onKeyPress, defaultValue: defaultValue, onKeyDown: onKeyDown, required: required }), getInputError(), helperText && (jsxRuntime.jsxs("div", __assign({ className: "form__text-field-info" }, { children: [jsxRuntime.jsx(SvgIcInfoFilled, { className: "form__icon form__icon--info" }), jsxRuntime.jsx("p", __assign({ className: "sentence-case" }, { children: helperText }))] })))] })));
28307
28375
  }
28308
28376
 
28377
+ exports.AddCDButton = AddCDButton;
28309
28378
  exports.AppStatus = AppStatus;
28310
28379
  exports.BreadCrumb = BreadCrumb;
28311
28380
  exports.BreadcrumbStore = Store;
@@ -28402,6 +28471,7 @@ exports.getTeamListMin = getTeamListMin;
28402
28471
  exports.getUnlockedJSON = getUnlockedJSON;
28403
28472
  exports.getUrlWithSearchParams = getUrlWithSearchParams;
28404
28473
  exports.getUserRole = getUserRole;
28474
+ exports.handleAddCD = handleAddCD;
28405
28475
  exports.handleUTCTime = handleUTCTime;
28406
28476
  exports.logExceptionToSentry = logExceptionToSentry;
28407
28477
  exports.multiSelectStyles = multiSelectStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.48-beta-4",
3
+ "version": "0.0.48-beta-6",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -0,0 +1,68 @@
1
+ import React from 'react'
2
+ import Tippy from '@tippyjs/react'
3
+ import { AddCDButtonProps, TooltipContentProps } from './types'
4
+ import { AddCDPositions } from '../Types'
5
+
6
+ function TooltipContent({ tooltipContent }: TooltipContentProps) {
7
+ if (tooltipContent) {
8
+ return (
9
+ <div className="dc__white-space-pre-wrap">
10
+ <p className="m-0 cn-0 fs-12 fw-6 lh-18">Click to add</p>
11
+
12
+ {tooltipContent}
13
+ </div>
14
+ )
15
+ }
16
+
17
+ return <div className="dc__white-space-pre-wrap">Click to add here</div>
18
+ }
19
+
20
+ export default function AddCDButton({
21
+ position,
22
+ addCDButtons,
23
+ endNode,
24
+ startNode,
25
+ handleAddCD,
26
+ tooltipContent,
27
+ }: Readonly<AddCDButtonProps>) {
28
+ const referenceNode = position === AddCDPositions.RIGHT ? endNode : startNode
29
+ const handleAddCDClick = () => {
30
+ handleAddCD(position)
31
+ }
32
+
33
+ if (addCDButtons?.includes(position)) {
34
+ return (
35
+ <Tippy
36
+ placement="top"
37
+ content={<TooltipContent tooltipContent={tooltipContent} />}
38
+ className="default-tt"
39
+ arrow={false}
40
+ >
41
+ <svg
42
+ x={referenceNode.x + (position === AddCDPositions.RIGHT ? -20 - 5 : referenceNode.width + 5)}
43
+ // Here 10 is the height of the button / 2
44
+ y={referenceNode.y + referenceNode.height / 2 - 10}
45
+ width="20"
46
+ height="20"
47
+ viewBox="0 0 20 20"
48
+ fill="none"
49
+ xmlns="http://www.w3.org/2000/svg"
50
+ data-testid={`add-cd-to-${position}`}
51
+ onClick={handleAddCDClick}
52
+ className="dc__outline-none-imp"
53
+ >
54
+ <rect width="20" height="20" rx="10" fill="#664BEE" className="add-cd-edge-btn" />
55
+ <path
56
+ d="M6.5 10H13.5M10 6.5V13.5"
57
+ stroke="white"
58
+ strokeWidth="1.5"
59
+ strokeLinecap="round"
60
+ strokeLinejoin="round"
61
+ />
62
+ </svg>
63
+ </Tippy>
64
+ )
65
+ }
66
+
67
+ return null
68
+ }
@@ -0,0 +1,2 @@
1
+ export { default as AddCDButton } from './AddCDButton'
2
+ export { handleAddCD } from './utils'
@@ -0,0 +1,38 @@
1
+ import { AddCDPositions, AddPipelineType, EdgeEndNodeType, EdgeNodeType, Point } from '../Types'
2
+
3
+ export interface AddCDButtonProps {
4
+ position: AddCDPositions
5
+ addCDButtons: AddCDPositions[]
6
+ endNode: Point & EdgeEndNodeType
7
+ startNode: Point & EdgeNodeType
8
+ handleAddCD: (position: AddCDPositions) => void
9
+ tooltipContent?: string
10
+ }
11
+
12
+ export interface HandleAddCD {
13
+ position: AddCDPositions
14
+ handleCDSelect: (
15
+ workflowId: number | string,
16
+ ciPipelineId: number | string,
17
+ parentPipelineType: string,
18
+ parentPipelineId: number | string,
19
+ isWebhookCD?: boolean,
20
+ childPipelineId?: number | string,
21
+ addType?: AddPipelineType,
22
+ ) => void
23
+ startNode: EdgeNodeType
24
+ endNode: EdgeEndNodeType
25
+ workflowId: number | string
26
+ ciPipelineId: number | string
27
+ isWebhookCD: boolean
28
+ isParallelEdge: boolean
29
+ }
30
+
31
+ export interface GetPipelineType {
32
+ isWebhookCD: boolean
33
+ startNode: EdgeNodeType
34
+ }
35
+
36
+ export interface TooltipContentProps {
37
+ tooltipContent?: string
38
+ }
@@ -0,0 +1,35 @@
1
+ import { AddCDPositions, AddPipelineType, PipelineType, WorkflowNodeType } from '../Types'
2
+ import { HandleAddCD, GetPipelineType } from './types'
3
+
4
+ const getPipelineType = ({ isWebhookCD, startNode }: GetPipelineType) => {
5
+ if (isWebhookCD) {
6
+ return PipelineType.WEBHOOK
7
+ }
8
+
9
+ if (startNode.type === WorkflowNodeType.CI) {
10
+ return PipelineType.CI_PIPELINE
11
+ }
12
+
13
+ return PipelineType.CD_PIPELINE
14
+ }
15
+
16
+ export const handleAddCD = ({
17
+ position,
18
+ handleCDSelect,
19
+ startNode,
20
+ endNode,
21
+ workflowId,
22
+ ciPipelineId,
23
+ isWebhookCD,
24
+ isParallelEdge,
25
+ }: HandleAddCD) => {
26
+ if (!handleCDSelect) {
27
+ return
28
+ }
29
+ const pipelineType = getPipelineType({ isWebhookCD, startNode })
30
+ const addPipelineType =
31
+ isParallelEdge && position === AddCDPositions.RIGHT ? AddPipelineType.PARALLEL : AddPipelineType.SEQUENTIAL
32
+ const endNodeId = !isParallelEdge && position === AddCDPositions.RIGHT ? endNode.id : null
33
+
34
+ handleCDSelect(workflowId, ciPipelineId, pipelineType, startNode.id, isWebhookCD, endNodeId, addPipelineType)
35
+ }
@@ -45,7 +45,7 @@ export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.F
45
45
  type="button"
46
46
  className="cta delete cta-cd-delete-modal ml-16"
47
47
  onClick={handleDelete}
48
- disabled={props.apiCallInProgress}
48
+ disabled={props.apiCallInProgress || props.disabled}
49
49
  data-testid="dialog-delete"
50
50
  >
51
51
  {props.apiCallInProgress ? (
@@ -11,6 +11,7 @@ export interface DeleteDialogProps {
11
11
  dataTestId?: string
12
12
  buttonPrimaryText?: string
13
13
  shouldStopPropagation?: boolean
14
+ disabled?: boolean
14
15
  }
15
16
 
16
17
  export interface ForceDeleteDialogType {
@@ -293,6 +293,11 @@ export interface CDMaterialServiceQueryParams {
293
293
  filter?: CDMaterialFilterQuery
294
294
  }
295
295
 
296
+ export interface DownstreamNodesEnvironmentsType {
297
+ environmentId: number
298
+ environmentName: string
299
+ }
300
+
296
301
  export interface CommonNodeAttr {
297
302
  connectingCiPipelineId?: number
298
303
  parents: string | number[] | string[]
@@ -354,6 +359,9 @@ export interface CommonNodeAttr {
354
359
  }
355
360
  appReleaseTagNames?: string[]
356
361
  tagsEditable?: boolean
362
+ deploymentAppCreated?: boolean
363
+ isLast?: boolean
364
+ downstreamEnvironments?: DownstreamNodesEnvironmentsType[]
357
365
  }
358
366
 
359
367
  export enum DeploymentAppTypes {
@@ -623,18 +631,6 @@ export interface CiPipeline {
623
631
  isOffendingMandatoryPlugin?: boolean
624
632
  pipelineType?: string
625
633
  }
626
-
627
- export interface DeploymentChartVersionType {
628
- chartRefId: number
629
- chartVersion: string
630
- chartType: string
631
- type: number
632
- }
633
-
634
- export interface ChartVersionAndTypeSelectorProps {
635
- setSelectedChartRefId: React.Dispatch<React.SetStateAction<number>>
636
- }
637
-
638
634
  export interface InformationBarProps {
639
635
  text: string
640
636
  className?: string
@@ -650,7 +646,7 @@ export interface CodeEditorInterface {
650
646
  onFocus?: () => void
651
647
  children?: any
652
648
  defaultValue?: string
653
- mode?: 'json' | 'yaml' | 'shell' | 'dockerfile' | 'plaintext'
649
+ mode?: 'json' | 'yaml' | 'shell' | 'dockerfile'
654
650
  tabSize?: number
655
651
  readOnly?: boolean
656
652
  noParsing?: boolean
@@ -692,4 +688,63 @@ export interface CodeEditorHeaderInterface {
692
688
  children?: any;
693
689
  className?: string
694
690
  hideDefaultSplitHeader?: boolean;
695
- }
691
+ }
692
+
693
+ export interface DeploymentChartVersionType {
694
+ chartRefId: number
695
+ chartVersion: string
696
+ chartType: string
697
+ type: number
698
+ }
699
+
700
+ export interface ChartVersionAndTypeSelectorProps {
701
+ setSelectedChartRefId: React.Dispatch<React.SetStateAction<number>>
702
+ }
703
+
704
+ export enum PipelineType {
705
+ CI_PIPELINE = 'CI_PIPELINE',
706
+ CD_PIPELINE = 'CD_PIPELINE',
707
+ WEBHOOK = 'WEBHOOK',
708
+ LINKED_CD = 'LINKED_CD',
709
+ }
710
+
711
+ export enum WorkflowNodeType {
712
+ GIT = 'GIT',
713
+ CI = 'CI',
714
+ WEBHOOK = 'WEBHOOK',
715
+ PRE_CD = 'PRECD',
716
+ CD = 'CD',
717
+ POST_CD = 'POSTCD',
718
+ }
719
+
720
+ export enum AddCDPositions {
721
+ LEFT = 'left',
722
+ RIGHT = 'right',
723
+ }
724
+
725
+ export interface SelectedNode {
726
+ nodeType: WorkflowNodeType
727
+ id: string
728
+ }
729
+
730
+ export enum AddPipelineType {
731
+ SEQUENTIAL = 'SEQUENTIAL',
732
+ PARALLEL = 'PARALLEL',
733
+ }
734
+
735
+ export interface Point {
736
+ x: number
737
+ y: number
738
+ }
739
+
740
+ export interface EdgeNodeType {
741
+ height: number
742
+ width: number
743
+ userApprovalConfig?: UserApprovalConfigType
744
+ type?: any
745
+ id?: number | string
746
+ }
747
+
748
+ export interface EdgeEndNodeType extends EdgeNodeType {
749
+ userApprovalConfig?: UserApprovalConfigType
750
+ }
@@ -43,4 +43,5 @@ export { AppStatus } from './AppStatus'
43
43
  export * from './RJSF'
44
44
  export * from './DevtronProgressing'
45
45
  export { default as ChartVersionAndTypeSelector } from './ChartVersionAndTypeSelector'
46
+ export * from './AddCDButton'
46
47
  export * from './CustomInput'