mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-12 06:00:02 +00:00
* Implement fabric native path * Fix default values to work with current fabric clients * Fix Fabric native mode * Fix unit test * export Fabric context * Dynamically close Home tab for Mirrored databases in Fabric rather than conditional init (which doesn't work for Native) * For Fabric native, don't show "Delete Database" in context menu and reading databases should return the database from the context. * Update to V3 messaging * For data plane operations, skip ARM for Fabric native. Refine the tests for fabric to make the distinction between mirrored key, mirrored AAD and native. Fix FabricUtil to strict compile. * Add support for refreshing access tokens * Buf fix: don't wait for refresh is async * Fix format * Fix strict compile issue --------- Co-authored-by: Laurent Nguyen <languye@microsoft.com>
26 lines
1.0 KiB
TypeScript
26 lines
1.0 KiB
TypeScript
import { isFabric } from "Platform/Fabric/FabricUtil";
|
|
import { Platform, configContext } from "./../ConfigContext";
|
|
|
|
export const getDataExplorerWindow = (currentWindow: Window): Window | undefined => {
|
|
// Data explorer is always loaded in an iframe, so traverse the parents until we hit the top and return the first child window.
|
|
try {
|
|
while (currentWindow) {
|
|
if (currentWindow.parent === currentWindow) {
|
|
return undefined;
|
|
}
|
|
if (isFabric() && currentWindow.parent.parent === currentWindow.top) {
|
|
// in Fabric data explorer is inside an extension iframe, so we have two parent iframes
|
|
return currentWindow;
|
|
}
|
|
if (configContext.platform !== Platform.Fabric && currentWindow.parent === currentWindow.top) {
|
|
return currentWindow;
|
|
}
|
|
currentWindow = currentWindow.parent;
|
|
}
|
|
} catch (error) {
|
|
// Hitting a cross domain error means we are in the portal and the current window is data explorer
|
|
return currentWindow;
|
|
}
|
|
return undefined;
|
|
};
|