@devtron-labs/devtron-fe-common-lib 1.17.0-pre-9 → 1.17.1
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.
- package/dist/{@code-editor-DcQ7PPhd.js → @code-editor-CXQ0yUkc.js} +8989 -9605
- package/dist/@common-rjsf-CDMxkHD5.js +609 -0
- package/dist/Common/Hooks/index.d.ts +0 -1
- package/dist/Common/RJSF/constants.d.ts +0 -1
- package/dist/Common/RJSF/utils.d.ts +1 -1
- package/dist/Common/Tooltip/constants.d.ts +1 -0
- package/dist/Pages/ResourceBrowser/ResourceBrowser.Types.d.ts +1 -0
- package/dist/Shared/Components/ActionMenu/types.d.ts +33 -2
- package/dist/Shared/Components/CollapsibleList/CollapsibleList.component.d.ts +0 -3
- package/dist/Shared/Components/Icon/Icon.d.ts +0 -4
- package/dist/Shared/Components/Security/SecurityModal/config/Sidebar.d.ts +3 -6
- package/dist/Shared/Components/Security/SecurityModal/config/index.d.ts +1 -1
- package/dist/Shared/Components/Security/SecurityModal/index.d.ts +2 -2
- package/dist/Shared/Components/Security/SecurityModal/types.d.ts +6 -0
- package/dist/Shared/Components/Security/types.d.ts +1 -5
- package/dist/Shared/Components/SelectPicker/SelectPicker.component.d.ts +1 -1
- package/dist/Shared/Components/SelectPicker/index.d.ts +0 -1
- package/dist/Shared/Components/SelectPicker/type.d.ts +2 -7
- package/dist/Shared/Components/index.d.ts +0 -2
- package/dist/Shared/Hooks/index.d.ts +1 -0
- package/dist/Shared/Hooks/useIsSecureConnection/index.d.ts +1 -0
- package/dist/Shared/Hooks/useIsSecureConnection/useIsSecureConnection.d.ts +1 -0
- package/dist/Shared/Hooks/useUserPreferences/constants.d.ts +0 -2
- package/dist/Shared/Hooks/useUserPreferences/index.d.ts +1 -1
- package/dist/Shared/Hooks/useUserPreferences/service.d.ts +2 -22
- package/dist/Shared/Hooks/useUserPreferences/types.d.ts +11 -24
- package/dist/Shared/Hooks/useUserPreferences/useUserPrefrences.d.ts +3 -5
- package/dist/Shared/Hooks/useUserPreferences/utils.d.ts +4 -3
- package/dist/assets/@code-editor.css +1 -1
- package/dist/assets/@common-rjsf.css +1 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.js +783 -791
- package/package.json +1 -1
- package/dist/@common-rjsf-DMiOG5j_.js +0 -598
- package/dist/Common/Hooks/UseIsTextTruncated/UseIsTextTruncated.d.ts +0 -5
- package/dist/Common/Hooks/UseIsTextTruncated/constants.d.ts +0 -1
- package/dist/Common/Hooks/UseIsTextTruncated/index.d.ts +0 -1
- package/dist/Shared/Components/ContextSwitcher/ContextSwitcher.d.ts +0 -2
- package/dist/Shared/Components/ContextSwitcher/index.d.ts +0 -3
- package/dist/Shared/Components/ContextSwitcher/types.d.ts +0 -14
- package/dist/Shared/Components/ContextSwitcher/utils.d.ts +0 -5
- package/dist/Shared/Components/SelectPicker/GroupedFilterSelectPicker.d.ts +0 -2
- package/dist/Shared/Components/TrailingItem/TrailingItem.component.d.ts +0 -3
- package/dist/Shared/Components/TrailingItem/index.d.ts +0 -2
- package/dist/Shared/Components/TrailingItem/types.d.ts +0 -39
- package/dist/Shared/Components/TreeView/TreeView.component.d.ts +0 -3
- package/dist/Shared/Components/TreeView/TreeViewNodeContent.d.ts +0 -3
- package/dist/Shared/Components/TreeView/constants.d.ts +0 -4
- package/dist/Shared/Components/TreeView/index.d.ts +0 -2
- package/dist/Shared/Components/TreeView/types.d.ts +0 -204
- package/dist/Shared/Components/TreeView/utils.d.ts +0 -22
- package/dist/assets/ic-activity.abf111c7.svg +0 -3
- package/dist/assets/ic-folder.8038c019.svg +0 -3
- package/dist/assets/ic-helm-app.a20cfeb3.svg +0 -4
- package/dist/assets/ic-namespace.8980221f.svg +0 -3
@@ -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>>;
|
@@ -1,6 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
|
4
|
-
export declare const getSecurityModalSidebarId: ({ category, subCategory }: SidebarDataChildType["value"]) => string;
|
5
|
-
export declare const getSecurityModalSidebarChildFromId: (id: string) => SidebarDataChildType["value"];
|
6
|
-
export declare const getSidebarData: ({ imageScan, codeScan, kubernetesManifest, imageScanLicenseRisks, selectedId, scanResult, }: GetSidebarDataParamsType) => TreeViewProps["nodes"];
|
1
|
+
import { ScanCategoriesWithLicense } from '../../types';
|
2
|
+
import { SidebarDataType } from '../types';
|
3
|
+
export declare const getSidebarData: (categoriesConfig: Record<ScanCategoriesWithLicense, boolean>) => SidebarDataType[];
|
@@ -1,4 +1,4 @@
|
|
1
1
|
export { getProgressingStateForStatus } from './ImageScan';
|
2
2
|
export { getInfoCardData } from './InfoCard';
|
3
|
-
export {
|
3
|
+
export { getSidebarData } from './Sidebar';
|
4
4
|
export { getTableData } from './Table';
|
@@ -1,7 +1,7 @@
|
|
1
|
-
export { getProgressingStateForStatus,
|
1
|
+
export { getProgressingStateForStatus, getSidebarData } from './config';
|
2
2
|
export { CATEGORY_LABELS } from './constants';
|
3
3
|
export { default as SecurityModal } from './SecurityModal';
|
4
4
|
export { getSecurityScan } from './service';
|
5
|
-
export type { GetResourceScanDetailsPayloadType, GetResourceScanDetailsResponseType, ScanResultDTO, SidebarDataChildType, SidebarPropsType, } from './types';
|
5
|
+
export type { GetResourceScanDetailsPayloadType, GetResourceScanDetailsResponseType, ScanResultDTO, SidebarDataChildType, SidebarDataType, SidebarPropsType, } from './types';
|
6
6
|
export { SeveritiesDTO } from './types';
|
7
7
|
export { getSecurityScanSeveritiesCount, getTotalVulnerabilityCount, parseGetResourceScanDetailsResponse, } from './utils';
|
@@ -224,6 +224,12 @@ export type SidebarDataChildType = {
|
|
224
224
|
subCategory: ScanSubCategories;
|
225
225
|
};
|
226
226
|
};
|
227
|
+
export type SidebarDataType = {
|
228
|
+
label: string;
|
229
|
+
isExpanded: boolean;
|
230
|
+
children: NonNullable<SidebarDataChildType[]>;
|
231
|
+
hideInHelmApp?: boolean;
|
232
|
+
};
|
227
233
|
export type EmptyStateType = Pick<GenericEmptyStateType, 'image' | 'SvgImage' | 'subTitle' | 'title' | 'children'>;
|
228
234
|
export declare const VulnerabilityState: {
|
229
235
|
readonly [-1]: "Failed";
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CATEGORIES,
|
1
|
+
import { CATEGORIES, SUB_CATEGORIES } from './SecurityModal/types';
|
2
2
|
export type ScanCategories = (typeof CATEGORIES)[keyof typeof CATEGORIES];
|
3
3
|
export type ScanSubCategories = (typeof SUB_CATEGORIES)[keyof typeof SUB_CATEGORIES];
|
4
4
|
export type ScanCategoriesWithLicense = ScanCategories | 'imageScanLicenseRisks';
|
@@ -16,8 +16,4 @@ export interface SecurityConfigType {
|
|
16
16
|
codeScan?: SecurityConfigCategoryType;
|
17
17
|
kubernetesManifest?: SecurityConfigCategoryType;
|
18
18
|
}
|
19
|
-
export interface GetSidebarDataParamsType extends Record<ScanCategoriesWithLicense, boolean> {
|
20
|
-
selectedId: string;
|
21
|
-
scanResult: ScanResultDTO;
|
22
|
-
}
|
23
19
|
export {};
|
@@ -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,
|
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> {
|
@@ -101,7 +100,7 @@ export declare enum SelectPickerVariantType {
|
|
101
100
|
BORDER_LESS = "border-less",
|
102
101
|
COMPACT = "compact"
|
103
102
|
}
|
104
|
-
export type SelectPickerProps<OptionValue = number | string, IsMulti extends boolean = false> = Pick<SelectProps<OptionValue, IsMulti>, 'name' | 'classNamePrefix' | 'options' | 'value' | 'onChange' | 'isSearchable' | 'isClearable' | 'hideSelectedOptions' | 'controlShouldRenderValue' | 'closeMenuOnSelect' | 'isDisabled' | 'isLoading' | 'required' | 'isOptionDisabled' | 'placeholder' | 'menuPosition' | 'getOptionLabel' | 'getOptionValue' | 'isOptionSelected' | 'menuIsOpen' | 'onMenuOpen' | 'onMenuClose' | 'autoFocus' | 'onBlur' | 'onKeyDown' | 'formatOptionLabel' | 'onInputChange' | 'inputValue' | 'filterOption' | 'noOptionsMessage' | 'defaultMenuIsOpen'
|
103
|
+
export type SelectPickerProps<OptionValue = number | string, IsMulti extends boolean = false> = Pick<SelectProps<OptionValue, IsMulti>, 'name' | 'classNamePrefix' | 'options' | 'value' | 'onChange' | 'isSearchable' | 'isClearable' | 'hideSelectedOptions' | 'controlShouldRenderValue' | 'closeMenuOnSelect' | 'isDisabled' | 'isLoading' | 'required' | 'isOptionDisabled' | 'placeholder' | 'menuPosition' | 'getOptionLabel' | 'getOptionValue' | 'isOptionSelected' | 'menuIsOpen' | 'onMenuOpen' | 'onMenuClose' | 'autoFocus' | 'onBlur' | 'onKeyDown' | 'formatOptionLabel' | 'onInputChange' | 'inputValue' | 'filterOption' | 'noOptionsMessage' | 'defaultMenuIsOpen'> & Partial<Pick<SelectProps<OptionValue, IsMulti>, 'shouldRenderCustomOptions' | 'renderCustomOptions' | 'icon' | 'showSelectedOptionIcon' | 'renderOptionsFooter' | 'shouldRenderTextArea'>> & Required<Pick<SelectProps<OptionValue, IsMulti>, 'inputId'>> & Partial<Pick<CreatableProps<SelectPickerOptionType<OptionValue>, IsMulti, GroupBase<SelectPickerOptionType<OptionValue>>>, 'onCreateOption' | 'formatCreateLabel' | 'menuPortalTarget'>> & Omit<FormFieldWrapperProps, 'children'> & {
|
105
104
|
/**
|
106
105
|
* Config for the footer at the bottom of menu list. It is sticky by default
|
107
106
|
*
|
@@ -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'
|
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,7 +21,6 @@ export * from './CollapsibleList';
|
|
21
21
|
export * from './CommitChipCell';
|
22
22
|
export * from './Confetti';
|
23
23
|
export * from './ConfirmationModal';
|
24
|
-
export * from './ContextSwitcher';
|
25
24
|
export * from './CountrySelect';
|
26
25
|
export * from './CustomInput';
|
27
26
|
export * from './DatePicker';
|
@@ -86,7 +85,6 @@ export * from './TargetPlatforms';
|
|
86
85
|
export * from './Textarea';
|
87
86
|
export * from './ThemeSwitcher';
|
88
87
|
export * from './ToggleResolveScopedVariables';
|
89
|
-
export * from './TreeView';
|
90
88
|
export * from './Typewriter';
|
91
89
|
export * from './UnsavedChanges';
|
92
90
|
export * from './UnsavedChangesDialog';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './useIsSecureConnection';
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const useIsSecureConnection: () => boolean;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
export * from './constants';
|
2
|
-
export { getUserPreferences,
|
2
|
+
export { getUserPreferences, updateUserPreferences } from './service';
|
3
3
|
export * from './types';
|
4
4
|
export { useUserPreferences } from './useUserPrefrences';
|
@@ -1,28 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { 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,
|
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>;
|
8
|
+
export declare const updateUserPreferences: ({ path, value, shouldThrowError, }: UserPreferenceResourceProps) => Promise<boolean>;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { USER_PREFERENCES_ATTRIBUTE_KEY } from './constants';
|
2
2
|
import { AppThemeType, ThemeConfigType, ThemePreferenceType } from '../../Providers/ThemeProvider/types';
|
3
|
+
import { BaseAppMetaData } from '../../Services';
|
3
4
|
import { ResourceKindType } from '../../types';
|
4
5
|
export interface GetUserPreferencesQueryParamsType {
|
5
6
|
key: typeof USER_PREFERENCES_ATTRIBUTE_KEY;
|
@@ -11,18 +12,12 @@ export declare enum ViewIsPipelineRBACConfiguredRadioTabs {
|
|
11
12
|
export declare enum UserPreferenceResourceActions {
|
12
13
|
RECENTLY_VISITED = "recently-visited"
|
13
14
|
}
|
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;
|
21
|
-
}
|
22
15
|
export interface UserResourceKindActionType {
|
23
|
-
[UserPreferenceResourceActions.RECENTLY_VISITED]:
|
16
|
+
[UserPreferenceResourceActions.RECENTLY_VISITED]: BaseAppMetaData[];
|
17
|
+
}
|
18
|
+
export interface UserPreferenceResourceType {
|
19
|
+
[ResourceKindType.devtronApplication]: UserResourceKindActionType;
|
24
20
|
}
|
25
|
-
export type UserPreferenceResourceType = Partial<Record<PreferredResourceKindType, UserResourceKindActionType>>;
|
26
21
|
export interface GetUserPreferencesParsedDTO {
|
27
22
|
viewPermittedEnvOnly?: boolean;
|
28
23
|
/**
|
@@ -61,34 +56,26 @@ export interface UserPreferencesType {
|
|
61
56
|
}
|
62
57
|
export interface UpdatedUserPreferencesType extends UserPreferencesType, Pick<ThemeConfigType, 'appTheme'> {
|
63
58
|
}
|
64
|
-
export interface RecentlyVisitedFetchConfigType extends UserPreferenceRecentlyVisitedAppsTypes {
|
65
|
-
isDataAvailable?: boolean;
|
66
|
-
}
|
67
59
|
export interface UseUserPreferencesProps {
|
68
|
-
userPreferenceResourceKind?: PreferredResourceKindType;
|
69
60
|
migrateUserPreferences?: (userPreferencesResponse: UserPreferencesType) => Promise<UserPreferencesType>;
|
70
|
-
recentlyVisitedFetchConfig?: RecentlyVisitedFetchConfigType;
|
71
61
|
}
|
72
62
|
export type UserPathValueMapType = {
|
73
63
|
path: 'themePreference';
|
74
64
|
value: Required<Pick<UpdatedUserPreferencesType, 'themePreference' | 'appTheme'>>;
|
75
|
-
resourceKind?: never;
|
76
|
-
userPreferencesResponse?: never;
|
77
65
|
} | {
|
78
66
|
path: 'pipelineRBACViewSelectedTab';
|
79
67
|
value: Required<Pick<UserPreferencesType, 'pipelineRBACViewSelectedTab'>>;
|
80
|
-
resourceKind?: never;
|
81
|
-
userPreferencesResponse?: never;
|
82
68
|
} | {
|
83
69
|
path: 'resources';
|
84
|
-
value: Required<
|
85
|
-
resourceKind: PreferredResourceKindType;
|
86
|
-
userPreferencesResponse?: UserPreferencesType;
|
70
|
+
value: Required<BaseAppMetaData[]>;
|
87
71
|
};
|
88
72
|
export type UserPreferenceResourceProps = UserPathValueMapType & {
|
89
73
|
shouldThrowError?: boolean;
|
90
|
-
userPreferencesResponse?: UserPreferencesType;
|
91
74
|
};
|
75
|
+
export interface UserPreferenceRecentlyVisitedAppsTypes {
|
76
|
+
appId: number;
|
77
|
+
appName: string;
|
78
|
+
}
|
92
79
|
export interface UserPreferenceFilteredListTypes extends UserPreferenceRecentlyVisitedAppsTypes {
|
93
|
-
userPreferencesResponse
|
80
|
+
userPreferencesResponse: UserPreferencesType;
|
94
81
|
}
|
@@ -1,12 +1,10 @@
|
|
1
1
|
import { ServerErrors } from '../../../Common/ServerError';
|
2
|
-
import {
|
3
|
-
export declare const useUserPreferences: ({ migrateUserPreferences
|
2
|
+
import { UserPreferenceRecentlyVisitedAppsTypes, UserPreferencesType, UseUserPreferencesProps, ViewIsPipelineRBACConfiguredRadioTabs } from './types';
|
3
|
+
export declare const useUserPreferences: ({ migrateUserPreferences }: 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
|
-
|
10
|
-
recentlyVisitedResources: BaseRecentlyVisitedEntitiesTypes[];
|
11
|
-
recentResourcesLoading: boolean;
|
9
|
+
fetchRecentlyVisitedParsedApps: ({ appId, appName }: UserPreferenceRecentlyVisitedAppsTypes) => Promise<void>;
|
12
10
|
};
|
@@ -1,3 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
export declare const
|
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[];
|