@devtron-labs/devtron-fe-common-lib 0.1.19-beta-1 → 0.2.0

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 (52) hide show
  1. package/dist/Common/Api.d.ts +5 -5
  2. package/dist/Common/CIPipeline.Types.d.ts +1 -4
  3. package/dist/Common/Constants.d.ts +2 -2
  4. package/dist/Common/CustomInput/Types.d.ts +2 -2
  5. package/dist/Common/Modals/VisibleModal.d.ts +1 -1
  6. package/dist/Common/Modals/VisibleModal2.d.ts +1 -1
  7. package/dist/Common/MultiSelectCustomization.d.ts +1 -1
  8. package/dist/Common/Types.d.ts +2 -2
  9. package/dist/Shared/Components/DetectBottom/DetectBottom.component.d.ts +1 -2
  10. package/dist/Shared/Components/FilterChips/FilterChips.component.d.ts +1 -1
  11. package/dist/Shared/Components/FilterChips/types.d.ts +18 -6
  12. package/dist/Shared/Components/Header/types.d.ts +12 -1
  13. package/dist/Shared/Components/Plugin/service.d.ts +2 -4
  14. package/dist/Shared/Components/Plugin/types.d.ts +3 -11
  15. package/dist/Shared/Components/Plugin/utils.d.ts +0 -3
  16. package/dist/Shared/Components/SelectPicker/SelectPicker.component.d.ts +1 -1
  17. package/dist/Shared/Components/SelectPicker/type.d.ts +1 -10
  18. package/dist/Shared/Components/index.d.ts +0 -1
  19. package/dist/Shared/Hooks/index.d.ts +1 -0
  20. package/dist/Shared/Hooks/useGetResourceKindsOptions/index.d.ts +2 -0
  21. package/dist/Shared/Hooks/useGetResourceKindsOptions/service.d.ts +9 -0
  22. package/dist/Shared/Hooks/useGetResourceKindsOptions/types.d.ts +31 -0
  23. package/dist/Shared/Hooks/useGetResourceKindsOptions/useGetResourceKindsOptions.d.ts +16 -0
  24. package/dist/Shared/Hooks/useGetResourceKindsOptions/utils.d.ts +4 -0
  25. package/dist/Shared/Services/common.service.d.ts +3 -2
  26. package/dist/Shared/Services/types.d.ts +15 -4
  27. package/dist/Shared/constants.d.ts +9 -1
  28. package/dist/Shared/types.d.ts +7 -1
  29. package/dist/Shared/validations.d.ts +0 -11
  30. package/dist/assets/index.css +1 -1
  31. package/dist/{cssMode-a009bf29.js → cssMode-dbee7387.js} +1 -1
  32. package/dist/{freemarker2-802b12b0.js → freemarker2-fb697141.js} +1 -1
  33. package/dist/{handlebars-4f0420f1.js → handlebars-6ec06359.js} +1 -1
  34. package/dist/{html-21a9a478.js → html-6ae050e1.js} +1 -1
  35. package/dist/{htmlMode-610c4063.js → htmlMode-702558fa.js} +1 -1
  36. package/dist/{index-a20388fd.js → index-6ebd2fed.js} +21351 -21462
  37. package/dist/index.js +374 -377
  38. package/dist/{javascript-5feedefd.js → javascript-8679ff0b.js} +1 -1
  39. package/dist/{jsonMode-8f6a8950.js → jsonMode-91fb45a0.js} +1 -1
  40. package/dist/{liquid-60cf834d.js → liquid-f14dacac.js} +1 -1
  41. package/dist/{mdx-26791043.js → mdx-b6b90a55.js} +1 -1
  42. package/dist/{python-b4d2da5f.js → python-2727f363.js} +1 -1
  43. package/dist/{razor-cb4e4bb2.js → razor-a39b435a.js} +1 -1
  44. package/dist/{tsMode-e8f57108.js → tsMode-a672c6cb.js} +1 -1
  45. package/dist/{typescript-7efe1a8a.js → typescript-7552adf0.js} +1 -1
  46. package/dist/{xml-3b59718c.js → xml-bd5dc492.js} +1 -1
  47. package/dist/{yaml-6d6e34a8.js → yaml-02909a35.js} +1 -1
  48. package/package.json +1 -1
  49. package/dist/Shared/Components/EditImageFormField/EditImageFormField.d.ts +0 -19
  50. package/dist/Shared/Components/EditImageFormField/constants.d.ts +0 -7
  51. package/dist/Shared/Components/EditImageFormField/index.d.ts +0 -2
  52. package/dist/Shared/Components/EditImageFormField/types.d.ts +0 -41
@@ -1,11 +1,11 @@
1
1
  import { MutableRefObject } from 'react';
2
2
  import { ResponseType, APIOptions } from './Types';
3
3
 
4
- export declare const post: <T = any, K = object>(url: string, data: K, options?: APIOptions, isMultipartRequest?: boolean) => Promise<ResponseType<T>>;
5
- export declare const put: <T = any, K = object>(url: string, data: K, options?: APIOptions) => Promise<ResponseType<T>>;
6
- export declare const patch: <T = any, K = object>(url: string, data: K, options?: APIOptions) => Promise<ResponseType<T>>;
7
- export declare const get: <T = any>(url: string, options?: APIOptions) => Promise<ResponseType<T>>;
8
- export declare const trash: <T = any, K = object>(url: string, data?: K, options?: APIOptions) => Promise<ResponseType<T>>;
4
+ export declare const post: (url: string, data: object, options?: APIOptions, isMultipartRequest?: boolean) => Promise<ResponseType>;
5
+ export declare const put: (url: string, data: object, options?: APIOptions) => Promise<ResponseType>;
6
+ export declare const patch: (url: string, data: object, options?: APIOptions) => Promise<ResponseType>;
7
+ export declare const get: (url: string, options?: APIOptions) => Promise<ResponseType>;
8
+ export declare const trash: (url: string, data?: object, options?: APIOptions) => Promise<ResponseType>;
9
9
  /**
10
10
  * Aborts the previous request before triggering next request
11
11
  */
@@ -77,7 +77,6 @@ export interface VariableType {
77
77
  format: string;
78
78
  description: string;
79
79
  defaultValue: string;
80
- allowEmptyValue: boolean;
81
80
  variableType: RefVariableType;
82
81
  refVariableStepIndex: number;
83
82
  refVariableName: string;
@@ -99,7 +98,7 @@ interface ConditionDetails {
99
98
  conditionType: ConditionType;
100
99
  conditionalValue: string;
101
100
  }
102
- export interface InlineStepDetailType {
101
+ interface InlineStepDetailType {
103
102
  scriptType: ScriptType;
104
103
  isMountCustomScript?: boolean;
105
104
  script?: string;
@@ -118,8 +117,6 @@ export interface InlineStepDetailType {
118
117
  inputVariables?: VariableType[];
119
118
  outputVariables?: VariableType[];
120
119
  conditionDetails: ConditionDetails[];
121
- storeScriptAt?: string;
122
- mountCodeToContainerPath?: string;
123
120
  }
124
121
  interface PluginRefStepDetailType {
125
122
  id: number;
@@ -75,10 +75,11 @@ 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;
81
- PLUGIN_LIST_MIN: string;
82
83
  };
83
84
  export declare enum KEY_VALUE {
84
85
  KEY = "key",
@@ -268,4 +269,3 @@ export declare const DATE_TIME_FORMATS: {
268
269
  DD_MMM_YYYY_HH_MM: string;
269
270
  DD_MMM_YYYY: string;
270
271
  };
271
- export declare const SEMANTIC_VERSION_DOCUMENTATION_LINK = "https://semver.org/";
@@ -1,4 +1,4 @@
1
- import { default as React, HTMLInputTypeAttribute, InputHTMLAttributes, ReactNode } from 'react';
1
+ import { default as React, HTMLInputTypeAttribute, InputHTMLAttributes } from 'react';
2
2
 
3
3
  export interface CustomInputProps {
4
4
  name: string;
@@ -17,7 +17,7 @@ export interface CustomInputProps {
17
17
  autoFocus?: boolean;
18
18
  rootClassName?: string;
19
19
  error?: string[] | string;
20
- helperText?: ReactNode;
20
+ helperText?: string;
21
21
  handleOnBlur?: (e: any) => void;
22
22
  readOnly?: boolean;
23
23
  noTrim?: boolean;
@@ -1,7 +1,7 @@
1
1
  import { default as React, SyntheticEvent } from 'react';
2
2
 
3
3
  export declare class VisibleModal extends React.Component<{
4
- className?: string;
4
+ className: string;
5
5
  parentClassName?: string;
6
6
  noBackground?: boolean;
7
7
  close?: (e: any) => void;
@@ -1,7 +1,7 @@
1
1
  import { default as React, SyntheticEvent } from 'react';
2
2
 
3
3
  export declare class VisibleModal2 extends React.Component<{
4
- className?: string;
4
+ className: string;
5
5
  close?: (e: any) => void;
6
6
  }> {
7
7
  modalRef: HTMLElement;
@@ -4,7 +4,7 @@ export declare const Option: (props: any) => JSX.Element;
4
4
  export declare const SingleSelectOption: (props: any) => JSX.Element;
5
5
  /**
6
6
  * Multi value container
7
- */
7
+ */
8
8
  export declare const MultiValueContainer: (props: any) => JSX.Element;
9
9
  /**
10
10
  *
@@ -177,10 +177,10 @@ export interface RadioGroupItemProps {
177
177
  export interface RadioGroupInterface {
178
178
  name: string;
179
179
  onChange: any;
180
+ className?: string;
180
181
  initialTab: string;
182
+ disabled: boolean;
181
183
  children: ReactNode;
182
- disabled?: boolean;
183
- className?: string;
184
184
  }
185
185
  export interface RadioInterface {
186
186
  children: ReactNode;
@@ -1,6 +1,5 @@
1
1
  interface DetectBottomProps {
2
2
  callback: () => void;
3
- hasError?: boolean;
4
3
  }
5
- declare const DetectBottom: ({ callback, hasError }: DetectBottomProps) => JSX.Element;
4
+ declare const DetectBottom: ({ callback }: DetectBottomProps) => JSX.Element;
6
5
  export default DetectBottom;
@@ -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
+ });
@@ -1,4 +1,3 @@
1
- import { ModuleStatus } from '../../types';
2
1
  import { ResponseType, TippyCustomizedProps } from '../../../Common';
3
2
 
4
3
  export declare enum InstallationType {
@@ -6,6 +5,18 @@ export declare enum InstallationType {
6
5
  OSS_HELM = "oss_helm",
7
6
  ENTERPRISE = "enterprise"
8
7
  }
8
+ export declare enum ModuleStatus {
9
+ HEALTHY = "healthy",
10
+ NONE = "none",
11
+ UNKNOWN = "unknown",
12
+ UPGRADING = "upgrading",
13
+ UPGRADE_FAILED = "upgradeFailed",
14
+ INSTALLED = "installed",
15
+ INSTALLING = "installing",
16
+ INSTALL_FAILED = "installFailed",
17
+ NOT_INSTALLED = "notInstalled",
18
+ TIMEOUT = "timeout"
19
+ }
9
20
  export interface PageHeaderType {
10
21
  headerName?: string;
11
22
  showTabs?: boolean;
@@ -1,7 +1,5 @@
1
- import { ResponseType } from '../../../Common';
2
- import { GetPluginStoreDataReturnType, GetPluginStoreDataServiceParamsType, MinParentPluginDTO, PluginDetailServiceParamsType } from './types';
1
+ import { GetPluginStoreDataReturnType, GetPluginStoreDataServiceParamsType, PluginDetailServiceParamsType } from './types';
3
2
 
4
- export declare const getPluginsDetail: ({ appId, parentPluginIds, pluginIds, signal, shouldShowError, }: PluginDetailServiceParamsType) => Promise<Pick<GetPluginStoreDataReturnType, 'pluginStore'>>;
3
+ export declare const getPluginsDetail: ({ appId, parentPluginIds, pluginIds, shouldShowError, }: PluginDetailServiceParamsType) => Promise<Pick<GetPluginStoreDataReturnType, 'pluginStore'>>;
5
4
  export declare const getPluginStoreData: ({ searchKey, selectedTags, appId, offset, signal, }: GetPluginStoreDataServiceParamsType) => Promise<GetPluginStoreDataReturnType>;
6
5
  export declare const getAvailablePluginTags: (appId: number) => Promise<string[]>;
7
- export declare const getParentPluginList: (appId?: number) => Promise<ResponseType<MinParentPluginDTO[]>>;
@@ -8,13 +8,9 @@ export declare enum PluginCreationType {
8
8
  SHARED = "SHARED",
9
9
  PRESET = "PRESET"
10
10
  }
11
- export interface PluginAPIBaseQueryParamsType {
11
+ export interface GetPluginTagsPayloadType {
12
12
  appId: number;
13
13
  }
14
- export interface GetPluginTagsPayloadType extends PluginAPIBaseQueryParamsType {
15
- }
16
- export interface GetParentPluginListPayloadType extends PluginAPIBaseQueryParamsType {
17
- }
18
14
  export interface PluginTagNamesDTO {
19
15
  tagNames: string[];
20
16
  }
@@ -49,9 +45,6 @@ export interface ParentPluginDTO {
49
45
  type: PluginCreationType;
50
46
  icon: string;
51
47
  pluginVersions: PluginVersionsDTO;
52
- pluginIdentifier: string;
53
- }
54
- export interface MinParentPluginDTO extends Pick<ParentPluginDTO, 'id' | 'name' | 'icon'> {
55
48
  }
56
49
  export interface PluginDetailDTO {
57
50
  parentPlugins: ParentPluginDTO[];
@@ -65,7 +58,6 @@ export interface PluginDetailServiceParamsType {
65
58
  * @default true
66
59
  */
67
60
  shouldShowError?: boolean;
68
- signal?: AbortSignal;
69
61
  }
70
62
  export interface PluginDetailPayloadType extends Pick<PluginDetailServiceParamsType, 'appId'> {
71
63
  pluginId?: PluginDetailServiceParamsType['pluginIds'];
@@ -74,11 +66,11 @@ export interface PluginDetailPayloadType extends Pick<PluginDetailServiceParamsT
74
66
  export interface PluginListFiltersType extends Pick<BaseFilterQueryParams<unknown>, 'searchKey'> {
75
67
  selectedTags: string[];
76
68
  }
77
- interface ParentPluginType extends Pick<ParentPluginDTO, 'id' | 'name' | 'description' | 'type' | 'icon' | 'pluginIdentifier'> {
69
+ interface ParentPluginType extends Pick<ParentPluginDTO, 'id' | 'name' | 'description' | 'type' | 'icon'> {
78
70
  latestVersionId: MinimalPluginVersionDataDTO['id'];
79
71
  pluginVersions: MinimalPluginVersionDataDTO[];
80
72
  }
81
- interface DetailedPluginVersionType extends Pick<MinimalPluginVersionDataDTO, 'id' | 'description' | 'name' | 'pluginVersion'>, Pick<DetailedPluginVersionDTO, 'tags' | 'isLatest' | 'inputVariables' | 'outputVariables' | 'updatedBy' | 'docLink'>, Pick<ParentPluginType, 'icon' | 'type' | 'pluginIdentifier'> {
73
+ interface DetailedPluginVersionType extends Pick<MinimalPluginVersionDataDTO, 'id' | 'description' | 'name' | 'pluginVersion'>, Pick<DetailedPluginVersionDTO, 'tags' | 'isLatest' | 'inputVariables' | 'outputVariables' | 'updatedBy' | 'docLink'>, Pick<ParentPluginType, 'icon' | 'type'> {
82
74
  parentPluginId: ParentPluginType['id'];
83
75
  }
84
76
  export interface PluginDataStoreType {
@@ -1,5 +1,3 @@
1
- import { OptionProps } from 'react-select';
2
- import { OptionType } from '../../../Common/Types';
3
1
  import { ParentPluginDTO, PluginDataStoreType } from './types';
4
2
 
5
3
  export declare const parsePluginDetailsDTOIntoPluginStore: (pluginData: ParentPluginDTO[]) => PluginDataStoreType;
@@ -16,7 +14,6 @@ export declare const pluginTagSelectStyles: {
16
14
  group: (base: any) => any;
17
15
  groupHeading: (base: any) => any;
18
16
  };
19
- export declare const PluginTagOption: (props: OptionProps<OptionType, true>) => JSX.Element;
20
17
  /**
21
18
  * @description This method takes the initial plugin data store and updates the keys with the target parent plugin store and plugin version store
22
19
  */
@@ -81,5 +81,5 @@ import { SelectPickerProps } from './type';
81
81
  * <SelectPicker ... showSelectedOptionsCount />
82
82
  * ```
83
83
  */
84
- declare const SelectPicker: ({ error, icon, renderMenuListFooter, helperText, placeholder, label, showSelectedOptionIcon, size, disabledTippyContent, showSelectedOptionsCount, menuSize, optionListError, reloadOptionList, ...props }: SelectPickerProps) => JSX.Element;
84
+ declare const SelectPicker: ({ error, icon, renderMenuListFooter, helperText, placeholder, label, showSelectedOptionIcon, size, disabledTippyContent, showSelectedOptionsCount, menuSize, ...props }: SelectPickerProps) => JSX.Element;
85
85
  export default SelectPicker;
@@ -1,4 +1,3 @@
1
- import { ServerErrors } from '../../../Common/ServerError';
2
1
  import { OptionType } from '../../../Common/Types';
3
2
  import { ComponentSizeType } from '../../constants';
4
3
  import { ReactElement, ReactNode } from 'react';
@@ -19,7 +18,7 @@ export interface SelectPickerOptionType extends OptionType<number | string, Reac
19
18
  endIcon?: ReactElement;
20
19
  }
21
20
  type SelectProps = ReactSelectProps<SelectPickerOptionType>;
22
- export interface SelectPickerProps extends Pick<SelectProps, 'options' | 'value' | 'onChange' | 'isSearchable' | 'isClearable' | 'isLoading' | 'hideSelectedOptions' | 'controlShouldRenderValue' | 'closeMenuOnSelect' | 'isDisabled' | 'isLoading' | 'required' | 'isOptionDisabled' | 'placeholder' | 'autoFocus' | 'onKeyDown'>, Required<Pick<SelectProps, 'classNamePrefix' | 'inputId' | 'name'>> {
21
+ export interface SelectPickerProps extends Pick<SelectProps, 'options' | 'value' | 'onChange' | 'isSearchable' | 'isClearable' | 'isLoading' | 'hideSelectedOptions' | 'controlShouldRenderValue' | 'closeMenuOnSelect' | 'isDisabled' | 'isLoading' | 'required' | 'isOptionDisabled' | 'placeholder'>, Required<Pick<SelectProps, 'classNamePrefix' | 'inputId' | 'name'>> {
23
22
  /**
24
23
  * Icon to be rendered in the control
25
24
  */
@@ -71,13 +70,5 @@ export interface SelectPickerProps extends Pick<SelectProps, 'options' | 'value'
71
70
  * @default 'ComponentSizeType.small'
72
71
  */
73
72
  menuSize?: ComponentSizeType;
74
- /**
75
- * If truthy, would show generic section error state as no options message
76
- */
77
- optionListError?: ServerErrors;
78
- /**
79
- * Would reload the option list when called in case optionListError is present
80
- */
81
- reloadOptionList?: () => void;
82
73
  }
83
74
  export {};
@@ -34,4 +34,3 @@ export * from './Plugin';
34
34
  export * from './KeyValueTable';
35
35
  export * from './SelectPicker';
36
36
  export * from './DetectBottom';
37
- export * from './EditImageFormField';
@@ -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 {};
@@ -388,4 +388,12 @@ export declare enum ComponentSizeType {
388
388
  medium = "medium",
389
389
  large = "large"
390
390
  }
391
- export declare const POP_UP_MENU_MODAL_ID = "popup";
391
+ /**
392
+ * Identifiers for grouped / all resources
393
+ */
394
+ export declare enum SelectAllGroupedResourceIdentifiers {
395
+ allProjects = "-1",
396
+ allExistingAndFutureNonProdEnvironments = "-1",
397
+ allExistingAndFutureProdEnvironments = "-2",
398
+ allExistingAndFutureEnvironments = "-3"
399
+ }
@@ -368,15 +368,21 @@ export declare enum ResourceKindType {
368
368
  tenant = "tenant",
369
369
  installation = "installation",
370
370
  environment = "environment",
371
- cdPipeline = "cd-pipeline"
371
+ cdPipeline = "cd-pipeline",
372
+ project = "project"
372
373
  }
373
374
  /**
374
375
  * Versions support for the resources on BE
376
+ *
377
+ * TODO: Rename to ApiVersionType
375
378
  */
376
379
  export declare enum ResourceVersionType {
377
380
  v1 = "v1",
378
381
  alpha1 = "alpha1"
379
382
  }
383
+ export declare enum PolicyKindType {
384
+ lockConfiguration = "lock-configuration"
385
+ }
380
386
  export interface LastExecutionResultType {
381
387
  lastExecution: string;
382
388
  severityCount: {
@@ -12,7 +12,6 @@ export declare const MESSAGES: {
12
12
  VALID_POSITIVE_NUMBER: string;
13
13
  VALID_POSITIVE_INTEGER: string;
14
14
  MAX_SAFE_INTEGER: string;
15
- INVALID_SEMANTIC_VERSION: string;
16
15
  };
17
16
  export declare const requiredField: (value: string) => ValidationResponseType;
18
17
  export declare const validateName: (name: string) => ValidationResponseType;
@@ -29,13 +28,3 @@ export declare const validateUniqueKeys: (keys: string[]) => {
29
28
  isValid: boolean;
30
29
  message: string;
31
30
  };
32
- /**
33
- * Rules for valid semantic version:
34
- * 1. version.length < 128 and not empty
35
- * 2. version should follow semantic versioning regex from https://semver.org/
36
- */
37
- export declare const validateSemanticVersioning: (version: string) => ValidationResponseType;
38
- /**
39
- * A valid display name should be between 3 and 50 characters
40
- */
41
- export declare const validateDisplayName: (name: string) => ValidationResponseType;