2024-08-06 14:52:22 +00:00
|
|
|
import type { AppState } from "ee/reducers";
|
2023-11-28 12:46:43 +00:00
|
|
|
import { getCurrentPageId } from "./editorSelectors";
|
2024-02-02 05:06:02 +00:00
|
|
|
import type { FocusEntityInfo } from "../navigation/FocusEntity";
|
|
|
|
|
import { identifyEntityFromPath } from "../navigation/FocusEntity";
|
2024-08-06 14:52:22 +00:00
|
|
|
import { getQueryEntityItemUrl } from "ee/pages/Editor/IDE/EditorPane/Query/utils";
|
|
|
|
|
import { selectQuerySegmentEditorTabs } from "ee/selectors/appIDESelectors";
|
2022-10-17 15:16:38 +00:00
|
|
|
|
|
|
|
|
export const getQueryPaneConfigSelectedTabIndex = (state: AppState) =>
|
|
|
|
|
state.ui.queryPane.selectedConfigTabIndex;
|
2023-11-28 12:46:43 +00:00
|
|
|
|
2024-02-29 06:23:57 +00:00
|
|
|
export const getQueryPaneDebuggerState = (state: AppState) =>
|
|
|
|
|
state.ui.queryPane.debugger;
|
|
|
|
|
|
2024-01-31 05:07:40 +00:00
|
|
|
export const getQueryRunErrorMessage = (state: AppState, id: string) => {
|
|
|
|
|
const { runErrorMessage } = state.ui.queryPane;
|
|
|
|
|
return runErrorMessage[id];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const getQueryIsRunning = (state: AppState, id: string): boolean => {
|
|
|
|
|
const { isRunning } = state.ui.queryPane;
|
|
|
|
|
return !!isRunning[id];
|
|
|
|
|
};
|
2024-04-19 06:49:24 +00:00
|
|
|
|
|
|
|
|
export const getLastQueryTab = (
|
|
|
|
|
state: AppState,
|
|
|
|
|
): FocusEntityInfo | undefined => {
|
|
|
|
|
const tabs = selectQuerySegmentEditorTabs(state);
|
|
|
|
|
const pageId = getCurrentPageId(state);
|
|
|
|
|
if (tabs.length) {
|
|
|
|
|
const url = getQueryEntityItemUrl(tabs[tabs.length - 1], pageId);
|
|
|
|
|
const urlWithoutQueryParams = url.split("?")[0];
|
|
|
|
|
return identifyEntityFromPath(urlWithoutQueryParams);
|
|
|
|
|
}
|
|
|
|
|
};
|