@devtron-labs/devtron-fe-common-lib 0.0.7-beta-35 → 0.0.7-beta-37
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/Constants.d.ts +8 -0
- package/dist/Common/Helper.d.ts +9 -1
- package/dist/Common/Security/ScanVulnerabilitiesTable.d.ts +4 -0
- package/dist/Common/Toggle/Toggle.d.ts +12 -0
- package/dist/Common/Types.d.ts +131 -0
- package/dist/Common/index.d.ts +2 -0
- package/dist/index.js +148 -9
- package/package.json +1 -1
- package/src/Common/Api.ts +7 -1
- package/src/Common/Constants.ts +11 -2
- package/src/Common/Helper.tsx +80 -2
- package/src/Common/Security/ScanVulnerabilitiesTable.tsx +55 -0
- package/src/Common/Security/scanVulnerabilities.css +67 -0
- package/src/Common/Toggle/Toggle.scss +70 -0
- package/src/Common/Toggle/Toggle.tsx +38 -0
- package/src/Common/Types.ts +143 -0
- package/src/Common/index.ts +2 -1
|
@@ -11,6 +11,9 @@ export declare const PATTERNS: {
|
|
|
11
11
|
START_END_ALPHANUMERIC: RegExp;
|
|
12
12
|
ALPHANUMERIC_WITH_SPECIAL_CHAR: RegExp;
|
|
13
13
|
};
|
|
14
|
+
export declare const URLS: {
|
|
15
|
+
LOGIN_SSO: string;
|
|
16
|
+
};
|
|
14
17
|
export declare const ROUTES: {
|
|
15
18
|
PROJECT_LIST_MIN: string;
|
|
16
19
|
};
|
|
@@ -40,3 +43,8 @@ export declare const ERROR_EMPTY_SCREEN: {
|
|
|
40
43
|
FORBIDDEN: string;
|
|
41
44
|
REQUIRED_MANAGER_ACCESS: string;
|
|
42
45
|
};
|
|
46
|
+
export declare const TOKEN_COOKIE_NAME = "argocd.token";
|
|
47
|
+
export declare const TriggerTypeMap: {
|
|
48
|
+
automatic: string;
|
|
49
|
+
manual: string;
|
|
50
|
+
};
|
package/dist/Common/Helper.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export declare function showError(serverError: any, showToastOnUnknownError?: boolean, hideAccessError?: boolean): void;
|
|
3
3
|
interface ConditionalWrapper<T> {
|
|
4
4
|
condition: boolean;
|
|
@@ -9,4 +9,12 @@ export declare const ConditionalWrap: React.FC<ConditionalWrapper<any>>;
|
|
|
9
9
|
export declare function sortCallback(key: string, a: any, b: any, isCaseSensitive?: boolean): 1 | -1 | 0;
|
|
10
10
|
export declare const stopPropagation: (event: any) => void;
|
|
11
11
|
export declare function useThrottledEffect(callback: any, delay: any, deps?: any[]): void;
|
|
12
|
+
export declare function getRandomColor(email: string): string;
|
|
13
|
+
export declare const getAlphabetIcon: (str: string) => JSX.Element;
|
|
14
|
+
export declare const getEmptyArrayOfLength: (length: number) => unknown[];
|
|
15
|
+
export declare function noop(...args: any[]): any;
|
|
16
|
+
export declare function not(e: any): boolean;
|
|
17
|
+
export declare function useEffectAfterMount(cb: any, dependencies: any): void;
|
|
18
|
+
export declare function getCookie(sKey: any): string;
|
|
19
|
+
export declare function getLoginInfo(): any;
|
|
12
20
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './Toggle.scss';
|
|
3
|
+
declare const Toggle: ({ selected, onSelect, color, rootClassName, disabled, dataTestId, ...props }: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
selected?: boolean;
|
|
6
|
+
onSelect?: any;
|
|
7
|
+
color?: string;
|
|
8
|
+
rootClassName?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
dataTestId?: string;
|
|
11
|
+
}) => JSX.Element;
|
|
12
|
+
export default Toggle;
|
package/dist/Common/Types.d.ts
CHANGED
|
@@ -158,3 +158,134 @@ export interface ModalType {
|
|
|
158
158
|
preventWheelDisable?: boolean;
|
|
159
159
|
noBackDrop?: boolean;
|
|
160
160
|
}
|
|
161
|
+
export type CDModalTabType = 'SECURITY' | 'CHANGES';
|
|
162
|
+
export declare const CDModalTab: {
|
|
163
|
+
Security: CDModalTabType;
|
|
164
|
+
Changes: CDModalTabType;
|
|
165
|
+
};
|
|
166
|
+
export declare enum DeploymentNodeType {
|
|
167
|
+
PRECD = "PRECD",
|
|
168
|
+
CD = "CD",
|
|
169
|
+
POSTCD = "POSTCD",
|
|
170
|
+
APPROVAL = "APPROVAL"
|
|
171
|
+
}
|
|
172
|
+
export interface UserApprovalConfigType {
|
|
173
|
+
requiredCount: number;
|
|
174
|
+
}
|
|
175
|
+
interface ApprovalUserDataType {
|
|
176
|
+
dataId: number;
|
|
177
|
+
userActionTime: string;
|
|
178
|
+
userComment: string;
|
|
179
|
+
userEmail: string;
|
|
180
|
+
userId: number;
|
|
181
|
+
userResponse: number;
|
|
182
|
+
}
|
|
183
|
+
export interface UserApprovalMetadataType {
|
|
184
|
+
approvalRequestId: number;
|
|
185
|
+
approvalRuntimeState: number;
|
|
186
|
+
approvedUsersData: ApprovalUserDataType[];
|
|
187
|
+
requestedUserData: ApprovalUserDataType;
|
|
188
|
+
}
|
|
189
|
+
export interface CommonNodeAttr {
|
|
190
|
+
connectingCiPipelineId?: number;
|
|
191
|
+
parents: string | number[] | string[];
|
|
192
|
+
x: number;
|
|
193
|
+
y: number;
|
|
194
|
+
title: string;
|
|
195
|
+
description?: string;
|
|
196
|
+
triggerType?: string;
|
|
197
|
+
id: string;
|
|
198
|
+
icon?: string;
|
|
199
|
+
status?: string;
|
|
200
|
+
isSource: boolean;
|
|
201
|
+
isGitSource: boolean;
|
|
202
|
+
isRoot: boolean;
|
|
203
|
+
downstreams: string[];
|
|
204
|
+
type: 'CI' | 'GIT' | 'PRECD' | 'CD' | 'POSTCD' | 'WEBHOOK';
|
|
205
|
+
parentCiPipeline?: number;
|
|
206
|
+
parentAppId?: number;
|
|
207
|
+
url?: string;
|
|
208
|
+
branch?: string;
|
|
209
|
+
sourceType?: string;
|
|
210
|
+
colorCode?: string;
|
|
211
|
+
isExternalCI?: boolean;
|
|
212
|
+
isLinkedCI?: boolean;
|
|
213
|
+
environmentName?: string;
|
|
214
|
+
environmentId?: number;
|
|
215
|
+
inputMaterialList?: any[];
|
|
216
|
+
rollbackMaterialList?: any[];
|
|
217
|
+
linkedCount?: number;
|
|
218
|
+
deploymentStrategy?: string;
|
|
219
|
+
height: number;
|
|
220
|
+
width: number;
|
|
221
|
+
preNode?: CommonNodeAttr;
|
|
222
|
+
postNode?: CommonNodeAttr;
|
|
223
|
+
stageIndex?: number;
|
|
224
|
+
sourceNodes?: Array<CommonNodeAttr>;
|
|
225
|
+
downstreamNodes?: Array<CommonNodeAttr>;
|
|
226
|
+
parentPipelineId?: string;
|
|
227
|
+
parentPipelineType?: string;
|
|
228
|
+
parentEnvironmentName?: string;
|
|
229
|
+
isRegex?: boolean;
|
|
230
|
+
regex?: string;
|
|
231
|
+
primaryBranchAfterRegex?: string;
|
|
232
|
+
storageConfigured?: boolean;
|
|
233
|
+
deploymentAppDeleteRequest?: boolean;
|
|
234
|
+
approvalUsers?: string[];
|
|
235
|
+
userApprovalConfig?: UserApprovalConfigType;
|
|
236
|
+
requestedUserId?: number;
|
|
237
|
+
}
|
|
238
|
+
export interface VulnerabilityType {
|
|
239
|
+
name: string;
|
|
240
|
+
severity: "CRITICAL" | "MODERATE" | "LOW";
|
|
241
|
+
package: string;
|
|
242
|
+
version: string;
|
|
243
|
+
fixedVersion: string;
|
|
244
|
+
policy: string;
|
|
245
|
+
url?: string;
|
|
246
|
+
}
|
|
247
|
+
export interface ScanVulnerabilitiesTableProps {
|
|
248
|
+
vulnerabilities: VulnerabilityType[];
|
|
249
|
+
}
|
|
250
|
+
export interface MaterialInfo {
|
|
251
|
+
revision: string;
|
|
252
|
+
modifiedTime: string | Date;
|
|
253
|
+
author: string;
|
|
254
|
+
message: string;
|
|
255
|
+
commitLink: string;
|
|
256
|
+
tag: string;
|
|
257
|
+
webhookData: string;
|
|
258
|
+
branch: string;
|
|
259
|
+
url?: string;
|
|
260
|
+
type?: string;
|
|
261
|
+
}
|
|
262
|
+
export interface CDMaterialType {
|
|
263
|
+
index: number;
|
|
264
|
+
id: string;
|
|
265
|
+
materialInfo: MaterialInfo[];
|
|
266
|
+
tab: CDModalTabType;
|
|
267
|
+
scanEnabled: boolean;
|
|
268
|
+
scanned: boolean;
|
|
269
|
+
vulnerabilitiesLoading: boolean;
|
|
270
|
+
lastExecution: string;
|
|
271
|
+
vulnerabilities: VulnerabilityType[];
|
|
272
|
+
vulnerable: boolean;
|
|
273
|
+
deployedTime: string;
|
|
274
|
+
deployedBy?: string;
|
|
275
|
+
wfrId?: number;
|
|
276
|
+
buildTime: string;
|
|
277
|
+
image: string;
|
|
278
|
+
isSelected: boolean;
|
|
279
|
+
showSourceInfo: boolean;
|
|
280
|
+
latest: boolean;
|
|
281
|
+
runningOnParentCd?: boolean;
|
|
282
|
+
userApprovalMetadata?: UserApprovalMetadataType;
|
|
283
|
+
triggeredBy?: number;
|
|
284
|
+
}
|
|
285
|
+
export interface CDMaterialResponseType {
|
|
286
|
+
approvalUsers: string[];
|
|
287
|
+
materials: any[];
|
|
288
|
+
userApprovalConfig: UserApprovalConfigType;
|
|
289
|
+
requestedUserId: number;
|
|
290
|
+
}
|
|
291
|
+
export {};
|
package/dist/Common/index.d.ts
CHANGED
|
@@ -26,3 +26,5 @@ export * from './Common.service';
|
|
|
26
26
|
export * from './Checkbox';
|
|
27
27
|
export { default as EmptyState } from './EmptyState/EmptyState';
|
|
28
28
|
export { default as GenericEmptyState } from './EmptyState/GenericEmptyState';
|
|
29
|
+
export { default as Toggle } from './Toggle/Toggle';
|
|
30
|
+
export { default as ScanVulnerabilitiesTable } from './Security/ScanVulnerabilitiesTable';
|
package/dist/index.js
CHANGED
|
@@ -37,6 +37,9 @@ var PATTERNS = {
|
|
|
37
37
|
START_END_ALPHANUMERIC: /^([Az09].*[A-Za-z0-9])$|[A-Za-z0-9]$/,
|
|
38
38
|
ALPHANUMERIC_WITH_SPECIAL_CHAR: /^[A-Za-z0-9._-]+$/, // allow alphanumeric,(.) ,(-),(_)
|
|
39
39
|
};
|
|
40
|
+
var URLS = {
|
|
41
|
+
LOGIN_SSO: '/login/sso',
|
|
42
|
+
};
|
|
40
43
|
var ROUTES = {
|
|
41
44
|
PROJECT_LIST_MIN: 'team/autocomplete',
|
|
42
45
|
};
|
|
@@ -67,6 +70,11 @@ var ERROR_EMPTY_SCREEN = {
|
|
|
67
70
|
UNAUTHORIZED: 'unauthorized',
|
|
68
71
|
FORBIDDEN: 'forbidden',
|
|
69
72
|
REQUIRED_MANAGER_ACCESS: 'Looks like you don’t have access to information on this page. Please contact your manager to request access.',
|
|
73
|
+
};
|
|
74
|
+
var TOKEN_COOKIE_NAME = 'argocd.token';
|
|
75
|
+
var TriggerTypeMap = {
|
|
76
|
+
automatic: 'Auto',
|
|
77
|
+
manual: 'Manual',
|
|
70
78
|
};
|
|
71
79
|
|
|
72
80
|
/******************************************************************************
|
|
@@ -229,7 +237,18 @@ exports.ImageType = void 0;
|
|
|
229
237
|
(function (ImageType) {
|
|
230
238
|
ImageType["Large"] = "large";
|
|
231
239
|
ImageType["Medium"] = "medium";
|
|
232
|
-
})(exports.ImageType || (exports.ImageType = {}));
|
|
240
|
+
})(exports.ImageType || (exports.ImageType = {}));
|
|
241
|
+
var CDModalTab = {
|
|
242
|
+
Security: 'SECURITY',
|
|
243
|
+
Changes: 'CHANGES',
|
|
244
|
+
};
|
|
245
|
+
exports.DeploymentNodeType = void 0;
|
|
246
|
+
(function (DeploymentNodeType) {
|
|
247
|
+
DeploymentNodeType["PRECD"] = "PRECD";
|
|
248
|
+
DeploymentNodeType["CD"] = "CD";
|
|
249
|
+
DeploymentNodeType["POSTCD"] = "POSTCD";
|
|
250
|
+
DeploymentNodeType["APPROVAL"] = "APPROVAL";
|
|
251
|
+
})(exports.DeploymentNodeType || (exports.DeploymentNodeType = {}));
|
|
233
252
|
|
|
234
253
|
var responseMessages = {
|
|
235
254
|
100: 'Continue',
|
|
@@ -301,6 +320,10 @@ var responseMessages = {
|
|
|
301
320
|
598: 'Network read timeout error',
|
|
302
321
|
599: 'Network connect timeout error',
|
|
303
322
|
};
|
|
323
|
+
function handleLogout() {
|
|
324
|
+
var continueParam = "".concat(window.location.pathname.replace(process.env.PUBLIC_URL, '')).concat(window.location.search);
|
|
325
|
+
window.location.href = "".concat(window.location.origin).concat(process.env.PUBLIC_URL).concat(URLS.LOGIN_SSO, "?continue=").concat(continueParam);
|
|
326
|
+
}
|
|
304
327
|
function handleServerError(contentType, response) {
|
|
305
328
|
return __awaiter(this, void 0, void 0, function () {
|
|
306
329
|
var code, status, serverError, responseBody;
|
|
@@ -362,6 +385,7 @@ function fetchAPI(url, type, data, signal, preventAutoLogout, isMultipartRequest
|
|
|
362
385
|
});
|
|
363
386
|
}
|
|
364
387
|
else {
|
|
388
|
+
handleLogout();
|
|
365
389
|
return [2 /*return*/, { code: 401, status: 'Unauthorized', result: [] }];
|
|
366
390
|
}
|
|
367
391
|
case 1:
|
|
@@ -476,8 +500,8 @@ function styleInject(css, ref) {
|
|
|
476
500
|
}
|
|
477
501
|
}
|
|
478
502
|
|
|
479
|
-
var css_248z$
|
|
480
|
-
styleInject(css_248z$
|
|
503
|
+
var css_248z$5 = ".empty-state {\n height: 100%;\n}\n.empty-state img {\n height: 40%;\n max-height: 200px;\n width: auto;\n max-width: 250px;\n}\n.empty-state svg {\n height: 40%;\n max-height: 200px;\n width: auto;\n}\n.empty-state h1,\n.empty-state h2,\n.empty-state h3,\n.empty-state h4,\n.empty-state h5,\n.empty-state h6 {\n color: var(--N900);\n}\n.empty-state .subtitle {\n font-size: 13px;\n width: 300px;\n font-weight: 400;\n text-align: center;\n line-height: 1.5;\n margin-bottom: 20px;\n}\n.empty-state .cta {\n height: 36px;\n}\n.empty-state p {\n width: 300px;\n text-align: center;\n font-size: 13px;\n color: var(--N700);\n}\n.empty-state strong {\n font-size: 16px;\n margin-bottom: 4px;\n color: var(--N900);\n font-weight: normal;\n}\n.empty-state .select-popup {\n height: min-content;\n max-height: 250px;\n overflow: auto;\n padding: 8px 0;\n}\n.empty-state .empty-state__loader {\n width: 34px;\n height: 34px;\n margin-bottom: 16px;\n}\n.empty-state .empty-state__loading-text {\n font-size: 12px;\n width: 200px;\n font-weight: normal;\n font-stretch: normal;\n font-style: normal;\n line-height: 1.5;\n letter-spacing: normal;\n text-align: center;\n color: var(--N900);\n}\n.empty-state .button__icon {\n width: 16px;\n height: 16px;\n margin-left: 8px;\n}";
|
|
504
|
+
styleInject(css_248z$5);
|
|
481
505
|
|
|
482
506
|
var _g$2;
|
|
483
507
|
function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
|
|
@@ -3981,6 +4005,66 @@ function useThrottledEffect(callback, delay, deps) {
|
|
|
3981
4005
|
clearTimeout(handler);
|
|
3982
4006
|
};
|
|
3983
4007
|
}, __spreadArray([delay], __read(deps), false));
|
|
4008
|
+
}
|
|
4009
|
+
var colors$1 = [
|
|
4010
|
+
'#FFB900',
|
|
4011
|
+
'#D83B01',
|
|
4012
|
+
'#B50E0E',
|
|
4013
|
+
'#E81123',
|
|
4014
|
+
'#B4009E',
|
|
4015
|
+
'#5C2D91',
|
|
4016
|
+
'#0078D7',
|
|
4017
|
+
'#00B4FF',
|
|
4018
|
+
'#008272',
|
|
4019
|
+
'#107C10',
|
|
4020
|
+
];
|
|
4021
|
+
function getRandomColor(email) {
|
|
4022
|
+
var sum = 0;
|
|
4023
|
+
for (var i = 0; i < email.length; i++) {
|
|
4024
|
+
sum += email.charCodeAt(i);
|
|
4025
|
+
}
|
|
4026
|
+
return colors$1[sum % colors$1.length];
|
|
4027
|
+
}
|
|
4028
|
+
var getAlphabetIcon = function (str) {
|
|
4029
|
+
if (!str)
|
|
4030
|
+
return null;
|
|
4031
|
+
return (jsxRuntime.jsx("span", __assign({ className: "alphabet-icon__initial fs-13 icon-dim-20 flex cn-0 mr-8", style: { backgroundColor: getRandomColor(str) } }, { children: str[0] })));
|
|
4032
|
+
};
|
|
4033
|
+
var getEmptyArrayOfLength = function (length) {
|
|
4034
|
+
return Array.from({ length: length });
|
|
4035
|
+
};
|
|
4036
|
+
function noop$1() {
|
|
4037
|
+
}
|
|
4038
|
+
function not(e) {
|
|
4039
|
+
return !e;
|
|
4040
|
+
}
|
|
4041
|
+
function useEffectAfterMount(cb, dependencies) {
|
|
4042
|
+
var justMounted = React.useRef(true);
|
|
4043
|
+
React.useEffect(function () {
|
|
4044
|
+
if (!justMounted.current) {
|
|
4045
|
+
return cb();
|
|
4046
|
+
}
|
|
4047
|
+
justMounted.current = false;
|
|
4048
|
+
}, dependencies);
|
|
4049
|
+
}
|
|
4050
|
+
function getCookie(sKey) {
|
|
4051
|
+
if (!sKey) {
|
|
4052
|
+
return null;
|
|
4053
|
+
}
|
|
4054
|
+
return (document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' + sKey.replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1') || null);
|
|
4055
|
+
}
|
|
4056
|
+
function getLoginInfo() {
|
|
4057
|
+
var argocdToken = getCookie(TOKEN_COOKIE_NAME);
|
|
4058
|
+
if (argocdToken) {
|
|
4059
|
+
var jwts = argocdToken.split('.');
|
|
4060
|
+
try {
|
|
4061
|
+
return JSON.parse(atob(jwts[1]));
|
|
4062
|
+
}
|
|
4063
|
+
catch (err) {
|
|
4064
|
+
console.error('error in setting user ', err);
|
|
4065
|
+
return null;
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
3984
4068
|
}
|
|
3985
4069
|
|
|
3986
4070
|
function Progressing(_a) {
|
|
@@ -4033,8 +4117,8 @@ var VisibleModal = /** @class */ (function (_super) {
|
|
|
4033
4117
|
return VisibleModal;
|
|
4034
4118
|
}(React.Component));
|
|
4035
4119
|
|
|
4036
|
-
var css_248z$
|
|
4037
|
-
styleInject(css_248z$
|
|
4120
|
+
var css_248z$4 = ".drawer {\n position: absolute;\n overflow: hidden;\n}\n.drawer.left, .drawer.right {\n top: 0;\n bottom: 0;\n width: 0;\n transition: width 200ms;\n}\n.drawer.left.show, .drawer.right.show {\n min-width: var(--minWidth);\n width: var(--width);\n max-width: var(--maxWidth);\n}\n.drawer.top, .drawer.bottom {\n left: 0;\n right: 0;\n height: 0;\n transition: height 200ms;\n}\n.drawer.top.show, .drawer.bottom.show {\n height: var(--height);\n}\n.drawer.right {\n right: 0;\n}\n.drawer.left {\n left: 0;\n}\n.drawer.top {\n top: 0;\n}\n.drawer.bottom {\n bottom: 0;\n}";
|
|
4121
|
+
styleInject(css_248z$4);
|
|
4038
4122
|
|
|
4039
4123
|
var Drawer = function (_a) {
|
|
4040
4124
|
var children = _a.children, position = _a.position, height = _a.height, width = _a.width, minWidth = _a.minWidth, maxWidth = _a.maxWidth, parentClassName = _a.parentClassName, onEscape = _a.onEscape;
|
|
@@ -8416,8 +8500,8 @@ var index = /*#__PURE__*/forwardRef( /*#__PURE__*/TippyGenerator(tippy));
|
|
|
8416
8500
|
|
|
8417
8501
|
var Tippy = index;
|
|
8418
8502
|
|
|
8419
|
-
var css_248z$
|
|
8420
|
-
styleInject(css_248z$
|
|
8503
|
+
var css_248z$3 = ".tippy-box[data-animation=shift-toward-subtle][data-state=hidden]{opacity:0}.tippy-box[data-animation=shift-toward-subtle][data-state=hidden][data-placement^=top][data-state=hidden]{transform:translateY(-5px)}.tippy-box[data-animation=shift-toward-subtle][data-state=hidden][data-placement^=bottom][data-state=hidden]{transform:translateY(5px)}.tippy-box[data-animation=shift-toward-subtle][data-state=hidden][data-placement^=left][data-state=hidden]{transform:translateX(-5px)}.tippy-box[data-animation=shift-toward-subtle][data-state=hidden][data-placement^=right][data-state=hidden]{transform:translateX(5px)}";
|
|
8504
|
+
styleInject(css_248z$3);
|
|
8421
8505
|
|
|
8422
8506
|
// This component will handle some of the new tippy designs and interactions
|
|
8423
8507
|
// So this can be updated to support further for new features or interactions
|
|
@@ -16358,8 +16442,8 @@ var CustomSelect = function (props) {
|
|
|
16358
16442
|
return jsxRuntime.jsx(Select, __assign({}, props));
|
|
16359
16443
|
};
|
|
16360
16444
|
|
|
16361
|
-
var css_248z = ".info-bar-container .info_text .success {\n background-color: var(--G100);\n}\n.info-bar-container .warn {\n background: var(--Y100);\n border: solid var(--Y200);\n}\n.info-bar-container .warn .warning-icon path:nth-child(2) {\n fill: var(--Y700);\n}\n.info-bar-container .info_bar {\n background-color: var(--B100);\n border: 1px solid var(--B200);\n}\n.info-bar-container .error_bar {\n background-color: var(--R100);\n border: 1px solid var(--R200);\n}\n.info-bar-container .question-bar {\n background-color: var(--V100);\n border: 1px solid var(--V200);\n}";
|
|
16362
|
-
styleInject(css_248z);
|
|
16445
|
+
var css_248z$2 = ".info-bar-container .info_text .success {\n background-color: var(--G100);\n}\n.info-bar-container .warn {\n background: var(--Y100);\n border: solid var(--Y200);\n}\n.info-bar-container .warn .warning-icon path:nth-child(2) {\n fill: var(--Y700);\n}\n.info-bar-container .info_bar {\n background-color: var(--B100);\n border: 1px solid var(--B200);\n}\n.info-bar-container .error_bar {\n background-color: var(--R100);\n border: 1px solid var(--R200);\n}\n.info-bar-container .question-bar {\n background-color: var(--V100);\n border: 1px solid var(--V200);\n}";
|
|
16446
|
+
styleInject(css_248z$2);
|
|
16363
16447
|
|
|
16364
16448
|
function InfoColourBar(_a) {
|
|
16365
16449
|
var message = _a.message, classname = _a.classname, Icon = _a.Icon, iconClass = _a.iconClass, iconSize = _a.iconSize, renderActionButton = _a.renderActionButton, linkText = _a.linkText, redirectLink = _a.redirectLink, linkOnClick = _a.linkOnClick, linkClass = _a.linkClass, internalLink = _a.internalLink, styles = _a.styles;
|
|
@@ -16419,8 +16503,50 @@ var Checkbox = /** @class */ (function (_super) {
|
|
|
16419
16503
|
return Checkbox;
|
|
16420
16504
|
}(React.Component));
|
|
16421
16505
|
|
|
16506
|
+
var css_248z$1 = ".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\ninput:checked + .toggle__slider {\n background-color: var(--color);\n}\n\ninput:focus + .toggle__slider {\n box-shadow: 0 0 1px var(--color);\n}\n\ninput:checked + .toggle__slider:before {\n transform: translateX(100%);\n}\n\n/* Rounded sliders */\n.toggle__slider.round {\n border-radius: 34px;\n}\n\n.toggle__slider.round:before {\n border-radius: 50%;\n}";
|
|
16507
|
+
styleInject(css_248z$1);
|
|
16508
|
+
|
|
16509
|
+
var Toggle = function (_a) {
|
|
16510
|
+
var _b;
|
|
16511
|
+
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, props = __rest(_a, ["selected", "onSelect", "color", "rootClassName", "disabled", "dataTestId"]);
|
|
16512
|
+
var _j = __read(React.useState(selected), 2), active = _j[0], setActive = _j[1];
|
|
16513
|
+
useEffectAfterMount(function () {
|
|
16514
|
+
if (typeof onSelect === 'function') {
|
|
16515
|
+
if (active !== selected) {
|
|
16516
|
+
onSelect(active);
|
|
16517
|
+
}
|
|
16518
|
+
}
|
|
16519
|
+
}, [active]);
|
|
16520
|
+
useEffectAfterMount(function () {
|
|
16521
|
+
setActive(selected);
|
|
16522
|
+
}, [selected]);
|
|
16523
|
+
function handleClick(e) {
|
|
16524
|
+
if (!disabled) {
|
|
16525
|
+
setActive(function (active) { return !active; });
|
|
16526
|
+
}
|
|
16527
|
+
}
|
|
16528
|
+
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", "data-testid": dataTestId })] })));
|
|
16529
|
+
};
|
|
16530
|
+
|
|
16531
|
+
var css_248z = ".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}";
|
|
16532
|
+
styleInject(css_248z);
|
|
16533
|
+
|
|
16534
|
+
function ScanVulnerabilitiesTable(_a) {
|
|
16535
|
+
var vulnerabilities = _a.vulnerabilities;
|
|
16536
|
+
var renderRow = function (vulnerability) {
|
|
16537
|
+
var _a, _b, _c;
|
|
16538
|
+
return (jsxRuntime.jsxs("tr", __assign({ className: "dc__security-tab__table-row cursor", onClick: function (e) {
|
|
16539
|
+
window.open("https://cve.mitre.org/cgi-bin/cvename.cgi?name=".concat(vulnerability.name), '_blank');
|
|
16540
|
+
} }, { children: [jsxRuntime.jsx("td", __assign({ className: "security-tab__cell-cve dc__cve-cell" }, { children: jsxRuntime.jsx("a", __assign({ href: "https://cve.mitre.org/cgi-bin/cvename.cgi?name=".concat(vulnerability.name), rel: "noopener noreferrer", target: "_blank" }, { children: vulnerability.name })) })), jsxRuntime.jsx("td", __assign({ className: "security-tab__cell-severity" }, { children: jsxRuntime.jsx("span", __assign({ className: "fill-".concat((_a = vulnerability.severity) === null || _a === void 0 ? void 0 : _a.toLowerCase()) }, { children: vulnerability.severity })) })), jsxRuntime.jsx("td", __assign({ className: "security-tab__cell-package" }, { children: vulnerability.package })), jsxRuntime.jsx("td", __assign({ className: "security-tab__cell-current-ver" }, { children: vulnerability.version })), jsxRuntime.jsx("td", __assign({ className: "security-tab__cell-fixed-ver" }, { children: vulnerability.fixedVersion })), jsxRuntime.jsx("td", __assign({ className: "security-tab__cell-policy security-tab__cell-policy--".concat((_b = vulnerability.policy) === null || _b === void 0 ? void 0 : _b.toLowerCase()) }, { children: (_c = vulnerability.policy) === null || _c === void 0 ? void 0 : _c.toLowerCase() }))] })));
|
|
16541
|
+
};
|
|
16542
|
+
return (jsxRuntime.jsx("table", __assign({ className: "security-tab__table" }, { children: jsxRuntime.jsxs("tbody", { children: [jsxRuntime.jsxs("tr", __assign({ className: "security-tab__table-header" }, { children: [jsxRuntime.jsx("th", __assign({ className: "security-cell-header security-tab__cell-cve" }, { children: "CVE" })), jsxRuntime.jsx("th", __assign({ className: "security-cell-header security-tab__cell-severity" }, { children: "Severity" })), jsxRuntime.jsx("th", __assign({ className: "security-cell-header security-tab__cell-package" }, { children: "Package" })), jsxRuntime.jsx("th", __assign({ className: "security-cell-header security-tab__cell-current-ver" }, { children: "Current Version" })), jsxRuntime.jsx("th", __assign({ className: "security-cell-header security-tab__cell-fixed-ver" }, { children: "Fixed In Version" })), jsxRuntime.jsx("th", __assign({ className: "security-cell-header security-tab__cell-policy" }, { children: "Policy" }))] })), vulnerabilities.map(function (vulnerability) {
|
|
16543
|
+
return renderRow(vulnerability);
|
|
16544
|
+
})] }) })));
|
|
16545
|
+
}
|
|
16546
|
+
|
|
16422
16547
|
exports.BreadCrumb = BreadCrumb;
|
|
16423
16548
|
exports.BreadcrumbStore = Store;
|
|
16549
|
+
exports.CDModalTab = CDModalTab;
|
|
16424
16550
|
exports.Checkbox = Checkbox;
|
|
16425
16551
|
exports.ClearIndicator = ClearIndicator;
|
|
16426
16552
|
exports.ConditionalWrap = ConditionalWrap;
|
|
@@ -16458,10 +16584,12 @@ exports.RadioGroupItem = RadioGroupItem;
|
|
|
16458
16584
|
exports.Reload = Reload;
|
|
16459
16585
|
exports.RequestTimeout = RequestTimeout;
|
|
16460
16586
|
exports.ResizableTagTextArea = ResizableTagTextArea;
|
|
16587
|
+
exports.ScanVulnerabilitiesTable = ScanVulnerabilitiesTable;
|
|
16461
16588
|
exports.ServerError = ServerError;
|
|
16462
16589
|
exports.ServerErrors = ServerErrors;
|
|
16463
16590
|
exports.SingleSelectOption = SingleSelectOption;
|
|
16464
16591
|
exports.TOAST_ACCESS_DENIED = TOAST_ACCESS_DENIED;
|
|
16592
|
+
exports.TOKEN_COOKIE_NAME = TOKEN_COOKIE_NAME;
|
|
16465
16593
|
exports.TagDetails = TagDetails;
|
|
16466
16594
|
exports.TagLabelSelect = TagLabelSelect;
|
|
16467
16595
|
exports.TagLabelValueSelector = TagLabelValueSelector;
|
|
@@ -16469,11 +16597,21 @@ exports.TippyCustomized = TippyCustomized;
|
|
|
16469
16597
|
exports.ToastBody = ToastBody;
|
|
16470
16598
|
exports.ToastBody3 = ToastBody3;
|
|
16471
16599
|
exports.ToastBodyWithButton = ToastBodyWithButton;
|
|
16600
|
+
exports.Toggle = Toggle;
|
|
16601
|
+
exports.TriggerTypeMap = TriggerTypeMap;
|
|
16602
|
+
exports.URLS = URLS;
|
|
16472
16603
|
exports.VisibleModal = VisibleModal;
|
|
16473
16604
|
exports.VisibleModal2 = VisibleModal2;
|
|
16474
16605
|
exports.get = get;
|
|
16606
|
+
exports.getAlphabetIcon = getAlphabetIcon;
|
|
16607
|
+
exports.getCookie = getCookie;
|
|
16608
|
+
exports.getEmptyArrayOfLength = getEmptyArrayOfLength;
|
|
16609
|
+
exports.getLoginInfo = getLoginInfo;
|
|
16610
|
+
exports.getRandomColor = getRandomColor;
|
|
16475
16611
|
exports.getTeamListMin = getTeamListMin;
|
|
16476
16612
|
exports.multiSelectStyles = multiSelectStyles;
|
|
16613
|
+
exports.noop = noop$1;
|
|
16614
|
+
exports.not = not;
|
|
16477
16615
|
exports.post = post;
|
|
16478
16616
|
exports.put = put;
|
|
16479
16617
|
exports.showError = showError;
|
|
@@ -16482,4 +16620,5 @@ exports.stopPropagation = stopPropagation;
|
|
|
16482
16620
|
exports.toastAccessDenied = toastAccessDenied;
|
|
16483
16621
|
exports.trash = trash;
|
|
16484
16622
|
exports.useBreadcrumb = useBreadcrumb;
|
|
16623
|
+
exports.useEffectAfterMount = useEffectAfterMount;
|
|
16485
16624
|
exports.useThrottledEffect = useThrottledEffect;
|
package/package.json
CHANGED
package/src/Common/Api.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ServerErrors } from './ServerError'
|
|
2
|
-
import { RequestTimeout, Host } from './Constants'
|
|
2
|
+
import { RequestTimeout, Host, URLS } from './Constants'
|
|
3
3
|
import { ResponseType, APIOptions } from './Types'
|
|
4
4
|
|
|
5
5
|
const responseMessages = {
|
|
@@ -73,6 +73,11 @@ const responseMessages = {
|
|
|
73
73
|
599: 'Network connect timeout error',
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
function handleLogout() {
|
|
77
|
+
const continueParam = `${window.location.pathname.replace(process.env.PUBLIC_URL, '')}${window.location.search}`
|
|
78
|
+
window.location.href = `${window.location.origin}${process.env.PUBLIC_URL}${URLS.LOGIN_SSO}?continue=${continueParam}`
|
|
79
|
+
}
|
|
80
|
+
|
|
76
81
|
async function handleServerError(contentType, response) {
|
|
77
82
|
//Test for HTTP Status Code
|
|
78
83
|
let code: number = response.status
|
|
@@ -126,6 +131,7 @@ async function fetchAPI(
|
|
|
126
131
|
],
|
|
127
132
|
})
|
|
128
133
|
} else {
|
|
134
|
+
handleLogout()
|
|
129
135
|
return { code: 401, status: 'Unauthorized', result: [] }
|
|
130
136
|
}
|
|
131
137
|
} else if (response.status >= 300 && response.status <= 599) {
|
package/src/Common/Constants.ts
CHANGED
|
@@ -14,6 +14,10 @@ export const PATTERNS = {
|
|
|
14
14
|
ALPHANUMERIC_WITH_SPECIAL_CHAR: /^[A-Za-z0-9._-]+$/, // allow alphanumeric,(.) ,(-),(_)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
export const URLS = {
|
|
18
|
+
LOGIN_SSO: '/login/sso',
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
export const ROUTES = {
|
|
18
22
|
PROJECT_LIST_MIN: 'team/autocomplete',
|
|
19
23
|
}
|
|
@@ -44,8 +48,13 @@ export const ERROR_EMPTY_SCREEN = {
|
|
|
44
48
|
TAKE_BACK_HOME: 'Take me home',
|
|
45
49
|
ONLY_FOR_SUPERADMIN: 'Information on this page is available only to superadmin users.',
|
|
46
50
|
NOT_AUTHORIZED: 'Not authorized',
|
|
47
|
-
UNAUTHORIZED:'unauthorized',
|
|
48
|
-
FORBIDDEN:'forbidden',
|
|
51
|
+
UNAUTHORIZED: 'unauthorized',
|
|
52
|
+
FORBIDDEN: 'forbidden',
|
|
49
53
|
REQUIRED_MANAGER_ACCESS:
|
|
50
54
|
'Looks like you don’t have access to information on this page. Please contact your manager to request access.',
|
|
51
55
|
}
|
|
56
|
+
export const TOKEN_COOKIE_NAME = 'argocd.token'
|
|
57
|
+
export const TriggerTypeMap = {
|
|
58
|
+
automatic: 'Auto',
|
|
59
|
+
manual: 'Manual',
|
|
60
|
+
}
|
package/src/Common/Helper.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react'
|
|
1
2
|
import { ServerErrors } from './ServerError'
|
|
2
3
|
import { toast } from 'react-toastify'
|
|
3
4
|
import * as Sentry from '@sentry/browser'
|
|
4
5
|
import { toastAccessDenied } from './ToastBody'
|
|
5
|
-
import {
|
|
6
|
-
import { ERROR_EMPTY_SCREEN } from './Constants'
|
|
6
|
+
import { ERROR_EMPTY_SCREEN, TOKEN_COOKIE_NAME } from './Constants'
|
|
7
7
|
|
|
8
8
|
toast.configure({
|
|
9
9
|
autoClose: 3000,
|
|
@@ -90,3 +90,81 @@ export function useThrottledEffect(callback, delay, deps = []) {
|
|
|
90
90
|
}
|
|
91
91
|
}, [delay, ...deps])
|
|
92
92
|
}
|
|
93
|
+
|
|
94
|
+
const colors = [
|
|
95
|
+
'#FFB900',
|
|
96
|
+
'#D83B01',
|
|
97
|
+
'#B50E0E',
|
|
98
|
+
'#E81123',
|
|
99
|
+
'#B4009E',
|
|
100
|
+
'#5C2D91',
|
|
101
|
+
'#0078D7',
|
|
102
|
+
'#00B4FF',
|
|
103
|
+
'#008272',
|
|
104
|
+
'#107C10',
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
export function getRandomColor(email: string): string {
|
|
108
|
+
let sum = 0
|
|
109
|
+
for (let i = 0; i < email.length; i++) {
|
|
110
|
+
sum += email.charCodeAt(i)
|
|
111
|
+
}
|
|
112
|
+
return colors[sum % colors.length]
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const getAlphabetIcon = (str: string) => {
|
|
116
|
+
if (!str) return null
|
|
117
|
+
return (
|
|
118
|
+
<span
|
|
119
|
+
className="alphabet-icon__initial fs-13 icon-dim-20 flex cn-0 mr-8"
|
|
120
|
+
style={{ backgroundColor: getRandomColor(str) }}
|
|
121
|
+
>
|
|
122
|
+
{str[0]}
|
|
123
|
+
</span>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export const getEmptyArrayOfLength = (length: number) => {
|
|
128
|
+
return Array.from({ length })
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function noop(...args): any {}
|
|
132
|
+
|
|
133
|
+
export function not(e) {
|
|
134
|
+
return !e
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function useEffectAfterMount(cb, dependencies) {
|
|
138
|
+
const justMounted = React.useRef(true)
|
|
139
|
+
React.useEffect(() => {
|
|
140
|
+
if (!justMounted.current) {
|
|
141
|
+
return cb()
|
|
142
|
+
}
|
|
143
|
+
justMounted.current = false
|
|
144
|
+
}, dependencies)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function getCookie(sKey) {
|
|
148
|
+
if (!sKey) {
|
|
149
|
+
return null
|
|
150
|
+
}
|
|
151
|
+
return (
|
|
152
|
+
document.cookie.replace(
|
|
153
|
+
new RegExp('(?:(?:^|.*;)\\s*' + sKey.replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=\\s*([^;]*).*$)|^.*$'),
|
|
154
|
+
'$1',
|
|
155
|
+
) || null
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function getLoginInfo() {
|
|
160
|
+
const argocdToken = getCookie(TOKEN_COOKIE_NAME)
|
|
161
|
+
if (argocdToken) {
|
|
162
|
+
const jwts = argocdToken.split('.')
|
|
163
|
+
try {
|
|
164
|
+
return JSON.parse(atob(jwts[1]))
|
|
165
|
+
} catch (err) {
|
|
166
|
+
console.error('error in setting user ', err)
|
|
167
|
+
return null
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ScanVulnerabilitiesTableProps, VulnerabilityType } from '../Types'
|
|
3
|
+
import './scanVulnerabilities.css'
|
|
4
|
+
|
|
5
|
+
export default function ScanVulnerabilitiesTable({ vulnerabilities }: ScanVulnerabilitiesTableProps) {
|
|
6
|
+
const renderRow = (vulnerability: VulnerabilityType) => {
|
|
7
|
+
return (
|
|
8
|
+
<tr
|
|
9
|
+
className="dc__security-tab__table-row cursor"
|
|
10
|
+
onClick={(e) => {
|
|
11
|
+
window.open(`https://cve.mitre.org/cgi-bin/cvename.cgi?name=${vulnerability.name}`, '_blank')
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<td className="security-tab__cell-cve dc__cve-cell">
|
|
15
|
+
<a
|
|
16
|
+
href={`https://cve.mitre.org/cgi-bin/cvename.cgi?name=${vulnerability.name}`}
|
|
17
|
+
rel="noopener noreferrer"
|
|
18
|
+
target="_blank"
|
|
19
|
+
>
|
|
20
|
+
{vulnerability.name}
|
|
21
|
+
</a>
|
|
22
|
+
</td>
|
|
23
|
+
<td className="security-tab__cell-severity">
|
|
24
|
+
<span className={`fill-${vulnerability.severity?.toLowerCase()}`}>{vulnerability.severity}</span>
|
|
25
|
+
</td>
|
|
26
|
+
<td className="security-tab__cell-package">{vulnerability.package}</td>
|
|
27
|
+
<td className="security-tab__cell-current-ver">{vulnerability.version}</td>
|
|
28
|
+
<td className="security-tab__cell-fixed-ver">{vulnerability.fixedVersion}</td>
|
|
29
|
+
<td
|
|
30
|
+
className={`security-tab__cell-policy security-tab__cell-policy--${vulnerability.policy?.toLowerCase()}`}
|
|
31
|
+
>
|
|
32
|
+
{vulnerability.policy?.toLowerCase()}
|
|
33
|
+
</td>
|
|
34
|
+
</tr>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<table className="security-tab__table">
|
|
40
|
+
<tbody>
|
|
41
|
+
<tr className="security-tab__table-header">
|
|
42
|
+
<th className="security-cell-header security-tab__cell-cve">CVE</th>
|
|
43
|
+
<th className="security-cell-header security-tab__cell-severity">Severity</th>
|
|
44
|
+
<th className="security-cell-header security-tab__cell-package">Package</th>
|
|
45
|
+
<th className="security-cell-header security-tab__cell-current-ver">Current Version</th>
|
|
46
|
+
<th className="security-cell-header security-tab__cell-fixed-ver">Fixed In Version</th>
|
|
47
|
+
<th className="security-cell-header security-tab__cell-policy">Policy</th>
|
|
48
|
+
</tr>
|
|
49
|
+
{vulnerabilities.map((vulnerability) => {
|
|
50
|
+
return renderRow(vulnerability)
|
|
51
|
+
})}
|
|
52
|
+
</tbody>
|
|
53
|
+
</table>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.modal-body--scan-details {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
right: 0;
|
|
5
|
+
background: var(--N000);
|
|
6
|
+
width: 800px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.security-tab__table {
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.security-tab__table-header {
|
|
14
|
+
border-bottom: solid 1px var(--N200);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.security-cell-header {
|
|
18
|
+
font-size: 12px;
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
line-height: 1.5;
|
|
21
|
+
letter-spacing: normal;
|
|
22
|
+
text-transform: uppercase;
|
|
23
|
+
color: var(--N500);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.dc__security-tab__table-row {
|
|
27
|
+
font-size: 13px;
|
|
28
|
+
font-weight: normal;
|
|
29
|
+
line-height: 1.54;
|
|
30
|
+
letter-spacing: normal;
|
|
31
|
+
color: var(--N900);
|
|
32
|
+
box-shadow: inset 0 -1px 0 0 #f5f5f5;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.security-tab__cell-cve,
|
|
36
|
+
.security-tab__cell-severity,
|
|
37
|
+
.security-tab__cell-package,
|
|
38
|
+
.security-tab__cell-current-ver,
|
|
39
|
+
.security-tab__cell-fixed-ver,
|
|
40
|
+
.security-tab__cell-policy {
|
|
41
|
+
padding: 10px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.security-tab__cell-cve {
|
|
45
|
+
padding-left: 0px;
|
|
46
|
+
text-align: left;
|
|
47
|
+
width: 20%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.security-tab__cell-policy {
|
|
51
|
+
padding-right: 0px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.security-tab__cell-policy--whitelist,
|
|
55
|
+
.security-tab__cell-policy--whitelisted {
|
|
56
|
+
color: var(--G500);
|
|
57
|
+
text-transform: capitalize;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.security-tab__cell-policy--block {
|
|
61
|
+
color: var(--R500);
|
|
62
|
+
text-transform: capitalize;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.scanned-object__results {
|
|
66
|
+
margin: 0 20px;
|
|
67
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
.toggle__switch {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
|
|
7
|
+
&.disabled{
|
|
8
|
+
cursor: not-allowed;
|
|
9
|
+
.toggle__slider{
|
|
10
|
+
cursor: not-allowed;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/* Hide default HTML checkbox */
|
|
17
|
+
|
|
18
|
+
.toggle__switch input {
|
|
19
|
+
opacity: 0;
|
|
20
|
+
width: 0;
|
|
21
|
+
height: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/* The slider */
|
|
26
|
+
|
|
27
|
+
.toggle__slider {
|
|
28
|
+
position: absolute;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
top: 0;
|
|
31
|
+
left: 0;
|
|
32
|
+
right: 0;
|
|
33
|
+
bottom: 0;
|
|
34
|
+
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
|
+
transition: all 0.4s ease;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
input:checked+.toggle__slider {
|
|
50
|
+
background-color: var(--color);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
input:focus+.toggle__slider {
|
|
54
|
+
box-shadow: 0 0 1px var(--color);
|
|
55
|
+
}
|
|
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
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useEffectAfterMount } from '../Helper';
|
|
3
|
+
import './Toggle.scss'
|
|
4
|
+
|
|
5
|
+
const Toggle = ({selected=false, onSelect=null, color="#36b37e", rootClassName="", disabled=false, dataTestId="handle-toggle-button", ...props})=>{
|
|
6
|
+
const [active, setActive] = React.useState(selected);
|
|
7
|
+
|
|
8
|
+
useEffectAfterMount(()=>{
|
|
9
|
+
if(typeof onSelect === 'function'){
|
|
10
|
+
if(active !== selected){
|
|
11
|
+
onSelect(active)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},[active])
|
|
15
|
+
|
|
16
|
+
useEffectAfterMount(() => {
|
|
17
|
+
setActive(selected)
|
|
18
|
+
}, [selected])
|
|
19
|
+
|
|
20
|
+
function handleClick(e){
|
|
21
|
+
if(!disabled){
|
|
22
|
+
setActive(active=>!active)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<label
|
|
28
|
+
{...props}
|
|
29
|
+
className={`${rootClassName} toggle__switch ${disabled ? 'disabled' : ''}`}
|
|
30
|
+
style={{ ['--color' as any]: color }}
|
|
31
|
+
>
|
|
32
|
+
<input type="checkbox" checked={!!active} onChange={handleClick} className="toggle__input" />
|
|
33
|
+
<span className="toggle__slider round" data-testid={dataTestId}></span>
|
|
34
|
+
</label>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default Toggle
|
package/src/Common/Types.ts
CHANGED
|
@@ -174,3 +174,146 @@ export interface ModalType {
|
|
|
174
174
|
preventWheelDisable?: boolean
|
|
175
175
|
noBackDrop?: boolean
|
|
176
176
|
}
|
|
177
|
+
|
|
178
|
+
export type CDModalTabType = 'SECURITY' | 'CHANGES'
|
|
179
|
+
|
|
180
|
+
export const CDModalTab = {
|
|
181
|
+
Security: <CDModalTabType>'SECURITY',
|
|
182
|
+
Changes: <CDModalTabType>'CHANGES',
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export enum DeploymentNodeType {
|
|
186
|
+
PRECD = 'PRECD',
|
|
187
|
+
CD = 'CD',
|
|
188
|
+
POSTCD = 'POSTCD',
|
|
189
|
+
APPROVAL = 'APPROVAL'
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface UserApprovalConfigType {
|
|
193
|
+
requiredCount: number
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
interface ApprovalUserDataType {
|
|
197
|
+
dataId: number
|
|
198
|
+
userActionTime: string
|
|
199
|
+
userComment: string
|
|
200
|
+
userEmail: string
|
|
201
|
+
userId: number
|
|
202
|
+
userResponse: number
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface UserApprovalMetadataType {
|
|
206
|
+
approvalRequestId: number
|
|
207
|
+
approvalRuntimeState: number
|
|
208
|
+
approvedUsersData: ApprovalUserDataType[]
|
|
209
|
+
requestedUserData: ApprovalUserDataType
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface CommonNodeAttr {
|
|
213
|
+
connectingCiPipelineId?: number
|
|
214
|
+
parents: string | number[] | string[]
|
|
215
|
+
x: number
|
|
216
|
+
y: number
|
|
217
|
+
title: string
|
|
218
|
+
description?: string
|
|
219
|
+
triggerType?: string
|
|
220
|
+
id: string
|
|
221
|
+
icon?: string
|
|
222
|
+
status?: string
|
|
223
|
+
isSource: boolean
|
|
224
|
+
isGitSource: boolean
|
|
225
|
+
isRoot: boolean
|
|
226
|
+
downstreams: string[]
|
|
227
|
+
type: 'CI' | 'GIT' | 'PRECD' | 'CD' | 'POSTCD' | 'WEBHOOK'
|
|
228
|
+
parentCiPipeline?: number
|
|
229
|
+
parentAppId?: number
|
|
230
|
+
url?: string
|
|
231
|
+
branch?: string
|
|
232
|
+
sourceType?: string
|
|
233
|
+
colorCode?: string
|
|
234
|
+
isExternalCI?: boolean
|
|
235
|
+
isLinkedCI?: boolean
|
|
236
|
+
environmentName?: string //used for CDs
|
|
237
|
+
environmentId?: number
|
|
238
|
+
inputMaterialList?: any[]
|
|
239
|
+
rollbackMaterialList?: any[] //used for CDs
|
|
240
|
+
linkedCount?: number //used for CI
|
|
241
|
+
deploymentStrategy?: string
|
|
242
|
+
height: number
|
|
243
|
+
width: number
|
|
244
|
+
preNode?: CommonNodeAttr //used for CDs
|
|
245
|
+
postNode?: CommonNodeAttr //used for CDs
|
|
246
|
+
stageIndex?: number //used for CDs
|
|
247
|
+
sourceNodes?: Array<CommonNodeAttr> //used for CI
|
|
248
|
+
downstreamNodes?: Array<CommonNodeAttr>
|
|
249
|
+
parentPipelineId?: string
|
|
250
|
+
parentPipelineType?: string
|
|
251
|
+
parentEnvironmentName?: string
|
|
252
|
+
isRegex?: boolean
|
|
253
|
+
regex?: string
|
|
254
|
+
primaryBranchAfterRegex?: string
|
|
255
|
+
storageConfigured?: boolean
|
|
256
|
+
deploymentAppDeleteRequest?: boolean
|
|
257
|
+
approvalUsers?: string[]
|
|
258
|
+
userApprovalConfig?: UserApprovalConfigType
|
|
259
|
+
requestedUserId?: number
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
export interface VulnerabilityType {
|
|
264
|
+
name: string;
|
|
265
|
+
severity: "CRITICAL" | "MODERATE" | "LOW";
|
|
266
|
+
package: string;
|
|
267
|
+
version: string;
|
|
268
|
+
fixedVersion: string;
|
|
269
|
+
policy: string;
|
|
270
|
+
url?: string;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export interface ScanVulnerabilitiesTableProps {
|
|
274
|
+
vulnerabilities: VulnerabilityType[];
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export interface MaterialInfo {
|
|
278
|
+
revision: string
|
|
279
|
+
modifiedTime: string | Date
|
|
280
|
+
author: string
|
|
281
|
+
message: string
|
|
282
|
+
commitLink: string
|
|
283
|
+
tag: string
|
|
284
|
+
webhookData: string
|
|
285
|
+
branch: string
|
|
286
|
+
url?: string
|
|
287
|
+
type?: string
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface CDMaterialType {
|
|
291
|
+
index: number
|
|
292
|
+
id: string
|
|
293
|
+
materialInfo: MaterialInfo[]
|
|
294
|
+
tab: CDModalTabType
|
|
295
|
+
scanEnabled: boolean
|
|
296
|
+
scanned: boolean
|
|
297
|
+
vulnerabilitiesLoading: boolean
|
|
298
|
+
lastExecution: string //timestamp
|
|
299
|
+
vulnerabilities: VulnerabilityType[]
|
|
300
|
+
vulnerable: boolean
|
|
301
|
+
deployedTime: string
|
|
302
|
+
deployedBy?: string
|
|
303
|
+
wfrId?: number
|
|
304
|
+
buildTime: string
|
|
305
|
+
image: string
|
|
306
|
+
isSelected: boolean
|
|
307
|
+
showSourceInfo: boolean
|
|
308
|
+
latest: boolean
|
|
309
|
+
runningOnParentCd?: boolean
|
|
310
|
+
userApprovalMetadata?: UserApprovalMetadataType
|
|
311
|
+
triggeredBy?: number
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export interface CDMaterialResponseType {
|
|
315
|
+
approvalUsers: string[]
|
|
316
|
+
materials: any[]
|
|
317
|
+
userApprovalConfig: UserApprovalConfigType
|
|
318
|
+
requestedUserId: number
|
|
319
|
+
}
|
package/src/Common/index.ts
CHANGED
|
@@ -26,4 +26,5 @@ export * from './Common.service'
|
|
|
26
26
|
export * from './Checkbox'
|
|
27
27
|
export { default as EmptyState } from './EmptyState/EmptyState'
|
|
28
28
|
export { default as GenericEmptyState } from './EmptyState/GenericEmptyState'
|
|
29
|
-
|
|
29
|
+
export { default as Toggle } from './Toggle/Toggle'
|
|
30
|
+
export { default as ScanVulnerabilitiesTable } from './Security/ScanVulnerabilitiesTable'
|