diff --git a/examples/panel-boilerplate-es5/module.js b/examples/panel-boilerplate-es5/module.js
index b991ad72f76..0e14c883923 100644
--- a/examples/panel-boilerplate-es5/module.js
+++ b/examples/panel-boilerplate-es5/module.js
@@ -1,28 +1,52 @@
define([
- 'app/plugins/sdk'
-], function(sdk) {
+ 'app/plugins/sdk',
+ 'lodash'
+], function(sdk, _) {
- var BoilerPlatePanel = (function(_super) {
+ var BoilerPlatePanelCtrl = (function(_super) {
+ var self;
- function BoilerPlatePanel($scope, $injector) {
+ function BoilerPlatePanelCtrl($scope, $injector) {
_super.call(this, $scope, $injector);
+
+ this.results = []
+
+ self = this;
}
// you do not need a templateUrl, you can use a inline template here
- // BoilerPlatePanel.template = '
boilerplate
';
+ // BoilerPlatePanelCtrl.template = 'boilerplate
';
// all panel static assets can be accessed via 'public/plugins//
- BoilerPlatePanel.templateUrl = 'panel.html';
+ BoilerPlatePanelCtrl.templateUrl = 'panel.html';
- BoilerPlatePanel.prototype = Object.create(_super.prototype);
- BoilerPlatePanel.prototype.constructor = BoilerPlatePanel;
+ BoilerPlatePanelCtrl.prototype = Object.create(_super.prototype);
+ BoilerPlatePanelCtrl.prototype.constructor = BoilerPlatePanelCtrl;
- return BoilerPlatePanel;
+ BoilerPlatePanelCtrl.prototype.refreshData = function(datasource) {
+ this.issueQueries(datasource)
+ .then(function(result) {
+ self.results = [];
+ _.each(result.data, function(target) {
+ var last = _.last(target.datapoints)
+ self.results.push(last[0]);
+ });
- })(sdk.PanelCtrl);
+ self.render();
+ });
+ }
+
+ BoilerPlatePanelCtrl.prototype.render = function() {
+ this.values = this.results.join(',');
+ }
+
+ return BoilerPlatePanelCtrl;
+
+ })(sdk.MetricsPanelCtrl);
return {
- PanelCtrl: BoilerPlatePanel
+ PanelCtrl: BoilerPlatePanelCtrl
};
});
+
diff --git a/examples/panel-boilerplate-es5/panel.html b/examples/panel-boilerplate-es5/panel.html
index 5d3e44c756a..59d4cbe6d9d 100644
--- a/examples/panel-boilerplate-es5/panel.html
+++ b/examples/panel-boilerplate-es5/panel.html
@@ -1,4 +1,7 @@
- Boilerplate panel
+ Basic panel
+{{ctrl.values}}
+
+