Skip to content

feat: open app in tab or slim-window #16152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions site/src/modules/resources/AppLink/AppLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
}

event.preventDefault();

// This is an external URI like "vscode://", so
// it needs to be opened with the browser protocol handler.
if (app.external && !app.url.startsWith("http")) {
// If the protocol is external the browser does not
// redirect the user from the page.
const shouldOpenAppExternally =
app.external && !app.url.startsWith("http");

if (shouldOpenAppExternally) {
// This is a magic undocumented string that is replaced
// with a brand-new session token from the backend.
// This only exists for external URLs, and should only
Expand All @@ -149,12 +150,22 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
setFetchingSessionToken(false);
}
window.location.href = url;
} else {
window.open(
href,
Language.appTitle(appDisplayName, generateRandomString(12)),
"width=900,height=600",
);
return;
}

switch (app.open_in) {
case "slim-window": {
window.open(
href,
Language.appTitle(appDisplayName, generateRandomString(12)),
"width=900,height=600",
);
return;
}
default: {
window.open(href);
return;
}
}
}}
>
Expand Down
Loading