From c824975a164922e7dc5b8695d9d72d1305b34787 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Fri, 6 Sep 2024 16:26:05 -0700 Subject: [PATCH] Add support for rigister plugin during the absence of local cluster Signed-off-by: Ryan Liang --- public/plugin.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/plugin.tsx b/public/plugin.tsx index 5c56bc5f7..4dabd09b6 100644 --- a/public/plugin.tsx +++ b/public/plugin.tsx @@ -169,6 +169,7 @@ export class ObservabilityPlugin constructor(initializerContext: PluginInitializerContext) { this.config = initializerContext.config.get(); } + private mdsFlagStatus: boolean = false; public setup( core: CoreSetup, @@ -184,6 +185,7 @@ export class ObservabilityPlugin }); setupOverviewPage(setupDeps.contentManagement!); + this.mdsFlagStatus = !!setupDeps.dataSource; // redirect legacy notebooks URL to current URL under observability if (window.location.pathname.includes('notebooks-dashboards')) { @@ -459,7 +461,8 @@ export class ObservabilityPlugin return `${type.charAt(0).toUpperCase()}${type.slice(1)}`; }; - // register all s3 datasources + // register all s3 datasources only if mds feature flag is disabled + if (!this.mdsFlagStatus) { const registerDataSources = () => { try { core.http.get(`${DATACONNECTIONS_BASE}`).then((s3DataSources) => { @@ -509,6 +512,7 @@ export class ObservabilityPlugin } else { registerDataSources(); } + } core.http.intercept({ request: catalogRequestIntercept(),