|
@@ -11,6 +11,8 @@ export class PluginEditCtrl {
|
|
|
readmeHtml: any;
|
|
readmeHtml: any;
|
|
|
includedDatasources: any;
|
|
includedDatasources: any;
|
|
|
tabIndex: number;
|
|
tabIndex: number;
|
|
|
|
|
+ tabs: any;
|
|
|
|
|
+ hasDashboards: any;
|
|
|
preUpdateHook: () => any;
|
|
preUpdateHook: () => any;
|
|
|
postUpdateHook: () => any;
|
|
postUpdateHook: () => any;
|
|
|
|
|
|
|
@@ -19,6 +21,7 @@ export class PluginEditCtrl {
|
|
|
this.model = {};
|
|
this.model = {};
|
|
|
this.pluginId = $routeParams.pluginId;
|
|
this.pluginId = $routeParams.pluginId;
|
|
|
this.tabIndex = 0;
|
|
this.tabIndex = 0;
|
|
|
|
|
+ this.tabs = ['Overview'];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
init() {
|
|
init() {
|
|
@@ -35,6 +38,15 @@ export class PluginEditCtrl {
|
|
|
return plug;
|
|
return plug;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ if (this.model.type === 'app') {
|
|
|
|
|
+ this.tabs.push('Config');
|
|
|
|
|
+
|
|
|
|
|
+ this.hasDashboards = _.findWhere(result.includes, {type: 'dashboard'});
|
|
|
|
|
+ if (this.hasDashboards) {
|
|
|
|
|
+ this.tabs.push('Dashboards');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return this.initReadme();
|
|
return this.initReadme();
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -54,6 +66,7 @@ export class PluginEditCtrl {
|
|
|
case 'panel': return 'icon-gf icon-gf-panel';
|
|
case 'panel': return 'icon-gf icon-gf-panel';
|
|
|
case 'app': return 'icon-gf icon-gf-apps';
|
|
case 'app': return 'icon-gf icon-gf-apps';
|
|
|
case 'page': return 'icon-gf icon-gf-share';
|
|
case 'page': return 'icon-gf icon-gf-share';
|
|
|
|
|
+ case 'dashboard': return 'icon-gf icon-gf-dashboard';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -64,9 +77,7 @@ export class PluginEditCtrl {
|
|
|
// the next step of execution will block until the promise resolves.
|
|
// the next step of execution will block until the promise resolves.
|
|
|
// if the promise is rejected, this update will be aborted.
|
|
// if the promise is rejected, this update will be aborted.
|
|
|
if (this.preUpdateHook != null) {
|
|
if (this.preUpdateHook != null) {
|
|
|
- chain = chain.then(function() {
|
|
|
|
|
- return Promise.resolve(self.preUpdateHook());
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ chain = self.preUpdateHook();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Perform the core update procedure
|
|
// Perform the core update procedure
|
|
@@ -86,7 +97,7 @@ export class PluginEditCtrl {
|
|
|
// 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 this.postUpdateHook();
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -101,17 +112,16 @@ export class PluginEditCtrl {
|
|
|
this.preUpdateHook = callback;
|
|
this.preUpdateHook = callback;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- setPOstUpdateHook(callback: () => any) {
|
|
|
|
|
|
|
+ setPostUpdateHook(callback: () => any) {
|
|
|
this.postUpdateHook = callback;
|
|
this.postUpdateHook = callback;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- toggleEnabled() {
|
|
|
|
|
|
|
+ enable() {
|
|
|
|
|
+ this.model.enabled = true;
|
|
|
|
|
+ this.model.pinned = true;
|
|
|
this.update();
|
|
this.update();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- togglePinned() {
|
|
|
|
|
- this.update();
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
angular.module('grafana.controllers').controller('PluginEditCtrl', PluginEditCtrl);
|
|
angular.module('grafana.controllers').controller('PluginEditCtrl', PluginEditCtrl);
|