feat(plugins): fix for plugin logo to navbar on plugin page, #4452

This commit is contained in:
Torkel Ödegaard
2016-03-23 16:43:32 +01:00
parent 481139772b
commit 35c853e906
+14 -10
View File
@@ -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);
});
}
}