2024-08-06 14:52:22 +00:00
|
|
|
import type { ReduxAction } from "ee/constants/ReduxActionConstants";
|
|
|
|
|
import type { AppState } from "ee/reducers";
|
2022-10-17 15:16:38 +00:00
|
|
|
|
|
|
|
|
export enum FocusElement {
|
|
|
|
|
ApiPaneConfigTabs = "ApiPaneConfigTabs",
|
2022-12-08 07:21:58 +00:00
|
|
|
CodeEditorHistory = "CodeEditorHistory",
|
|
|
|
|
EntityCollapsibleState = "EntityCollapsibleState",
|
|
|
|
|
EntityExplorerWidth = "EntityExplorerWidth",
|
|
|
|
|
ExplorerSwitchIndex = "ExplorerSwitchIndex",
|
2022-12-02 03:06:22 +00:00
|
|
|
DatasourceViewMode = "DatasourceViewMode",
|
2023-10-18 07:14:10 +00:00
|
|
|
SelectedDatasource = "SelectedDatasource",
|
2023-04-10 12:59:14 +00:00
|
|
|
DebuggerContext = "DebuggerContext",
|
2022-11-25 03:47:00 +00:00
|
|
|
ApiRightPaneTabs = "ApiRightPaneTabs",
|
2022-10-17 15:16:38 +00:00
|
|
|
QueryPaneConfigTabs = "QueryPaneConfigTabs",
|
|
|
|
|
JSPaneConfigTabs = "JSPaneConfigTabs",
|
|
|
|
|
PropertySections = "PropertySections",
|
2022-12-16 17:22:47 +00:00
|
|
|
PropertyField = "PropertyField",
|
2022-10-17 15:16:38 +00:00
|
|
|
PropertyTabs = "PropertyTabs",
|
2022-12-08 07:21:58 +00:00
|
|
|
PropertyPanelContext = "PropertyPanelContext",
|
|
|
|
|
PropertyPaneWidth = "PropertyPaneWidth",
|
|
|
|
|
SelectedPropertyPanel = "SelectedPropertyPanel",
|
2022-10-17 15:16:38 +00:00
|
|
|
SelectedWidgets = "SelectedWidgets",
|
2022-12-08 07:21:58 +00:00
|
|
|
SubEntityCollapsibleState = "SubEntityCollapsibleState",
|
2022-12-15 14:15:46 +00:00
|
|
|
InputField = "InputField",
|
2023-11-28 12:46:43 +00:00
|
|
|
SelectedQuery = "SelectedQuery",
|
|
|
|
|
SelectedJSObject = "SelectedJSObject",
|
2024-04-29 05:01:27 +00:00
|
|
|
SelectedEntity = "SelectedEntity",
|
2024-01-29 07:18:05 +00:00
|
|
|
IDETabs = "IDETabs",
|
2024-02-29 06:23:57 +00:00
|
|
|
QueryDebugger = "QueryDebugger",
|
|
|
|
|
ApiDebugger = "ApiDebugger",
|
|
|
|
|
JSDebugger = "JSDebugger",
|
2022-10-17 15:16:38 +00:00
|
|
|
}
|
|
|
|
|
|
2024-01-08 05:39:47 +00:00
|
|
|
export enum FocusElementConfigType {
|
2023-10-18 07:14:10 +00:00
|
|
|
Redux = "Redux",
|
|
|
|
|
URL = "URL",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface ConfigOther {
|
2022-10-17 15:16:38 +00:00
|
|
|
name: FocusElement;
|
2023-10-24 09:58:21 +00:00
|
|
|
/* If a selector is added for default value, it will be supplied the state to
|
|
|
|
|
derive a default value */
|
|
|
|
|
defaultValue?: unknown | ((state: AppState) => unknown);
|
2022-10-17 15:16:38 +00:00
|
|
|
subTypes?: Record<string, { defaultValue: unknown }>;
|
2024-02-27 05:12:27 +00:00
|
|
|
persist?: boolean;
|
2023-10-11 07:35:24 +00:00
|
|
|
}
|
2022-10-17 15:16:38 +00:00
|
|
|
|
2023-10-18 07:14:10 +00:00
|
|
|
type ConfigRedux = {
|
2024-01-08 05:39:47 +00:00
|
|
|
type: FocusElementConfigType.Redux;
|
2023-10-18 07:14:10 +00:00
|
|
|
selector: (state: AppState) => unknown;
|
2024-07-31 15:41:28 +00:00
|
|
|
// TODO: Fix this the next time the file is edited
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2023-10-18 07:14:10 +00:00
|
|
|
setter: (payload: any) => ReduxAction<any>;
|
|
|
|
|
} & ConfigOther;
|
|
|
|
|
|
|
|
|
|
type ConfigURL = {
|
2024-01-08 05:39:47 +00:00
|
|
|
type: FocusElementConfigType.URL;
|
2023-10-18 07:14:10 +00:00
|
|
|
selector: (url: string) => unknown;
|
2024-07-31 15:41:28 +00:00
|
|
|
// TODO: Fix this the next time the file is edited
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2023-10-18 07:14:10 +00:00
|
|
|
setter: (payload: any) => void;
|
|
|
|
|
} & ConfigOther;
|
|
|
|
|
|
2024-01-08 05:39:47 +00:00
|
|
|
export type FocusElementConfig = ConfigRedux | ConfigURL;
|