chore: navigate to applications page with workspace context on click of All Apps icon or logo (#41298)
## Description Made changes to ensure that workspace id is also added to the /applications url when clicking on All Apps icon or logo from editor page. Fixes #`41296` ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/18468233571> > Commit: 73d0192dfaf32c350335a2fb6d57d2ad81c65413 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=18468233571&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Mon, 13 Oct 2025 15:26:00 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Navigation to Applications is now workspace-aware: the Back to Apps button (App Viewer) and the Appsmith link (Editor) route to the Applications page scoped to the selected workspace when present. * Ctrl/Cmd-click opens the workspace-scoped Applications page in a new tab. * Navigation updates dynamically when the current workspace changes. * Behavior for anonymous users remains unchanged. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
de2bcae0d5
commit
7711058ce3
|
|
@ -14,6 +14,8 @@ import { getCurrentUser } from "selectors/usersSelectors";
|
|||
import type { User } from "constants/userConstants";
|
||||
import { ANONYMOUS_USERNAME } from "constants/userConstants";
|
||||
import { Icon, Tooltip } from "@appsmith/ads";
|
||||
import { getCurrentWorkspaceId } from "ee/selectors/selectedWorkspaceSelectors";
|
||||
import { APPLICATIONS_URL } from "constants/routes";
|
||||
|
||||
interface BackToAppsButtonProps {
|
||||
currentApplicationDetails?: ApplicationPayload;
|
||||
|
|
@ -44,11 +46,20 @@ const BackToAppsButton = (props: BackToAppsButtonProps) => {
|
|||
);
|
||||
const history = useHistory();
|
||||
const currentUser: User | undefined = useSelector(getCurrentUser);
|
||||
const currentWorkspaceId = useSelector(getCurrentWorkspaceId);
|
||||
|
||||
if (currentUser?.username === ANONYMOUS_USERNAME) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const handleNavigation = () => {
|
||||
const applicationsUrl = currentWorkspaceId
|
||||
? `${APPLICATIONS_URL}?workspaceId=${currentWorkspaceId}`
|
||||
: APPLICATIONS_URL;
|
||||
|
||||
history.push(applicationsUrl);
|
||||
};
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
content={createMessage(ALL_APPS)}
|
||||
|
|
@ -69,9 +80,7 @@ const BackToAppsButton = (props: BackToAppsButtonProps) => {
|
|||
insideSidebar={insideSidebar}
|
||||
isMinimal={isMinimal}
|
||||
navColorStyle={navColorStyle}
|
||||
onClick={() => {
|
||||
history.push("/applications");
|
||||
}}
|
||||
onClick={handleNavigation}
|
||||
primaryColor={primaryColor}
|
||||
text={insideSidebar && !isMinimal && createMessage(ALL_APPS)}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import AppsmithLogo from "assets/images/appsmith_logo_square.png";
|
|||
import history from "utils/history";
|
||||
import { useSelector } from "react-redux";
|
||||
import { getOrganizationConfig } from "ee/selectors/organizationSelectors";
|
||||
import { getCurrentWorkspaceId } from "ee/selectors/selectedWorkspaceSelectors";
|
||||
|
||||
export const StyledLink = styled((props) => {
|
||||
// we are removing non input related props before passing them in the components
|
||||
|
|
@ -27,18 +28,23 @@ export const StyledLink = styled((props) => {
|
|||
|
||||
export const AppsmithLink = () => {
|
||||
const organizationConfig = useSelector(getOrganizationConfig);
|
||||
const currentWorkspaceId = useSelector(getCurrentWorkspaceId);
|
||||
|
||||
const handleOnClick = useCallback(
|
||||
(e: React.MouseEvent<HTMLAnchorElement>) => {
|
||||
e.stopPropagation();
|
||||
|
||||
const applicationsUrl = currentWorkspaceId
|
||||
? `${APPLICATIONS_URL}?workspaceId=${currentWorkspaceId}`
|
||||
: APPLICATIONS_URL;
|
||||
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
window.open(APPLICATIONS_URL, "_blank");
|
||||
window.open(applicationsUrl, "_blank");
|
||||
} else {
|
||||
history.push(APPLICATIONS_URL);
|
||||
history.push(applicationsUrl);
|
||||
}
|
||||
},
|
||||
[],
|
||||
[currentWorkspaceId],
|
||||
);
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user