Add Platform.Fabric to run in context of Fabric

This commit is contained in:
Sevo Kukol 2023-09-12 13:21:01 +02:00
parent 12ed591634
commit 14a8072551
3 changed files with 9 additions and 0 deletions

View File

@ -16,6 +16,7 @@ export enum Platform {
Portal = "Portal", Portal = "Portal",
Hosted = "Hosted", Hosted = "Hosted",
Emulator = "Emulator", Emulator = "Emulator",
Fabric = "Fabric",
} }
export interface ConfigContext { export interface ConfigContext {
@ -187,6 +188,7 @@ export async function initializeConfiguration(): Promise<ConfigContext> {
console.error(`Invalid platform query parameter: ${platform}`); console.error(`Invalid platform query parameter: ${platform}`);
break; break;
case Platform.Portal: case Platform.Portal:
case Platform.Fabric:
case Platform.Hosted: case Platform.Hosted:
case Platform.Emulator: case Platform.Emulator:
updateConfigContext({ platform }); updateConfigContext({ platform });

View File

@ -5,6 +5,9 @@ export const getDataExplorerWindow = (currentWindow: Window): Window | undefined
if (currentWindow.parent === currentWindow) { if (currentWindow.parent === currentWindow) {
return undefined; return undefined;
} }
if (currentWindow.parent.parent === currentWindow.top) { // Fabric
return currentWindow;
}
if (currentWindow.parent === currentWindow.top) { if (currentWindow.parent === currentWindow.top) {
return currentWindow; return currentWindow;
} }

View File

@ -60,6 +60,10 @@ export function useKnockoutExplorer(platform: Platform): Explorer {
} else if (platform === Platform.Portal) { } else if (platform === Platform.Portal) {
const explorer = await configurePortal(); const explorer = await configurePortal();
setExplorer(explorer); setExplorer(explorer);
} else if (platform === Platform.Fabric) {
//TODO: need Fabric specific implementation similar to portal
const explorer = await configureHosted();
setExplorer(explorer);
} }
} }
}; };