@devtron-labs/devtron-fe-common-lib 0.0.10-beta-15 → 0.0.10-beta-16
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.d.ts +2 -2
- package/dist/Common/Types.d.ts +4 -1
- package/dist/index.js +8 -6
- package/package.json +1 -1
- package/src/Common/ImageTags.tsx +9 -2
- package/src/Common/Types.ts +4 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ImageButtonType, ImageTaggingContainerType } from './Types';
|
|
3
|
-
export declare const ImageTagsContainer: ({ ciPipelineId, artifactId, imageComment, imageReleaseTags, appReleaseTagNames, setAppReleaseTagNames, tagsEditable, setTagsEditable, toggleCardMode, hideHardDelete, forceReInit }: ImageTaggingContainerType) => JSX.Element;
|
|
4
|
-
export declare const ImageTagButton: ({ text, isSoftDeleted, isEditing, onSoftDeleteClick, onHardDeleteClick, tagId, softDeleteTags, isSuperAdmin, duplicateTag, }: ImageButtonType) => JSX.Element;
|
|
3
|
+
export declare const ImageTagsContainer: ({ ciPipelineId, artifactId, imageComment, imageReleaseTags, matId, updateCurrentAppMaterial, appReleaseTagNames, setAppReleaseTagNames, tagsEditable, setTagsEditable, toggleCardMode, hideHardDelete, forceReInit, }: ImageTaggingContainerType) => JSX.Element;
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode, CSSProperties } from 'react';
|
|
1
|
+
import React, { ReactNode, CSSProperties } from 'react';
|
|
2
2
|
import { Placement } from 'tippy.js';
|
|
3
3
|
export interface ResponseType {
|
|
4
4
|
code: number;
|
|
@@ -323,6 +323,8 @@ export interface ImageTaggingContainerType {
|
|
|
323
323
|
artifactId?: number;
|
|
324
324
|
imageComment?: ImageComment;
|
|
325
325
|
imageReleaseTags?: ReleaseTag[];
|
|
326
|
+
matId?: number;
|
|
327
|
+
updateCurrentAppMaterial?: (matId: number, releaseTags?: ReleaseTag[], imageComment?: ImageComment) => void;
|
|
326
328
|
appReleaseTagNames?: string[];
|
|
327
329
|
tagsEditable?: boolean;
|
|
328
330
|
forceReInit?: boolean;
|
|
@@ -341,5 +343,6 @@ export interface ImageButtonType {
|
|
|
341
343
|
softDeleteTags: any;
|
|
342
344
|
isSuperAdmin: any;
|
|
343
345
|
duplicateTag?: boolean;
|
|
346
|
+
hideHardDelete?: boolean;
|
|
344
347
|
}
|
|
345
348
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -22696,7 +22696,7 @@ var SvgIcEnter = function SvgIcEnter(props) {
|
|
|
22696
22696
|
};
|
|
22697
22697
|
|
|
22698
22698
|
var ImageTagsContainer = function (_a) {
|
|
22699
|
-
var ciPipelineId = _a.ciPipelineId, artifactId = _a.artifactId, imageComment = _a.imageComment, imageReleaseTags = _a.imageReleaseTags, appReleaseTagNames = _a.appReleaseTagNames, setAppReleaseTagNames = _a.setAppReleaseTagNames, tagsEditable = _a.tagsEditable, setTagsEditable = _a.setTagsEditable, toggleCardMode = _a.toggleCardMode
|
|
22699
|
+
var ciPipelineId = _a.ciPipelineId, artifactId = _a.artifactId, imageComment = _a.imageComment, imageReleaseTags = _a.imageReleaseTags, matId = _a.matId, updateCurrentAppMaterial = _a.updateCurrentAppMaterial, appReleaseTagNames = _a.appReleaseTagNames, setAppReleaseTagNames = _a.setAppReleaseTagNames, tagsEditable = _a.tagsEditable, setTagsEditable = _a.setTagsEditable, toggleCardMode = _a.toggleCardMode, hideHardDelete = _a.hideHardDelete, forceReInit = _a.forceReInit;
|
|
22700
22700
|
var _b = __read(React.useState(imageReleaseTags ? imageReleaseTags : []), 2), initialTags = _b[0], setInitialTags = _b[1];
|
|
22701
22701
|
var _c = __read(React.useState(imageComment ? imageComment.comment : ''), 2), initialDescription = _c[0], setInitialDescription = _c[1];
|
|
22702
22702
|
var _d = __read(React.useState(appReleaseTagNames ? appReleaseTagNames : []), 2), existingTags = _d[0], setExistingTags = _d[1];
|
|
@@ -22885,7 +22885,7 @@ var ImageTagsContainer = function (_a) {
|
|
|
22885
22885
|
// set loading state true
|
|
22886
22886
|
setImageTags(payload, ciPipelineId, artifactId)
|
|
22887
22887
|
.then(function (res) {
|
|
22888
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
22888
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
22889
22889
|
var tags = (_b = (_a = res.result) === null || _a === void 0 ? void 0 : _a.imageReleaseTags) === null || _b === void 0 ? void 0 : _b.map(function (tag) { return ({
|
|
22890
22890
|
id: tag.id,
|
|
22891
22891
|
tagName: tag.tagName,
|
|
@@ -22909,6 +22909,8 @@ var ImageTagsContainer = function (_a) {
|
|
|
22909
22909
|
handleEditClick();
|
|
22910
22910
|
setShowTagsWarning(false);
|
|
22911
22911
|
setTagErrorMessage('');
|
|
22912
|
+
if (updateCurrentAppMaterial)
|
|
22913
|
+
updateCurrentAppMaterial(matId, tags, (_j = res.result) === null || _j === void 0 ? void 0 : _j.imageComment);
|
|
22912
22914
|
})
|
|
22913
22915
|
.catch(function (err) {
|
|
22914
22916
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -22968,7 +22970,7 @@ var ImageTagsContainer = function (_a) {
|
|
|
22968
22970
|
}, onHardDeleteClick: function (e) {
|
|
22969
22971
|
stopPropagation(e);
|
|
22970
22972
|
handleTagHardDelete(index);
|
|
22971
|
-
}, tagId: tag.id, softDeleteTags: softDeleteTags, isSuperAdmin: isSuperAdmin, duplicateTag: tag === null || tag === void 0 ? void 0 : tag.duplicateTag }, 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) {
|
|
22973
|
+
}, 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) {
|
|
22972
22974
|
stopPropagation(e);
|
|
22973
22975
|
handleCancel();
|
|
22974
22976
|
} }, { 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) {
|
|
@@ -22980,16 +22982,16 @@ var ImageTagsContainer = function (_a) {
|
|
|
22980
22982
|
}, onHardDeleteClick: function (e) {
|
|
22981
22983
|
stopPropagation(e);
|
|
22982
22984
|
handleTagHardDelete(index);
|
|
22983
|
-
}, tagId: tag.id, softDeleteTags: softDeleteTags, isSuperAdmin: isSuperAdmin, duplicateTag: tag === null || tag === void 0 ? void 0 : tag.duplicateTag }, tag === null || tag === void 0 ? void 0 : tag.id)); }) }))] }) })), jsxRuntime.jsx("div", __assign({ className: "mt-8 mr-6 icon-dim-16" }, { children: tagsEditable && (jsxRuntime.jsx(SvgIcPencil, { className: "icon-dim-16 image-tags-container-edit__icon cursor", "data-testid": "edit-tags-icon", onClick: function (e) {
|
|
22985
|
+
}, tagId: tag.id, softDeleteTags: softDeleteTags, isSuperAdmin: isSuperAdmin, duplicateTag: tag === null || tag === void 0 ? void 0 : tag.duplicateTag, hideHardDelete: hideHardDelete }, tag === null || tag === void 0 ? void 0 : tag.id)); }) }))] }) })), jsxRuntime.jsx("div", __assign({ className: "mt-8 mr-6 icon-dim-16" }, { children: tagsEditable && (jsxRuntime.jsx(SvgIcPencil, { className: "icon-dim-16 image-tags-container-edit__icon cursor", "data-testid": "edit-tags-icon", onClick: function (e) {
|
|
22984
22986
|
stopPropagation(e);
|
|
22985
22987
|
handleEditClick();
|
|
22986
22988
|
} })) }))] }))) })));
|
|
22987
22989
|
};
|
|
22988
22990
|
var ImageTagButton = function (_a) {
|
|
22989
|
-
var text = _a.text, isSoftDeleted = _a.isSoftDeleted, isEditing = _a.isEditing, onSoftDeleteClick = _a.onSoftDeleteClick, onHardDeleteClick = _a.onHardDeleteClick, tagId = _a.tagId, softDeleteTags = _a.softDeleteTags, isSuperAdmin = _a.isSuperAdmin, duplicateTag = _a.duplicateTag;
|
|
22991
|
+
var text = _a.text, isSoftDeleted = _a.isSoftDeleted, isEditing = _a.isEditing, onSoftDeleteClick = _a.onSoftDeleteClick, onHardDeleteClick = _a.onHardDeleteClick, tagId = _a.tagId, softDeleteTags = _a.softDeleteTags, isSuperAdmin = _a.isSuperAdmin, duplicateTag = _a.duplicateTag, hideHardDelete = _a.hideHardDelete;
|
|
22990
22992
|
var IconComponent = isSoftDeleted ? SvgIcArrowCounterClockwise : SvgIcMinus;
|
|
22991
22993
|
var isInSoftDeleteTags = isSoftDeleted && softDeleteTags.some(function (tag) { return tag.tagName === text; });
|
|
22992
|
-
var canTagBeHardDelete = tagId === 0 || isSuperAdmin;
|
|
22994
|
+
var canTagBeHardDelete = tagId === 0 || (isSuperAdmin && !hideHardDelete);
|
|
22993
22995
|
var tabColor = function () {
|
|
22994
22996
|
if (duplicateTag) {
|
|
22995
22997
|
return 'cr-5 bcr-1 er-2';
|
package/package.json
CHANGED
package/src/Common/ImageTags.tsx
CHANGED
|
@@ -24,13 +24,15 @@ export const ImageTagsContainer = ({
|
|
|
24
24
|
artifactId,
|
|
25
25
|
imageComment,
|
|
26
26
|
imageReleaseTags,
|
|
27
|
+
matId,
|
|
28
|
+
updateCurrentAppMaterial,
|
|
27
29
|
appReleaseTagNames,
|
|
28
30
|
setAppReleaseTagNames,
|
|
29
31
|
tagsEditable,
|
|
30
32
|
setTagsEditable,
|
|
31
33
|
toggleCardMode,
|
|
32
34
|
hideHardDelete,
|
|
33
|
-
forceReInit
|
|
35
|
+
forceReInit,
|
|
34
36
|
}: ImageTaggingContainerType) => {
|
|
35
37
|
const [initialTags, setInitialTags] = useState<ReleaseTag[]>(imageReleaseTags ? imageReleaseTags : [])
|
|
36
38
|
const [initialDescription, setInitialDescription] = useState(imageComment ? imageComment.comment : '')
|
|
@@ -249,6 +251,7 @@ export const ImageTagsContainer = ({
|
|
|
249
251
|
handleEditClick()
|
|
250
252
|
setShowTagsWarning(false)
|
|
251
253
|
setTagErrorMessage('')
|
|
254
|
+
if(updateCurrentAppMaterial)updateCurrentAppMaterial(matId,tags,res.result?.imageComment)
|
|
252
255
|
})
|
|
253
256
|
.catch((err) => {
|
|
254
257
|
// Fix toast message
|
|
@@ -330,6 +333,7 @@ export const ImageTagsContainer = ({
|
|
|
330
333
|
}
|
|
331
334
|
|
|
332
335
|
const setInputValue = (e) => {
|
|
336
|
+
|
|
333
337
|
setTextInput(e.target.value)
|
|
334
338
|
}
|
|
335
339
|
|
|
@@ -406,6 +410,7 @@ export const ImageTagsContainer = ({
|
|
|
406
410
|
softDeleteTags={softDeleteTags}
|
|
407
411
|
isSuperAdmin={isSuperAdmin}
|
|
408
412
|
duplicateTag={tag?.duplicateTag}
|
|
413
|
+
hideHardDelete={hideHardDelete}
|
|
409
414
|
/>
|
|
410
415
|
))}
|
|
411
416
|
</div>
|
|
@@ -484,6 +489,7 @@ export const ImageTagsContainer = ({
|
|
|
484
489
|
softDeleteTags={softDeleteTags}
|
|
485
490
|
isSuperAdmin={isSuperAdmin}
|
|
486
491
|
duplicateTag={tag?.duplicateTag}
|
|
492
|
+
hideHardDelete={hideHardDelete}
|
|
487
493
|
/>
|
|
488
494
|
))}
|
|
489
495
|
</div>
|
|
@@ -517,10 +523,11 @@ export const ImageTagButton = ({
|
|
|
517
523
|
softDeleteTags,
|
|
518
524
|
isSuperAdmin,
|
|
519
525
|
duplicateTag,
|
|
526
|
+
hideHardDelete,
|
|
520
527
|
}: ImageButtonType) => {
|
|
521
528
|
const IconComponent = isSoftDeleted ? Redo : Minus
|
|
522
529
|
const isInSoftDeleteTags = isSoftDeleted && softDeleteTags.some((tag) => tag.tagName === text)
|
|
523
|
-
const canTagBeHardDelete = tagId === 0 || isSuperAdmin
|
|
530
|
+
const canTagBeHardDelete = tagId === 0 || (isSuperAdmin && !hideHardDelete)
|
|
524
531
|
|
|
525
532
|
const tabColor = () => {
|
|
526
533
|
if (duplicateTag) {
|
package/src/Common/Types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode, CSSProperties } from 'react'
|
|
1
|
+
import React, { ReactNode, CSSProperties } from 'react'
|
|
2
2
|
import { Placement } from 'tippy.js'
|
|
3
3
|
export interface ResponseType {
|
|
4
4
|
code: number
|
|
@@ -356,6 +356,8 @@ export interface ImageTaggingContainerType {
|
|
|
356
356
|
artifactId?: number
|
|
357
357
|
imageComment?: ImageComment
|
|
358
358
|
imageReleaseTags?: ReleaseTag[]
|
|
359
|
+
matId?: number
|
|
360
|
+
updateCurrentAppMaterial? : (matId:number, releaseTags?:ReleaseTag[], imageComment?:ImageComment) => void
|
|
359
361
|
appReleaseTagNames?: string[]
|
|
360
362
|
tagsEditable?: boolean
|
|
361
363
|
forceReInit?: boolean
|
|
@@ -375,6 +377,7 @@ export interface ImageButtonType {
|
|
|
375
377
|
softDeleteTags: any
|
|
376
378
|
isSuperAdmin: any
|
|
377
379
|
duplicateTag?: boolean
|
|
380
|
+
hideHardDelete?: boolean
|
|
378
381
|
}
|
|
379
382
|
|
|
380
383
|
|