@devtron-labs/devtron-fe-common-lib 0.0.17-beta-3 → 0.0.17-beta-4
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 +3 -1
- package/dist/Common/Helper.d.ts +1 -3
- package/dist/index.js +65 -65
- package/package.json +1 -1
- package/src/Common/Common.service.ts +74 -1
- package/src/Common/Helper.tsx +1 -72
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TeamList, ResponseType } from './Types';
|
|
1
|
+
import { TeamList, ResponseType, DeploymentNodeType } from './Types';
|
|
2
2
|
export declare const getTeamListMin: () => Promise<TeamList>;
|
|
3
3
|
interface UserRole extends ResponseType {
|
|
4
4
|
result?: {
|
|
@@ -8,4 +8,6 @@ interface UserRole extends ResponseType {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function getUserRole(appName?: string): Promise<UserRole>;
|
|
10
10
|
export declare function setImageTags(request: any, pipelineId: number, artifactId: number): Promise<ResponseType>;
|
|
11
|
+
export declare const getCDMaterials: (cdMaterialId: any, stageType: DeploymentNodeType, abortSignal: AbortSignal, isApprovalNode?: boolean, imageTag?: string) => Promise<any>;
|
|
12
|
+
export declare function extractImage(image: string): string;
|
|
11
13
|
export {};
|
package/dist/Common/Helper.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { UseSearchString } from './Types';
|
|
3
3
|
export declare function showError(serverError: any, showToastOnUnknownError?: boolean, hideAccessError?: boolean): void;
|
|
4
4
|
interface ConditionalWrapper<T> {
|
|
5
5
|
condition: boolean;
|
|
@@ -42,6 +42,4 @@ export declare function CustomInput({ name, value, error, onChange, onBlur, onFo
|
|
|
42
42
|
}): JSX.Element;
|
|
43
43
|
export declare function handleUTCTime(ts: string, isRelativeTime?: boolean): string;
|
|
44
44
|
export declare function useSearchString(): UseSearchString;
|
|
45
|
-
export declare const getCDMaterials: (cdMaterialId: any, stageType: DeploymentNodeType, abortSignal: AbortSignal, isApprovalNode?: boolean, imageTag?: string) => Promise<any>;
|
|
46
|
-
export declare function extractImage(image: string): string;
|
|
47
45
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -10095,71 +10095,6 @@ function useSearchString() {
|
|
|
10095
10095
|
return agg;
|
|
10096
10096
|
}, {});
|
|
10097
10097
|
return { queryParams: queryParams, searchParams: searchParams };
|
|
10098
|
-
}
|
|
10099
|
-
var getCDMaterials = function (cdMaterialId, stageType, abortSignal, isApprovalNode, imageTag) {
|
|
10100
|
-
var URL = (!imageTag) ? "app/cd-pipeline/".concat(cdMaterialId, "/material?stage=APPROVAL") : "app/cd-pipeline/".concat(cdMaterialId, "/material?stage=APPROVAL&search=").concat(imageTag);
|
|
10101
|
-
return get(URL, {
|
|
10102
|
-
signal: abortSignal,
|
|
10103
|
-
}).then(function (response) {
|
|
10104
|
-
var _a;
|
|
10105
|
-
var artifacts = (_a = response.result.ci_artifacts) !== null && _a !== void 0 ? _a : [];
|
|
10106
|
-
if (!response.result) {
|
|
10107
|
-
return {
|
|
10108
|
-
materials: [],
|
|
10109
|
-
};
|
|
10110
|
-
}
|
|
10111
|
-
else {
|
|
10112
|
-
var materials = artifacts.map(function (material, index) {
|
|
10113
|
-
var artifactStatusValue = '';
|
|
10114
|
-
return {
|
|
10115
|
-
index: index,
|
|
10116
|
-
id: material.id,
|
|
10117
|
-
deployedTime: material.deployed_time
|
|
10118
|
-
? moment(material.deployed_time).format('ddd, DD MMM YYYY, hh:mm A')
|
|
10119
|
-
: 'Not Deployed',
|
|
10120
|
-
deployedBy: material.deployedBy,
|
|
10121
|
-
wfrId: material.wfrId,
|
|
10122
|
-
image: extractImage(material.image),
|
|
10123
|
-
showChanges: false,
|
|
10124
|
-
vulnerabilities: [],
|
|
10125
|
-
buildTime: material.build_time || '',
|
|
10126
|
-
showSourceInfo: false,
|
|
10127
|
-
deployed: material.deployed || false,
|
|
10128
|
-
latest: material.latest || false,
|
|
10129
|
-
vulnerabilitiesLoading: true,
|
|
10130
|
-
scanned: material.scanned,
|
|
10131
|
-
scanEnabled: material.scanEnabled,
|
|
10132
|
-
vulnerable: material.vulnerable,
|
|
10133
|
-
runningOnParentCd: material.runningOnParentCd,
|
|
10134
|
-
artifactStatus: artifactStatusValue,
|
|
10135
|
-
userApprovalMetadata: material.userApprovalMetadata,
|
|
10136
|
-
triggeredBy: material.triggeredBy,
|
|
10137
|
-
isVirtualEnvironment: material.isVirtualEnvironment,
|
|
10138
|
-
imageComment: material.imageComment,
|
|
10139
|
-
imageReleaseTags: material.imageReleaseTags,
|
|
10140
|
-
materialInfo: material.material_info
|
|
10141
|
-
? material.material_info.map(function (mat) {
|
|
10142
|
-
return {
|
|
10143
|
-
author: mat.author || '',
|
|
10144
|
-
message: mat.message || '',
|
|
10145
|
-
revision: mat.revision || '',
|
|
10146
|
-
tag: mat.tag || '',
|
|
10147
|
-
webhookData: mat.webhookData || '',
|
|
10148
|
-
url: mat.url || '',
|
|
10149
|
-
type: material.ciConfigureSourceType || '',
|
|
10150
|
-
};
|
|
10151
|
-
})
|
|
10152
|
-
: [],
|
|
10153
|
-
};
|
|
10154
|
-
});
|
|
10155
|
-
return {
|
|
10156
|
-
materials: materials
|
|
10157
|
-
};
|
|
10158
|
-
}
|
|
10159
|
-
});
|
|
10160
|
-
};
|
|
10161
|
-
function extractImage(image) {
|
|
10162
|
-
return image ? image.split(':').pop() : '';
|
|
10163
10098
|
}
|
|
10164
10099
|
|
|
10165
10100
|
function Progressing(_a) {
|
|
@@ -22610,6 +22545,71 @@ function getUserRole(appName) {
|
|
|
22610
22545
|
}
|
|
22611
22546
|
function setImageTags(request, pipelineId, artifactId) {
|
|
22612
22547
|
return post("".concat(ROUTES.IMAGE_TAGGING, "/").concat(pipelineId, "/").concat(artifactId), request);
|
|
22548
|
+
}
|
|
22549
|
+
var getCDMaterials = function (cdMaterialId, stageType, abortSignal, isApprovalNode, imageTag) {
|
|
22550
|
+
var URL = (!imageTag) ? "app/cd-pipeline/".concat(cdMaterialId, "/material?stage=APPROVAL") : "app/cd-pipeline/".concat(cdMaterialId, "/material?stage=APPROVAL&search=").concat(imageTag);
|
|
22551
|
+
return get(URL, {
|
|
22552
|
+
signal: abortSignal,
|
|
22553
|
+
}).then(function (response) {
|
|
22554
|
+
var _a;
|
|
22555
|
+
var artifacts = (_a = response.result.ci_artifacts) !== null && _a !== void 0 ? _a : [];
|
|
22556
|
+
if (!response.result) {
|
|
22557
|
+
return {
|
|
22558
|
+
materials: [],
|
|
22559
|
+
};
|
|
22560
|
+
}
|
|
22561
|
+
else {
|
|
22562
|
+
var materials = artifacts.map(function (material, index) {
|
|
22563
|
+
var artifactStatusValue = '';
|
|
22564
|
+
return {
|
|
22565
|
+
index: index,
|
|
22566
|
+
id: material.id,
|
|
22567
|
+
deployedTime: material.deployed_time
|
|
22568
|
+
? moment(material.deployed_time).format('ddd, DD MMM YYYY, hh:mm A')
|
|
22569
|
+
: 'Not Deployed',
|
|
22570
|
+
deployedBy: material.deployedBy,
|
|
22571
|
+
wfrId: material.wfrId,
|
|
22572
|
+
image: extractImage(material.image),
|
|
22573
|
+
showChanges: false,
|
|
22574
|
+
vulnerabilities: [],
|
|
22575
|
+
buildTime: material.build_time || '',
|
|
22576
|
+
showSourceInfo: false,
|
|
22577
|
+
deployed: material.deployed || false,
|
|
22578
|
+
latest: material.latest || false,
|
|
22579
|
+
vulnerabilitiesLoading: true,
|
|
22580
|
+
scanned: material.scanned,
|
|
22581
|
+
scanEnabled: material.scanEnabled,
|
|
22582
|
+
vulnerable: material.vulnerable,
|
|
22583
|
+
runningOnParentCd: material.runningOnParentCd,
|
|
22584
|
+
artifactStatus: artifactStatusValue,
|
|
22585
|
+
userApprovalMetadata: material.userApprovalMetadata,
|
|
22586
|
+
triggeredBy: material.triggeredBy,
|
|
22587
|
+
isVirtualEnvironment: material.isVirtualEnvironment,
|
|
22588
|
+
imageComment: material.imageComment,
|
|
22589
|
+
imageReleaseTags: material.imageReleaseTags,
|
|
22590
|
+
materialInfo: material.material_info
|
|
22591
|
+
? material.material_info.map(function (mat) {
|
|
22592
|
+
return {
|
|
22593
|
+
author: mat.author || '',
|
|
22594
|
+
message: mat.message || '',
|
|
22595
|
+
revision: mat.revision || '',
|
|
22596
|
+
tag: mat.tag || '',
|
|
22597
|
+
webhookData: mat.webhookData || '',
|
|
22598
|
+
url: mat.url || '',
|
|
22599
|
+
type: material.ciConfigureSourceType || '',
|
|
22600
|
+
};
|
|
22601
|
+
})
|
|
22602
|
+
: [],
|
|
22603
|
+
};
|
|
22604
|
+
});
|
|
22605
|
+
return {
|
|
22606
|
+
materials: materials
|
|
22607
|
+
};
|
|
22608
|
+
}
|
|
22609
|
+
});
|
|
22610
|
+
};
|
|
22611
|
+
function extractImage(image) {
|
|
22612
|
+
return image ? image.split(':').pop() : '';
|
|
22613
22613
|
}
|
|
22614
22614
|
|
|
22615
22615
|
/*
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
1
2
|
import {get, post} from './Api';
|
|
2
3
|
import { ROUTES } from './Constants'
|
|
3
4
|
import { sortCallback } from './Helper';
|
|
4
|
-
import { TeamList ,ResponseType } from './Types';
|
|
5
|
+
import { TeamList ,ResponseType, DeploymentNodeType } from './Types';
|
|
5
6
|
|
|
6
7
|
export const getTeamListMin = (): Promise<TeamList> => {
|
|
7
8
|
// ignore active field
|
|
@@ -35,4 +36,76 @@ export function getUserRole(appName?: string): Promise<UserRole> {
|
|
|
35
36
|
|
|
36
37
|
export function setImageTags(request, pipelineId: number, artifactId: number){
|
|
37
38
|
return post(`${ROUTES.IMAGE_TAGGING}/${pipelineId}/${artifactId}`,request )
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const getCDMaterials = (
|
|
42
|
+
cdMaterialId,
|
|
43
|
+
stageType: DeploymentNodeType,
|
|
44
|
+
abortSignal: AbortSignal,
|
|
45
|
+
isApprovalNode?: boolean,
|
|
46
|
+
imageTag?: string): Promise<any> => {
|
|
47
|
+
const URL = (!imageTag) ? `app/cd-pipeline/${cdMaterialId}/material?stage=APPROVAL` : `app/cd-pipeline/${cdMaterialId}/material?stage=APPROVAL&search=${imageTag}`
|
|
48
|
+
|
|
49
|
+
return get(URL, {
|
|
50
|
+
signal: abortSignal,
|
|
51
|
+
}).then((response) => {
|
|
52
|
+
let artifacts = response.result.ci_artifacts ?? []
|
|
53
|
+
if (!response.result) {
|
|
54
|
+
return {
|
|
55
|
+
materials: [],
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const materials = artifacts.map((material, index) => {
|
|
60
|
+
let artifactStatusValue = ''
|
|
61
|
+
return {
|
|
62
|
+
index,
|
|
63
|
+
id: material.id,
|
|
64
|
+
deployedTime: material.deployed_time
|
|
65
|
+
? moment(material.deployed_time).format('ddd, DD MMM YYYY, hh:mm A')
|
|
66
|
+
: 'Not Deployed',
|
|
67
|
+
deployedBy: material.deployedBy,
|
|
68
|
+
wfrId: material.wfrId,
|
|
69
|
+
image: extractImage(material.image),
|
|
70
|
+
showChanges: false,
|
|
71
|
+
vulnerabilities: [],
|
|
72
|
+
buildTime: material.build_time || '',
|
|
73
|
+
showSourceInfo: false,
|
|
74
|
+
deployed: material.deployed || false,
|
|
75
|
+
latest: material.latest || false,
|
|
76
|
+
vulnerabilitiesLoading: true,
|
|
77
|
+
scanned: material.scanned,
|
|
78
|
+
scanEnabled: material.scanEnabled,
|
|
79
|
+
vulnerable: material.vulnerable,
|
|
80
|
+
runningOnParentCd: material.runningOnParentCd,
|
|
81
|
+
artifactStatus: artifactStatusValue,
|
|
82
|
+
userApprovalMetadata: material.userApprovalMetadata,
|
|
83
|
+
triggeredBy: material.triggeredBy,
|
|
84
|
+
isVirtualEnvironment: material.isVirtualEnvironment,
|
|
85
|
+
imageComment: material.imageComment,
|
|
86
|
+
imageReleaseTags: material.imageReleaseTags,
|
|
87
|
+
materialInfo: material.material_info
|
|
88
|
+
? material.material_info.map((mat) => {
|
|
89
|
+
return {
|
|
90
|
+
author: mat.author || '',
|
|
91
|
+
message: mat.message || '',
|
|
92
|
+
revision: mat.revision || '',
|
|
93
|
+
tag: mat.tag || '',
|
|
94
|
+
webhookData: mat.webhookData || '',
|
|
95
|
+
url: mat.url || '',
|
|
96
|
+
type: material.ciConfigureSourceType || '',
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
: [],
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
return {
|
|
103
|
+
materials: materials
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function extractImage(image: string): string {
|
|
110
|
+
return image ? image.split(':').pop() : ''
|
|
38
111
|
}
|
package/src/Common/Helper.tsx
CHANGED
|
@@ -6,9 +6,8 @@ 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 {
|
|
9
|
+
import { UseSearchString } from './Types'
|
|
10
10
|
import { useLocation } from 'react-router-dom'
|
|
11
|
-
import { get } from './Api'
|
|
12
11
|
|
|
13
12
|
toast.configure({
|
|
14
13
|
autoClose: 3000,
|
|
@@ -369,74 +368,4 @@ export function useSearchString(): UseSearchString {
|
|
|
369
368
|
return { queryParams, searchParams }
|
|
370
369
|
}
|
|
371
370
|
|
|
372
|
-
export const getCDMaterials = (
|
|
373
|
-
cdMaterialId,
|
|
374
|
-
stageType: DeploymentNodeType,
|
|
375
|
-
abortSignal: AbortSignal,
|
|
376
|
-
isApprovalNode?: boolean,
|
|
377
|
-
imageTag?: string): Promise<any> => {
|
|
378
|
-
const URL = (!imageTag) ? `app/cd-pipeline/${cdMaterialId}/material?stage=APPROVAL` : `app/cd-pipeline/${cdMaterialId}/material?stage=APPROVAL&search=${imageTag}`
|
|
379
|
-
|
|
380
|
-
return get(URL, {
|
|
381
|
-
signal: abortSignal,
|
|
382
|
-
}).then((response) => {
|
|
383
|
-
let artifacts = response.result.ci_artifacts ?? []
|
|
384
|
-
if (!response.result) {
|
|
385
|
-
return {
|
|
386
|
-
materials: [],
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
else {
|
|
390
|
-
const materials = artifacts.map((material, index) => {
|
|
391
|
-
let artifactStatusValue = ''
|
|
392
|
-
return {
|
|
393
|
-
index,
|
|
394
|
-
id: material.id,
|
|
395
|
-
deployedTime: material.deployed_time
|
|
396
|
-
? moment(material.deployed_time).format('ddd, DD MMM YYYY, hh:mm A')
|
|
397
|
-
: 'Not Deployed',
|
|
398
|
-
deployedBy: material.deployedBy,
|
|
399
|
-
wfrId: material.wfrId,
|
|
400
|
-
image: extractImage(material.image),
|
|
401
|
-
showChanges: false,
|
|
402
|
-
vulnerabilities: [],
|
|
403
|
-
buildTime: material.build_time || '',
|
|
404
|
-
showSourceInfo: false,
|
|
405
|
-
deployed: material.deployed || false,
|
|
406
|
-
latest: material.latest || false,
|
|
407
|
-
vulnerabilitiesLoading: true,
|
|
408
|
-
scanned: material.scanned,
|
|
409
|
-
scanEnabled: material.scanEnabled,
|
|
410
|
-
vulnerable: material.vulnerable,
|
|
411
|
-
runningOnParentCd: material.runningOnParentCd,
|
|
412
|
-
artifactStatus: artifactStatusValue,
|
|
413
|
-
userApprovalMetadata: material.userApprovalMetadata,
|
|
414
|
-
triggeredBy: material.triggeredBy,
|
|
415
|
-
isVirtualEnvironment: material.isVirtualEnvironment,
|
|
416
|
-
imageComment: material.imageComment,
|
|
417
|
-
imageReleaseTags: material.imageReleaseTags,
|
|
418
|
-
materialInfo: material.material_info
|
|
419
|
-
? material.material_info.map((mat) => {
|
|
420
|
-
return {
|
|
421
|
-
author: mat.author || '',
|
|
422
|
-
message: mat.message || '',
|
|
423
|
-
revision: mat.revision || '',
|
|
424
|
-
tag: mat.tag || '',
|
|
425
|
-
webhookData: mat.webhookData || '',
|
|
426
|
-
url: mat.url || '',
|
|
427
|
-
type: material.ciConfigureSourceType || '',
|
|
428
|
-
}
|
|
429
|
-
})
|
|
430
|
-
: [],
|
|
431
|
-
}
|
|
432
|
-
})
|
|
433
|
-
return {
|
|
434
|
-
materials: materials
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
})
|
|
438
|
-
}
|
|
439
371
|
|
|
440
|
-
export function extractImage(image: string): string {
|
|
441
|
-
return image ? image.split(':').pop() : ''
|
|
442
|
-
}
|