@devtron-labs/devtron-fe-common-lib 0.0.26-beta-4 → 0.0.26-beta1
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 +1 -0
- package/dist/Common/ImageTags.d.ts +1 -1
- package/dist/Common/Types.d.ts +0 -1
- package/dist/index.js +4 -31
- package/package.json +1 -1
- package/src/Common/Helper.tsx +1 -1
- package/src/Common/ImageTags.Types.ts +1 -0
- package/src/Common/ImageTags.tsx +1 -14
- package/src/Common/Types.ts +0 -1
|
@@ -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, }: ImageTaggingContainerType) => JSX.Element;
|
|
3
|
+
export declare const ImageTagsContainer: ({ ciPipelineId, artifactId, imageComment, imageReleaseTags, updateCurrentAppMaterial, appReleaseTagNames, setAppReleaseTagNames, tagsEditable, setTagsEditable, toggleCardMode, hideHardDelete, forceReInit, isSuperAdmin }: 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
package/dist/index.js
CHANGED
|
@@ -10065,7 +10065,7 @@ function CustomInput(_a) {
|
|
|
10065
10065
|
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) {
|
|
10066
10066
|
e.persist();
|
|
10067
10067
|
onChange(e);
|
|
10068
|
-
}, 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] }))); })] })));
|
|
10068
|
+
}, 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] }), err)); })] })));
|
|
10069
10069
|
}
|
|
10070
10070
|
function handleUTCTime(ts, isRelativeTime) {
|
|
10071
10071
|
if (isRelativeTime === void 0) { isRelativeTime = false; }
|
|
@@ -23000,7 +23000,7 @@ var SvgIcEnter = function SvgIcEnter(props) {
|
|
|
23000
23000
|
};
|
|
23001
23001
|
|
|
23002
23002
|
var ImageTagsContainer = function (_a) {
|
|
23003
|
-
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;
|
|
23003
|
+
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, isSuperAdmin = _a.isSuperAdmin;
|
|
23004
23004
|
var _b = __read(React.useState(imageReleaseTags ? imageReleaseTags : []), 2), initialTags = _b[0], setInitialTags = _b[1];
|
|
23005
23005
|
var _c = __read(React.useState(imageComment ? imageComment.comment : ''), 2), initialDescription = _c[0], setInitialDescription = _c[1];
|
|
23006
23006
|
var _d = __read(React.useState(appReleaseTagNames ? appReleaseTagNames : []), 2), existingTags = _d[0], setExistingTags = _d[1];
|
|
@@ -23012,41 +23012,14 @@ var ImageTagsContainer = function (_a) {
|
|
|
23012
23012
|
var _k = __read(React.useState([]), 2), createTags = _k[0], setCreateTags = _k[1];
|
|
23013
23013
|
var _l = __read(React.useState([]), 2), softDeleteTags = _l[0], setSoftDeleteTags = _l[1];
|
|
23014
23014
|
var _m = __read(React.useState([]), 2), hardDeleteTags = _m[0], setHardDeleteTags = _m[1];
|
|
23015
|
-
var _o = __read(React.useState(
|
|
23016
|
-
var _p = __read(React.useState(''), 2),
|
|
23017
|
-
var _q = __read(React.useState(''), 2), textInput = _q[0], setTextInput = _q[1];
|
|
23018
|
-
React.useEffect(function () {
|
|
23019
|
-
initialise();
|
|
23020
|
-
}, []);
|
|
23015
|
+
var _o = __read(React.useState(''), 2), descriptionValidationMessage = _o[0], setDescriptionValidationMessage = _o[1];
|
|
23016
|
+
var _p = __read(React.useState(''), 2), textInput = _p[0], setTextInput = _p[1];
|
|
23021
23017
|
React.useEffect(function () {
|
|
23022
23018
|
reInitState();
|
|
23023
23019
|
}, [imageReleaseTags, imageComment, tagsEditable]);
|
|
23024
23020
|
React.useEffect(function () {
|
|
23025
23021
|
setExistingTags(appReleaseTagNames ? appReleaseTagNames : []);
|
|
23026
23022
|
}, [appReleaseTagNames]);
|
|
23027
|
-
function initialise() {
|
|
23028
|
-
var _a, _b;
|
|
23029
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
23030
|
-
var userRole, superAdmin, err_1;
|
|
23031
|
-
return __generator(this, function (_c) {
|
|
23032
|
-
switch (_c.label) {
|
|
23033
|
-
case 0:
|
|
23034
|
-
_c.trys.push([0, 2, , 3]);
|
|
23035
|
-
return [4 /*yield*/, getUserRole()];
|
|
23036
|
-
case 1:
|
|
23037
|
-
userRole = _c.sent();
|
|
23038
|
-
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___');
|
|
23039
|
-
setSuperAdmin(superAdmin);
|
|
23040
|
-
return [3 /*break*/, 3];
|
|
23041
|
-
case 2:
|
|
23042
|
-
err_1 = _c.sent();
|
|
23043
|
-
showError(err_1);
|
|
23044
|
-
return [3 /*break*/, 3];
|
|
23045
|
-
case 3: return [2 /*return*/];
|
|
23046
|
-
}
|
|
23047
|
-
});
|
|
23048
|
-
});
|
|
23049
|
-
}
|
|
23050
23023
|
var reInitState = function () {
|
|
23051
23024
|
if (forceReInit || !isEditing) {
|
|
23052
23025
|
setInitialTags(imageReleaseTags ? imageReleaseTags : []);
|
package/package.json
CHANGED
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" key={err}>
|
|
330
330
|
<FormError className="form__icon form__icon--error" />
|
|
331
331
|
{err}
|
|
332
332
|
</div>
|
package/src/Common/ImageTags.tsx
CHANGED
|
@@ -32,6 +32,7 @@ export const ImageTagsContainer = ({
|
|
|
32
32
|
toggleCardMode,
|
|
33
33
|
hideHardDelete,
|
|
34
34
|
forceReInit,
|
|
35
|
+
isSuperAdmin
|
|
35
36
|
}: ImageTaggingContainerType) => {
|
|
36
37
|
const [initialTags, setInitialTags] = useState<ReleaseTag[]>(imageReleaseTags ? imageReleaseTags : [])
|
|
37
38
|
const [initialDescription, setInitialDescription] = useState(imageComment ? imageComment.comment : '')
|
|
@@ -44,13 +45,9 @@ export const ImageTagsContainer = ({
|
|
|
44
45
|
const [createTags, setCreateTags] = useState<ReleaseTag[]>([])
|
|
45
46
|
const [softDeleteTags, setSoftDeleteTags] = useState<ReleaseTag[]>([])
|
|
46
47
|
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
|
-
}, [])
|
|
54
51
|
|
|
55
52
|
useEffect(() => {
|
|
56
53
|
reInitState()
|
|
@@ -60,16 +57,6 @@ export const ImageTagsContainer = ({
|
|
|
60
57
|
setExistingTags(appReleaseTagNames ? appReleaseTagNames : [])
|
|
61
58
|
}, [appReleaseTagNames])
|
|
62
59
|
|
|
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
|
-
}
|
|
73
60
|
|
|
74
61
|
const reInitState = () => {
|
|
75
62
|
if (forceReInit || !isEditing) {
|
package/src/Common/Types.ts
CHANGED
|
@@ -267,7 +267,6 @@ export interface CommonNodeAttr {
|
|
|
267
267
|
colorCode?: string
|
|
268
268
|
isExternalCI?: boolean
|
|
269
269
|
isLinkedCI?: boolean
|
|
270
|
-
isJobCI?: boolean // used for Job type CI in Devtron Apps
|
|
271
270
|
environmentName?: string //used for CDs
|
|
272
271
|
environmentId?: number
|
|
273
272
|
inputMaterialList?: any[]
|