PromucFlow_constructor/app/client/src/selectors/queryPaneSelectors.ts

35 lines
1.3 KiB
TypeScript
Raw Normal View History

import type { AppState } from "ee/reducers";
import { getCurrentPageId } from "./editorSelectors";
import type { FocusEntityInfo } from "../navigation/FocusEntity";
import { identifyEntityFromPath } from "../navigation/FocusEntity";
import { getQueryEntityItemUrl } from "ee/pages/Editor/IDE/EditorPane/Query/utils";
import { selectQuerySegmentEditorTabs } from "ee/selectors/appIDESelectors";
export const getQueryPaneConfigSelectedTabIndex = (state: AppState) =>
state.ui.queryPane.selectedConfigTabIndex;
chore: Debugger Split states (#31043) ## Description Creates local states for the debugger for Query Pane, Api Pane and JS Pane and separates it from the main Canvas Debugger state. This is done so that in Split pane, the states of Action Pane debugger can be different from the Canvas Debugger state. To keep handling the Fullscreen Debugger experience, a new hook `useDebuggerTriggerClick` is introduced which opens the correct debugger based on the IDE state. Also removes the Error and Logs from the Query / Api / JS Debuggers when in split screen mode for a cleaner debugging experience ##### This change removes the expectation of having a common debugger state that follows around as the user navigates in the IDE. Instead it create a new debugger state per entity item. The tests have been updated to reflect this #### PR fixes following issue(s) Fixes #30836 Fixes #30342 #### Media #### Type of change - Breaking change (fix or feature that would cause existing functionality to not work as expected) ## Testing #### How Has This Been Tested? - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2024-02-29 06:23:57 +00:00
export const getQueryPaneDebuggerState = (state: AppState) =>
state.ui.queryPane.debugger;
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];
};
feat: revamped logic for tabs removal and action/JS deletion (#32690) ## Description This PR has changed the logic of next item selection after deleting an item or removing a tab. The new logic is 1. If there is no more tabs left after removal of current item, navigate to first item from all items list 2. If all items list is empty, navigate to add 3. If the removed tab is not currently selected, no redirection required just close the tab 4. If removed tab is in 0th position, redirect to current tab + 1 5. if removed tab is not in 0th position, redirect to tab - 1 Fixes #32634 ## Automation /ok-to-test tags="@tag.Sanity, @tag.IDE" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!CAUTION] > 🔴 🔴 🔴 Some tests have failed. > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/8748435770> > Commit: e3e9b51cc9a708fadf4d1b9f0e426b63e9f3c10a > Cypress dashboard: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8748435770&attempt=2&selectiontype=test&testsstatus=failed&specsstatus=fail" target="_blank"> Click here!</a> > The following are new failures, please fix them before merging the PR: <ol> > <li>cypress/e2e/Regression/ClientSide/ExplorerTests/Hide_Page_spec.js > <li>cypress/e2e/Regression/ClientSide/ExplorerTests/Page_Load_Spec.js </ol> > To know the list of identified flaky tests - <a href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master" target="_blank">Refer here</a> <!-- end of auto-generated comment: Cypress test results --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved the closing functionality for JavaScript and query action tabs in the IDE, enhancing user experience with smoother tab management. - **Refactor** - Aligned sagas and reducers with new action types for improved handling of tab closures and entity redirects within the IDE. - **Tests** - Updated test cases to reflect changes in IDE saga functions and logic, ensuring reliability and consistency in behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
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);
}
};