@devtron-labs/devtron-fe-common-lib 0.0.17-beta-16 → 0.0.17-beta-18
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/Common.service.d.ts +1 -9
- package/dist/Common/Helper.d.ts +0 -2
- package/dist/Common/Toggle/Toggle.d.ts +2 -1
- package/dist/Common/Types.d.ts +0 -6
- package/dist/index.js +7 -134
- package/package.json +1 -1
- package/src/Common/Common.service.ts +2 -121
- package/src/Common/EmptyState/GenericEmptyState.tsx +1 -0
- package/src/Common/Helper.tsx +1 -24
- package/src/Common/ImageTags.tsx +2 -2
- package/src/Common/Toggle/Toggle.scss +40 -32
- package/src/Common/Toggle/Toggle.tsx +24 -13
- package/src/Common/Types.ts +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TeamList, ResponseType
|
|
1
|
+
import { TeamList, ResponseType } from './Types';
|
|
2
2
|
export declare const getTeamListMin: () => Promise<TeamList>;
|
|
3
3
|
interface UserRole extends ResponseType {
|
|
4
4
|
result?: {
|
|
@@ -6,14 +6,6 @@ interface UserRole extends ResponseType {
|
|
|
6
6
|
superAdmin: boolean;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
-
export declare const SourceTypeMap: {
|
|
10
|
-
BranchFixed: string;
|
|
11
|
-
WEBHOOK: string;
|
|
12
|
-
BranchRegex: string;
|
|
13
|
-
};
|
|
14
9
|
export declare function getUserRole(appName?: string): Promise<UserRole>;
|
|
15
10
|
export declare function setImageTags(request: any, pipelineId: number, artifactId: number): Promise<ResponseType>;
|
|
16
|
-
export declare const getCDMaterials: (cdMaterialId: any, stageType: DeploymentNodeType, abortSignal: AbortSignal, isApprovalNode?: boolean, imageTag?: string) => Promise<any>;
|
|
17
|
-
export declare function extractImage(image: string): string;
|
|
18
|
-
export declare function createGitCommitUrl(url: string, revision: string): string;
|
|
19
11
|
export {};
|
package/dist/Common/Helper.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { UseSearchString } from './Types';
|
|
3
2
|
export declare function showError(serverError: any, showToastOnUnknownError?: boolean, hideAccessError?: boolean): void;
|
|
4
3
|
interface ConditionalWrapper<T> {
|
|
5
4
|
condition: boolean;
|
|
@@ -41,5 +40,4 @@ export declare function CustomInput({ name, value, error, onChange, onBlur, onFo
|
|
|
41
40
|
dataTestid?: string;
|
|
42
41
|
}): JSX.Element;
|
|
43
42
|
export declare function handleUTCTime(ts: string, isRelativeTime?: boolean): string;
|
|
44
|
-
export declare function useSearchString(): UseSearchString;
|
|
45
43
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import './Toggle.scss';
|
|
3
|
-
declare const Toggle: ({ selected, onSelect, color, rootClassName, disabled, dataTestId, ...props }: {
|
|
3
|
+
declare const Toggle: ({ selected, onSelect, color, rootClassName, disabled, dataTestId, Icon, ...props }: {
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
selected?: boolean;
|
|
6
6
|
onSelect?: any;
|
|
@@ -8,5 +8,6 @@ declare const Toggle: ({ selected, onSelect, color, rootClassName, disabled, dat
|
|
|
8
8
|
rootClassName?: string;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
dataTestId?: string;
|
|
11
|
+
Icon?: any;
|
|
11
12
|
}) => JSX.Element;
|
|
12
13
|
export default Toggle;
|
package/dist/Common/Types.d.ts
CHANGED
|
@@ -332,10 +332,4 @@ export interface RegistryTypeDetailType {
|
|
|
332
332
|
id: InputDetailType;
|
|
333
333
|
password: InputDetailType;
|
|
334
334
|
}
|
|
335
|
-
export interface UseSearchString {
|
|
336
|
-
queryParams: URLSearchParams;
|
|
337
|
-
searchParams: {
|
|
338
|
-
[key: string]: string;
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
335
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -2162,6 +2162,7 @@ var AppNotDeployed = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAGQCAYA
|
|
|
2162
2162
|
|
|
2163
2163
|
function GenericEmptyState(_a) {
|
|
2164
2164
|
var title = _a.title, image = _a.image, subTitle = _a.subTitle, isButtonAvailable = _a.isButtonAvailable, classname = _a.classname, styles = _a.styles, heightToDeduct = _a.heightToDeduct, imageType = _a.imageType, renderButton = _a.renderButton, imageClassName = _a.imageClassName, children = _a.children, SvgImage = _a.SvgImage, noImage = _a.noImage;
|
|
2165
|
+
console.log(image);
|
|
2165
2166
|
return (jsxRuntime.jsxs("div", __assign({ className: "flex column empty-state ".concat(classname ? classname : ''), style: styles, "data-testid": "generic-empty-state" }, (heightToDeduct >= 0 && { style: __assign(__assign({}, styles), { height: "calc(100vh - ".concat(heightToDeduct, "px)") }) }), { children: [!SvgImage ? !noImage && jsxRuntime.jsx("img", { className: imageClassName ? imageClassName : '', src: image || AppNotDeployed, width: imageType === exports.ImageType.Medium ? '200' : '250', height: imageType === exports.ImageType.Medium ? '160' : '200', alt: "empty-state" }) : jsxRuntime.jsx(SvgImage, {}), jsxRuntime.jsx("h4", __assign({ className: "title fw-6 cn-9 mb-8" }, { children: title })), subTitle && jsxRuntime.jsx("p", __assign({ className: "subtitle" }, { children: subTitle })), isButtonAvailable && renderButton(), children] })));
|
|
2166
2167
|
}
|
|
2167
2168
|
|
|
@@ -10078,22 +10079,6 @@ function handleUTCTime(ts, isRelativeTime) {
|
|
|
10078
10079
|
console.error("Error Parsing Date:", ts);
|
|
10079
10080
|
}
|
|
10080
10081
|
return timestamp;
|
|
10081
|
-
}
|
|
10082
|
-
function useSearchString() {
|
|
10083
|
-
var location = reactRouterDom.useLocation();
|
|
10084
|
-
var queryParams = React.useMemo(function () {
|
|
10085
|
-
var queryParams = new URLSearchParams(location.search);
|
|
10086
|
-
return queryParams;
|
|
10087
|
-
}, [location]);
|
|
10088
|
-
// const searchParams={}
|
|
10089
|
-
// for (let [key, value] of queryParams.entries()){
|
|
10090
|
-
// searchParams[key]=value
|
|
10091
|
-
// }
|
|
10092
|
-
var searchParams = Array.from(queryParams.entries()).reduce(function (agg, curr, idx) {
|
|
10093
|
-
agg[curr[0]] = curr[1];
|
|
10094
|
-
return agg;
|
|
10095
|
-
}, {});
|
|
10096
|
-
return { queryParams: queryParams, searchParams: searchParams };
|
|
10097
10082
|
}
|
|
10098
10083
|
|
|
10099
10084
|
function Progressing(_a) {
|
|
@@ -22539,118 +22524,11 @@ var getTeamListMin = function () {
|
|
|
22539
22524
|
};
|
|
22540
22525
|
});
|
|
22541
22526
|
};
|
|
22542
|
-
var stageMap = {
|
|
22543
|
-
PRECD: 'PRE',
|
|
22544
|
-
CD: 'DEPLOY',
|
|
22545
|
-
POSTCD: 'POST',
|
|
22546
|
-
APPROVAL: 'APPROVAL',
|
|
22547
|
-
};
|
|
22548
|
-
var SourceTypeMap = {
|
|
22549
|
-
BranchFixed: 'SOURCE_TYPE_BRANCH_FIXED',
|
|
22550
|
-
WEBHOOK: 'WEBHOOK',
|
|
22551
|
-
BranchRegex: 'SOURCE_TYPE_BRANCH_REGEX',
|
|
22552
|
-
};
|
|
22553
22527
|
function getUserRole(appName) {
|
|
22554
22528
|
return get("".concat(ROUTES.USER_CHECK_ROLE).concat(appName ? "?appName=".concat(appName) : ''));
|
|
22555
22529
|
}
|
|
22556
22530
|
function setImageTags(request, pipelineId, artifactId) {
|
|
22557
22531
|
return post("".concat(ROUTES.IMAGE_TAGGING, "/").concat(pipelineId, "/").concat(artifactId), request);
|
|
22558
|
-
}
|
|
22559
|
-
var getCDMaterials = function (cdMaterialId, stageType, abortSignal, isApprovalNode, imageTag) {
|
|
22560
|
-
var URL = (!imageTag) ? "app/cd-pipeline/".concat(cdMaterialId, "/material?stage=").concat(stageMap[stageType]) : "app/cd-pipeline/".concat(cdMaterialId, "/material?stage=").concat(stageMap[stageType], "&search=").concat(imageTag);
|
|
22561
|
-
return get(URL, {
|
|
22562
|
-
signal: abortSignal,
|
|
22563
|
-
}).then(function (response) {
|
|
22564
|
-
var _a;
|
|
22565
|
-
var artifacts = (_a = response.result.ci_artifacts) !== null && _a !== void 0 ? _a : [];
|
|
22566
|
-
if (!response.result) {
|
|
22567
|
-
return {
|
|
22568
|
-
materials: [],
|
|
22569
|
-
};
|
|
22570
|
-
}
|
|
22571
|
-
else {
|
|
22572
|
-
var materials = artifacts.map(function (material, index) {
|
|
22573
|
-
var artifactStatusValue = '';
|
|
22574
|
-
return {
|
|
22575
|
-
index: index,
|
|
22576
|
-
id: material.id,
|
|
22577
|
-
deployedTime: material.deployed_time
|
|
22578
|
-
? moment(material.deployed_time).format('ddd, DD MMM YYYY, hh:mm A')
|
|
22579
|
-
: 'Not Deployed',
|
|
22580
|
-
deployedBy: material.deployedBy,
|
|
22581
|
-
wfrId: material.wfrId,
|
|
22582
|
-
image: extractImage(material.image),
|
|
22583
|
-
showChanges: false,
|
|
22584
|
-
vulnerabilities: [],
|
|
22585
|
-
buildTime: material.build_time || '',
|
|
22586
|
-
tab: CDModalTab.Changes,
|
|
22587
|
-
showSourceInfo: false,
|
|
22588
|
-
deployed: material.deployed || false,
|
|
22589
|
-
latest: material.latest || false,
|
|
22590
|
-
vulnerabilitiesLoading: true,
|
|
22591
|
-
scanned: material.scanned,
|
|
22592
|
-
scanEnabled: material.scanEnabled,
|
|
22593
|
-
isSelected: !material.vulnerable && index === 0,
|
|
22594
|
-
vulnerable: material.vulnerable,
|
|
22595
|
-
runningOnParentCd: material.runningOnParentCd,
|
|
22596
|
-
artifactStatus: artifactStatusValue,
|
|
22597
|
-
userApprovalMetadata: material.userApprovalMetadata,
|
|
22598
|
-
triggeredBy: material.triggeredBy,
|
|
22599
|
-
isVirtualEnvironment: material.isVirtualEnvironment,
|
|
22600
|
-
imageComment: material.imageComment,
|
|
22601
|
-
imageReleaseTags: material.imageReleaseTags,
|
|
22602
|
-
materialInfo: material.material_info
|
|
22603
|
-
? material.material_info.map(function (mat) {
|
|
22604
|
-
return {
|
|
22605
|
-
modifiedTime: mat.modifiedTime ? moment(mat.modifiedTime).format("ddd, DD MMM YYYY, hh:mm A") : '',
|
|
22606
|
-
commitLink: createGitCommitUrl(mat.url, mat.revision),
|
|
22607
|
-
author: mat.author || '',
|
|
22608
|
-
message: mat.message || '',
|
|
22609
|
-
revision: mat.revision || '',
|
|
22610
|
-
tag: mat.tag || '',
|
|
22611
|
-
webhookData: mat.webhookData || '',
|
|
22612
|
-
url: mat.url || '',
|
|
22613
|
-
branch: (material.ciConfigureSourceType === SourceTypeMap.WEBHOOK
|
|
22614
|
-
? material.ciConfigureSourceValue
|
|
22615
|
-
: mat.branch) || '',
|
|
22616
|
-
type: material.ciConfigureSourceType || '',
|
|
22617
|
-
};
|
|
22618
|
-
})
|
|
22619
|
-
: [],
|
|
22620
|
-
};
|
|
22621
|
-
});
|
|
22622
|
-
return {
|
|
22623
|
-
materials: materials
|
|
22624
|
-
};
|
|
22625
|
-
}
|
|
22626
|
-
});
|
|
22627
|
-
};
|
|
22628
|
-
function extractImage(image) {
|
|
22629
|
-
return image ? image.split(':').pop() : '';
|
|
22630
|
-
}
|
|
22631
|
-
function createGitCommitUrl(url, revision) {
|
|
22632
|
-
if (!url || !revision) {
|
|
22633
|
-
return "NA";
|
|
22634
|
-
}
|
|
22635
|
-
if (url.indexOf("gitlab") > 0 || url.indexOf("github") > 0 || url.indexOf("azure") > 0) {
|
|
22636
|
-
var urlpart = url.split("@");
|
|
22637
|
-
if (urlpart.length > 1) {
|
|
22638
|
-
return "https://" + urlpart[1].split(".git")[0] + "/commit/" + revision;
|
|
22639
|
-
}
|
|
22640
|
-
if (urlpart.length == 1) {
|
|
22641
|
-
return urlpart[0].split(".git")[0] + "/commit/" + revision;
|
|
22642
|
-
}
|
|
22643
|
-
}
|
|
22644
|
-
if (url.indexOf("bitbucket") > 0) {
|
|
22645
|
-
var urlpart = url.split("@");
|
|
22646
|
-
if (urlpart.length > 1) {
|
|
22647
|
-
return "https://" + urlpart[1].split(".git")[0] + "/commits/" + revision;
|
|
22648
|
-
}
|
|
22649
|
-
if (urlpart.length == 1) {
|
|
22650
|
-
return urlpart[0].split(".git")[0] + "/commits/" + revision;
|
|
22651
|
-
}
|
|
22652
|
-
}
|
|
22653
|
-
return "NA";
|
|
22654
22532
|
}
|
|
22655
22533
|
|
|
22656
22534
|
/*
|
|
@@ -22675,13 +22553,13 @@ var Checkbox = /** @class */ (function (_super) {
|
|
|
22675
22553
|
return Checkbox;
|
|
22676
22554
|
}(React.Component));
|
|
22677
22555
|
|
|
22678
|
-
var css_248z$2 = ".toggle__switch {\n position: relative;\n display: inline-block;\n width: 100%;\n height: 100%;\n}\n.toggle__switch.disabled {\n cursor: not-allowed;\n}\n.toggle__switch.disabled .toggle__slider {\n cursor: not-allowed;\n}\n\n/* Hide default HTML checkbox */\n.toggle__switch input {\n opacity: 0;\n width: 0;\n height: 0;\n}\n\n/* The slider */\n.toggle__slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #ccc;\n transition: all 0.4s ease;\n}\n\n.toggle__slider:before {\n position: absolute;\n content: \"\";\n height: calc(100% - 8px);\n width: calc(50% - 4px);\n left: 4px;\n bottom: 4px;\n background-color: white;\n transition: all 0.4s ease;\n}\n\
|
|
22556
|
+
var css_248z$2 = ".toggle__switch {\n position: relative;\n display: inline-block;\n width: 100%;\n height: 100%;\n}\n.toggle__switch.disabled {\n cursor: not-allowed;\n}\n.toggle__switch.disabled .toggle__slider {\n cursor: not-allowed;\n}\n\n/* Hide default HTML checkbox */\n.toggle__switch input {\n opacity: 0;\n width: 0;\n height: 0;\n}\n\n/* The slider */\n.toggle__slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #ccc;\n transition: all 0.4s ease;\n}\n.toggle__slider.round {\n border-radius: 34px;\n}\n.toggle__slider.round:before {\n border-radius: 50%;\n}\n.toggle__slider:before {\n position: absolute;\n content: \"\";\n height: calc(100% - 8px);\n width: calc(50% - 4px);\n left: 4px;\n bottom: 4px;\n background-color: white;\n transition: all 0.4s ease;\n}\n.toggle__slider.with-icon {\n background-color: var(--N000) !important;\n}\n.toggle__slider.with-icon svg {\n position: absolute;\n content: \"\";\n top: -1px;\n left: -1px;\n background-color: var(--N300);\n transition: all 0.4s ease;\n}\n\ninput:checked + .toggle__slider {\n background-color: var(--color);\n}\ninput:checked + .toggle__slider:before {\n transform: translateX(100%);\n}\ninput:checked + .toggle__slider.with-icon svg {\n transform: translateX(100%);\n background-color: var(--color);\n}\n\ninput:focus + .toggle__slider {\n box-shadow: 0 0 1px var(--color);\n}";
|
|
22679
22557
|
styleInject(css_248z$2);
|
|
22680
22558
|
|
|
22681
22559
|
var Toggle = function (_a) {
|
|
22682
22560
|
var _b;
|
|
22683
|
-
var _c = _a.selected, selected = _c === void 0 ? false : _c, _d = _a.onSelect, onSelect = _d === void 0 ? null : _d, _e = _a.color, color = _e === void 0 ?
|
|
22684
|
-
var
|
|
22561
|
+
var _c = _a.selected, selected = _c === void 0 ? false : _c, _d = _a.onSelect, onSelect = _d === void 0 ? null : _d, _e = _a.color, color = _e === void 0 ? '#36b37e' : _e, _f = _a.rootClassName, rootClassName = _f === void 0 ? '' : _f, _g = _a.disabled, disabled = _g === void 0 ? false : _g, _h = _a.dataTestId, dataTestId = _h === void 0 ? 'handle-toggle-button' : _h, _j = _a.Icon, Icon = _j === void 0 ? null : _j, props = __rest(_a, ["selected", "onSelect", "color", "rootClassName", "disabled", "dataTestId", "Icon"]);
|
|
22562
|
+
var _k = __read(React.useState(selected), 2), active = _k[0], setActive = _k[1];
|
|
22685
22563
|
useEffectAfterMount(function () {
|
|
22686
22564
|
if (typeof onSelect === 'function') {
|
|
22687
22565
|
if (active !== selected) {
|
|
@@ -22697,7 +22575,7 @@ var Toggle = function (_a) {
|
|
|
22697
22575
|
setActive(function (active) { return !active; });
|
|
22698
22576
|
}
|
|
22699
22577
|
}
|
|
22700
|
-
return (jsxRuntime.jsxs("label", __assign({}, props, { className: "".concat(rootClassName, " toggle__switch ").concat(disabled ? 'disabled' : ''), style: (_b = {}, _b['--color'] = color, _b) }, { children: [jsxRuntime.jsx("input", { type: "checkbox", checked: !!active, onChange: handleClick, className: "toggle__input" }), jsxRuntime.jsx("span", { className: "toggle__slider round
|
|
22578
|
+
return (jsxRuntime.jsxs("label", __assign({}, props, { className: "".concat(rootClassName, " toggle__switch ").concat(disabled ? 'disabled' : ''), style: (_b = {}, _b['--color'] = color, _b) }, { children: [jsxRuntime.jsx("input", { type: "checkbox", checked: !!active, onChange: handleClick, className: "toggle__input" }), jsxRuntime.jsx("span", __assign({ className: "toggle__slider ".concat(Icon ? 'with-icon br-4 dc__border' : 'round'), "data-testid": dataTestId }, { children: Icon && jsxRuntime.jsx(Icon, { className: "icon-dim-20 br-4" }) }))] })));
|
|
22701
22579
|
};
|
|
22702
22580
|
|
|
22703
22581
|
var css_248z$1 = ".modal-body--scan-details {\n position: fixed;\n top: 0;\n right: 0;\n background: var(--N000);\n width: 800px;\n}\n\n.security-tab__table {\n width: 100%;\n}\n\n.security-tab__table-header {\n border-bottom: solid 1px var(--N200);\n}\n\n.security-cell-header {\n font-size: 12px;\n font-weight: 600;\n line-height: 1.5;\n letter-spacing: normal;\n text-transform: uppercase;\n color: var(--N500);\n}\n\n.dc__security-tab__table-row {\n font-size: 13px;\n font-weight: normal;\n line-height: 1.54;\n letter-spacing: normal;\n color: var(--N900);\n box-shadow: inset 0 -1px 0 0 #f5f5f5;\n}\n\n.security-tab__cell-cve,\n.security-tab__cell-severity,\n.security-tab__cell-package,\n.security-tab__cell-current-ver,\n.security-tab__cell-fixed-ver,\n.security-tab__cell-policy {\n padding: 10px;\n}\n\n.security-tab__cell-cve {\n padding-left: 0px;\n text-align: left;\n width: 20%;\n}\n\n.security-tab__cell-policy {\n padding-right: 0px;\n}\n\n.security-tab__cell-policy--whitelist,\n.security-tab__cell-policy--whitelisted {\n color: var(--G500);\n text-transform: capitalize;\n}\n\n.security-tab__cell-policy--block {\n color: var(--R500);\n text-transform: capitalize;\n}\n\n.scanned-object__results {\n margin: 0 20px;\n}";
|
|
@@ -23252,7 +23130,7 @@ var ImageTagsContainer = function (_a) {
|
|
|
23252
23130
|
}
|
|
23253
23131
|
handleSave(tagsToBeCreated);
|
|
23254
23132
|
};
|
|
23255
|
-
return (jsxRuntime.jsx("div", __assign({ className: "mt-8" }, { children: isEditing && tagsEditable ? (jsxRuntime.jsxs("div", __assign({ className: "bcn-0 dc__border-top-n1 " }, { children: [jsxRuntime.jsxs("div", __assign({ className: "cn-7 mt-12 flex left" }, { children: [jsxRuntime.jsx("div", { children: "Release tags (eg. v1.0)" }), renderInfoCard()] })), jsxRuntime.jsxs("div", __assign({ className: "mt-6 dc__position-rel-imp", "data-testid": "add-tag-text-area" }, { children: [jsxRuntime.jsx("input", { className: "form__input
|
|
23133
|
+
return (jsxRuntime.jsx("div", __assign({ className: "mt-8" }, { children: isEditing && tagsEditable ? (jsxRuntime.jsxs("div", __assign({ className: "bcn-0 dc__border-top-n1 " }, { children: [jsxRuntime.jsxs("div", __assign({ className: "cn-7 mt-12 flex left" }, { children: [jsxRuntime.jsx("div", { children: "Release tags (eg. v1.0)" }), renderInfoCard()] })), jsxRuntime.jsxs("div", __assign({ className: "mt-6 dc__position-rel-imp", "data-testid": "add-tag-text-area" }, { children: [jsxRuntime.jsx("input", { className: "form__input", value: textInput, onChange: setInputValue, placeholder: "Type a tag and press enter", onKeyDown: handleKeydown, onBlur: setInputValue, ref: creatableRef }), textInput.length > 0 && (jsxRuntime.jsxs("div", __assign({ onClick: enterTagCreate, className: "dc__position-abs bcn-0 flex cursor pt-2 pb-2 pr-4 pl-4 br-2 cn-7 dc__border dc__border-bottom-2", style: {
|
|
23256
23134
|
top: '50%',
|
|
23257
23135
|
fontFamily: 'monospace',
|
|
23258
23136
|
right: '8px',
|
|
@@ -23263,7 +23141,7 @@ var ImageTagsContainer = function (_a) {
|
|
|
23263
23141
|
}, onHardDeleteClick: function (e) {
|
|
23264
23142
|
stopPropagation(e);
|
|
23265
23143
|
handleTagHardDelete(index);
|
|
23266
|
-
}, tagId: tag.id, softDeleteTags: softDeleteTags, isSuperAdmin: isSuperAdmin, duplicateTag: tag === null || tag === void 0 ? void 0 : tag.duplicateTag, hideHardDelete: hideHardDelete }, tag.id)); }) })), showTagsWarning && (jsxRuntime.jsxs("div", __assign({ className: "cn-7 mb-8 flex left" }, { children: [jsxRuntime.jsx(SvgIcInfoFilled, { className: "form__icon--info icon-dim-16 mr-2" }), "Tags cannot be edited/removed later"] }))), jsxRuntime.jsx("div", __assign({ className: "cn-7 mt-12" }, { children: "Comment" })), jsxRuntime.jsx("div", __assign({ className: "flex left flex-wrap dc__gap-8 w-100 mt-6 mb-12", "data-testid": "add-image-comment-text-area" }, { children: jsxRuntime.jsx("textarea", { value: newDescription, onChange: handleDescriptionChange, className: "flex left flex-wrap dc__gap-8 dc__description-textarea
|
|
23144
|
+
}, tagId: tag.id, softDeleteTags: softDeleteTags, isSuperAdmin: isSuperAdmin, duplicateTag: tag === null || tag === void 0 ? void 0 : tag.duplicateTag, hideHardDelete: hideHardDelete }, tag.id)); }) })), showTagsWarning && (jsxRuntime.jsxs("div", __assign({ className: "cn-7 mb-8 flex left" }, { children: [jsxRuntime.jsx(SvgIcInfoFilled, { className: "form__icon--info icon-dim-16 mr-2" }), "Tags cannot be edited/removed later"] }))), jsxRuntime.jsx("div", __assign({ className: "cn-7 mt-12" }, { children: "Comment" })), jsxRuntime.jsx("div", __assign({ className: "flex left flex-wrap dc__gap-8 w-100 mt-6 mb-12", "data-testid": "add-image-comment-text-area" }, { children: jsxRuntime.jsx("textarea", { value: newDescription, onChange: handleDescriptionChange, className: "flex left flex-wrap dc__gap-8 dc__description-textarea", style: { height: '90px !important' } }) })), descriptionValidationMessage !== '' && (jsxRuntime.jsxs("div", __assign({ className: "flex left" }, { children: [jsxRuntime.jsx(SvgIcWarning, { className: "form__icon form__icon--error" }), jsxRuntime.jsx("div", __assign({ className: "form__error" }, { children: descriptionValidationMessage }))] }))), jsxRuntime.jsxs("div", __assign({ className: "w-100 flex right mt-12" }, { children: [jsxRuntime.jsx("button", __assign({ className: "cta flex cancel h-32 lh-32-imp", type: "button", onClick: function (e) {
|
|
23267
23145
|
stopPropagation(e);
|
|
23268
23146
|
handleCancel();
|
|
23269
23147
|
} }, { children: "Cancel" })), jsxRuntime.jsx("button", __assign({ className: "cta flex h-32 lh-32-imp ml-12", "data-testid": "save-tags-button", type: "button", onClick: function (e) {
|
|
@@ -23357,7 +23235,6 @@ exports.ScanVulnerabilitiesTable = ScanVulnerabilitiesTable;
|
|
|
23357
23235
|
exports.ServerError = ServerError;
|
|
23358
23236
|
exports.ServerErrors = ServerErrors;
|
|
23359
23237
|
exports.SingleSelectOption = SingleSelectOption;
|
|
23360
|
-
exports.SourceTypeMap = SourceTypeMap;
|
|
23361
23238
|
exports.StyledRadioGroup = RadioGroup;
|
|
23362
23239
|
exports.TOAST_ACCESS_DENIED = TOAST_ACCESS_DENIED;
|
|
23363
23240
|
exports.TOKEN_COOKIE_NAME = TOKEN_COOKIE_NAME;
|
|
@@ -23373,11 +23250,8 @@ exports.TriggerTypeMap = TriggerTypeMap;
|
|
|
23373
23250
|
exports.URLS = URLS;
|
|
23374
23251
|
exports.VisibleModal = VisibleModal;
|
|
23375
23252
|
exports.VisibleModal2 = VisibleModal2;
|
|
23376
|
-
exports.createGitCommitUrl = createGitCommitUrl;
|
|
23377
|
-
exports.extractImage = extractImage;
|
|
23378
23253
|
exports.get = get;
|
|
23379
23254
|
exports.getAlphabetIcon = getAlphabetIcon;
|
|
23380
|
-
exports.getCDMaterials = getCDMaterials;
|
|
23381
23255
|
exports.getCookie = getCookie;
|
|
23382
23256
|
exports.getEmptyArrayOfLength = getEmptyArrayOfLength;
|
|
23383
23257
|
exports.getLoginInfo = getLoginInfo;
|
|
@@ -23399,5 +23273,4 @@ exports.trash = trash;
|
|
|
23399
23273
|
exports.useBreadcrumb = useBreadcrumb;
|
|
23400
23274
|
exports.useEffectAfterMount = useEffectAfterMount;
|
|
23401
23275
|
exports.useForm = useForm;
|
|
23402
|
-
exports.useSearchString = useSearchString;
|
|
23403
23276
|
exports.useThrottledEffect = useThrottledEffect;
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
2
1
|
import {get, post} from './Api';
|
|
3
2
|
import { ROUTES } from './Constants'
|
|
4
3
|
import { sortCallback } from './Helper';
|
|
5
|
-
import { TeamList ,ResponseType
|
|
4
|
+
import { TeamList ,ResponseType } from './Types';
|
|
6
5
|
|
|
7
6
|
export const getTeamListMin = (): Promise<TeamList> => {
|
|
8
7
|
// ignore active field
|
|
@@ -30,128 +29,10 @@ interface UserRole extends ResponseType {
|
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
let stageMap = {
|
|
34
|
-
PRECD: 'PRE',
|
|
35
|
-
CD: 'DEPLOY',
|
|
36
|
-
POSTCD: 'POST',
|
|
37
|
-
APPROVAL: 'APPROVAL',
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const SourceTypeMap = {
|
|
41
|
-
BranchFixed: 'SOURCE_TYPE_BRANCH_FIXED',
|
|
42
|
-
WEBHOOK: 'WEBHOOK',
|
|
43
|
-
BranchRegex: 'SOURCE_TYPE_BRANCH_REGEX',
|
|
44
|
-
}
|
|
45
|
-
|
|
46
32
|
export function getUserRole(appName?: string): Promise<UserRole> {
|
|
47
33
|
return get(`${ROUTES.USER_CHECK_ROLE}${appName ? `?appName=${appName}` : ''}`)
|
|
48
34
|
}
|
|
49
35
|
|
|
50
36
|
export function setImageTags(request, pipelineId: number, artifactId: number){
|
|
51
37
|
return post(`${ROUTES.IMAGE_TAGGING}/${pipelineId}/${artifactId}`,request )
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export const getCDMaterials = (
|
|
55
|
-
cdMaterialId,
|
|
56
|
-
stageType: DeploymentNodeType,
|
|
57
|
-
abortSignal: AbortSignal,
|
|
58
|
-
isApprovalNode?: boolean,
|
|
59
|
-
imageTag?: string): Promise<any> => {
|
|
60
|
-
const URL = (!imageTag) ? `app/cd-pipeline/${cdMaterialId}/material?stage=${stageMap[stageType]}` : `app/cd-pipeline/${cdMaterialId}/material?stage=${stageMap[stageType]}&search=${imageTag}`
|
|
61
|
-
|
|
62
|
-
return get(URL, {
|
|
63
|
-
signal: abortSignal,
|
|
64
|
-
}).then((response) => {
|
|
65
|
-
let artifacts = response.result.ci_artifacts ?? []
|
|
66
|
-
if (!response.result) {
|
|
67
|
-
return {
|
|
68
|
-
materials: [],
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
const materials = artifacts.map((material, index) => {
|
|
73
|
-
let artifactStatusValue = ''
|
|
74
|
-
return {
|
|
75
|
-
index,
|
|
76
|
-
id: material.id,
|
|
77
|
-
deployedTime: material.deployed_time
|
|
78
|
-
? moment(material.deployed_time).format('ddd, DD MMM YYYY, hh:mm A')
|
|
79
|
-
: 'Not Deployed',
|
|
80
|
-
deployedBy: material.deployedBy,
|
|
81
|
-
wfrId: material.wfrId,
|
|
82
|
-
image: extractImage(material.image),
|
|
83
|
-
showChanges: false,
|
|
84
|
-
vulnerabilities: [],
|
|
85
|
-
buildTime: material.build_time || '',
|
|
86
|
-
tab: CDModalTab.Changes,
|
|
87
|
-
showSourceInfo: false,
|
|
88
|
-
deployed: material.deployed || false,
|
|
89
|
-
latest: material.latest || false,
|
|
90
|
-
vulnerabilitiesLoading: true,
|
|
91
|
-
scanned: material.scanned,
|
|
92
|
-
scanEnabled: material.scanEnabled,
|
|
93
|
-
isSelected: !material.vulnerable && index === 0,
|
|
94
|
-
vulnerable: material.vulnerable,
|
|
95
|
-
runningOnParentCd: material.runningOnParentCd,
|
|
96
|
-
artifactStatus: artifactStatusValue,
|
|
97
|
-
userApprovalMetadata: material.userApprovalMetadata,
|
|
98
|
-
triggeredBy: material.triggeredBy,
|
|
99
|
-
isVirtualEnvironment: material.isVirtualEnvironment,
|
|
100
|
-
imageComment: material.imageComment,
|
|
101
|
-
imageReleaseTags: material.imageReleaseTags,
|
|
102
|
-
materialInfo: material.material_info
|
|
103
|
-
? material.material_info.map((mat) => {
|
|
104
|
-
return {
|
|
105
|
-
modifiedTime: mat.modifiedTime ? moment(mat.modifiedTime).format("ddd, DD MMM YYYY, hh:mm A") : '',
|
|
106
|
-
commitLink: createGitCommitUrl(mat.url, mat.revision),
|
|
107
|
-
author: mat.author || '',
|
|
108
|
-
message: mat.message || '',
|
|
109
|
-
revision: mat.revision || '',
|
|
110
|
-
tag: mat.tag || '',
|
|
111
|
-
webhookData: mat.webhookData || '',
|
|
112
|
-
url: mat.url || '',
|
|
113
|
-
branch:
|
|
114
|
-
(material.ciConfigureSourceType === SourceTypeMap.WEBHOOK
|
|
115
|
-
? material.ciConfigureSourceValue
|
|
116
|
-
: mat.branch) || '',
|
|
117
|
-
type: material.ciConfigureSourceType || '',
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
: [],
|
|
121
|
-
}
|
|
122
|
-
})
|
|
123
|
-
return {
|
|
124
|
-
materials: materials
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
})
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function extractImage(image: string): string {
|
|
131
|
-
return image ? image.split(':').pop() : ''
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export function createGitCommitUrl(url: string, revision: string): string {
|
|
135
|
-
if (!url || !revision) {
|
|
136
|
-
return "NA"
|
|
137
|
-
}
|
|
138
|
-
if (url.indexOf("gitlab") > 0 || url.indexOf("github") > 0 || url.indexOf("azure") > 0) {
|
|
139
|
-
let urlpart = url.split("@")
|
|
140
|
-
if (urlpart.length > 1) {
|
|
141
|
-
return "https://" + urlpart[1].split(".git")[0] + "/commit/" + revision
|
|
142
|
-
}
|
|
143
|
-
if (urlpart.length == 1) {
|
|
144
|
-
return urlpart[0].split(".git")[0] + "/commit/" + revision
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
if (url.indexOf("bitbucket") > 0) {
|
|
148
|
-
let urlpart = url.split("@")
|
|
149
|
-
if (urlpart.length > 1) {
|
|
150
|
-
return "https://" + urlpart[1].split(".git")[0] + "/commits/" + revision
|
|
151
|
-
}
|
|
152
|
-
if (urlpart.length == 1) {
|
|
153
|
-
return urlpart[0].split(".git")[0] + "/commits/" + revision
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return "NA"
|
|
157
|
-
}
|
|
38
|
+
}
|
package/src/Common/Helper.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useEffect,
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
2
|
import { ServerErrors } from './ServerError'
|
|
3
3
|
import { toast } from 'react-toastify'
|
|
4
4
|
import * as Sentry from '@sentry/browser'
|
|
@@ -6,8 +6,6 @@ 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
8
|
import moment from 'moment';
|
|
9
|
-
import { UseSearchString } from './Types'
|
|
10
|
-
import { useLocation } from 'react-router-dom'
|
|
11
9
|
|
|
12
10
|
toast.configure({
|
|
13
11
|
autoClose: 3000,
|
|
@@ -348,24 +346,3 @@ export function handleUTCTime(ts: string, isRelativeTime = false) {
|
|
|
348
346
|
}
|
|
349
347
|
return timestamp;
|
|
350
348
|
}
|
|
351
|
-
|
|
352
|
-
export function useSearchString(): UseSearchString {
|
|
353
|
-
const location = useLocation()
|
|
354
|
-
const queryParams: URLSearchParams = useMemo(() => {
|
|
355
|
-
const queryParams = new URLSearchParams(location.search)
|
|
356
|
-
return queryParams
|
|
357
|
-
}, [location])
|
|
358
|
-
|
|
359
|
-
// const searchParams={}
|
|
360
|
-
// for (let [key, value] of queryParams.entries()){
|
|
361
|
-
// searchParams[key]=value
|
|
362
|
-
// }
|
|
363
|
-
const searchParams = Array.from(queryParams.entries()).reduce((agg, curr, idx) => {
|
|
364
|
-
agg[curr[0]] = curr[1]
|
|
365
|
-
return agg
|
|
366
|
-
}, {})
|
|
367
|
-
|
|
368
|
-
return { queryParams, searchParams }
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
|
package/src/Common/ImageTags.tsx
CHANGED
|
@@ -352,7 +352,7 @@ export const ImageTagsContainer = ({
|
|
|
352
352
|
</div>
|
|
353
353
|
<div className="mt-6 dc__position-rel-imp" data-testid="add-tag-text-area">
|
|
354
354
|
<input
|
|
355
|
-
className="form__input
|
|
355
|
+
className="form__input"
|
|
356
356
|
value={textInput}
|
|
357
357
|
onChange={setInputValue}
|
|
358
358
|
placeholder="Type a tag and press enter"
|
|
@@ -420,7 +420,7 @@ export const ImageTagsContainer = ({
|
|
|
420
420
|
<textarea
|
|
421
421
|
value={newDescription}
|
|
422
422
|
onChange={handleDescriptionChange}
|
|
423
|
-
className="flex left flex-wrap dc__gap-8 dc__description-textarea
|
|
423
|
+
className="flex left flex-wrap dc__gap-8 dc__description-textarea"
|
|
424
424
|
style={{ height: '90px !important' }}
|
|
425
425
|
/>
|
|
426
426
|
</div>
|
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
width: 100%;
|
|
5
5
|
height: 100%;
|
|
6
6
|
|
|
7
|
-
&.disabled{
|
|
7
|
+
&.disabled {
|
|
8
8
|
cursor: not-allowed;
|
|
9
|
-
.toggle__slider{
|
|
9
|
+
.toggle__slider {
|
|
10
10
|
cursor: not-allowed;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
/* Hide default HTML checkbox */
|
|
17
16
|
|
|
18
17
|
.toggle__switch input {
|
|
@@ -21,7 +20,6 @@
|
|
|
21
20
|
height: 0;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
|
|
25
23
|
/* The slider */
|
|
26
24
|
|
|
27
25
|
.toggle__slider {
|
|
@@ -32,39 +30,49 @@
|
|
|
32
30
|
right: 0;
|
|
33
31
|
bottom: 0;
|
|
34
32
|
background-color: #ccc;
|
|
35
|
-
transition: all .4s ease;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.toggle__slider:before {
|
|
39
|
-
position: absolute;
|
|
40
|
-
content: "";
|
|
41
|
-
height: calc( 100% - 8px);
|
|
42
|
-
width: calc( 50% - 4px);
|
|
43
|
-
left: 4px;
|
|
44
|
-
bottom: 4px;
|
|
45
|
-
background-color: white;
|
|
46
33
|
transition: all 0.4s ease;
|
|
34
|
+
&.round {
|
|
35
|
+
border-radius: 34px;
|
|
36
|
+
&:before {
|
|
37
|
+
border-radius: 50%;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
&:before {
|
|
41
|
+
position: absolute;
|
|
42
|
+
content: '';
|
|
43
|
+
height: calc(100% - 8px);
|
|
44
|
+
width: calc(50% - 4px);
|
|
45
|
+
left: 4px;
|
|
46
|
+
bottom: 4px;
|
|
47
|
+
background-color: white;
|
|
48
|
+
transition: all 0.4s ease;
|
|
49
|
+
}
|
|
50
|
+
&.with-icon {
|
|
51
|
+
background-color: var(--N000) !important;
|
|
52
|
+
svg {
|
|
53
|
+
position: absolute;
|
|
54
|
+
content: '';
|
|
55
|
+
top: -1px;
|
|
56
|
+
left: -1px;
|
|
57
|
+
background-color: var(--N300);
|
|
58
|
+
transition: all 0.4s ease;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
47
61
|
}
|
|
48
62
|
|
|
49
|
-
input:checked
|
|
63
|
+
input:checked + .toggle__slider {
|
|
50
64
|
background-color: var(--color);
|
|
65
|
+
&:before {
|
|
66
|
+
transform: translateX(calc(100%));
|
|
67
|
+
}
|
|
68
|
+
&.with-icon {
|
|
69
|
+
svg {
|
|
70
|
+
transform: translateX(calc(100%));
|
|
71
|
+
background-color: var(--color);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
51
74
|
}
|
|
52
75
|
|
|
53
|
-
input:focus
|
|
76
|
+
input:focus + .toggle__slider {
|
|
54
77
|
box-shadow: 0 0 1px var(--color);
|
|
55
78
|
}
|
|
56
|
-
|
|
57
|
-
input:checked+.toggle__slider:before {
|
|
58
|
-
transform: translateX(calc( 100%));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/* Rounded sliders */
|
|
63
|
-
|
|
64
|
-
.toggle__slider.round {
|
|
65
|
-
border-radius: 34px;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.toggle__slider.round:before {
|
|
69
|
-
border-radius: 50%;
|
|
70
|
-
}
|
|
@@ -1,25 +1,34 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { useEffectAfterMount } from '../Helper'
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useEffectAfterMount } from '../Helper'
|
|
3
3
|
import './Toggle.scss'
|
|
4
4
|
|
|
5
|
-
const Toggle = ({
|
|
6
|
-
|
|
5
|
+
const Toggle = ({
|
|
6
|
+
selected = false,
|
|
7
|
+
onSelect = null,
|
|
8
|
+
color = '#36b37e',
|
|
9
|
+
rootClassName = '',
|
|
10
|
+
disabled = false,
|
|
11
|
+
dataTestId = 'handle-toggle-button',
|
|
12
|
+
Icon = null,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
const [active, setActive] = React.useState(selected)
|
|
7
16
|
|
|
8
|
-
useEffectAfterMount(()=>{
|
|
9
|
-
if(typeof onSelect === 'function'){
|
|
10
|
-
if(active !== selected){
|
|
17
|
+
useEffectAfterMount(() => {
|
|
18
|
+
if (typeof onSelect === 'function') {
|
|
19
|
+
if (active !== selected) {
|
|
11
20
|
onSelect(active)
|
|
12
21
|
}
|
|
13
22
|
}
|
|
14
|
-
},[active])
|
|
23
|
+
}, [active])
|
|
15
24
|
|
|
16
25
|
useEffectAfterMount(() => {
|
|
17
26
|
setActive(selected)
|
|
18
27
|
}, [selected])
|
|
19
28
|
|
|
20
|
-
function handleClick(e){
|
|
21
|
-
if(!disabled){
|
|
22
|
-
setActive(active
|
|
29
|
+
function handleClick(e) {
|
|
30
|
+
if (!disabled) {
|
|
31
|
+
setActive((active) => !active)
|
|
23
32
|
}
|
|
24
33
|
}
|
|
25
34
|
|
|
@@ -30,9 +39,11 @@ const Toggle = ({selected=false, onSelect=null, color="#36b37e", rootClassName="
|
|
|
30
39
|
style={{ ['--color' as any]: color }}
|
|
31
40
|
>
|
|
32
41
|
<input type="checkbox" checked={!!active} onChange={handleClick} className="toggle__input" />
|
|
33
|
-
<span className=
|
|
42
|
+
<span className={`toggle__slider ${Icon ? 'with-icon br-4 dc__border' : 'round'}`} data-testid={dataTestId}>
|
|
43
|
+
{Icon && <Icon className="icon-dim-20 br-4" />}
|
|
44
|
+
</span>
|
|
34
45
|
</label>
|
|
35
46
|
)
|
|
36
47
|
}
|
|
37
48
|
|
|
38
|
-
export default Toggle
|
|
49
|
+
export default Toggle
|
package/src/Common/Types.ts
CHANGED
|
@@ -364,11 +364,4 @@ export interface RegistryTypeDetailType {
|
|
|
364
364
|
registryURL: InputDetailType
|
|
365
365
|
id: InputDetailType
|
|
366
366
|
password: InputDetailType
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
export interface UseSearchString {
|
|
370
|
-
queryParams: URLSearchParams
|
|
371
|
-
searchParams: {
|
|
372
|
-
[key: string]: string
|
|
373
|
-
}
|
|
374
367
|
}
|