@devtron-labs/devtron-fe-common-lib 0.0.32-beta1 → 0.0.33-beta-1
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/ImageTags.Types.d.ts +0 -1
- package/dist/Common/ImageTags.d.ts +1 -1
- package/dist/Common/Types.d.ts +18 -3
- package/dist/index.js +40 -8
- package/package.json +1 -1
- package/src/Common/Common.service.ts +1 -1
- package/src/Common/Helper.tsx +1 -1
- package/src/Common/ImageTags.Types.ts +0 -1
- package/src/Common/ImageTags.tsx +14 -1
- package/src/Common/Types.ts +25 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ImageButtonType, ImageTaggingContainerType } from './ImageTags.Types';
|
|
3
|
-
export declare const ImageTagsContainer: ({ ciPipelineId, artifactId, imageComment, imageReleaseTags, updateCurrentAppMaterial, appReleaseTagNames, setAppReleaseTagNames, tagsEditable, setTagsEditable, toggleCardMode, hideHardDelete, forceReInit,
|
|
3
|
+
export declare const ImageTagsContainer: ({ ciPipelineId, artifactId, imageComment, imageReleaseTags, updateCurrentAppMaterial, appReleaseTagNames, setAppReleaseTagNames, tagsEditable, setTagsEditable, toggleCardMode, hideHardDelete, forceReInit, }: ImageTaggingContainerType) => JSX.Element;
|
|
4
4
|
export declare const ImageTagButton: ({ text, isSoftDeleted, isEditing, onSoftDeleteClick, onHardDeleteClick, tagId, softDeleteTags, isSuperAdmin, duplicateTag, hideHardDelete, }: ImageButtonType) => JSX.Element;
|
package/dist/Common/Types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode, CSSProperties } from 'react';
|
|
2
2
|
import { Placement } from 'tippy.js';
|
|
3
|
-
import { ImageComment, ReleaseTag } from
|
|
3
|
+
import { ImageComment, ReleaseTag } from './ImageTags.Types';
|
|
4
4
|
export interface ResponseType {
|
|
5
5
|
code: number;
|
|
6
6
|
status: string;
|
|
@@ -193,8 +193,8 @@ export interface UserApprovalMetadataType {
|
|
|
193
193
|
requestedUserData: ApprovalUserDataType;
|
|
194
194
|
}
|
|
195
195
|
export declare enum FilterStates {
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
ALLOWED = 0,
|
|
197
|
+
BLOCKED = 1,
|
|
198
198
|
ERROR = 2
|
|
199
199
|
}
|
|
200
200
|
export interface CDMaterialType {
|
|
@@ -315,6 +315,20 @@ export interface MaterialInfo {
|
|
|
315
315
|
url?: string;
|
|
316
316
|
type?: string;
|
|
317
317
|
}
|
|
318
|
+
export declare enum FilterConditionType {
|
|
319
|
+
PASS = 1,
|
|
320
|
+
FAIL = 0
|
|
321
|
+
}
|
|
322
|
+
export interface FilterConditionsInfo {
|
|
323
|
+
conditionType: FilterConditionType;
|
|
324
|
+
expression: string;
|
|
325
|
+
}
|
|
326
|
+
export interface FilterConditionsListType {
|
|
327
|
+
id: number;
|
|
328
|
+
name: string;
|
|
329
|
+
description: string;
|
|
330
|
+
conditions: FilterConditionsInfo[];
|
|
331
|
+
}
|
|
318
332
|
export interface CDMaterialResponseType {
|
|
319
333
|
approvalUsers: string[];
|
|
320
334
|
materials: any[];
|
|
@@ -323,6 +337,7 @@ export interface CDMaterialResponseType {
|
|
|
323
337
|
tagsEditable: boolean;
|
|
324
338
|
appReleaseTagNames: string[];
|
|
325
339
|
hideImageTaggingHardDelete: boolean;
|
|
340
|
+
resourceFilters?: FilterConditionsListType[];
|
|
326
341
|
}
|
|
327
342
|
export interface InputDetailType {
|
|
328
343
|
label: string;
|
package/dist/index.js
CHANGED
|
@@ -426,8 +426,8 @@ exports.DeploymentNodeType = void 0;
|
|
|
426
426
|
})(exports.DeploymentNodeType || (exports.DeploymentNodeType = {}));
|
|
427
427
|
exports.FilterStates = void 0;
|
|
428
428
|
(function (FilterStates) {
|
|
429
|
-
FilterStates[FilterStates["
|
|
430
|
-
FilterStates[FilterStates["
|
|
429
|
+
FilterStates[FilterStates["ALLOWED"] = 0] = "ALLOWED";
|
|
430
|
+
FilterStates[FilterStates["BLOCKED"] = 1] = "BLOCKED";
|
|
431
431
|
FilterStates[FilterStates["ERROR"] = 2] = "ERROR";
|
|
432
432
|
})(exports.FilterStates || (exports.FilterStates = {}));
|
|
433
433
|
exports.DeploymentAppTypes = void 0;
|
|
@@ -436,7 +436,12 @@ exports.DeploymentAppTypes = void 0;
|
|
|
436
436
|
DeploymentAppTypes["GITOPS"] = "argo_cd";
|
|
437
437
|
DeploymentAppTypes["MANIFEST_DOWNLOAD"] = "manifest_download";
|
|
438
438
|
DeploymentAppTypes["MANIFEST_PUSH"] = "manifest_push";
|
|
439
|
-
})(exports.DeploymentAppTypes || (exports.DeploymentAppTypes = {}));
|
|
439
|
+
})(exports.DeploymentAppTypes || (exports.DeploymentAppTypes = {}));
|
|
440
|
+
exports.FilterConditionType = void 0;
|
|
441
|
+
(function (FilterConditionType) {
|
|
442
|
+
FilterConditionType[FilterConditionType["PASS"] = 1] = "PASS";
|
|
443
|
+
FilterConditionType[FilterConditionType["FAIL"] = 0] = "FAIL";
|
|
444
|
+
})(exports.FilterConditionType || (exports.FilterConditionType = {}));
|
|
440
445
|
|
|
441
446
|
var responseMessages = {
|
|
442
447
|
100: 'Continue',
|
|
@@ -10071,7 +10076,7 @@ function CustomInput(_a) {
|
|
|
10071
10076
|
return (jsxRuntime.jsxs("div", __assign({ className: "flex column left top" }, { children: [jsxRuntime.jsx("label", __assign({ className: "form__label ".concat(labelClassName) }, { children: label })), jsxRuntime.jsx("input", { "data-testid": dataTestid, type: type, name: name, autoComplete: "off", className: "form__input", onChange: function (e) {
|
|
10072
10077
|
e.persist();
|
|
10073
10078
|
onChange(e);
|
|
10074
|
-
}, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, value: value, disabled: disabled, tabIndex: tabIndex }), handleError(error).map(function (err) { return (jsxRuntime.jsxs("div", __assign({ className: "form__error" }, { children: [jsxRuntime.jsx(SvgIcWarning, { className: "form__icon form__icon--error" }), err] })
|
|
10079
|
+
}, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, value: value, disabled: disabled, tabIndex: tabIndex }), handleError(error).map(function (err) { return (jsxRuntime.jsxs("div", __assign({ className: "form__error" }, { children: [jsxRuntime.jsx(SvgIcWarning, { className: "form__icon form__icon--error" }), err] }))); })] })));
|
|
10075
10080
|
}
|
|
10076
10081
|
function handleUTCTime(ts, isRelativeTime) {
|
|
10077
10082
|
if (isRelativeTime === void 0) { isRelativeTime = false; }
|
|
@@ -22683,7 +22688,7 @@ function getUserRole(appName) {
|
|
|
22683
22688
|
function setImageTags(request, pipelineId, artifactId) {
|
|
22684
22689
|
return post("".concat(ROUTES.IMAGE_TAGGING, "/").concat(pipelineId, "/").concat(artifactId), request);
|
|
22685
22690
|
}
|
|
22686
|
-
//
|
|
22691
|
+
// FIXME: This is only returning materials to cater the case of search in approval but it should be a common function service coming from dashboard.
|
|
22687
22692
|
var getCDMaterials = function (cdMaterialId, stageType, abortSignal, isApprovalNode, imageTag) {
|
|
22688
22693
|
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);
|
|
22689
22694
|
return get(URL, {
|
|
@@ -23120,7 +23125,7 @@ var SvgIcEnter = function SvgIcEnter(props) {
|
|
|
23120
23125
|
};
|
|
23121
23126
|
|
|
23122
23127
|
var ImageTagsContainer = function (_a) {
|
|
23123
|
-
var ciPipelineId = _a.ciPipelineId, artifactId = _a.artifactId, imageComment = _a.imageComment, imageReleaseTags = _a.imageReleaseTags, updateCurrentAppMaterial = _a.updateCurrentAppMaterial, appReleaseTagNames = _a.appReleaseTagNames, setAppReleaseTagNames = _a.setAppReleaseTagNames, tagsEditable = _a.tagsEditable, setTagsEditable = _a.setTagsEditable, toggleCardMode = _a.toggleCardMode, hideHardDelete = _a.hideHardDelete, forceReInit = _a.forceReInit
|
|
23128
|
+
var ciPipelineId = _a.ciPipelineId, artifactId = _a.artifactId, imageComment = _a.imageComment, imageReleaseTags = _a.imageReleaseTags, updateCurrentAppMaterial = _a.updateCurrentAppMaterial, appReleaseTagNames = _a.appReleaseTagNames, setAppReleaseTagNames = _a.setAppReleaseTagNames, tagsEditable = _a.tagsEditable, setTagsEditable = _a.setTagsEditable, toggleCardMode = _a.toggleCardMode, hideHardDelete = _a.hideHardDelete, forceReInit = _a.forceReInit;
|
|
23124
23129
|
var _b = __read(React.useState(imageReleaseTags ? imageReleaseTags : []), 2), initialTags = _b[0], setInitialTags = _b[1];
|
|
23125
23130
|
var _c = __read(React.useState(imageComment ? imageComment.comment : ''), 2), initialDescription = _c[0], setInitialDescription = _c[1];
|
|
23126
23131
|
var _d = __read(React.useState(appReleaseTagNames ? appReleaseTagNames : []), 2), existingTags = _d[0], setExistingTags = _d[1];
|
|
@@ -23132,14 +23137,41 @@ var ImageTagsContainer = function (_a) {
|
|
|
23132
23137
|
var _k = __read(React.useState([]), 2), createTags = _k[0], setCreateTags = _k[1];
|
|
23133
23138
|
var _l = __read(React.useState([]), 2), softDeleteTags = _l[0], setSoftDeleteTags = _l[1];
|
|
23134
23139
|
var _m = __read(React.useState([]), 2), hardDeleteTags = _m[0], setHardDeleteTags = _m[1];
|
|
23135
|
-
var _o = __read(React.useState(
|
|
23136
|
-
var _p = __read(React.useState(''), 2),
|
|
23140
|
+
var _o = __read(React.useState(false), 2), isSuperAdmin = _o[0], setSuperAdmin = _o[1];
|
|
23141
|
+
var _p = __read(React.useState(''), 2), descriptionValidationMessage = _p[0], setDescriptionValidationMessage = _p[1];
|
|
23142
|
+
var _q = __read(React.useState(''), 2), textInput = _q[0], setTextInput = _q[1];
|
|
23143
|
+
React.useEffect(function () {
|
|
23144
|
+
initialise();
|
|
23145
|
+
}, []);
|
|
23137
23146
|
React.useEffect(function () {
|
|
23138
23147
|
reInitState();
|
|
23139
23148
|
}, [imageReleaseTags, imageComment, tagsEditable]);
|
|
23140
23149
|
React.useEffect(function () {
|
|
23141
23150
|
setExistingTags(appReleaseTagNames ? appReleaseTagNames : []);
|
|
23142
23151
|
}, [appReleaseTagNames]);
|
|
23152
|
+
function initialise() {
|
|
23153
|
+
var _a, _b;
|
|
23154
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23155
|
+
var userRole, superAdmin, err_1;
|
|
23156
|
+
return __generator(this, function (_c) {
|
|
23157
|
+
switch (_c.label) {
|
|
23158
|
+
case 0:
|
|
23159
|
+
_c.trys.push([0, 2, , 3]);
|
|
23160
|
+
return [4 /*yield*/, getUserRole()];
|
|
23161
|
+
case 1:
|
|
23162
|
+
userRole = _c.sent();
|
|
23163
|
+
superAdmin = (_b = (_a = userRole === null || userRole === void 0 ? void 0 : userRole.result) === null || _a === void 0 ? void 0 : _a.roles) === null || _b === void 0 ? void 0 : _b.includes('role:super-admin___');
|
|
23164
|
+
setSuperAdmin(superAdmin);
|
|
23165
|
+
return [3 /*break*/, 3];
|
|
23166
|
+
case 2:
|
|
23167
|
+
err_1 = _c.sent();
|
|
23168
|
+
showError(err_1);
|
|
23169
|
+
return [3 /*break*/, 3];
|
|
23170
|
+
case 3: return [2 /*return*/];
|
|
23171
|
+
}
|
|
23172
|
+
});
|
|
23173
|
+
});
|
|
23174
|
+
}
|
|
23143
23175
|
var reInitState = function () {
|
|
23144
23176
|
if (forceReInit || !isEditing) {
|
|
23145
23177
|
setInitialTags(imageReleaseTags ? imageReleaseTags : []);
|
package/package.json
CHANGED
|
@@ -51,7 +51,7 @@ export function setImageTags(request, pipelineId: number, artifactId: number){
|
|
|
51
51
|
return post(`${ROUTES.IMAGE_TAGGING}/${pipelineId}/${artifactId}`,request )
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
//
|
|
54
|
+
// FIXME: This is only returning materials to cater the case of search in approval but it should be a common function service coming from dashboard.
|
|
55
55
|
export const getCDMaterials = (
|
|
56
56
|
cdMaterialId,
|
|
57
57
|
stageType: DeploymentNodeType,
|
package/src/Common/Helper.tsx
CHANGED
|
@@ -326,7 +326,7 @@ export function CustomInput({
|
|
|
326
326
|
tabIndex={tabIndex}
|
|
327
327
|
/>
|
|
328
328
|
{handleError(error).map((err) => (
|
|
329
|
-
<div className="form__error"
|
|
329
|
+
<div className="form__error">
|
|
330
330
|
<FormError className="form__icon form__icon--error" />
|
|
331
331
|
{err}
|
|
332
332
|
</div>
|
package/src/Common/ImageTags.tsx
CHANGED
|
@@ -32,7 +32,6 @@ export const ImageTagsContainer = ({
|
|
|
32
32
|
toggleCardMode,
|
|
33
33
|
hideHardDelete,
|
|
34
34
|
forceReInit,
|
|
35
|
-
isSuperAdmin
|
|
36
35
|
}: ImageTaggingContainerType) => {
|
|
37
36
|
const [initialTags, setInitialTags] = useState<ReleaseTag[]>(imageReleaseTags ? imageReleaseTags : [])
|
|
38
37
|
const [initialDescription, setInitialDescription] = useState(imageComment ? imageComment.comment : '')
|
|
@@ -45,9 +44,13 @@ export const ImageTagsContainer = ({
|
|
|
45
44
|
const [createTags, setCreateTags] = useState<ReleaseTag[]>([])
|
|
46
45
|
const [softDeleteTags, setSoftDeleteTags] = useState<ReleaseTag[]>([])
|
|
47
46
|
const [hardDeleteTags, setHardDeleteTags] = useState<ReleaseTag[]>([])
|
|
47
|
+
const [isSuperAdmin, setSuperAdmin] = useState<boolean>(false)
|
|
48
48
|
const [descriptionValidationMessage, setDescriptionValidationMessage] = useState<string>('')
|
|
49
49
|
const [textInput, setTextInput] = useState<string>('')
|
|
50
50
|
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
initialise()
|
|
53
|
+
}, [])
|
|
51
54
|
|
|
52
55
|
useEffect(() => {
|
|
53
56
|
reInitState()
|
|
@@ -57,6 +60,16 @@ export const ImageTagsContainer = ({
|
|
|
57
60
|
setExistingTags(appReleaseTagNames ? appReleaseTagNames : [])
|
|
58
61
|
}, [appReleaseTagNames])
|
|
59
62
|
|
|
63
|
+
async function initialise() {
|
|
64
|
+
try {
|
|
65
|
+
const userRole = await getUserRole()
|
|
66
|
+
|
|
67
|
+
const superAdmin = userRole?.result?.roles?.includes('role:super-admin___')
|
|
68
|
+
setSuperAdmin(superAdmin)
|
|
69
|
+
} catch (err) {
|
|
70
|
+
showError(err)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
60
73
|
|
|
61
74
|
const reInitState = () => {
|
|
62
75
|
if (forceReInit || !isEditing) {
|
package/src/Common/Types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode, CSSProperties } from 'react'
|
|
2
2
|
import { Placement } from 'tippy.js'
|
|
3
|
-
import { ImageComment, ReleaseTag } from
|
|
3
|
+
import { ImageComment, ReleaseTag } from './ImageTags.Types'
|
|
4
4
|
export interface ResponseType {
|
|
5
5
|
code: number
|
|
6
6
|
status: string
|
|
@@ -216,9 +216,9 @@ export interface UserApprovalMetadataType {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
export enum FilterStates {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
ERROR = 2
|
|
219
|
+
ALLOWED = 0,
|
|
220
|
+
BLOCKED = 1,
|
|
221
|
+
ERROR = 2,
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
export interface CDMaterialType {
|
|
@@ -246,7 +246,7 @@ export interface CDMaterialType {
|
|
|
246
246
|
imageComment?: ImageComment
|
|
247
247
|
imageReleaseTags?: ReleaseTag[]
|
|
248
248
|
artifactStatus?: string
|
|
249
|
-
filterState: FilterStates
|
|
249
|
+
filterState: FilterStates
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
export interface CommonNodeAttr {
|
|
@@ -304,7 +304,7 @@ export interface CommonNodeAttr {
|
|
|
304
304
|
deploymentAppType?: DeploymentAppTypes
|
|
305
305
|
isCITriggerBlocked?: boolean
|
|
306
306
|
ciBlockState?: {
|
|
307
|
-
action: any
|
|
307
|
+
action: any
|
|
308
308
|
metadataField: string
|
|
309
309
|
}
|
|
310
310
|
appReleaseTagNames?: string[]
|
|
@@ -315,7 +315,7 @@ export enum DeploymentAppTypes {
|
|
|
315
315
|
HELM = 'helm',
|
|
316
316
|
GITOPS = 'argo_cd',
|
|
317
317
|
MANIFEST_DOWNLOAD = 'manifest_download',
|
|
318
|
-
MANIFEST_PUSH='manifest_push'
|
|
318
|
+
MANIFEST_PUSH = 'manifest_push',
|
|
319
319
|
}
|
|
320
320
|
|
|
321
321
|
export interface VulnerabilityType {
|
|
@@ -345,6 +345,23 @@ export interface MaterialInfo {
|
|
|
345
345
|
type?: string
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
export enum FilterConditionType {
|
|
349
|
+
PASS = 1,
|
|
350
|
+
FAIL = 0,
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export interface FilterConditionsInfo {
|
|
354
|
+
conditionType: FilterConditionType
|
|
355
|
+
expression: string
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export interface FilterConditionsListType {
|
|
359
|
+
id: number
|
|
360
|
+
name: string
|
|
361
|
+
description: string
|
|
362
|
+
conditions: FilterConditionsInfo[]
|
|
363
|
+
}
|
|
364
|
+
|
|
348
365
|
export interface CDMaterialResponseType {
|
|
349
366
|
approvalUsers: string[]
|
|
350
367
|
materials: any[]
|
|
@@ -353,9 +370,9 @@ export interface CDMaterialResponseType {
|
|
|
353
370
|
tagsEditable: boolean
|
|
354
371
|
appReleaseTagNames: string[]
|
|
355
372
|
hideImageTaggingHardDelete: boolean
|
|
373
|
+
resourceFilters?: FilterConditionsListType[]
|
|
356
374
|
}
|
|
357
375
|
|
|
358
|
-
|
|
359
376
|
export interface InputDetailType {
|
|
360
377
|
label: string
|
|
361
378
|
defaultValue: string
|
|
@@ -404,7 +421,6 @@ export interface AsyncState<T> {
|
|
|
404
421
|
dependencies: any[]
|
|
405
422
|
}
|
|
406
423
|
|
|
407
|
-
|
|
408
424
|
export interface AsyncOptions {
|
|
409
425
|
resetOnChange: boolean
|
|
410
426
|
}
|