From e068804a9e4844283322105d5be0987bca9ba924 Mon Sep 17 00:00:00 2001 From: Giuseppe Guerra Date: Tue, 27 Feb 2024 15:14:23 +0100 Subject: [PATCH] Plugins: Angular deprecation: Fix AngularDeprecationNotice not being rendered on first page load (#83221) * Plugins: Angular deprecation: Wait for plugins to be inizialized before rendering AngularDeprecationNotice * use then * fix tests * mockCleanUpDashboardAndVariables.mockReset(); * Handle plugin not found * PR review feedback * Add comment * removed unnecessary return * PR review feedback * Use grafanaBootData * Removed comments * fix tests * Use config for hideDeprecation as well --- public/app/features/dashboard/state/DashboardModel.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/app/features/dashboard/state/DashboardModel.ts b/public/app/features/dashboard/state/DashboardModel.ts index 9179f772ee0..f0afaba7660 100644 --- a/public/app/features/dashboard/state/DashboardModel.ts +++ b/public/app/features/dashboard/state/DashboardModel.ts @@ -1338,7 +1338,9 @@ export class DashboardModel implements TimeModel { hasAngularPlugins(): boolean { return this.panels.some((panel) => { // Return false for plugins that are angular but have angular.hideDeprecation = false - const isAngularPanel = panel.isAngularPlugin() && !panel.plugin?.meta.angular?.hideDeprecation; + // We cannot use panel.plugin.isAngularPlugin() because panel.plugin may not be initialized at this stage. + const isAngularPanel = + config.panels[panel.type]?.angular?.detected && !config.panels[panel.type]?.angular?.hideDeprecation; let isAngularDs = false; if (panel.datasource?.uid) { isAngularDs = isAngularDatasourcePluginAndNotHidden(panel.datasource?.uid);