@devtron-labs/devtron-fe-common-lib 1.17.0-pre-8 → 1.17.0-pre-9
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-CsKzSw6Y.js → @code-editor-DcQ7PPhd.js} +5196 -5082
- package/dist/{@common-rjsf-zRo8kSDe.js → @common-rjsf-DMiOG5j_.js} +1 -1
- package/dist/Shared/Components/ContextSwitcher/ContextSwitcher.d.ts +2 -0
- package/dist/Shared/Components/ContextSwitcher/index.d.ts +3 -0
- package/dist/Shared/Components/ContextSwitcher/types.d.ts +14 -0
- package/dist/Shared/Components/ContextSwitcher/utils.d.ts +5 -0
- package/dist/Shared/Components/index.d.ts +1 -0
- package/dist/Shared/Hooks/useUserPreferences/constants.d.ts +2 -0
- package/dist/Shared/Hooks/useUserPreferences/index.d.ts +1 -1
- package/dist/Shared/Hooks/useUserPreferences/service.d.ts +22 -2
- package/dist/Shared/Hooks/useUserPreferences/types.d.ts +24 -11
- package/dist/Shared/Hooks/useUserPreferences/useUserPrefrences.d.ts +5 -3
- package/dist/Shared/Hooks/useUserPreferences/utils.d.ts +3 -4
- package/dist/Shared/types.d.ts +4 -0
- package/dist/index.js +785 -781
- package/package.json +1 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
import { j as n, at as y, av as k, au as M } from "./@vendor-DbxoIktR.js";
|
2
2
|
import W, { forwardRef as J, useMemo as P } from "react";
|
3
3
|
import V, { getDefaultRegistry as K } from "@rjsf/core";
|
4
|
-
import { T as N, j as w, c as v, b as F, S as q, i as Y, a as G, d as C, e as z } from "./@code-editor-
|
4
|
+
import { T as N, j as w, c as v, b as F, S as q, i as Y, a as G, d as C, e as z } from "./@code-editor-DcQ7PPhd.js";
|
5
5
|
import { getUiOptions as I, getTemplate as D, getSubmitButtonOptions as Q, ADDITIONAL_PROPERTY_FLAG as B, errorId as X, englishStringTranslator as Z, TranslatableString as ee, titleId as te, canExpand as ne, deepEquals as re } from "@rjsf/utils";
|
6
6
|
import { ReactComponent as se } from "./assets/ic-add.cfaa779b.svg";
|
7
7
|
import { ReactComponent as ae } from "./assets/ic-warning.ecf7ff97.svg";
|
@@ -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,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;
|
@@ -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,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
|
16
|
-
|
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
|
19
|
-
[
|
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<
|
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
|
93
|
+
userPreferencesResponse?: UserPreferencesType;
|
81
94
|
}
|
@@ -1,10 +1,12 @@
|
|
1
1
|
import { ServerErrors } from '../../../Common/ServerError';
|
2
|
-
import {
|
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
|
-
|
9
|
+
fetchRecentlyVisitedParsedEntities: () => Promise<UserPreferencesType>;
|
10
|
+
recentlyVisitedResources: BaseRecentlyVisitedEntitiesTypes[];
|
11
|
+
recentResourcesLoading: boolean;
|
10
12
|
};
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
export declare const
|
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"];
|
package/dist/Shared/types.d.ts
CHANGED
@@ -787,6 +787,10 @@ export type InitTabType = Omit<CommonTabArgsType, 'type'> & ({
|
|
787
787
|
});
|
788
788
|
export interface DynamicTabType extends CommonTabArgsType {
|
789
789
|
id: string;
|
790
|
+
/**
|
791
|
+
* Id of the last active tab before switching to current tab
|
792
|
+
*/
|
793
|
+
lastActiveTabId: string | null;
|
790
794
|
}
|
791
795
|
export interface ResourceApprovalPolicyConfigDTO {
|
792
796
|
appId: number;
|