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

This commit is contained in:
Torkel Ödegaard
2016-03-23 16:37:58 +01:00
parent b06d809364
commit 5dfac9a765
8 changed files with 41 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
<navbar icon="icon-gf icon-gf-apps" title="{{ctrl.appModel.name}}" title-url="{{ctrl.appModel.defaultNavUrl}}">
<navbar icon-url="{{ctrl.appLogoUrl}}" title="{{ctrl.appModel.name}}" title-url="{{ctrl.appModel.defaultNavUrl}}">
</navbar>
<div class="page-container" >

View File

@@ -3,18 +3,32 @@
import angular from 'angular';
import _ from 'lodash';
var pluginInfoCache = {};
export class AppPageCtrl {
page: any;
pluginId: any;
appModel: any;
appLogoUrl: any;
/** @ngInject */
constructor(private backendSrv, private $routeParams: any, private $rootScope) {
this.pluginId = $routeParams.pluginId;
if (pluginInfoCache[this.pluginId]) {
this.appModel = pluginInfoCache[this.pluginId];
} else {
this.loadPluginInfo();
}
}
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', '']);