diff --git a/app/client/src/ce/sagas/JSActionSagas.ts b/app/client/src/ce/sagas/JSActionSagas.ts index 33d450319c..01c2ec2286 100644 --- a/app/client/src/ce/sagas/JSActionSagas.ts +++ b/app/client/src/ce/sagas/JSActionSagas.ts @@ -70,6 +70,8 @@ import { getWidgets } from "sagas/selectors"; import { removeFocusHistoryRequest } from "actions/focusHistoryActions"; import { getIsEditorPaneSegmentsEnabled } from "@appsmith/selectors/featureFlagsSelectors"; import { handleJSEntityRedirect } from "sagas/IDESaga"; +import { getIDETypeByUrl } from "@appsmith/entities/IDE/utils"; +import { IDE_TYPE } from "@appsmith/entities/IDE/constants"; export function* fetchJSCollectionsSaga( action: EvaluationReduxAction, @@ -281,22 +283,23 @@ export function* deleteJSCollectionSaga( ) { try { const id = actionPayload.payload.id; + const currentUrl = window.location.pathname; const pageId: string = yield select(getCurrentPageId); const response: ApiResponse = yield JSActionAPI.deleteJSCollection(id); const isValidResponse: boolean = yield validateResponse(response); + const ideType = getIDETypeByUrl(currentUrl); if (isValidResponse) { // @ts-expect-error: response.data is of type unknown toast.show(createMessage(JS_ACTION_DELETE_SUCCESS, response.data.name), { kind: "success", }); - const currentUrl = window.location.pathname; const isEditorPaneSegmentsEnabled: boolean = yield select( getIsEditorPaneSegmentsEnabled, ); - if (isEditorPaneSegmentsEnabled) { + if (isEditorPaneSegmentsEnabled && ideType === IDE_TYPE.App) { yield call(handleJSEntityRedirect, id); - } else if (pageId) { + } else { history.push(builderURL({ pageId })); } yield put(removeFocusHistoryRequest(currentUrl)); diff --git a/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx b/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx index 6ecfa5056d..19d02fa9ed 100644 --- a/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx +++ b/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx @@ -334,3 +334,21 @@ export function AppsmithAIIcon() { export function ActionUrlIcon(url: string) { return ; } + +export function ModuleIcon( + height = 18, + width = 18, + noBackground = false, + noBorder = false, +) { + return ( + + + + ); +} diff --git a/app/client/src/sagas/ActionSagas.ts b/app/client/src/sagas/ActionSagas.ts index 17bc3799f8..e9abe6ac4f 100644 --- a/app/client/src/sagas/ActionSagas.ts +++ b/app/client/src/sagas/ActionSagas.ts @@ -137,6 +137,8 @@ import { removeFocusHistoryRequest } from "../actions/focusHistoryActions"; import { getIsEditorPaneSegmentsEnabled } from "@appsmith/selectors/featureFlagsSelectors"; import { resolveParentEntityMetadata } from "@appsmith/sagas/helpers"; import { handleQueryEntityRedirect } from "./IDESaga"; +import { IDE_TYPE } from "@appsmith/entities/IDE/constants"; +import { getIDETypeByUrl } from "@appsmith/entities/IDE/utils"; export const DEFAULT_PREFIX = { QUERY: "Query", @@ -575,7 +577,9 @@ export function* deleteActionSaga( try { const id = actionPayload.payload.id; const name = actionPayload.payload.name; + const currentUrl = window.location.pathname; const action: Action | undefined = yield select(getAction, id); + const ideType = getIDETypeByUrl(currentUrl); if (!action) return; @@ -610,12 +614,11 @@ export function* deleteActionSaga( queryName: name, }); } - const currentUrl = window.location.pathname; const isEditorPaneSegmentsEnabled: boolean = yield select( getIsEditorPaneSegmentsEnabled, ); - if (isEditorPaneSegmentsEnabled) { + if (isEditorPaneSegmentsEnabled && ideType === IDE_TYPE.App) { yield call(handleQueryEntityRedirect, action.id); } else { if (!!actionPayload.payload.onSuccess) { diff --git a/app/client/src/sagas/IDESaga.tsx b/app/client/src/sagas/IDESaga.tsx index 80e88aa742..56afe727d5 100644 --- a/app/client/src/sagas/IDESaga.tsx +++ b/app/client/src/sagas/IDESaga.tsx @@ -19,12 +19,18 @@ import log from "loglevel"; export function* updateIDETabsOnRouteChangeSaga(entityInfo: FocusEntityInfo) { const { entity, id } = entityInfo; - if (entity === FocusEntity.JS_OBJECT) { + if ( + entity === FocusEntity.JS_OBJECT || + entity === FocusEntity.JS_MODULE_INSTANCE + ) { const jsTabs: string[] = yield select(getJSTabs); const newTabs: string[] = yield call(getUpdatedTabs, id, jsTabs); yield put(setJSTabs(newTabs)); } - if (entity === FocusEntity.QUERY) { + if ( + entity === FocusEntity.QUERY || + entity === FocusEntity.QUERY_MODULE_INSTANCE + ) { const queryTabs: string[] = yield select(getQueryTabs); const newTabs: string[] = yield call(getUpdatedTabs, id, queryTabs); yield put(setQueryTabs(newTabs)); @@ -46,12 +52,12 @@ export function* handleJSEntityRedirect(deletedId: string) { const redirectAction = getNextEntityAfterDelete(deletedId, allJsItems); switch (redirectAction.action) { case RedirectAction.CREATE: - history.push(jsCollectionAddURL({})); + history.push(jsCollectionAddURL({ pageId })); break; case RedirectAction.ITEM: if (!redirectAction.payload) { log.error("Redirect item does not have a payload"); - history.push(jsCollectionAddURL({})); + history.push(jsCollectionAddURL({ pageId })); break; } const { payload } = redirectAction; @@ -66,11 +72,11 @@ export function* handleQueryEntityRedirect(deletedId: string) { const redirectAction = getNextEntityAfterDelete(deletedId, allQueryItems); switch (redirectAction.action) { case RedirectAction.CREATE: - history.push(queryAddURL({})); + history.push(queryAddURL({ pageId })); break; case RedirectAction.ITEM: if (!redirectAction.payload) { - history.push(queryAddURL({})); + history.push(queryAddURL({ pageId })); log.error("Redirect item does not have a payload"); break; }