Skip to content

Commit c14b769

Browse files
committed
fix(FR-1778): Modified to open the terminal when the ‘Launch Terminal App’ button is clicked in the session detail panel (#4803)
resolves #4801 (FR-1778) In this PR, I updated to conditionally skip `_openTerminalGuideDialog()` **Checklist:** (if applicable) - [ ] Documentation - [ ] Minium required manager version - [ ] Specific setting for review (eg., KB link, endpoint or how to setup) - [ ] Minimum requirements to check during review - [ ] Test case(s) to demonstrate the difference of before/after
1 parent 6656d71 commit c14b769

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

react/src/hooks/useBackendAIAppLauncher.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1+
import { useWebUINavigate } from '.';
12
import { useSetBAINotification } from './useBAINotification';
23
import { BAILink } from 'backend.ai-ui';
34
import { useTranslation } from 'react-i18next';
45
import { graphql, useFragment } from 'react-relay';
5-
import { useNavigate } from 'react-router-dom';
66
import { useBackendAIAppLauncherFragment$key } from 'src/__generated__/useBackendAIAppLauncherFragment.graphql';
77

88
export const useBackendAIAppLauncher = (
99
sessionFrgmt?: useBackendAIAppLauncherFragment$key | null,
1010
) => {
1111
const { t } = useTranslation();
1212
const { upsertNotification } = useSetBAINotification();
13-
const navigate = useNavigate();
13+
const webuiNavigate = useWebUINavigate();
1414

1515
// TODO: migrate backend-ai-app-launcher features to this hook using fragment data.
1616
const session = useFragment(
@@ -41,7 +41,7 @@ export const useBackendAIAppLauncher = (
4141
onClick={() => {
4242
const newSearchParams = new URLSearchParams(location.search);
4343
newSearchParams.set('sessionDetail', session?.row_id || '');
44-
navigate({
44+
webuiNavigate({
4545
pathname: `/session`,
4646
search: newSearchParams.toString(),
4747
});
@@ -56,7 +56,7 @@ export const useBackendAIAppLauncher = (
5656
}),
5757
});
5858
// @ts-ignore
59-
globalThis.appLauncher.runTerminal(session.row_id);
59+
globalThis.appLauncher.runTerminal(session?.row_id ?? '');
6060
},
6161
// TODO: implement below function
6262
// showLauncher: (params: {

src/components/backend-ai-app-launcher.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,11 @@ export default class BackendAiAppLauncher extends BackendAIPage {
15241524
*/
15251525
async runTerminal(sessionUuid: string) {
15261526
const isVisible = localStorage.getItem('backendaiwebui.terminalguide');
1527-
if (!isVisible || isVisible === 'true') {
1527+
if (
1528+
(!globalThis.backendaiclient.supports('copy-on-terminal') &&
1529+
!isVisible) ||
1530+
isVisible === 'true'
1531+
) {
15281532
this._openTerminalGuideDialog();
15291533
return;
15301534
}

0 commit comments

Comments
 (0)