mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-04-23 01:53:46 +01:00
* Add Platform.Fabric to run in context of Fabric * Use separate StyleConstants We want to have more flexibility with Styles at runtime but Constants depend on ConfigContext and therefore get loaded very early at startup. * Add Fabric specific styles and Fluent theme documentDBFabric.less contains all styles for Fabric. We use React.lazy to import them conditionally at runtime preventing webpack from preprocessing them into main.css. * Restyle CommandBar for Fabric with more roundness and native colors. * Disable Notebooks when running in Fabric * Disable Synapse and Scripts commands for Fabric * Fix code formatting issues * Fetch encrypted token from sessionStorage for fabric platform * Fix Tabs style * Dark refresh icons for Fabric * Use new ResourceTree2 for Fabric * Fluent tree should have a fixed width otherwise the action buttons jump around on hover. * Disable remaining Script actions in Fabric * Revert accidentally committed change which broke a test * Fix cross-origin error second try * Adjust @FabrixBoxMargin css * Hide Database Scale node on Fabric * Remove all Collection child nodes on Fabric * Add a comment about why we need FabricPlatform.tsx * Fix equality checks * Fix more Colors for Fabric * Switch resource tree to "medium" size * Fix formatting again * Fix formatting again * Disable no-var-requires error on some intended var import. * Increase memory limit for build * Use standard Segoe UI font for Fabric * Improve Tabs design for Fabric * Fix active Tab style bug in Portal introduced with 39a7765aef807de5c1e7c82b094765072a10924c --------- Co-authored-by: Laurent Nguyen <laurent.nguyen@microsoft.com>
25 lines
1010 B
TypeScript
25 lines
1010 B
TypeScript
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 (configContext.platform === Platform.Fabric && 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;
|
|
};
|