@devtron-labs/devtron-fe-common-lib 1.17.0-beta-2 → 1.17.0-beta-4

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 (26) hide show
  1. package/dist/{@code-editor-BxJ15h1P.js → @code-editor-CHmXQoJu.js} +5567 -5513
  2. package/dist/{@common-rjsf-D-9UITDU.js → @common-rjsf-kLdUrmr1.js} +1 -1
  3. package/dist/Shared/Components/ContextSwitcher/ContextSwitcher.d.ts +2 -0
  4. package/dist/Shared/Components/ContextSwitcher/index.d.ts +3 -0
  5. package/dist/Shared/Components/ContextSwitcher/types.d.ts +14 -0
  6. package/dist/Shared/Components/ContextSwitcher/utils.d.ts +5 -0
  7. package/dist/Shared/Components/Icon/Icon.d.ts +0 -4
  8. package/dist/Shared/Components/SelectPicker/SelectPicker.component.d.ts +1 -1
  9. package/dist/Shared/Components/SelectPicker/index.d.ts +0 -1
  10. package/dist/Shared/Components/SelectPicker/type.d.ts +1 -6
  11. package/dist/Shared/Components/index.d.ts +1 -0
  12. package/dist/Shared/Hooks/useUserPreferences/constants.d.ts +2 -0
  13. package/dist/Shared/Hooks/useUserPreferences/index.d.ts +1 -1
  14. package/dist/Shared/Hooks/useUserPreferences/service.d.ts +22 -2
  15. package/dist/Shared/Hooks/useUserPreferences/types.d.ts +24 -11
  16. package/dist/Shared/Hooks/useUserPreferences/useUserPrefrences.d.ts +5 -3
  17. package/dist/Shared/Hooks/useUserPreferences/utils.d.ts +3 -4
  18. package/dist/assets/@code-editor.css +1 -1
  19. package/dist/index.d.ts +0 -6
  20. package/dist/index.js +780 -777
  21. package/package.json +1 -1
  22. package/dist/Shared/Components/SelectPicker/GroupedFilterSelectPicker.d.ts +0 -2
  23. package/dist/assets/ic-activity.abf111c7.svg +0 -3
  24. package/dist/assets/ic-folder.8038c019.svg +0 -3
  25. package/dist/assets/ic-helm-app.a20cfeb3.svg +0 -4
  26. package/dist/assets/ic-namespace.8980221f.svg +0 -3
@@ -1,7 +1,7 @@
1
1
  import { j as n, at as b, av as k, au as W } from "./@vendor-DbxoIktR.js";
2
2
  import V, { forwardRef as J, useMemo as P } from "react";
3
3
  import K, { getDefaultRegistry as q } from "@rjsf/core";
4
- import { T as F, j as N, c as v, b as S, S as Y, i as z, a as w, d as A, e as G } from "./@code-editor-BxJ15h1P.js";
4
+ import { T as F, j as N, c as v, b as S, S as Y, i as z, a as w, d as A, e as G } from "./@code-editor-CHmXQoJu.js";
5
5
  import Q, { components as D } from "react-select";
6
6
  import { ReactComponent as X } from "./assets/ic-chevron-down.fc70d7a7.svg";
7
7
  import { getUiOptions as $, getTemplate as B, getSubmitButtonOptions as Z, ADDITIONAL_PROPERTY_FLAG as L, errorId as ee, englishStringTranslator as te, TranslatableString as ne, titleId as re, canExpand as ae, deepEquals as se } from "@rjsf/utils";
@@ -0,0 +1,2 @@
1
+ import { ContextSwitcherTypes } from './types';
2
+ export declare const ContextSwitcher: ({ inputId, options, inputValue, onInputChange, isLoading, value, onChange, placeholder, filterOption, formatOptionLabel, optionListError, reloadOptionList, classNamePrefix, }: ContextSwitcherTypes) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { ContextSwitcher } from './ContextSwitcher';
2
+ export type { ContextSwitcherTypes, RecentlyVisitedGroupedOptionsType, RecentlyVisitedOptions } from './types';
3
+ export { getMinCharSearchPlaceholderGroup } from './utils';
@@ -0,0 +1,14 @@
1
+ import { GroupBase } from 'react-select';
2
+ import { SelectPickerOptionType, SelectPickerProps } from '../SelectPicker';
3
+ export interface ContextSwitcherTypes extends Pick<SelectPickerProps, 'placeholder' | 'onChange' | 'value' | 'isLoading' | 'onInputChange' | 'inputValue' | 'inputId' | 'formatOptionLabel' | 'filterOption' | 'optionListError' | 'reloadOptionList' | 'classNamePrefix'> {
4
+ options: GroupBase<SelectPickerOptionType<string | number>>[];
5
+ isAppDataAvailable?: boolean;
6
+ }
7
+ export interface RecentlyVisitedOptions extends SelectPickerOptionType<number> {
8
+ isDisabled?: boolean;
9
+ isRecentlyVisited?: boolean;
10
+ }
11
+ export interface RecentlyVisitedGroupedOptionsType extends GroupBase<SelectPickerOptionType<number>> {
12
+ label: string;
13
+ options: RecentlyVisitedOptions[];
14
+ }
@@ -0,0 +1,5 @@
1
+ import { SelectPickerProps } from '../SelectPicker';
2
+ import { RecentlyVisitedGroupedOptionsType, RecentlyVisitedOptions } from './types';
3
+ export declare const getDisabledOptions: (option: RecentlyVisitedOptions) => SelectPickerProps["isDisabled"];
4
+ export declare const customSelectFilterOption: SelectPickerProps['filterOption'];
5
+ export declare const getMinCharSearchPlaceholderGroup: (resourceKind: string) => RecentlyVisitedGroupedOptionsType;
@@ -2,7 +2,6 @@ import { IconBaseProps } from './types';
2
2
  export declare const iconMap: {
3
3
  'ic-73strings': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
4
4
  'ic-aborted': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
5
- 'ic-activity': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
6
5
  'ic-add': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
7
6
  'ic-amazon-eks': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
8
7
  'ic-apica': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -93,7 +92,6 @@ export declare const iconMap: {
93
92
  'ic-flask': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
94
93
  'ic-folder-color': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
95
94
  'ic-folder-user': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
96
- 'ic-folder': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
97
95
  'ic-gavel': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
98
96
  'ic-gear': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
99
97
  'ic-gift-gradient': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -111,7 +109,6 @@ export declare const iconMap: {
111
109
  'ic-heart-green': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
112
110
  'ic-heart-red-animated': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
113
111
  'ic-heart-red': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
114
- 'ic-helm-app': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
115
112
  'ic-helm': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
116
113
  'ic-help-filled': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
117
114
  'ic-help-outline': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -150,7 +147,6 @@ export declare const iconMap: {
150
147
  'ic-mobile': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
151
148
  'ic-monitoring': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
152
149
  'ic-more-vertical': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
153
- 'ic-namespace': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
154
150
  'ic-new': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
155
151
  'ic-node-script': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
156
152
  'ic-oidc': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -133,5 +133,5 @@ import { SelectPickerProps } from './type';
133
133
  * />
134
134
  * ```
135
135
  */
136
- declare const SelectPicker: <OptionValue, IsMulti extends boolean>({ error, icon, helperText, placeholder, label, showSelectedOptionIcon, size, disabledTippyContent, showSelectedOptionsCount, menuSize, optionListError, reloadOptionList, menuPosition, variant, disableDescriptionEllipsis, multiSelectProps, isMulti, name, classNamePrefix, shouldRenderCustomOptions, isSearchable, selectRef: refFromConsumer, shouldMenuAlignRight, fullWidth, customSelectedOptionsCount, menuListFooterConfig, isCreatable, onCreateOption, closeMenuOnSelect, shouldShowNoOptionsMessage, shouldRenderTextArea, onKeyDown, shouldHideMenu, warningText, layout, ariaLabel, borderConfig, borderRadiusConfig, labelTippyCustomizedConfig, labelTooltipConfig, hideFormFieldInfo, autoFocus, ...props }: SelectPickerProps<OptionValue, IsMulti>) => JSX.Element;
136
+ declare const SelectPicker: <OptionValue, IsMulti extends boolean>({ error, icon, helperText, placeholder, label, showSelectedOptionIcon, size, disabledTippyContent, showSelectedOptionsCount, menuSize, optionListError, reloadOptionList, menuPosition, variant, disableDescriptionEllipsis, multiSelectProps, isMulti, name, classNamePrefix, shouldRenderCustomOptions, isSearchable, selectRef: refFromConsumer, shouldMenuAlignRight, fullWidth, customSelectedOptionsCount, menuListFooterConfig, isCreatable, onCreateOption, closeMenuOnSelect, shouldShowNoOptionsMessage, shouldRenderTextArea, onKeyDown, shouldHideMenu, warningText, layout, ariaLabel, borderConfig, borderRadiusConfig, labelTippyCustomizedConfig, labelTooltipConfig, hideFormFieldInfo, ...props }: SelectPickerProps<OptionValue, IsMulti>) => JSX.Element;
137
137
  export default SelectPicker;
@@ -1,6 +1,5 @@
1
1
  export { ValueContainerWithLoadingShimmer } from './common';
2
2
  export { default as FilterSelectPicker } from './FilterSelectPicker';
3
- export * from './GroupedFilterSelectPicker';
4
3
  export { default as SelectPicker } from './SelectPicker.component';
5
4
  export * from './SelectPickerTextArea.component';
6
5
  export * from './type';
@@ -6,7 +6,6 @@ import { ServerErrors } from '../../../Common/ServerError';
6
6
  import { TooltipProps } from '../../../Common/Tooltip';
7
7
  import { OptionType } from '../../../Common/Types';
8
8
  import { ComponentSizeType } from '../../constants';
9
- import { ActionMenuProps } from '../ActionMenu';
10
9
  import { ButtonComponentType, ButtonProps, ButtonVariantType } from '../Button';
11
10
  import { FormFieldWrapperProps } from '../FormFieldWrapper/types';
12
11
  export interface SelectPickerOptionType<OptionValue = string | number> extends OptionType<OptionValue, ReactNode> {
@@ -216,13 +215,9 @@ export type SelectPickerProps<OptionValue = number | string, IsMulti extends boo
216
215
  export type SelectPickerGroupHeadingProps<OptionValue> = GroupHeadingProps<SelectPickerOptionType<OptionValue>> & {
217
216
  isGroupHeadingSelectable: boolean;
218
217
  };
219
- export interface FilterSelectPickerProps extends Required<Pick<SelectPickerProps<number | string, true>, 'options' | 'isDisabled' | 'placeholder' | 'isLoading'>>, Pick<SelectPickerProps<number | string, true>, 'selectRef' | 'inputId' | 'menuPosition' | 'autoFocus' | 'shouldMenuAlignRight' | 'optionListError' | 'reloadOptionList' | 'getOptionValue' | 'isOptionDisabled' | 'onMenuClose' | 'menuIsOpen' | 'onKeyDown'> {
218
+ export interface FilterSelectPickerProps extends Required<Pick<SelectPickerProps<number | string, true>, 'options' | 'isDisabled' | 'placeholder' | 'isLoading'>>, Pick<SelectPickerProps<number | string, true>, 'selectRef' | 'inputId' | 'menuPosition' | 'autoFocus' | 'shouldMenuAlignRight' | 'optionListError' | 'reloadOptionList' | 'getOptionValue' | 'isOptionDisabled'> {
220
219
  appliedFilterOptions: SelectPickerOptionType[];
221
220
  handleApplyFilter: (filtersToApply: SelectPickerOptionType<number | string>[]) => void;
222
221
  }
223
222
  export type SelectPickerTextAreaProps = Omit<SelectPickerProps<string, false>, 'selectRef' | 'inputValue' | 'onInputChange' | 'controlShouldRenderValue' | 'onKeyDown' | 'onCreateOption' | 'shouldRenderTextArea'> & Pick<ResizableTagTextAreaProps, 'maxHeight' | 'minHeight' | 'refVar' | 'dependentRefs'>;
224
- export interface GroupedFilterSelectPickerProps<T extends string | number = string | number> extends Omit<ActionMenuProps<T>, 'onClick' | 'disableDescriptionEllipsis' | 'children' | 'buttonProps' | 'isSearchable'> {
225
- isFilterApplied?: boolean;
226
- filterSelectPickerPropsMap: Record<T, Omit<FilterSelectPickerProps, 'autoFocus' | 'menuIsOpen' | 'onMenuClose' | 'onKeyDown'>>;
227
- }
228
223
  export {};
@@ -21,6 +21,7 @@ export * from './CollapsibleList';
21
21
  export * from './CommitChipCell';
22
22
  export * from './Confetti';
23
23
  export * from './ConfirmationModal';
24
+ export * from './ContextSwitcher';
24
25
  export * from './CountrySelect';
25
26
  export * from './CustomInput';
26
27
  export * from './DatePicker';
@@ -1 +1,3 @@
1
+ import { PreferredResourceKindType } from './types';
1
2
  export declare const USER_PREFERENCES_ATTRIBUTE_KEY = "userPreferences";
3
+ export declare const DEFAULT_RESOURCES_MAP: Record<PreferredResourceKindType, null>;
@@ -1,4 +1,4 @@
1
1
  export * from './constants';
2
- export { getUserPreferences, updateUserPreferences } from './service';
2
+ export { getUserPreferences, updateAndPersistUserPreferences, updateUserPreferences } from './service';
3
3
  export * from './types';
4
4
  export { useUserPreferences } from './useUserPrefrences';
@@ -1,8 +1,28 @@
1
- import { UserPreferenceResourceProps, UserPreferencesType } from './types';
1
+ import { PreferredResourceKindType, UserPreferenceFilteredListTypes, UserPreferenceResourceProps, UserPreferencesType } from './types';
2
2
  /**
3
3
  * @returns UserPreferencesType
4
4
  * @description This function fetches the user preferences from the server. It uses the `get` method to make a request to the server and retrieves the user preferences based on the `USER_PREFERENCES_ATTRIBUTE_KEY`. The result is parsed and returned as a `UserPreferencesType` object.
5
5
  * @throws Will throw an error if the request fails or if the result is not in the expected format.
6
6
  */
7
7
  export declare const getUserPreferences: () => Promise<UserPreferencesType>;
8
- export declare const updateUserPreferences: ({ path, value, shouldThrowError, }: UserPreferenceResourceProps) => Promise<boolean>;
8
+ export declare const updateUserPreferences: ({ path, value, resourceKind, shouldThrowError, userPreferencesResponse, }: UserPreferenceResourceProps) => Promise<boolean>;
9
+ /**
10
+ * Optimized function to get updated user preferences with resource filtering
11
+ * Can work with provided userPreferences or fetch from server/localStorage
12
+ * Centralizes all resource updating logic
13
+ */
14
+ export declare const getUpdatedUserPreferences: ({ id, name, resourceKind, userPreferencesResponse, }: UserPreferenceFilteredListTypes & {
15
+ userPreferencesResponse?: UserPreferencesType;
16
+ }) => Promise<UserPreferencesType>;
17
+ /**
18
+ * Centralized function to update and persist user preferences
19
+ * Handles both local state and server updates automatically
20
+ * Eliminates the need for manual resource management in multiple places
21
+ */
22
+ export declare const updateAndPersistUserPreferences: ({ id, name, resourceKind, shouldThrowError, updateLocalStorage, }: {
23
+ id?: number;
24
+ name?: string;
25
+ resourceKind?: PreferredResourceKindType;
26
+ shouldThrowError?: boolean;
27
+ updateLocalStorage?: boolean;
28
+ }) => Promise<UserPreferencesType>;
@@ -1,6 +1,5 @@
1
1
  import { USER_PREFERENCES_ATTRIBUTE_KEY } from './constants';
2
2
  import { AppThemeType, ThemeConfigType, ThemePreferenceType } from '../../Providers/ThemeProvider/types';
3
- import { BaseAppMetaData } from '../../Services';
4
3
  import { ResourceKindType } from '../../types';
5
4
  export interface GetUserPreferencesQueryParamsType {
6
5
  key: typeof USER_PREFERENCES_ATTRIBUTE_KEY;
@@ -12,12 +11,18 @@ export declare enum ViewIsPipelineRBACConfiguredRadioTabs {
12
11
  export declare enum UserPreferenceResourceActions {
13
12
  RECENTLY_VISITED = "recently-visited"
14
13
  }
15
- export interface UserResourceKindActionType {
16
- [UserPreferenceResourceActions.RECENTLY_VISITED]: BaseAppMetaData[];
14
+ export type PreferredResourceKindType = ResourceKindType.devtronApplication | ResourceKindType.job | 'app-group' | ResourceKindType.cluster;
15
+ export interface BaseRecentlyVisitedEntitiesTypes {
16
+ id: number;
17
+ name: string;
18
+ }
19
+ export interface UserPreferenceRecentlyVisitedAppsTypes extends BaseRecentlyVisitedEntitiesTypes {
20
+ resourceKind: PreferredResourceKindType;
17
21
  }
18
- export interface UserPreferenceResourceType {
19
- [ResourceKindType.devtronApplication]: UserResourceKindActionType;
22
+ export interface UserResourceKindActionType {
23
+ [UserPreferenceResourceActions.RECENTLY_VISITED]: BaseRecentlyVisitedEntitiesTypes[];
20
24
  }
25
+ export type UserPreferenceResourceType = Partial<Record<PreferredResourceKindType, UserResourceKindActionType>>;
21
26
  export interface GetUserPreferencesParsedDTO {
22
27
  viewPermittedEnvOnly?: boolean;
23
28
  /**
@@ -56,26 +61,34 @@ export interface UserPreferencesType {
56
61
  }
57
62
  export interface UpdatedUserPreferencesType extends UserPreferencesType, Pick<ThemeConfigType, 'appTheme'> {
58
63
  }
64
+ export interface RecentlyVisitedFetchConfigType extends UserPreferenceRecentlyVisitedAppsTypes {
65
+ isDataAvailable?: boolean;
66
+ }
59
67
  export interface UseUserPreferencesProps {
68
+ userPreferenceResourceKind?: PreferredResourceKindType;
60
69
  migrateUserPreferences?: (userPreferencesResponse: UserPreferencesType) => Promise<UserPreferencesType>;
70
+ recentlyVisitedFetchConfig?: RecentlyVisitedFetchConfigType;
61
71
  }
62
72
  export type UserPathValueMapType = {
63
73
  path: 'themePreference';
64
74
  value: Required<Pick<UpdatedUserPreferencesType, 'themePreference' | 'appTheme'>>;
75
+ resourceKind?: never;
76
+ userPreferencesResponse?: never;
65
77
  } | {
66
78
  path: 'pipelineRBACViewSelectedTab';
67
79
  value: Required<Pick<UserPreferencesType, 'pipelineRBACViewSelectedTab'>>;
80
+ resourceKind?: never;
81
+ userPreferencesResponse?: never;
68
82
  } | {
69
83
  path: 'resources';
70
- value: Required<BaseAppMetaData[]>;
84
+ value: Required<BaseRecentlyVisitedEntitiesTypes[]>;
85
+ resourceKind: PreferredResourceKindType;
86
+ userPreferencesResponse?: UserPreferencesType;
71
87
  };
72
88
  export type UserPreferenceResourceProps = UserPathValueMapType & {
73
89
  shouldThrowError?: boolean;
90
+ userPreferencesResponse?: UserPreferencesType;
74
91
  };
75
- export interface UserPreferenceRecentlyVisitedAppsTypes {
76
- appId: number;
77
- appName: string;
78
- }
79
92
  export interface UserPreferenceFilteredListTypes extends UserPreferenceRecentlyVisitedAppsTypes {
80
- userPreferencesResponse: UserPreferencesType;
93
+ userPreferencesResponse?: UserPreferencesType;
81
94
  }
@@ -1,10 +1,12 @@
1
1
  import { ServerErrors } from '../../../Common/ServerError';
2
- import { UserPreferenceRecentlyVisitedAppsTypes, UserPreferencesType, UseUserPreferencesProps, ViewIsPipelineRBACConfiguredRadioTabs } from './types';
3
- export declare const useUserPreferences: ({ migrateUserPreferences }: UseUserPreferencesProps) => {
2
+ import { BaseRecentlyVisitedEntitiesTypes, UserPreferencesType, UseUserPreferencesProps, ViewIsPipelineRBACConfiguredRadioTabs } from './types';
3
+ export declare const useUserPreferences: ({ migrateUserPreferences, recentlyVisitedFetchConfig }: UseUserPreferencesProps) => {
4
4
  userPreferences: UserPreferencesType;
5
5
  userPreferencesError: ServerErrors;
6
6
  handleFetchUserPreferences: () => Promise<void>;
7
7
  handleUpdatePipelineRBACViewSelectedTab: (selectedTab: ViewIsPipelineRBACConfiguredRadioTabs) => void;
8
8
  handleUpdateUserThemePreference: (themePreference: UserPreferencesType["themePreference"]) => void;
9
- fetchRecentlyVisitedParsedApps: ({ appId, appName }: UserPreferenceRecentlyVisitedAppsTypes) => Promise<void>;
9
+ fetchRecentlyVisitedParsedEntities: () => Promise<UserPreferencesType>;
10
+ recentlyVisitedResources: BaseRecentlyVisitedEntitiesTypes[];
11
+ recentResourcesLoading: boolean;
10
12
  };
@@ -1,4 +1,3 @@
1
- import { BaseAppMetaData } from '../../Services';
2
- import { UserPreferenceFilteredListTypes, UserPreferenceResourceType } from './types';
3
- export declare const getUserPreferenceResourcesMetadata: (recentlyVisited: BaseAppMetaData[]) => UserPreferenceResourceType;
4
- export declare const getFilteredUniqueAppList: ({ userPreferencesResponse, appId, appName, }: UserPreferenceFilteredListTypes) => BaseAppMetaData[];
1
+ import { GetUserPreferencesParsedDTO, UserPreferenceFilteredListTypes, UserPreferencesType } from './types';
2
+ export declare const getFilteredUniqueAppList: ({ userPreferencesResponse, id, name, resourceKind, }: UserPreferenceFilteredListTypes) => import('./types').BaseRecentlyVisitedEntitiesTypes[];
3
+ export declare const getParsedResourcesMap: (resources: GetUserPreferencesParsedDTO["resources"]) => UserPreferencesType["resources"];