mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-03-06 18:07:11 +00:00
Dynamically close Home tab for Mirrored databases in Fabric rather than conditional init (which doesn't work for Native)
This commit is contained in:
parent
87155c4822
commit
8f75f47416
@ -146,6 +146,8 @@ async function configureFabric(): Promise<Explorer> {
|
|||||||
explorer = createExplorerFabric(data.message);
|
explorer = createExplorerFabric(data.message);
|
||||||
|
|
||||||
if (data.message.artifactType === CosmosDbArtifactType.MIRRORED) {
|
if (data.message.artifactType === CosmosDbArtifactType.MIRRORED) {
|
||||||
|
// Do not show Home tab for Mirrored
|
||||||
|
useTabs.getState().closeReactTab(ReactTabKind.Home);
|
||||||
await scheduleRefreshDatabaseResourceToken(true);
|
await scheduleRefreshDatabaseResourceToken(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { clamp } from "@fluentui/react";
|
import { clamp } from "@fluentui/react";
|
||||||
import { Platform } from "ConfigContext";
|
|
||||||
import { OpenTab } from "Contracts/ActionContracts";
|
import { OpenTab } from "Contracts/ActionContracts";
|
||||||
import { useSelectedNode } from "Explorer/useSelectedNode";
|
import { useSelectedNode } from "Explorer/useSelectedNode";
|
||||||
import { isFabricMirrored } from "Platform/Fabric/FabricUtil";
|
import { isFabricMirrored } from "Platform/Fabric/FabricUtil";
|
||||||
@ -52,22 +51,11 @@ export enum ReactTabKind {
|
|||||||
QueryCopilot,
|
QueryCopilot,
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK: using this const when the configuration context is not initialized yet.
|
|
||||||
// Since Fabric is always setting the url param, use that instead of the regular config.
|
|
||||||
const isPlatformFabric = (() => {
|
|
||||||
const params = new URLSearchParams(window.location.search);
|
|
||||||
if (params.has("platform")) {
|
|
||||||
const platform = params.get("platform");
|
|
||||||
return platform === Platform.Fabric;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
})();
|
|
||||||
|
|
||||||
export const useTabs: UseStore<TabsState> = create((set, get) => ({
|
export const useTabs: UseStore<TabsState> = create((set, get) => ({
|
||||||
openedTabs: [],
|
openedTabs: [] as TabsBase[],
|
||||||
openedReactTabs: !isPlatformFabric ? [ReactTabKind.Home] : [],
|
openedReactTabs: [ReactTabKind.Home],
|
||||||
activeTab: undefined,
|
activeTab: undefined,
|
||||||
activeReactTab: !isPlatformFabric ? ReactTabKind.Home : undefined,
|
activeReactTab: ReactTabKind.Home,
|
||||||
queryCopilotTabInitialInput: "",
|
queryCopilotTabInitialInput: "",
|
||||||
isTabExecuting: false,
|
isTabExecuting: false,
|
||||||
isQueryErrorThrown: false,
|
isQueryErrorThrown: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user