|
@@ -5,6 +5,7 @@ import _ from 'lodash';
|
|
|
|
|
|
|
|
export class PluginEditCtrl {
|
|
export class PluginEditCtrl {
|
|
|
model: any;
|
|
model: any;
|
|
|
|
|
+ pluginIcon: string;
|
|
|
pluginId: any;
|
|
pluginId: any;
|
|
|
includedPanels: any;
|
|
includedPanels: any;
|
|
|
includedDatasources: any;
|
|
includedDatasources: any;
|
|
@@ -22,9 +23,22 @@ export class PluginEditCtrl {
|
|
|
this.model = result;
|
|
this.model = result;
|
|
|
this.includedPanels = _.where(result.includes, {type: 'panel'});
|
|
this.includedPanels = _.where(result.includes, {type: 'panel'});
|
|
|
this.includedDatasources = _.where(result.includes, {type: 'datasource'});
|
|
this.includedDatasources = _.where(result.includes, {type: 'datasource'});
|
|
|
|
|
+ this.pluginIcon = this.getPluginIcon(this.model.type);
|
|
|
|
|
+
|
|
|
|
|
+ this.model.dependencies.plugins.forEach(plug => {
|
|
|
|
|
+ plug.icon = this.getPluginIcon(plug.type);
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ getPluginIcon(type) {
|
|
|
|
|
+ switch (type) {
|
|
|
|
|
+ case 'datasource': return 'icon-gf icon-gf-datasources';
|
|
|
|
|
+ case 'panel': return 'icon-gf icon-gf-panel';
|
|
|
|
|
+ case 'app': return 'icon-gf icon-gf-apps';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
update() {
|
|
update() {
|
|
|
var chain = Promise.resolve();
|
|
var chain = Promise.resolve();
|
|
|
var self = this;
|
|
var self = this;
|
|
@@ -53,7 +67,7 @@ export class PluginEditCtrl {
|
|
|
|
|
|
|
|
// if set, performt he postUpdate hook. If a promise is returned it will block
|
|
// if set, performt he postUpdate hook. If a promise is returned it will block
|
|
|
// the final step of the update procedure (reloading the page) until the promise
|
|
// the final step of the update procedure (reloading the page) until the promise
|
|
|
- // resolves. If the promise is rejected the page will not be reloaded.
|
|
|
|
|
|
|
+ // resolves. If the promise is rejected the page will not be reloaded.
|
|
|
if (this.postUpdateHook != null) {
|
|
if (this.postUpdateHook != null) {
|
|
|
chain = chain.then(function() {
|
|
chain = chain.then(function() {
|
|
|
return Promise.resolve(this.postUpdateHook());
|
|
return Promise.resolve(this.postUpdateHook());
|