@devtron-labs/devtron-fe-common-lib 0.0.36 → 0.0.37-beta-2

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.
@@ -0,0 +1,6 @@
1
+ import { useSuperAdminType } from './types';
2
+ /**
3
+ * @description It will return isSuperAdmin and would be set to false by default, might need few optimizations like dep, etc
4
+ * @returns {useSuperAdminType} isSuperAdmin
5
+ */
6
+ export declare const useSuperAdmin: () => useSuperAdminType;
@@ -0,0 +1,3 @@
1
+ export interface useSuperAdminType {
2
+ isSuperAdmin: boolean;
3
+ }
@@ -0,0 +1 @@
1
+ export { useSuperAdmin } from './UseSuperAdmin/UseSuperAdmin';
@@ -228,6 +228,9 @@ export interface CDMaterialType {
228
228
  imageReleaseTags?: ReleaseTag[];
229
229
  artifactStatus?: string;
230
230
  filterState: FilterStates;
231
+ registryType?: string;
232
+ imagePath?: string;
233
+ registryName?: string;
231
234
  }
232
235
  export interface CommonNodeAttr {
233
236
  connectingCiPipelineId?: number;
@@ -38,3 +38,4 @@ export * from './ResizableTextarea';
38
38
  export { default as DebouncedSearch } from './DebouncedSearch/DebouncedSearch';
39
39
  export { default as Grid } from './Grid/Grid';
40
40
  export { default as ClipboardButton } from './ClipboardButton/ClipboardButton';
41
+ export * from './Hooks';
package/dist/index.js CHANGED
@@ -23589,6 +23589,25 @@ function ClipboardButton(_a) {
23589
23589
  return (jsxRuntime.jsx("div", __assign({ className: "icon-dim-16 flex center" }, { children: jsxRuntime.jsx(Tippy, __assign({ className: "default-tt", content: copied ? copiedTippyText : 'Copy', placement: "right", visible: copied || enableTippy }, { children: jsxRuntime.jsx("button", __assign({ type: "button", className: "dc__hover-n100 dc__outline-none-imp p-0 flex bcn-0 dc__no-border", onMouseEnter: handleEnableTippy, onMouseLeave: handleDisableTippy, onClick: handleCopyContent }, { children: jsxRuntime.jsx(SvgIcCopy, { className: "icon-dim-16" }) })) })) })));
23590
23590
  }
23591
23591
 
23592
+ /**
23593
+ * @description It will return isSuperAdmin and would be set to false by default, might need few optimizations like dep, etc
23594
+ * @returns {useSuperAdminType} isSuperAdmin
23595
+ */
23596
+ var useSuperAdmin = function () {
23597
+ var _a = __read(React.useState(false), 2), isSuperAdmin = _a[0], setSuperAdmin = _a[1];
23598
+ React.useEffect(function () {
23599
+ getUserRole()
23600
+ .then(function (response) {
23601
+ var _a;
23602
+ setSuperAdmin((_a = response.result.superAdmin) !== null && _a !== void 0 ? _a : false);
23603
+ })
23604
+ .catch(function (error) {
23605
+ showError(error);
23606
+ });
23607
+ }, []);
23608
+ return { isSuperAdmin: isSuperAdmin };
23609
+ };
23610
+
23592
23611
  exports.BreadCrumb = BreadCrumb;
23593
23612
  exports.BreadcrumbStore = Store;
23594
23613
  exports.BuildStageVariable = BuildStageVariable;
@@ -23690,4 +23709,5 @@ exports.useBreadcrumb = useBreadcrumb;
23690
23709
  exports.useEffectAfterMount = useEffectAfterMount;
23691
23710
  exports.useForm = useForm;
23692
23711
  exports.useSearchString = useSearchString;
23712
+ exports.useSuperAdmin = useSuperAdmin;
23693
23713
  exports.useThrottledEffect = useThrottledEffect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.36",
3
+ "version": "0.0.37-beta-2",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -0,0 +1,24 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { getUserRole } from '../../Common.service'
3
+ import { useSuperAdminType } from './types'
4
+ import { showError } from '../../Helper'
5
+
6
+ /**
7
+ * @description It will return isSuperAdmin and would be set to false by default, might need few optimizations like dep, etc
8
+ * @returns {useSuperAdminType} isSuperAdmin
9
+ */
10
+ export const useSuperAdmin = (): useSuperAdminType => {
11
+ const [isSuperAdmin, setSuperAdmin] = useState<boolean>(false)
12
+
13
+ useEffect(() => {
14
+ getUserRole()
15
+ .then((response) => {
16
+ setSuperAdmin(response.result.superAdmin ?? false)
17
+ })
18
+ .catch((error) => {
19
+ showError(error)
20
+ })
21
+ }, [])
22
+
23
+ return { isSuperAdmin }
24
+ }
@@ -0,0 +1,3 @@
1
+ export interface useSuperAdminType {
2
+ isSuperAdmin: boolean
3
+ }
@@ -0,0 +1 @@
1
+ export { useSuperAdmin } from './UseSuperAdmin/UseSuperAdmin'
@@ -16,7 +16,7 @@ import { TippyTheme } from './Types'
16
16
  import { ImageButtonType, ImageTaggingContainerType, ReleaseTag } from './ImageTags.Types'
17
17
  import { showError, stopPropagation } from './Helper'
18
18
  import { TippyCustomized } from './TippyCustomized'
19
- import { setImageTags, getUserRole } from './Common.service'
19
+ import { setImageTags } from './Common.service'
20
20
  import Tippy from '@tippyjs/react'
21
21
 
22
22
  export const ImageTagsContainer = ({
@@ -252,6 +252,9 @@ export interface CDMaterialType {
252
252
  imageReleaseTags?: ReleaseTag[]
253
253
  artifactStatus?: string
254
254
  filterState: FilterStates
255
+ registryType?: string;
256
+ imagePath?: string
257
+ registryName?: string
255
258
  }
256
259
 
257
260
  export interface CommonNodeAttr {
@@ -38,3 +38,4 @@ export * from './ResizableTextarea'
38
38
  export { default as DebouncedSearch } from './DebouncedSearch/DebouncedSearch'
39
39
  export { default as Grid } from './Grid/Grid'
40
40
  export { default as ClipboardButton } from './ClipboardButton/ClipboardButton'
41
+ export * from './Hooks'