@devtron-labs/devtron-fe-common-lib 1.17.1 → 1.18.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.
- package/dist/{@code-editor-CXQ0yUkc.js → @code-editor-Cmi_dLiG.js} +10498 -9829
- package/dist/@common-rjsf-DTSwvp93.js +598 -0
- package/dist/Common/EmptyState/GenericEmptyState.d.ts +1 -1
- package/dist/Common/Hooks/UseIsTextTruncated/UseIsTextTruncated.d.ts +5 -0
- package/dist/Common/Hooks/UseIsTextTruncated/constants.d.ts +1 -0
- package/dist/Common/Hooks/UseIsTextTruncated/index.d.ts +1 -0
- package/dist/Common/Hooks/index.d.ts +1 -0
- package/dist/Common/RJSF/constants.d.ts +1 -0
- package/dist/Common/RJSF/utils.d.ts +1 -1
- package/dist/Common/Tooltip/constants.d.ts +0 -1
- package/dist/Common/Types.d.ts +2 -0
- package/dist/Pages/ResourceBrowser/ResourceBrowser.Types.d.ts +0 -1
- package/dist/Shared/Components/ActionMenu/types.d.ts +2 -33
- package/dist/Shared/Components/CollapsibleList/CollapsibleList.component.d.ts +3 -0
- 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/DocLink/types.d.ts +4 -0
- package/dist/Shared/Components/DocLink/utils.d.ts +2 -1
- package/dist/Shared/Components/Icon/Icon.d.ts +5 -0
- package/dist/Shared/Components/Illustration/Illustration.d.ts +15 -0
- package/dist/Shared/Components/Illustration/IllustrationBase.d.ts +2 -0
- package/dist/Shared/Components/Illustration/index.d.ts +1 -0
- package/dist/Shared/Components/Illustration/types.d.ts +27 -0
- package/dist/Shared/Components/PortalContainer/PortalContainer.d.ts +5 -0
- package/dist/Shared/Components/PortalContainer/index.d.ts +1 -0
- package/dist/Shared/Components/Security/SecurityModal/config/Sidebar.d.ts +6 -3
- 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 +0 -6
- package/dist/Shared/Components/Security/types.d.ts +5 -1
- package/dist/Shared/Components/SelectPicker/GroupedFilterSelectPicker.d.ts +2 -0
- package/dist/Shared/Components/SelectPicker/SelectPicker.component.d.ts +1 -1
- package/dist/Shared/Components/SelectPicker/index.d.ts +1 -0
- package/dist/Shared/Components/SelectPicker/type.d.ts +7 -2
- package/dist/Shared/Components/Table/InternalTable.d.ts +2 -2
- package/dist/Shared/Components/Table/Table.component.d.ts +2 -2
- package/dist/Shared/Components/Table/TableContent.d.ts +2 -2
- package/dist/Shared/Components/Table/index.d.ts +1 -1
- package/dist/Shared/Components/Table/types.d.ts +56 -67
- package/dist/Shared/Components/Table/useTableWithKeyboardShortcuts.d.ts +2 -2
- package/dist/Shared/Components/Table/utils.d.ts +6 -6
- package/dist/Shared/Components/TrailingItem/TrailingItem.component.d.ts +3 -0
- package/dist/Shared/Components/TrailingItem/index.d.ts +2 -0
- package/dist/Shared/Components/TrailingItem/types.d.ts +39 -0
- package/dist/Shared/Components/TreeView/TreeView.component.d.ts +3 -0
- package/dist/Shared/Components/TreeView/TreeViewNodeContent.d.ts +3 -0
- package/dist/Shared/Components/TreeView/constants.d.ts +4 -0
- package/dist/Shared/Components/TreeView/index.d.ts +2 -0
- package/dist/Shared/Components/TreeView/types.d.ts +204 -0
- package/dist/Shared/Components/TreeView/utils.d.ts +22 -0
- package/dist/Shared/Components/UserIdentifier/UserIdentifier.d.ts +1 -1
- package/dist/Shared/Components/UserIdentifier/types.d.ts +5 -0
- package/dist/Shared/Components/index.d.ts +4 -0
- package/dist/Shared/Helpers.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 +0 -4
- package/dist/assets/@code-editor.css +1 -1
- package/dist/assets/@common-rjsf.css +1 -1
- package/dist/assets/ic-activity.abf111c7.svg +3 -0
- package/dist/assets/ic-folder.8038c019.svg +3 -0
- package/dist/assets/ic-helm-app.a20cfeb3.svg +4 -0
- package/dist/assets/ic-list-bullets.91aab240.svg +4 -0
- package/dist/assets/ic-namespace.8980221f.svg +3 -0
- package/dist/assets/img-code.fa00ae8e.webp +0 -0
- package/dist/assets/img-man-on-rocket.ab6bef97.webp +0 -0
- package/dist/assets/img-no-result.51284acb.webp +0 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +802 -789
- package/package.json +3 -2
- package/dist/@common-rjsf-CDMxkHD5.js +0 -609
- package/dist/assets/empty-noresult@2x.022ec87c.png +0 -0
- package/dist/assets/ic-errorInfo.d8d674b8.svg +0 -23
@@ -0,0 +1,39 @@
|
|
1
|
+
import { ReactElement } from 'react';
|
2
|
+
import { OmitNever } from '../../types';
|
3
|
+
import { ButtonProps } from '../Button';
|
4
|
+
import { IconsProps } from '../Icon';
|
5
|
+
import { NumbersCountProps } from '../NumbersCount';
|
6
|
+
import { DTSwitchProps } from '../Switch';
|
7
|
+
export type ActionMenuItemIconType = Pick<IconsProps, 'name'> & {
|
8
|
+
/** @default 'N800' */
|
9
|
+
color?: IconsProps['color'];
|
10
|
+
};
|
11
|
+
export type TrailingItemType = {
|
12
|
+
type: 'icon';
|
13
|
+
config: ActionMenuItemIconType;
|
14
|
+
} | {
|
15
|
+
type: 'text';
|
16
|
+
config: {
|
17
|
+
value: string;
|
18
|
+
icon?: ActionMenuItemIconType;
|
19
|
+
};
|
20
|
+
} | {
|
21
|
+
type: 'counter';
|
22
|
+
config: {
|
23
|
+
value: NumbersCountProps['count'];
|
24
|
+
} & Pick<NumbersCountProps, 'isSelected'>;
|
25
|
+
} | {
|
26
|
+
type: 'switch';
|
27
|
+
config: Pick<DTSwitchProps, 'ariaLabel' | 'isChecked' | 'indeterminate' | 'isDisabled' | 'isLoading' | 'name' | 'onChange' | 'tooltipContent'>;
|
28
|
+
} | {
|
29
|
+
type: 'button';
|
30
|
+
config: OmitNever<Omit<Extract<ButtonProps, {
|
31
|
+
icon: ReactElement;
|
32
|
+
}>, 'size' | 'variant'>>;
|
33
|
+
};
|
34
|
+
export type TrailingItemProps = TrailingItemType & {
|
35
|
+
/**
|
36
|
+
* @default 'neutral'
|
37
|
+
*/
|
38
|
+
variant?: 'neutral' | 'negative';
|
39
|
+
};
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { TreeViewProps } from './types';
|
2
|
+
declare const TreeView: <DataAttributeType = null>({ nodes, isControlled, expandedMap: expandedMapProp, selectedId, onToggle: onToggleProp, onSelect, depth, mode, flatNodeList: flatNodeListProp, getUpdateItemsRefMap: getUpdateItemsRefMapProp, variant, defaultExpandedMap, }: TreeViewProps<DataAttributeType>) => JSX.Element;
|
3
|
+
export default TreeView;
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { TreeViewProps } from './types';
|
2
|
+
export declare const DEFAULT_NO_ITEMS_TEXT = "No items found";
|
3
|
+
export declare const VARIANT_TO_BG_CLASS_MAP: Record<TreeViewProps['variant'], string>;
|
4
|
+
export declare const VARIANT_TO_HOVER_CLASS_MAP: Record<TreeViewProps['variant'], string>;
|
@@ -0,0 +1,204 @@
|
|
1
|
+
import { SyntheticEvent } from 'react';
|
2
|
+
import { TooltipProps } from '../../../Common/Tooltip';
|
3
|
+
import { DataAttributes, Never } from '../../types';
|
4
|
+
import { IconsProps } from '../Icon';
|
5
|
+
import { TrailingItemProps } from '../TrailingItem';
|
6
|
+
export type TreeNode<DataAttributeType = null> = TreeHeading<DataAttributeType> | TreeItem<DataAttributeType>;
|
7
|
+
/**
|
8
|
+
* Represents a base node structure for a tree view component.
|
9
|
+
*
|
10
|
+
* @typeParam DataAttributeType - The type for data attributes, defaults to null. If it extends `DataAttributes`, the node can have `dataAttributes` of this type.
|
11
|
+
*
|
12
|
+
* @property id - Unique identifier for the node.
|
13
|
+
* @property title - The main title text displayed for the node.
|
14
|
+
* @property subtitle - Optional subtitle text for the node.
|
15
|
+
* @property customTooltipConfig - Optional configuration for a custom tooltip.
|
16
|
+
* @property strikeThrough - If true, the title will be rendered with a line-through style.
|
17
|
+
* @property startIconConfig - Optional configuration for a start icon, which can be either a standard icon (with `name` and `color`) or a custom JSX element.
|
18
|
+
* @property trailingItem - Optional configuration for a trailing item (e.g., button, icon) displayed at the end of the node.
|
19
|
+
* @property dataAttributes - Optional data attributes, present only if `DataAttributeType` extends `DataAttributes`.
|
20
|
+
*/
|
21
|
+
type BaseNode<DataAttributeType = null> = {
|
22
|
+
/**
|
23
|
+
* id - Unique identifier for the node.
|
24
|
+
*/
|
25
|
+
id: string;
|
26
|
+
/**
|
27
|
+
* The title of the list item.
|
28
|
+
*/
|
29
|
+
title: string;
|
30
|
+
/**
|
31
|
+
* The subtitle of the list item.
|
32
|
+
*/
|
33
|
+
subtitle?: string;
|
34
|
+
/**
|
35
|
+
* Optional configuration for a custom tooltip.
|
36
|
+
*/
|
37
|
+
customTooltipConfig?: TooltipProps;
|
38
|
+
/**
|
39
|
+
* If true, the title will be rendered with line-through.
|
40
|
+
*/
|
41
|
+
strikeThrough?: boolean;
|
42
|
+
/**
|
43
|
+
* Optional configuration for a start icon, which can be either a standard icon (with `name` and `color`) or a custom JSX element.
|
44
|
+
*/
|
45
|
+
startIconConfig?: {
|
46
|
+
tooltipContent?: string;
|
47
|
+
} & ((Pick<IconsProps, 'name' | 'color'> & {
|
48
|
+
customIcon?: never;
|
49
|
+
}) | (Never<Pick<IconsProps, 'name' | 'color'>> & {
|
50
|
+
customIcon?: JSX.Element;
|
51
|
+
}));
|
52
|
+
trailingItem?: TrailingItemProps;
|
53
|
+
} & (DataAttributeType extends DataAttributes ? {
|
54
|
+
dataAttributes?: DataAttributeType;
|
55
|
+
} : {
|
56
|
+
dataAttributes?: never;
|
57
|
+
});
|
58
|
+
export type TreeHeading<DataAttributeType = null> = BaseNode<DataAttributeType> & {
|
59
|
+
type: 'heading';
|
60
|
+
items?: TreeNode<DataAttributeType>[];
|
61
|
+
/**
|
62
|
+
* Text to display when there are no items in the list.
|
63
|
+
* @default DEFAULT_NO_ITEMS_TEXT
|
64
|
+
*/
|
65
|
+
noItemsText?: string;
|
66
|
+
};
|
67
|
+
export type NodeElementType = HTMLDivElement | HTMLButtonElement | HTMLAnchorElement;
|
68
|
+
/**
|
69
|
+
* Represents an item node in a tree structure, supporting different rendering modes.
|
70
|
+
*
|
71
|
+
* @template DataAttributeType - The type for custom data attributes, defaults to null.
|
72
|
+
*
|
73
|
+
* A `TreeItem` can be rendered as a button, link, or div, each with its own set of properties:
|
74
|
+
* - When `as` is `'button'` (default), it can have an `onClick` handler.
|
75
|
+
* - When `as` is `'link'`, it requires an `href`, can have an `onClick` handler, and supports clearing query parameters on navigation.
|
76
|
+
* - When `as` is `'div'`, it is a non-interactive container.
|
77
|
+
*
|
78
|
+
* @property {'item'} type - Identifies the node as an item.
|
79
|
+
* @property {boolean} [isDisabled=false] - If true, disables the item.
|
80
|
+
* @property {'button' | 'link' | 'div'} [as] - Determines the rendered element type.
|
81
|
+
* @property {(e: SyntheticEvent) => void} [onClick] - Callback for click events (button or link only).
|
82
|
+
* @property {string} [href] - The navigation URL (link only).
|
83
|
+
* @property {boolean} [clearQueryParamsOnNavigation=false] - If true, clears query parameters during navigation (link only).
|
84
|
+
*/
|
85
|
+
export type TreeItem<DataAttributeType = null> = BaseNode<DataAttributeType> & {
|
86
|
+
type: 'item';
|
87
|
+
/**
|
88
|
+
* @default false
|
89
|
+
*/
|
90
|
+
isDisabled?: boolean;
|
91
|
+
} & ({
|
92
|
+
as?: 'button';
|
93
|
+
/**
|
94
|
+
* The callback function to handle click events on the button.
|
95
|
+
*/
|
96
|
+
onClick?: (e: SyntheticEvent) => void;
|
97
|
+
href?: never;
|
98
|
+
clearQueryParamsOnNavigation?: never;
|
99
|
+
} | {
|
100
|
+
as: 'link';
|
101
|
+
href: string;
|
102
|
+
/**
|
103
|
+
* The callback function to handle click events on the nav link.
|
104
|
+
*/
|
105
|
+
onClick?: (e: SyntheticEvent) => void;
|
106
|
+
/**
|
107
|
+
* If `true`, clears query parameters during navigation.
|
108
|
+
* @default false
|
109
|
+
*/
|
110
|
+
clearQueryParamsOnNavigation?: boolean;
|
111
|
+
} | {
|
112
|
+
as: 'div';
|
113
|
+
href?: never;
|
114
|
+
onClick?: never;
|
115
|
+
clearQueryParamsOnNavigation?: never;
|
116
|
+
});
|
117
|
+
/**
|
118
|
+
* Props for the TreeView component.
|
119
|
+
*
|
120
|
+
* @template DataAttributeType - The type for data attributes associated with tree nodes.
|
121
|
+
*
|
122
|
+
* @property nodes - An array of tree nodes to be rendered in the tree view.
|
123
|
+
* @property selectedId - (Optional) The ID of the currently selected tree item.
|
124
|
+
* @property onSelect - (Optional) Callback invoked when a tree item is selected.
|
125
|
+
* @property mode - (Optional) Determines the navigation mode of the tree view.
|
126
|
+
* - `'navigation'`: Enables keyboard navigation and focuses only the selected item.
|
127
|
+
* - `'form'`: Leaves navigation to the browser.
|
128
|
+
* - @default 'navigation'
|
129
|
+
* @property variant - (Optional) Visual variant of the tree view.
|
130
|
+
* - `'primary'`: Uses primary background and hover colors.
|
131
|
+
* - `'secondary'`: Uses secondary background and hover colors.
|
132
|
+
* - @default 'primary'
|
133
|
+
* @property defaultExpandedMap - (Optional) Initial map of node IDs to their expanded state.
|
134
|
+
* - @default {}
|
135
|
+
*
|
136
|
+
* @property depth - (Internal use only) The current depth level in the tree.
|
137
|
+
* @property getUpdateItemsRefMap - (Internal use only) Function to update the ref map for item buttons/anchors.
|
138
|
+
* @property flatNodeList - (Internal use only) List of all visible node IDs for keyboard navigation.
|
139
|
+
* @property onToggle - (Internal use only) Callback invoked when a tree heading is toggled.
|
140
|
+
* @property expandedMap - (Internal use only) Map of node IDs to their expanded state.
|
141
|
+
* @property isControlled - (Internal use only) Indicates if the tree view is controlled.
|
142
|
+
*/
|
143
|
+
export type TreeViewProps<DataAttributeType = null> = {
|
144
|
+
nodes: TreeNode<DataAttributeType>[];
|
145
|
+
selectedId?: string;
|
146
|
+
onSelect?: (item: TreeItem<DataAttributeType>) => void;
|
147
|
+
/**
|
148
|
+
* If navigation mode, the tree view will provide navigation through keyboard actions and make the only selected item focusable.
|
149
|
+
* If form mode, will leave the navigation to browser.
|
150
|
+
* @default 'navigation'
|
151
|
+
*/
|
152
|
+
mode?: 'navigation' | 'form';
|
153
|
+
/**
|
154
|
+
* If primary the background color will be bg__primary and bg__hover--opaque, if secondary the background color will be bg__secondary bg__hover-secondary--opaque.
|
155
|
+
* @default 'primary'
|
156
|
+
*/
|
157
|
+
variant?: 'primary' | 'secondary';
|
158
|
+
/**
|
159
|
+
* @default {}
|
160
|
+
*/
|
161
|
+
defaultExpandedMap?: Record<string, boolean>;
|
162
|
+
} /**
|
163
|
+
* WARNING: For internal use only.
|
164
|
+
*/ & ({
|
165
|
+
depth: number;
|
166
|
+
/**
|
167
|
+
* Would pass this to item button/ref and store it in out ref map through this function.
|
168
|
+
*/
|
169
|
+
getUpdateItemsRefMap: (id: string) => (element: NodeElementType) => void;
|
170
|
+
/**
|
171
|
+
* List of all nodes visible in tree view for keyboard navigation.
|
172
|
+
*/
|
173
|
+
flatNodeList: string[];
|
174
|
+
/**
|
175
|
+
* Would be called when the user toggles a heading.
|
176
|
+
*/
|
177
|
+
onToggle: (item: TreeHeading<DataAttributeType>) => void;
|
178
|
+
/**
|
179
|
+
* Map of id to whether the item is expanded or not.
|
180
|
+
*/
|
181
|
+
expandedMap: Record<string, boolean>;
|
182
|
+
isControlled: true;
|
183
|
+
} | {
|
184
|
+
depth?: never;
|
185
|
+
getUpdateItemsRefMap?: never;
|
186
|
+
flatNodeList?: never;
|
187
|
+
onToggle?: never;
|
188
|
+
expandedMap?: never;
|
189
|
+
isControlled?: false;
|
190
|
+
});
|
191
|
+
export interface TreeViewNodeContentProps extends Pick<BaseNode, 'startIconConfig' | 'title' | 'subtitle' | 'customTooltipConfig' | 'strikeThrough'> {
|
192
|
+
type: 'heading' | 'item';
|
193
|
+
isSelected: boolean;
|
194
|
+
}
|
195
|
+
export interface GetSelectedIdParentNodesProps<DataAttributeType = null> extends Pick<TreeViewProps<DataAttributeType>, 'nodes' | 'selectedId'> {
|
196
|
+
}
|
197
|
+
export interface FindSelectedIdParentNodesProps<DataAttributeType = null> extends Pick<GetSelectedIdParentNodesProps<DataAttributeType>, 'selectedId'> {
|
198
|
+
node: TreeNode<DataAttributeType>;
|
199
|
+
onFindParentNode: (id: string) => void;
|
200
|
+
}
|
201
|
+
export interface GetVisibleNodesProps<DataAttributeType = null> extends Pick<TreeViewProps<DataAttributeType>, 'expandedMap'> {
|
202
|
+
nodeList: TreeNode<DataAttributeType>[];
|
203
|
+
}
|
204
|
+
export {};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { GetSelectedIdParentNodesProps, GetVisibleNodesProps } from './types';
|
2
|
+
/**
|
3
|
+
* Retrieves an array of parent node IDs for the currently selected node.
|
4
|
+
*
|
5
|
+
* Iterates through the provided tree nodes and collects the IDs of all parent nodes
|
6
|
+
* leading to the node identified by `selectedId`. If no node is selected, returns an empty array.
|
7
|
+
*
|
8
|
+
* @returns {string[]} An array of parent node IDs for the selected node, or an empty array if no node is selected.
|
9
|
+
*/
|
10
|
+
export declare const getSelectedIdParentNodes: <DataAttributeType = null>({ nodes, selectedId, }: GetSelectedIdParentNodesProps<DataAttributeType>) => string[];
|
11
|
+
/**
|
12
|
+
* Recursively traverses a list of tree nodes and returns an array of all node IDs that are present in DOM.
|
13
|
+
*
|
14
|
+
* For each node in the provided list:
|
15
|
+
* - Adds the node's `id` to the result array.
|
16
|
+
* - If the node is of type `'heading'`, is expanded (as per `expandedMap`), and has child items,
|
17
|
+
* recursively traverses its child items and includes their IDs as well.
|
18
|
+
*
|
19
|
+
* @param nodeList - The list of nodes to traverse.
|
20
|
+
* @returns An array of strings representing the IDs of all traversed nodes.
|
21
|
+
*/
|
22
|
+
export declare const getVisibleNodes: <DataAttributeType = null>({ nodeList, expandedMap, }: GetVisibleNodesProps<DataAttributeType>) => string[];
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import { UserIdentifierProps } from './types';
|
2
|
-
export declare const UserIdentifier: ({ identifier, children, rootClassName, tooltipContent, isUserGroup, }: UserIdentifierProps) => JSX.Element;
|
2
|
+
export declare const UserIdentifier: ({ identifier, children, rootClassName, tooltipContent, isUserGroup, displayYouLabelForCurrentUser, }: UserIdentifierProps) => JSX.Element;
|
@@ -8,4 +8,9 @@ export interface UserIdentifierProps {
|
|
8
8
|
* @description - If given, would show tooltip on div containing avatar, email and children
|
9
9
|
*/
|
10
10
|
tooltipContent?: string;
|
11
|
+
/**
|
12
|
+
* Controls whether to display "You" text for the current user
|
13
|
+
* @default true
|
14
|
+
*/
|
15
|
+
displayYouLabelForCurrentUser?: boolean;
|
11
16
|
}
|
@@ -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';
|
@@ -49,6 +50,7 @@ export * from './GraphVisualizer';
|
|
49
50
|
export * from './Header';
|
50
51
|
export * from './Icon';
|
51
52
|
export * from './IframeContainer';
|
53
|
+
export * from './Illustration';
|
52
54
|
export * from './ImageCard';
|
53
55
|
export * from './ImageCardAccordion';
|
54
56
|
export * from './ImageChipCell';
|
@@ -66,6 +68,7 @@ export * from './NumbersCount';
|
|
66
68
|
export * from './PhoneInput';
|
67
69
|
export * from './Plugin';
|
68
70
|
export * from './Popover';
|
71
|
+
export * from './PortalContainer';
|
69
72
|
export * from './ProgressBar';
|
70
73
|
export { default as QRCode } from './QRCode';
|
71
74
|
export * from './ReactSelect';
|
@@ -85,6 +88,7 @@ export * from './TargetPlatforms';
|
|
85
88
|
export * from './Textarea';
|
86
89
|
export * from './ThemeSwitcher';
|
87
90
|
export * from './ToggleResolveScopedVariables';
|
91
|
+
export * from './TreeView';
|
88
92
|
export * from './Typewriter';
|
89
93
|
export * from './UnsavedChanges';
|
90
94
|
export * from './UnsavedChangesDialog';
|
package/dist/Shared/Helpers.d.ts
CHANGED
@@ -29,6 +29,7 @@ export declare const getGitCommitInfo: (materialInfo: MaterialInfo) => GitTrigge
|
|
29
29
|
export declare const stringComparatorBySortOrder: (a: string, b: string, sortOrder?: SortingOrder, isCaseSensitive?: boolean) => number;
|
30
30
|
export declare const numberComparatorBySortOrder: (a: number, b: number, sortOrder?: SortingOrder) => number;
|
31
31
|
export declare function versionComparatorBySortOrder(a: string, b: string, orderBy?: SortingOrder): number;
|
32
|
+
export declare const dateComparatorBySortOrder: (a: string | number | Date, b: string | number | Date, sortOrder?: SortingOrder) => number;
|
32
33
|
export declare const getWebhookEventIcon: (eventName: WebhookEventNameType) => JSX.Element;
|
33
34
|
export declare const yamlComparatorBySortOrder: (a: Pair, b: Pair, sortOrder?: SortingOrder) => number;
|
34
35
|
export declare const useIntersection: (target: React.RefObject<Element> | Element | null, options?: IntersectionOptions, callback?: IntersectionChangeHandler) => boolean;
|
@@ -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,10 +787,6 @@ 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;
|
794
790
|
}
|
795
791
|
export interface ResourceApprovalPolicyConfigDTO {
|
796
792
|
appId: number;
|