@devtron-labs/devtron-fe-common-lib 0.1.15-beta-3 → 0.1.15-beta-5

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.
Files changed (35) hide show
  1. package/dist/Common/AppStatus/constants.d.ts +0 -5
  2. package/dist/Common/Constants.d.ts +2 -0
  3. package/dist/Common/Types.d.ts +1 -2
  4. package/dist/Shared/Components/FilterChips/FilterChips.component.d.ts +1 -1
  5. package/dist/Shared/Components/FilterChips/types.d.ts +18 -6
  6. package/dist/Shared/Components/Header/HeaderWithCreateButton/constants.d.ts +22 -0
  7. package/dist/Shared/Hooks/index.d.ts +1 -0
  8. package/dist/Shared/Hooks/useGetResourceKindsOptions/index.d.ts +2 -0
  9. package/dist/Shared/Hooks/useGetResourceKindsOptions/service.d.ts +9 -0
  10. package/dist/Shared/Hooks/useGetResourceKindsOptions/types.d.ts +31 -0
  11. package/dist/Shared/Hooks/useGetResourceKindsOptions/useGetResourceKindsOptions.d.ts +16 -0
  12. package/dist/Shared/Hooks/useGetResourceKindsOptions/utils.d.ts +4 -0
  13. package/dist/Shared/Services/common.service.d.ts +3 -2
  14. package/dist/Shared/Services/types.d.ts +15 -4
  15. package/dist/Shared/constants.d.ts +1 -26
  16. package/dist/Shared/types.d.ts +8 -10
  17. package/dist/{cssMode-058ab96c.js → cssMode-a297ca6e.js} +1 -1
  18. package/dist/{freemarker2-64197048.js → freemarker2-05744383.js} +1 -1
  19. package/dist/{handlebars-90c1751f.js → handlebars-ab9e5510.js} +1 -1
  20. package/dist/{html-c30667e4.js → html-fb5fd277.js} +1 -1
  21. package/dist/{htmlMode-7a8b50c7.js → htmlMode-7431ae7d.js} +1 -1
  22. package/dist/{index-e2376136.js → index-487cba05.js} +18897 -18827
  23. package/dist/index.d.ts +1 -2
  24. package/dist/index.js +325 -323
  25. package/dist/{javascript-df1177dd.js → javascript-097af821.js} +1 -1
  26. package/dist/{jsonMode-eb5f0a08.js → jsonMode-d511a4fb.js} +1 -1
  27. package/dist/{liquid-4d1dbabc.js → liquid-e8a241ee.js} +1 -1
  28. package/dist/{mdx-a79fb1a5.js → mdx-1d38e886.js} +1 -1
  29. package/dist/{python-d2ee4285.js → python-6001c39d.js} +1 -1
  30. package/dist/{razor-4a83f7e4.js → razor-122e5840.js} +1 -1
  31. package/dist/{tsMode-6ddb6fc9.js → tsMode-c0596bae.js} +1 -1
  32. package/dist/{typescript-5844ed4e.js → typescript-12536e6a.js} +1 -1
  33. package/dist/{xml-bd63fabc.js → xml-d09d26cb.js} +1 -1
  34. package/dist/{yaml-111cdabf.js → yaml-bf1a774e.js} +1 -1
  35. package/package.json +1 -1
@@ -4,11 +4,6 @@ export declare const StatusConstants: {
4
4
  normalCase: string;
5
5
  lowerCase: string;
6
6
  };
7
- NOT_READY: {
8
- noSpaceLower: string;
9
- normalCase: string;
10
- lowerCase: string;
11
- };
12
7
  APP_STATUS: {
13
8
  noSpaceLower: string;
14
9
  normalText: string;
@@ -75,6 +75,8 @@ export declare const ROUTES: {
75
75
  CONFIG_CD_PIPELINE: string;
76
76
  MODULE_CONFIGURED: string;
77
77
  RESOURCE_HISTORY_DEPLOYMENT: string;
78
+ APP_LIST_MIN: string;
79
+ CLUSTER_LIST_MIN: string;
78
80
  PLUGIN_GLOBAL_LIST_DETAIL_V2: string;
79
81
  PLUGIN_GLOBAL_LIST_V2: string;
80
82
  PLUGIN_GLOBAL_LIST_TAGS: string;
@@ -488,8 +488,7 @@ export declare enum DeploymentAppTypes {
488
488
  HELM = "helm",
489
489
  GITOPS = "argo_cd",
490
490
  MANIFEST_DOWNLOAD = "manifest_download",
491
- MANIFEST_PUSH = "manifest_push",
492
- FLUX = "flux"
491
+ MANIFEST_PUSH = "manifest_push"
493
492
  }
494
493
  export interface VulnerabilityType {
495
494
  name: string;
@@ -3,5 +3,5 @@ import { FilterChipsProps } from './types';
3
3
  /**
4
4
  * Component for rendering the applied filter chips
5
5
  */
6
- declare const FilterChips: <T = Record<string, unknown>>({ filterConfig, clearFilters, onRemoveFilter, getFormattedLabel, getFormattedValue, className, clearButtonClassName, shouldHideLabel, }: FilterChipsProps<T>) => JSX.Element;
6
+ declare const FilterChips: <T = Record<string, unknown>>({ filterConfig, clearFilters, onRemoveFilter, getFormattedLabel, getFormattedValue, className, clearButtonClassName, showClearAndRemove, shouldHideLabel, }: FilterChipsProps<T>) => JSX.Element;
7
7
  export default FilterChips;
@@ -21,17 +21,33 @@ export interface FilterChipProps {
21
21
  * If passed, the label will be formatted accordingly
22
22
  */
23
23
  getFormattedValue?: (filterKey: string, filterValue: unknown) => ReactNode;
24
+ showRemoveIcon: boolean;
24
25
  /**
25
26
  * If true, would hide the label
26
27
  * @default false
27
28
  */
28
29
  shouldHideLabel?: boolean;
29
30
  }
30
- export interface FilterChipsProps<T = Record<string, unknown>> extends Pick<FilterChipProps, 'getFormattedLabel' | 'getFormattedValue' | 'shouldHideLabel'> {
31
+ export type FilterChipsProps<T = Record<string, unknown>> = Pick<FilterChipProps, 'getFormattedLabel' | 'getFormattedValue' | 'shouldHideLabel'> & {
31
32
  /**
32
33
  * Current filter configuration
33
34
  */
34
35
  filterConfig: T;
36
+ /**
37
+ * Class name for the container
38
+ */
39
+ className?: string;
40
+ } & ({
41
+ /**
42
+ * If false, anything related to removing filters is not shown
43
+ * @default 'true'
44
+ */
45
+ showClearAndRemove: false;
46
+ clearFilters?: never;
47
+ onRemoveFilter?: never;
48
+ clearButtonClassName?: never;
49
+ } | {
50
+ showClearAndRemove?: true;
35
51
  /**
36
52
  * Callback handler for removing the filters
37
53
  */
@@ -40,12 +56,8 @@ export interface FilterChipsProps<T = Record<string, unknown>> extends Pick<Filt
40
56
  * Handler for removing a applied filter
41
57
  */
42
58
  onRemoveFilter: (filterConfig: T) => void;
43
- /**
44
- * Class name for the container
45
- */
46
- className?: string;
47
59
  /**
48
60
  * Class name for the clear filter button
49
61
  */
50
62
  clearButtonClassName?: string;
51
- }
63
+ });
@@ -0,0 +1,22 @@
1
+ declare const AppListConstants: {
2
+ SAMPLE_NODE_REPO_URL: string;
3
+ CREATE_DEVTRON_APP_URL: string;
4
+ AppTabs: {
5
+ DEVTRON_APPS: string;
6
+ HELM_APPS: string;
7
+ ARGO_APPS: string;
8
+ };
9
+ AppType: {
10
+ DEVTRON_APPS: string;
11
+ HELM_APPS: string;
12
+ ARGO_APPS: string;
13
+ };
14
+ FilterType: {
15
+ PROJECT: string;
16
+ CLUTSER: string;
17
+ NAMESPACE: string;
18
+ ENVIRONMENT: string;
19
+ APP_STATUS: string;
20
+ };
21
+ };
22
+ export default AppListConstants;
@@ -1,2 +1,3 @@
1
1
  export * from './UsePrompt';
2
+ export * from './useGetResourceKindsOptions';
2
3
  export * from './UseDownload';
@@ -0,0 +1,2 @@
1
+ export { default as useGetResourceKindsOptions } from './useGetResourceKindsOptions';
2
+ export type { UseGetResourceKindsOptionsProps, UseGetResourceKindOptionsReturnType } from './types';
@@ -0,0 +1,9 @@
1
+ import { Teams } from '../../../Common/Types';
2
+ import { ClusterType } from '../../Services';
3
+ import { EnvironmentType } from '../../types';
4
+ import { AppsGroupedByProjectsType } from './types';
5
+
6
+ export declare const getAppOptionsGroupedByProjects: () => Promise<AppsGroupedByProjectsType>;
7
+ export declare const getProjectOptions: () => Promise<Pick<Teams, 'id' | 'name'>[]>;
8
+ export declare const getClusterOptions: () => Promise<ClusterType[]>;
9
+ export declare const getEnvironmentOptions: () => Promise<EnvironmentType[]>;
@@ -0,0 +1,31 @@
1
+ import { ResourceKindType } from '../../types';
2
+ import { ServerErrors } from '../../../Common/ServerError';
3
+ import { getAppOptionsGroupedByProjects, getClusterOptions, getEnvironmentOptions, getProjectOptions } from './service';
4
+
5
+ export interface AppType {
6
+ name: string;
7
+ }
8
+ export type AppsGroupedByProjectsType = {
9
+ projectId: number;
10
+ projectName: string;
11
+ appList: AppType[];
12
+ }[];
13
+ export interface ClusterDTO {
14
+ id: number;
15
+ cluster_name: string;
16
+ isVirtualCluster: boolean;
17
+ }
18
+ export interface UseGetResourceKindsOptionsProps {
19
+ resourcesToFetch: Extract<ResourceKindType, ResourceKindType.devtronApplication | ResourceKindType.project | ResourceKindType.cluster | ResourceKindType.environment>[];
20
+ }
21
+ export interface UseGetResourceKindOptionsReturnType {
22
+ isResourcesOptionsLoading: boolean;
23
+ resourcesOptionsMap: {
24
+ [ResourceKindType.devtronApplication]: Awaited<ReturnType<typeof getAppOptionsGroupedByProjects>>;
25
+ [ResourceKindType.project]: Awaited<ReturnType<typeof getProjectOptions>>;
26
+ [ResourceKindType.cluster]: Awaited<ReturnType<typeof getClusterOptions>>;
27
+ [ResourceKindType.environment]: Awaited<ReturnType<typeof getEnvironmentOptions>>;
28
+ };
29
+ resourcesOptionsError: ServerErrors;
30
+ refetchResourcesOptions: () => void;
31
+ }
@@ -0,0 +1,16 @@
1
+ import { UseGetResourceKindOptionsReturnType, UseGetResourceKindsOptionsProps } from './types';
2
+
3
+ /**
4
+ * Generic hook to fetch the options list for the supported resource kinds.
5
+ *
6
+ * Note: no call would be made for empty resource kind list
7
+ *
8
+ * @example Usage
9
+ * ```tsx
10
+ * const data = useGetResourceKindsOptions({
11
+ * resourcesToFetch: [ResourceKindType.devtronApplication, ResourceKindType.environment]
12
+ * })
13
+ * ```
14
+ */
15
+ declare const useGetResourceKindsOptions: ({ resourcesToFetch, }: UseGetResourceKindsOptionsProps) => UseGetResourceKindOptionsReturnType;
16
+ export default useGetResourceKindsOptions;
@@ -0,0 +1,4 @@
1
+ import { ResourceKindType } from '../../types';
2
+ import { UseGetResourceKindsOptionsProps } from './types';
3
+
4
+ export declare const getResourcesToFetchMap: (resourcesToFetch: UseGetResourceKindsOptionsProps['resourcesToFetch']) => Record<ResourceKindType.devtronApplication | ResourceKindType.cluster | ResourceKindType.environment | ResourceKindType.project, boolean>;
@@ -1,3 +1,4 @@
1
- import { GetResourceApiUrlProps } from './types';
1
+ import { GetPolicyApiUrlProps, GetResourceApiUrlProps } from './types';
2
2
 
3
- export declare const getResourceApiUrl: <T>({ baseUrl, kind, version, queryParams }: GetResourceApiUrlProps<T>) => string;
3
+ export declare const getResourceApiUrl: <T>({ baseUrl, kind, version, suffix, queryParams }: GetResourceApiUrlProps<T>) => string;
4
+ export declare const getPolicyApiUrl: <T>({ kind, version, queryParams, suffix }: GetPolicyApiUrlProps<T>) => string;
@@ -1,5 +1,5 @@
1
1
  import { getUrlWithSearchParams } from '../../Common';
2
- import { ResourceKindType, ResourceVersionType } from '../types';
2
+ import { PolicyKindType, ResourceKindType, ResourceVersionType } from '../types';
3
3
 
4
4
  export interface ClusterType {
5
5
  id: number;
@@ -9,9 +9,20 @@ export interface ClusterType {
9
9
  */
10
10
  isVirtual: boolean;
11
11
  }
12
- export interface GetResourceApiUrlProps<T> {
12
+ /**
13
+ * T => Type of query params
14
+ * K => Type of kind
15
+ * P => Type of version
16
+ */
17
+ interface BaseGetApiUrlProps<T, K extends ResourceKindType | PolicyKindType, P extends ResourceVersionType> {
13
18
  baseUrl: string;
14
- kind: ResourceKindType;
15
- version: ResourceVersionType;
19
+ kind: K;
20
+ version: P;
21
+ suffix?: string;
16
22
  queryParams?: T extends Parameters<typeof getUrlWithSearchParams>[1] ? T : never;
17
23
  }
24
+ export interface GetResourceApiUrlProps<T> extends BaseGetApiUrlProps<T, ResourceKindType, ResourceVersionType> {
25
+ }
26
+ export interface GetPolicyApiUrlProps<T> extends Omit<BaseGetApiUrlProps<T, PolicyKindType, ResourceVersionType>, 'baseUrl'> {
27
+ }
28
+ export {};
@@ -349,35 +349,10 @@ export declare const statusColor: {
349
349
  };
350
350
  export declare const APP_STATUS_HEADERS: string[];
351
351
  export declare const MATERIAL_EXCLUDE_TIPPY_TEXT = "Not available for build as this commit contains changes in excluded files or folders";
352
- export declare const AppListConstants: {
353
- SAMPLE_NODE_REPO_URL: string;
354
- CREATE_DEVTRON_APP_URL: string;
355
- AppTabs: {
356
- DEVTRON_APPS: string;
357
- HELM_APPS: string;
358
- ARGO_APPS: string;
359
- FLUX_APPS: string;
360
- };
361
- AppType: {
362
- DEVTRON_APPS: string;
363
- HELM_APPS: string;
364
- ARGO_APPS: string;
365
- FLUX_APPS: string;
366
- };
367
- FilterType: {
368
- PROJECT: string;
369
- CLUTSER: string;
370
- NAMESPACE: string;
371
- ENVIRONMENT: string;
372
- APP_STATUS: string;
373
- TEMPLATE_TYPE: string;
374
- };
375
- };
376
352
  export declare enum K8sResourcePayloadAppType {
377
353
  DEVTRON_APP = 0,
378
354
  HELM_APP = 1,
379
- EXTERNAL_ARGO_APP = 2,
380
- EXTERNAL_FLUX_APP = 3
355
+ EXTERNAL_ARGO_APP = 2
381
356
  }
382
357
  /**
383
358
  * Size variants for components
@@ -124,8 +124,7 @@ export declare enum AppType {
124
124
  DEVTRON_APP = "devtron_app",
125
125
  DEVTRON_HELM_CHART = "devtron_helm_chart",
126
126
  EXTERNAL_HELM_CHART = "external_helm_chart",
127
- EXTERNAL_ARGO_APP = "external_argo_app",
128
- EXTERNAL_FLUX_APP = "external_flux_app"
127
+ EXTERNAL_ARGO_APP = "external_argo_app"
129
128
  }
130
129
  export interface HelmReleaseStatus {
131
130
  status: string;
@@ -141,11 +140,6 @@ interface MaterialInfo {
141
140
  url: string;
142
141
  webhookData: string;
143
142
  }
144
- export interface FluxAppStatusDetail {
145
- status: string;
146
- message: string;
147
- reason: string;
148
- }
149
143
  export interface AppDetails {
150
144
  appId?: number;
151
145
  appName: string;
@@ -187,8 +181,6 @@ export interface AppDetails {
187
181
  helmPackageName?: string;
188
182
  appStatus?: string;
189
183
  chartAvatar?: string;
190
- fluxTemplateType?: string;
191
- FluxAppStatusDetail?: FluxAppStatusDetail;
192
184
  }
193
185
  export declare enum RegistryType {
194
186
  GIT = "git",
@@ -368,15 +360,21 @@ export declare enum ResourceKindType {
368
360
  tenant = "tenant",
369
361
  installation = "installation",
370
362
  environment = "environment",
371
- cdPipeline = "cd-pipeline"
363
+ cdPipeline = "cd-pipeline",
364
+ project = "project"
372
365
  }
373
366
  /**
374
367
  * Versions support for the resources on BE
368
+ *
369
+ * TODO: Rename to ApiVersionType
375
370
  */
376
371
  export declare enum ResourceVersionType {
377
372
  v1 = "v1",
378
373
  alpha1 = "alpha1"
379
374
  }
375
+ export declare enum PolicyKindType {
376
+ lockConfiguration = "lock-configuration"
377
+ }
380
378
  export interface LastExecutionResultType {
381
379
  lastExecution: string;
382
380
  severityCount: {
@@ -1,7 +1,7 @@
1
1
  var Le = Object.defineProperty;
2
2
  var je = (e, n, i) => n in e ? Le(e, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[n] = i;
3
3
  var k = (e, n, i) => (je(e, typeof n != "symbol" ? n + "" : n, i), i);
4
- import { m as Ne } from "./index-e2376136.js";
4
+ import { m as Ne } from "./index-487cba05.js";
5
5
  /*!-----------------------------------------------------------------------------
6
6
  * Copyright (c) Microsoft Corporation. All rights reserved.
7
7
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
@@ -1,4 +1,4 @@
1
- import { m as F } from "./index-e2376136.js";
1
+ import { m as F } from "./index-487cba05.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
@@ -1,4 +1,4 @@
1
- import { m as i } from "./index-e2376136.js";
1
+ import { m as i } from "./index-487cba05.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
@@ -1,4 +1,4 @@
1
- import { m as d } from "./index-e2376136.js";
1
+ import { m as d } from "./index-487cba05.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
@@ -1,7 +1,7 @@
1
1
  var $e = Object.defineProperty;
2
2
  var qe = (e, n, i) => n in e ? $e(e, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[n] = i;
3
3
  var k = (e, n, i) => (qe(e, typeof n != "symbol" ? n + "" : n, i), i);
4
- import { m as Qe } from "./index-e2376136.js";
4
+ import { m as Qe } from "./index-487cba05.js";
5
5
  /*!-----------------------------------------------------------------------------
6
6
  * Copyright (c) Microsoft Corporation. All rights reserved.
7
7
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)