mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-22 18:32:00 +00:00
Restore open collection tabs: Query, Documents, Settings (#2004)
* Persist query multiple query texts * Save multiple query tab histories * Save and restore states for QueryTab and DocumentsTab for SQL and Mongo * Enable Collection Scale/Settings restore * Persist documents tab current filter * Fix DocumentsTab conflict resolve mistake * Remove unused variable * Fix e2e test * Fix e2e localStorage reference * Try clearing local storage via playwright page * Clear local storage after opening page * Move restore flag behind feature flag. Whitelist restorable tabs in for Fabric. Restore e2e tests. * Fix typo * Fix: avoid setting undefined for preferredSize for the <Allotment.Pane> * Add comments * Move restore tabs after knockout configure step from Explorer constructor (which could be called multiple times)
This commit is contained in:
@@ -7,6 +7,11 @@ import Explorer from "Explorer/Explorer";
|
||||
import { useDataPlaneRbac } from "Explorer/Panes/SettingsPane/SettingsPane";
|
||||
import { useSelectedNode } from "Explorer/useSelectedNode";
|
||||
import { scheduleRefreshDatabaseResourceToken } from "Platform/Fabric/FabricUtil";
|
||||
import {
|
||||
AppStateComponentNames,
|
||||
OPEN_TABS_SUBCOMPONENT_NAME,
|
||||
readSubComponentState,
|
||||
} from "Shared/AppStatePersistenceUtility";
|
||||
import { LocalStorageUtility, StorageKey } from "Shared/StorageUtility";
|
||||
import { useNewPortalBackendEndpoint } from "Utils/EndpointUtils";
|
||||
import { getNetworkSettingsWarningMessage } from "Utils/NetworkUtility";
|
||||
@@ -80,6 +85,11 @@ export function useKnockoutExplorer(platform: Platform): Explorer {
|
||||
await updateContextForCopilot(explorer);
|
||||
await updateContextForSampleData(explorer);
|
||||
}
|
||||
|
||||
if (userContext.features.restoreTabs) {
|
||||
restoreOpenTabs();
|
||||
}
|
||||
|
||||
setExplorer(explorer);
|
||||
}
|
||||
};
|
||||
@@ -816,3 +826,17 @@ async function updateContextForSampleData(explorer: Explorer): Promise<void> {
|
||||
interface SampledataconnectionResponse {
|
||||
connectionString: string;
|
||||
}
|
||||
|
||||
const restoreOpenTabs = () => {
|
||||
const openTabsState = readSubComponentState<(DataExplorerAction | undefined)[]>(
|
||||
AppStateComponentNames.DataExplorerAction,
|
||||
OPEN_TABS_SUBCOMPONENT_NAME,
|
||||
undefined,
|
||||
[],
|
||||
);
|
||||
openTabsState.forEach((openTabState) => {
|
||||
if (openTabState) {
|
||||
handleOpenAction(openTabState, useDatabases.getState().databases, this);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user