@devtron-labs/devtron-fe-common-lib 0.0.47 → 0.0.48
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/AddCDButton/AddCDButton.d.ts +3 -0
- package/dist/Common/AddCDButton/index.d.ts +2 -0
- package/dist/Common/AddCDButton/types.d.ts +26 -0
- package/dist/Common/AddCDButton/utils.d.ts +2 -0
- package/dist/Common/Dialogs/Types.d.ts +1 -0
- package/dist/Common/Types.d.ts +47 -0
- package/dist/Common/index.d.ts +1 -0
- package/dist/index.js +72 -2
- package/package.json +1 -1
- package/src/Common/AddCDButton/AddCDButton.tsx +68 -0
- package/src/Common/AddCDButton/index.ts +2 -0
- package/src/Common/AddCDButton/types.ts +38 -0
- package/src/Common/AddCDButton/utils.tsx +35 -0
- package/src/Common/Dialogs/DeleteDialog.tsx +1 -1
- package/src/Common/Dialogs/Types.ts +1 -0
- package/src/Common/Types.ts +57 -1
- package/src/Common/index.ts +1 -0
|
@@ -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
|
+
}
|
package/dist/Common/Types.d.ts
CHANGED
|
@@ -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,4 +570,44 @@ export interface CiPipeline {
|
|
|
563
570
|
isOffendingMandatoryPlugin?: boolean;
|
|
564
571
|
pipelineType?: string;
|
|
565
572
|
}
|
|
573
|
+
export declare enum PipelineType {
|
|
574
|
+
CI_PIPELINE = "CI_PIPELINE",
|
|
575
|
+
CD_PIPELINE = "CD_PIPELINE",
|
|
576
|
+
WEBHOOK = "WEBHOOK",
|
|
577
|
+
LINKED_CD = "LINKED_CD"
|
|
578
|
+
}
|
|
579
|
+
export declare enum WorkflowNodeType {
|
|
580
|
+
GIT = "GIT",
|
|
581
|
+
CI = "CI",
|
|
582
|
+
WEBHOOK = "WEBHOOK",
|
|
583
|
+
PRE_CD = "PRECD",
|
|
584
|
+
CD = "CD",
|
|
585
|
+
POST_CD = "POSTCD"
|
|
586
|
+
}
|
|
587
|
+
export declare enum AddCDPositions {
|
|
588
|
+
LEFT = "left",
|
|
589
|
+
RIGHT = "right"
|
|
590
|
+
}
|
|
591
|
+
export interface SelectedNode {
|
|
592
|
+
nodeType: WorkflowNodeType;
|
|
593
|
+
id: string;
|
|
594
|
+
}
|
|
595
|
+
export declare enum AddPipelineType {
|
|
596
|
+
SEQUENTIAL = "SEQUENTIAL",
|
|
597
|
+
PARALLEL = "PARALLEL"
|
|
598
|
+
}
|
|
599
|
+
export interface Point {
|
|
600
|
+
x: number;
|
|
601
|
+
y: number;
|
|
602
|
+
}
|
|
603
|
+
export interface EdgeNodeType {
|
|
604
|
+
height: number;
|
|
605
|
+
width: number;
|
|
606
|
+
userApprovalConfig?: UserApprovalConfigType;
|
|
607
|
+
type?: any;
|
|
608
|
+
id?: number | string;
|
|
609
|
+
}
|
|
610
|
+
export interface EdgeEndNodeType extends EdgeNodeType {
|
|
611
|
+
userApprovalConfig?: UserApprovalConfigType;
|
|
612
|
+
}
|
|
566
613
|
export {};
|
package/dist/Common/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -463,7 +463,33 @@ exports.FilterConditionType = void 0;
|
|
|
463
463
|
(function (FilterConditionType) {
|
|
464
464
|
FilterConditionType[FilterConditionType["PASS"] = 1] = "PASS";
|
|
465
465
|
FilterConditionType[FilterConditionType["FAIL"] = 0] = "FAIL";
|
|
466
|
-
})(exports.FilterConditionType || (exports.FilterConditionType = {}));
|
|
466
|
+
})(exports.FilterConditionType || (exports.FilterConditionType = {}));
|
|
467
|
+
exports.PipelineType = void 0;
|
|
468
|
+
(function (PipelineType) {
|
|
469
|
+
PipelineType["CI_PIPELINE"] = "CI_PIPELINE";
|
|
470
|
+
PipelineType["CD_PIPELINE"] = "CD_PIPELINE";
|
|
471
|
+
PipelineType["WEBHOOK"] = "WEBHOOK";
|
|
472
|
+
PipelineType["LINKED_CD"] = "LINKED_CD";
|
|
473
|
+
})(exports.PipelineType || (exports.PipelineType = {}));
|
|
474
|
+
exports.WorkflowNodeType = void 0;
|
|
475
|
+
(function (WorkflowNodeType) {
|
|
476
|
+
WorkflowNodeType["GIT"] = "GIT";
|
|
477
|
+
WorkflowNodeType["CI"] = "CI";
|
|
478
|
+
WorkflowNodeType["WEBHOOK"] = "WEBHOOK";
|
|
479
|
+
WorkflowNodeType["PRE_CD"] = "PRECD";
|
|
480
|
+
WorkflowNodeType["CD"] = "CD";
|
|
481
|
+
WorkflowNodeType["POST_CD"] = "POSTCD";
|
|
482
|
+
})(exports.WorkflowNodeType || (exports.WorkflowNodeType = {}));
|
|
483
|
+
exports.AddCDPositions = void 0;
|
|
484
|
+
(function (AddCDPositions) {
|
|
485
|
+
AddCDPositions["LEFT"] = "left";
|
|
486
|
+
AddCDPositions["RIGHT"] = "right";
|
|
487
|
+
})(exports.AddCDPositions || (exports.AddCDPositions = {}));
|
|
488
|
+
exports.AddPipelineType = void 0;
|
|
489
|
+
(function (AddPipelineType) {
|
|
490
|
+
AddPipelineType["SEQUENTIAL"] = "SEQUENTIAL";
|
|
491
|
+
AddPipelineType["PARALLEL"] = "PARALLEL";
|
|
492
|
+
})(exports.AddPipelineType || (exports.AddPipelineType = {}));
|
|
467
493
|
|
|
468
494
|
var responseMessages = {
|
|
469
495
|
100: 'Continue',
|
|
@@ -15096,7 +15122,7 @@ var DeleteDialog = function (props) {
|
|
|
15096
15122
|
}
|
|
15097
15123
|
props.closeDelete();
|
|
15098
15124
|
};
|
|
15099
|
-
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 || '')) }))] })) })] })));
|
|
15125
|
+
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 || '')) }))] })) })] })));
|
|
15100
15126
|
};
|
|
15101
15127
|
function DeleteDialogDescription(props) {
|
|
15102
15128
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children });
|
|
@@ -26623,6 +26649,48 @@ function DevtronProgressing(_a) {
|
|
|
26623
26649
|
return (jsxRuntime.jsx("div", __assign({ className: parentClasses ? parentClasses : '' }, { children: jsxRuntime.jsx(SvgIcRotateDevtron, { className: classes ? classes : '' }) })));
|
|
26624
26650
|
}
|
|
26625
26651
|
|
|
26652
|
+
function TooltipContent(_a) {
|
|
26653
|
+
var tooltipContent = _a.tooltipContent;
|
|
26654
|
+
if (tooltipContent) {
|
|
26655
|
+
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] })));
|
|
26656
|
+
}
|
|
26657
|
+
return jsxRuntime.jsx("div", __assign({ className: "dc__white-space-pre-wrap" }, { children: "Click to add here" }));
|
|
26658
|
+
}
|
|
26659
|
+
function AddCDButton(_a) {
|
|
26660
|
+
var position = _a.position, addCDButtons = _a.addCDButtons, endNode = _a.endNode, startNode = _a.startNode, handleAddCD = _a.handleAddCD, tooltipContent = _a.tooltipContent;
|
|
26661
|
+
var referenceNode = position === exports.AddCDPositions.RIGHT ? endNode : startNode;
|
|
26662
|
+
var handleAddCDClick = function () {
|
|
26663
|
+
handleAddCD(position);
|
|
26664
|
+
};
|
|
26665
|
+
if (addCDButtons === null || addCDButtons === void 0 ? void 0 : addCDButtons.includes(position)) {
|
|
26666
|
+
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),
|
|
26667
|
+
// Here 10 is the height of the button / 2
|
|
26668
|
+
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" })] })) })));
|
|
26669
|
+
}
|
|
26670
|
+
return null;
|
|
26671
|
+
}
|
|
26672
|
+
|
|
26673
|
+
var getPipelineType = function (_a) {
|
|
26674
|
+
var isWebhookCD = _a.isWebhookCD, startNode = _a.startNode;
|
|
26675
|
+
if (isWebhookCD) {
|
|
26676
|
+
return exports.PipelineType.WEBHOOK;
|
|
26677
|
+
}
|
|
26678
|
+
if (startNode.type === exports.WorkflowNodeType.CI) {
|
|
26679
|
+
return exports.PipelineType.CI_PIPELINE;
|
|
26680
|
+
}
|
|
26681
|
+
return exports.PipelineType.CD_PIPELINE;
|
|
26682
|
+
};
|
|
26683
|
+
var handleAddCD = function (_a) {
|
|
26684
|
+
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;
|
|
26685
|
+
if (!handleCDSelect) {
|
|
26686
|
+
return;
|
|
26687
|
+
}
|
|
26688
|
+
var pipelineType = getPipelineType({ isWebhookCD: isWebhookCD, startNode: startNode });
|
|
26689
|
+
var addPipelineType = isParallelEdge && position === exports.AddCDPositions.RIGHT ? exports.AddPipelineType.PARALLEL : exports.AddPipelineType.SEQUENTIAL;
|
|
26690
|
+
var endNodeId = !isParallelEdge && position === exports.AddCDPositions.RIGHT ? endNode.id : null;
|
|
26691
|
+
handleCDSelect(workflowId, ciPipelineId, pipelineType, startNode.id, isWebhookCD, endNodeId, addPipelineType);
|
|
26692
|
+
};
|
|
26693
|
+
|
|
26626
26694
|
function CustomInput(_a) {
|
|
26627
26695
|
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;
|
|
26628
26696
|
function handleError(error) {
|
|
@@ -26679,6 +26747,7 @@ function CustomInput(_a) {
|
|
|
26679
26747
|
}, 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 }))] })))] })));
|
|
26680
26748
|
}
|
|
26681
26749
|
|
|
26750
|
+
exports.AddCDButton = AddCDButton;
|
|
26682
26751
|
exports.AppStatus = AppStatus;
|
|
26683
26752
|
exports.BreadCrumb = BreadCrumb;
|
|
26684
26753
|
exports.BreadcrumbStore = Store;
|
|
@@ -26769,6 +26838,7 @@ exports.getRedirectionProps = getRedirectionProps;
|
|
|
26769
26838
|
exports.getTeamListMin = getTeamListMin;
|
|
26770
26839
|
exports.getUrlWithSearchParams = getUrlWithSearchParams;
|
|
26771
26840
|
exports.getUserRole = getUserRole;
|
|
26841
|
+
exports.handleAddCD = handleAddCD;
|
|
26772
26842
|
exports.handleUTCTime = handleUTCTime;
|
|
26773
26843
|
exports.logExceptionToSentry = logExceptionToSentry;
|
|
26774
26844
|
exports.multiSelectStyles = multiSelectStyles;
|
package/package.json
CHANGED
|
@@ -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,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 ? (
|
package/src/Common/Types.ts
CHANGED
|
@@ -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 {
|
|
@@ -622,4 +630,52 @@ export interface CiPipeline {
|
|
|
622
630
|
}
|
|
623
631
|
isOffendingMandatoryPlugin?: boolean
|
|
624
632
|
pipelineType?: string
|
|
625
|
-
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
export enum PipelineType {
|
|
636
|
+
CI_PIPELINE = 'CI_PIPELINE',
|
|
637
|
+
CD_PIPELINE = 'CD_PIPELINE',
|
|
638
|
+
WEBHOOK = 'WEBHOOK',
|
|
639
|
+
LINKED_CD = 'LINKED_CD',
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
export enum WorkflowNodeType {
|
|
643
|
+
GIT = 'GIT',
|
|
644
|
+
CI = 'CI',
|
|
645
|
+
WEBHOOK = 'WEBHOOK',
|
|
646
|
+
PRE_CD = 'PRECD',
|
|
647
|
+
CD = 'CD',
|
|
648
|
+
POST_CD = 'POSTCD',
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
export enum AddCDPositions {
|
|
652
|
+
LEFT = 'left',
|
|
653
|
+
RIGHT = 'right',
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export interface SelectedNode {
|
|
657
|
+
nodeType: WorkflowNodeType
|
|
658
|
+
id: string
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
export enum AddPipelineType {
|
|
662
|
+
SEQUENTIAL = 'SEQUENTIAL',
|
|
663
|
+
PARALLEL = 'PARALLEL',
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
export interface Point {
|
|
667
|
+
x: number
|
|
668
|
+
y: number
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
export interface EdgeNodeType {
|
|
672
|
+
height: number
|
|
673
|
+
width: number
|
|
674
|
+
userApprovalConfig?: UserApprovalConfigType
|
|
675
|
+
type?: any
|
|
676
|
+
id?: number | string
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
export interface EdgeEndNodeType extends EdgeNodeType {
|
|
680
|
+
userApprovalConfig?: UserApprovalConfigType
|
|
681
|
+
}
|