mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-21 18:01:39 +00:00
Close quick start tab when user types \q in PSQL shell
This commit is contained in:
@@ -32,7 +32,7 @@ export const QuickstartTab: React.FC<QuickstartTabProps> = ({ explorer }: Quicks
|
|||||||
<NotebookTerminalComponent
|
<NotebookTerminalComponent
|
||||||
notebookServerInfo={getNotebookServerInfo()}
|
notebookServerInfo={getNotebookServerInfo()}
|
||||||
databaseAccount={userContext.databaseAccount}
|
databaseAccount={userContext.databaseAccount}
|
||||||
tabId="EmbbedTerminal"
|
tabId="QuickstartPSQLShell"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!notebookServerInfo?.notebookServerEndpoint && (
|
{!notebookServerInfo?.notebookServerEndpoint && (
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useTabs } from "hooks/useTabs";
|
import { ReactTabKind, useTabs } from "hooks/useTabs";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { applyExplorerBindings } from "../applyExplorerBindings";
|
import { applyExplorerBindings } from "../applyExplorerBindings";
|
||||||
import { AuthType } from "../AuthType";
|
import { AuthType } from "../AuthType";
|
||||||
@@ -100,7 +100,11 @@ async function configureHosted(): Promise<Explorer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.data?.type === MessageTypes.CloseTab) {
|
if (event.data?.type === MessageTypes.CloseTab) {
|
||||||
useTabs.getState().closeTabsByComparator((tab) => tab.tabId === event.data?.data?.tabId);
|
if (event.data?.data?.tabId === "QuickstartPSQLShell") {
|
||||||
|
useTabs.getState().closeReactTab(ReactTabKind.Quickstart);
|
||||||
|
} else {
|
||||||
|
useTabs.getState().closeTabsByComparator((tab) => tab.tabId === event.data?.data?.tabId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
@@ -290,7 +294,11 @@ async function configurePortal(): Promise<Explorer> {
|
|||||||
} else if (shouldForwardMessage(message, event.origin)) {
|
} else if (shouldForwardMessage(message, event.origin)) {
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
} else if (event.data?.type === MessageTypes.CloseTab) {
|
} else if (event.data?.type === MessageTypes.CloseTab) {
|
||||||
useTabs.getState().closeTabsByComparator((tab) => tab.tabId === event.data?.data?.tabId);
|
if (event.data?.data?.tabId === "QuickstartPSQLShell") {
|
||||||
|
useTabs.getState().closeReactTab(ReactTabKind.Quickstart);
|
||||||
|
} else {
|
||||||
|
useTabs.getState().closeTabsByComparator((tab) => tab.tabId === event.data?.data?.tabId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
|
|||||||
Reference in New Issue
Block a user