From 4a41324356415aa4eb766a5f284385ec63079d3f Mon Sep 17 00:00:00 2001 From: Ashit Rath Date: Fri, 23 May 2025 14:41:27 +0530 Subject: [PATCH] chore: Module editor Remove page tab from navigate to action selector (#40743) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Screenshot 2025-05-23 at 11 32 51 AM Fixes https://github.com/appsmithorg/appsmith/issues/40741 ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 76b7112333792f4612b5ef6e4524552c99fe88a8 > Cypress dashboard. > Tags: `@tag.All` > Spec: >
Fri, 23 May 2025 07:28:05 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Enhanced the "Navigate To" section to adjust available tabs and default selection based on the IDE type, offering a tailored experience for UIPackage IDE users. - **Improvements** - Improved loading state handling by considering additional action sources, resulting in more accurate widget loading indicators. --- .../src/ce/selectors/modulesSelector.ts | 3 +++ .../ActionCreator/FieldGroup/index.tsx | 24 +++++++++++++++---- app/client/src/sagas/WidgetLoadingSaga.ts | 7 +++++- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/app/client/src/ce/selectors/modulesSelector.ts b/app/client/src/ce/selectors/modulesSelector.ts index 359d327ad5..82ad037603 100644 --- a/app/client/src/ce/selectors/modulesSelector.ts +++ b/app/client/src/ce/selectors/modulesSelector.ts @@ -16,3 +16,6 @@ export const showUIModulesList = (state: DefaultRootState) => false; export const getActionsInCurrentModule = (state: DefaultRootState) => []; export const getJSCollectionsInCurrentModule = (state: DefaultRootState) => []; + +export const getModuleInstanceActions = (state: DefaultRootState) => []; +export const getModuleInstanceJSCollections = (state: DefaultRootState) => []; diff --git a/app/client/src/components/editorComponents/ActionCreator/FieldGroup/index.tsx b/app/client/src/components/editorComponents/ActionCreator/FieldGroup/index.tsx index eadd5fc1d6..b2a2a1157e 100644 --- a/app/client/src/components/editorComponents/ActionCreator/FieldGroup/index.tsx +++ b/app/client/src/components/editorComponents/ActionCreator/FieldGroup/index.tsx @@ -5,10 +5,15 @@ import { getCodeFromMoustache, isValueValidURL } from "../utils"; import { getFieldFromValue } from "../helpers"; import { useSelector } from "react-redux"; import { getDataTreeForActionCreator } from "sagas/selectors"; +import { useLocation } from "react-router"; +import { getIDETypeByUrl } from "ee/entities/IDE/utils"; +import { IDE_TYPE } from "ee/IDE/Interfaces/IDETypes"; function FieldGroup(props: FieldGroupProps) { const { isChainedAction = false, ...otherProps } = props; const dataTree = useSelector(getDataTreeForActionCreator); + const location = useLocation(); + const ideType = getIDETypeByUrl(location.pathname); const NAVIGATE_TO_TAB_SWITCHER: Array = [ { @@ -42,9 +47,18 @@ function FieldGroup(props: FieldGroupProps) { }, ]; - const [activeTabNavigateTo, setActiveTabNavigateTo] = useState( - NAVIGATE_TO_TAB_SWITCHER[isValueValidURL(props.value) ? 1 : 0], - ); + const defaultNavigateToTab = + ideType === IDE_TYPE.UIPackage + ? NAVIGATE_TO_TAB_SWITCHER[1] + : NAVIGATE_TO_TAB_SWITCHER[isValueValidURL(props.value) ? 1 : 0]; + + const navigateToSwitches = + ideType === IDE_TYPE.UIPackage + ? [NAVIGATE_TO_TAB_SWITCHER[1]] + : NAVIGATE_TO_TAB_SWITCHER; + + const [activeTabNavigateTo, setActiveTabNavigateTo] = + useState(defaultNavigateToTab); const [activeTabApiAndQueryCallback, setActiveTabApiAndQueryCallback] = useState(apiAndQueryCallbackTabSwitches[0]); @@ -69,7 +83,7 @@ function FieldGroup(props: FieldGroupProps) { activeNavigateToTab: activeTabNavigateTo, activeTabApiAndQueryCallback: activeTabApiAndQueryCallback, apiAndQueryCallbackTabSwitches: apiAndQueryCallbackTabSwitches, - navigateToSwitches: NAVIGATE_TO_TAB_SWITCHER, + navigateToSwitches, })}
    @@ -119,7 +133,7 @@ function FieldGroup(props: FieldGroupProps) { activeTabApiAndQueryCallback: activeTabApiAndQueryCallback, apiAndQueryCallbackTabSwitches: apiAndQueryCallbackTabSwitches, - navigateToSwitches: NAVIGATE_TO_TAB_SWITCHER, + navigateToSwitches, })} ); diff --git a/app/client/src/sagas/WidgetLoadingSaga.ts b/app/client/src/sagas/WidgetLoadingSaga.ts index 2470208259..921089aa9f 100644 --- a/app/client/src/sagas/WidgetLoadingSaga.ts +++ b/app/client/src/sagas/WidgetLoadingSaga.ts @@ -18,6 +18,7 @@ import { import log from "loglevel"; import { appsmithTelemetry } from "instrumentation"; import { findLoadingEntities } from "utils/WidgetLoadingStateUtils"; +import { getModuleInstanceActions } from "ee/selectors/modulesSelector"; const actionExecutionRequestActions = [ ReduxActionTypes.EXECUTE_PLUGIN_ACTION_REQUEST, @@ -48,7 +49,11 @@ function* setWidgetsLoadingSaga(action: ReduxAction) { yield take(ReduxActionTypes.SET_EVALUATED_TREE); } - const actions: ActionDataState = yield select(getActions); + const entityActions: ActionDataState = yield select(getActions); + const moduleInstanceActions: ActionDataState = yield select( + getModuleInstanceActions, + ); + const actions = [...entityActions, ...moduleInstanceActions]; const isLoadingActions: string[] = actions .filter((action: ActionData) => action.isLoading) .map((action: ActionData) => action.config.name);