@devtron-labs/devtron-fe-common-lib 0.0.35 → 0.0.36

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.
@@ -24,6 +24,7 @@ export interface ImageTaggingContainerType {
24
24
  setTagsEditable?: (tagsEditable: boolean) => void;
25
25
  toggleCardMode?: (id: number) => void;
26
26
  hideHardDelete?: boolean;
27
+ isSuperAdmin?: boolean;
27
28
  }
28
29
  export interface ImageButtonType {
29
30
  text: string;
@@ -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
@@ -23126,7 +23126,7 @@ var SvgIcEnter = function SvgIcEnter(props) {
23126
23126
  };
23127
23127
 
23128
23128
  var ImageTagsContainer = function (_a) {
23129
- 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;
23129
+ 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;
23130
23130
  var _b = __read(React.useState(imageReleaseTags ? imageReleaseTags : []), 2), initialTags = _b[0], setInitialTags = _b[1];
23131
23131
  var _c = __read(React.useState(imageComment ? imageComment.comment : ''), 2), initialDescription = _c[0], setInitialDescription = _c[1];
23132
23132
  var _d = __read(React.useState(appReleaseTagNames ? appReleaseTagNames : []), 2), existingTags = _d[0], setExistingTags = _d[1];
@@ -23138,41 +23138,14 @@ var ImageTagsContainer = function (_a) {
23138
23138
  var _k = __read(React.useState([]), 2), createTags = _k[0], setCreateTags = _k[1];
23139
23139
  var _l = __read(React.useState([]), 2), softDeleteTags = _l[0], setSoftDeleteTags = _l[1];
23140
23140
  var _m = __read(React.useState([]), 2), hardDeleteTags = _m[0], setHardDeleteTags = _m[1];
23141
- var _o = __read(React.useState(false), 2), isSuperAdmin = _o[0], setSuperAdmin = _o[1];
23142
- var _p = __read(React.useState(''), 2), descriptionValidationMessage = _p[0], setDescriptionValidationMessage = _p[1];
23143
- var _q = __read(React.useState(''), 2), textInput = _q[0], setTextInput = _q[1];
23144
- React.useEffect(function () {
23145
- initialise();
23146
- }, []);
23141
+ var _o = __read(React.useState(''), 2), descriptionValidationMessage = _o[0], setDescriptionValidationMessage = _o[1];
23142
+ var _p = __read(React.useState(''), 2), textInput = _p[0], setTextInput = _p[1];
23147
23143
  React.useEffect(function () {
23148
23144
  reInitState();
23149
23145
  }, [imageReleaseTags, imageComment, tagsEditable]);
23150
23146
  React.useEffect(function () {
23151
23147
  setExistingTags(appReleaseTagNames ? appReleaseTagNames : []);
23152
23148
  }, [appReleaseTagNames]);
23153
- function initialise() {
23154
- var _a, _b;
23155
- return __awaiter(this, void 0, void 0, function () {
23156
- var userRole, superAdmin, err_1;
23157
- return __generator(this, function (_c) {
23158
- switch (_c.label) {
23159
- case 0:
23160
- _c.trys.push([0, 2, , 3]);
23161
- return [4 /*yield*/, getUserRole()];
23162
- case 1:
23163
- userRole = _c.sent();
23164
- 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___');
23165
- setSuperAdmin(superAdmin);
23166
- return [3 /*break*/, 3];
23167
- case 2:
23168
- err_1 = _c.sent();
23169
- showError(err_1);
23170
- return [3 /*break*/, 3];
23171
- case 3: return [2 /*return*/];
23172
- }
23173
- });
23174
- });
23175
- }
23176
23149
  var reInitState = function () {
23177
23150
  if (forceReInit || !isEditing) {
23178
23151
  setInitialTags(imageReleaseTags ? imageReleaseTags : []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -27,6 +27,7 @@ export interface ImageTaggingContainerType {
27
27
  setTagsEditable?: (tagsEditable: boolean) => void
28
28
  toggleCardMode?: (id: number) => void
29
29
  hideHardDelete?: boolean
30
+ isSuperAdmin?: boolean
30
31
  }
31
32
 
32
33
  export interface ImageButtonType {
@@ -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) {