@devtron-labs/devtron-fe-common-lib 0.0.29-beta-1 → 0.0.30-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.
|
@@ -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/index.js
CHANGED
|
@@ -10071,7 +10071,7 @@ function CustomInput(_a) {
|
|
|
10071
10071
|
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
10072
|
e.persist();
|
|
10073
10073
|
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] }))); })] })));
|
|
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] }), err)); })] })));
|
|
10075
10075
|
}
|
|
10076
10076
|
function handleUTCTime(ts, isRelativeTime) {
|
|
10077
10077
|
if (isRelativeTime === void 0) { isRelativeTime = false; }
|
|
@@ -23010,7 +23010,7 @@ var SvgIcEnter = function SvgIcEnter(props) {
|
|
|
23010
23010
|
};
|
|
23011
23011
|
|
|
23012
23012
|
var ImageTagsContainer = function (_a) {
|
|
23013
|
-
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;
|
|
23013
|
+
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;
|
|
23014
23014
|
var _b = __read(React.useState(imageReleaseTags ? imageReleaseTags : []), 2), initialTags = _b[0], setInitialTags = _b[1];
|
|
23015
23015
|
var _c = __read(React.useState(imageComment ? imageComment.comment : ''), 2), initialDescription = _c[0], setInitialDescription = _c[1];
|
|
23016
23016
|
var _d = __read(React.useState(appReleaseTagNames ? appReleaseTagNames : []), 2), existingTags = _d[0], setExistingTags = _d[1];
|
|
@@ -23022,41 +23022,14 @@ var ImageTagsContainer = function (_a) {
|
|
|
23022
23022
|
var _k = __read(React.useState([]), 2), createTags = _k[0], setCreateTags = _k[1];
|
|
23023
23023
|
var _l = __read(React.useState([]), 2), softDeleteTags = _l[0], setSoftDeleteTags = _l[1];
|
|
23024
23024
|
var _m = __read(React.useState([]), 2), hardDeleteTags = _m[0], setHardDeleteTags = _m[1];
|
|
23025
|
-
var _o = __read(React.useState(
|
|
23026
|
-
var _p = __read(React.useState(''), 2),
|
|
23027
|
-
var _q = __read(React.useState(''), 2), textInput = _q[0], setTextInput = _q[1];
|
|
23028
|
-
React.useEffect(function () {
|
|
23029
|
-
initialise();
|
|
23030
|
-
}, []);
|
|
23025
|
+
var _o = __read(React.useState(''), 2), descriptionValidationMessage = _o[0], setDescriptionValidationMessage = _o[1];
|
|
23026
|
+
var _p = __read(React.useState(''), 2), textInput = _p[0], setTextInput = _p[1];
|
|
23031
23027
|
React.useEffect(function () {
|
|
23032
23028
|
reInitState();
|
|
23033
23029
|
}, [imageReleaseTags, imageComment, tagsEditable]);
|
|
23034
23030
|
React.useEffect(function () {
|
|
23035
23031
|
setExistingTags(appReleaseTagNames ? appReleaseTagNames : []);
|
|
23036
23032
|
}, [appReleaseTagNames]);
|
|
23037
|
-
function initialise() {
|
|
23038
|
-
var _a, _b;
|
|
23039
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
23040
|
-
var userRole, superAdmin, err_1;
|
|
23041
|
-
return __generator(this, function (_c) {
|
|
23042
|
-
switch (_c.label) {
|
|
23043
|
-
case 0:
|
|
23044
|
-
_c.trys.push([0, 2, , 3]);
|
|
23045
|
-
return [4 /*yield*/, getUserRole()];
|
|
23046
|
-
case 1:
|
|
23047
|
-
userRole = _c.sent();
|
|
23048
|
-
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___');
|
|
23049
|
-
setSuperAdmin(superAdmin);
|
|
23050
|
-
return [3 /*break*/, 3];
|
|
23051
|
-
case 2:
|
|
23052
|
-
err_1 = _c.sent();
|
|
23053
|
-
showError(err_1);
|
|
23054
|
-
return [3 /*break*/, 3];
|
|
23055
|
-
case 3: return [2 /*return*/];
|
|
23056
|
-
}
|
|
23057
|
-
});
|
|
23058
|
-
});
|
|
23059
|
-
}
|
|
23060
23033
|
var reInitState = function () {
|
|
23061
23034
|
if (forceReInit || !isEditing) {
|
|
23062
23035
|
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) {
|