From 35c853e9062097254623aeea3166fb1b8eadc462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 23 Mar 2016 16:43:32 +0100 Subject: [PATCH] feat(plugins): fix for plugin logo to navbar on plugin page, #4452 --- .../app/features/plugins/plugin_page_ctrl.ts | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/public/app/features/plugins/plugin_page_ctrl.ts b/public/app/features/plugins/plugin_page_ctrl.ts index c21cb4fdad7..298587ec0d9 100644 --- a/public/app/features/plugins/plugin_page_ctrl.ts +++ b/public/app/features/plugins/plugin_page_ctrl.ts @@ -16,23 +16,27 @@ export class AppPageCtrl { this.pluginId = $routeParams.pluginId; if (pluginInfoCache[this.pluginId]) { - this.appModel = pluginInfoCache[this.pluginId]; + this.initPage(pluginInfoCache[this.pluginId]); } else { this.loadPluginInfo(); } } + initPage(app) { + this.appModel = app; + this.page = _.findWhere(app.includes, {slug: this.$routeParams.slug}); + this.appLogoUrl = app.info.logos.small; + + pluginInfoCache[this.pluginId] = app; + + if (!this.page) { + this.$rootScope.appEvent('alert-error', ['App Page Not Found', '']); + } + } + loadPluginInfo() { this.backendSrv.get(`/api/plugins/${this.pluginId}/settings`).then(app => { - this.appModel = app; - this.page = _.findWhere(app.includes, {slug: this.$routeParams.slug}); - this.appLogoUrl = app.info.logos.small; - - pluginInfoCache[this.pluginId] = app; - - if (!this.page) { - this.$rootScope.appEvent('alert-error', ['App Page Not Found', '']); - } + this.initPage(app); }); } }