Commit 3191678b by Torkel Ödegaard

feat(plugins): work on plugins that include dashboards

parent 091726b3
......@@ -8,8 +8,13 @@ class DashboardScriptLoader {
}
export class DashImportListCtrl {
dashboards: any[];
plugin: any;
constructor(private $http) {
console.log('importList', this);
this.dashboards = this.plugin.includes.filter(val => val.type === 'dashboard');
}
load(json) {
......@@ -18,17 +23,22 @@ export class DashImportListCtrl {
}
import() {
var url = 'public/app/plugins/datasource/graphite/dashboards/carbon_stats.json';
this.$http.get(url).then(res => {
this.load(res.data);
});
// this.$http.get(url).then(res => {
// this.load(res.data);
// });
}
}
var template = `
<h3 class="page-heading">Dashboards</h3>
<div class="gf-form-group">
<button class="btn btn-mini btn-inverse" ng-click="ctrl.import(dash)">Import</button>
<div class="gf-form-group" ng-if="ctrl.dashboards.length">
<h3 class="page-heading">Dashboards</h3>
<div class="gf-form" ng-repeat="dash in ctrl.dashboards">
<label class="gf-form-label">
<i class="icon-gf icon-gf-dashboard"></i>
</label>
<label class="gf-form-label width-20">{{dash.name}}</label>
<button class="btn btn-inverse gf-form-btn" ng-click="ctrl.import(dash)">Import</button>
</div>
</div>
`;
......
......@@ -18,7 +18,13 @@ function (angular, _, config) {
module.controller('DataSourceEditCtrl', function($scope, $q, backendSrv, $routeParams, $location, datasourceSrv) {
var defaults = {name: '', type: 'graphite', url: '', access: 'proxy', jsonData: {}};
var defaults = {
name: '',
type: 'graphite',
url: '',
access: 'proxy',
jsonData: {}
};
$scope.init = function() {
$scope.isNew = true;
......
......@@ -36,6 +36,8 @@ icon="icon-gf icon-gf-datasources">
<rebuild-on-change property="datasourceMeta.id">
<plugin-component type="datasource-config-ctrl">
</plugin-component>
<dashboard-import-list plugin="datasourceMeta"></dashboard-import-list>
</rebuild-on-change>
<div ng-if="testing" style="margin-top: 25px">
......@@ -47,8 +49,6 @@ icon="icon-gf icon-gf-datasources">
</div>
</div>
<!-- <dashboard&#45;import&#45;list plugin="current"></dashboard&#45;import&#45;list> -->
<div class="gf-form-button-row">
<button type="submit" class="btn btn-success" ng-show="isNew" ng-click="saveChanges()">Add</button>
<button type="submit" class="btn btn-success" ng-show="!isNew" ng-click="saveChanges()">Save</button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment