Commit 26ea0bc3 by Torkel Ödegaard

feat(export): work on export

parent 6632f883
...@@ -22,6 +22,7 @@ function (angular, $, _, moment) { ...@@ -22,6 +22,7 @@ function (angular, $, _, moment) {
this.id = data.id || null; this.id = data.id || null;
this.title = data.title || 'No Title'; this.title = data.title || 'No Title';
this.description = data.description;
this.tags = data.tags || []; this.tags = data.tags || [];
this.style = data.style || "dark"; this.style = data.style || "dark";
this.timezone = data.timezone || ''; this.timezone = data.timezone || '';
......
...@@ -26,9 +26,11 @@ export class DashboardExporter { ...@@ -26,9 +26,11 @@ export class DashboardExporter {
_.each(row.panels, (panel) => { _.each(row.panels, (panel) => {
if (panel.datasource !== undefined) { if (panel.datasource !== undefined) {
promises.push(this.datasourceSrv.get(panel.datasource).then(ds => { promises.push(this.datasourceSrv.get(panel.datasource).then(ds => {
var refName = 'DS_' + ds.name.toUpperCase(); var refName = 'DS_' + ds.name.replace(' ', '_').toUpperCase();
datasources[panel.datasource] = { datasources[panel.datasource] = {
name: refName, name: refName,
label: ds.name,
description: '',
type: 'datasource', type: 'datasource',
pluginId: ds.meta.id, pluginId: ds.meta.id,
pluginName: ds.meta.name, pluginName: ds.meta.name,
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<div ng-repeat="input in ctrl.inputs"> <div ng-repeat="input in ctrl.inputs">
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-label width-15">{{input.name}}</label> <label class="gf-form-label width-15">{{input.label}}</label>
<div class="gf-form-select-wrapper" style="width: 100%"> <div class="gf-form-select-wrapper" style="width: 100%">
<select class="gf-form-input" ng-model="input.value" ng-options="v.value as v.text for v in input.options" ng-change="ctrl.inputValueChanged()"></select> <select class="gf-form-input" ng-model="input.value" ng-options="v.value as v.text for v in input.options" ng-change="ctrl.inputValueChanged()"></select>
</div> </div>
......
...@@ -31,6 +31,8 @@ export class DashImportCtrl { ...@@ -31,6 +31,8 @@ export class DashImportCtrl {
for (let input of this.dash.__inputs) { for (let input of this.dash.__inputs) {
var inputModel = { var inputModel = {
name: input.name, name: input.name,
label: input.label,
description: input.description,
type: input.type, type: input.type,
pluginId: input.pluginId, pluginId: input.pluginId,
options: [] options: []
...@@ -55,6 +57,8 @@ export class DashImportCtrl { ...@@ -55,6 +57,8 @@ export class DashImportCtrl {
if (sources.length === 0) { if (sources.length === 0) {
inputModel.error = "No data sources of type " + input.pluginName + " found"; inputModel.error = "No data sources of type " + input.pluginName + " found";
} else if (inputModel.description) {
inputModel.info = inputModel.description;
} else { } else {
inputModel.info = "Select a " + input.pluginName + " data source"; inputModel.info = "Select a " + input.pluginName + " data source";
} }
......
...@@ -23,7 +23,11 @@ ...@@ -23,7 +23,11 @@
<h5 class="section-heading">Details</h5> <h5 class="section-heading">Details</h5>
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-label width-7">Title</label> <label class="gf-form-label width-7">Title</label>
<input type="text" class="gf-form-input width-25" ng-model='dashboard.title'></input> <input type="text" class="gf-form-input width-30" ng-model='dashboard.title'></input>
</div>
<div class="gf-form">
<label class="gf-form-label width-7">Description</label>
<input type="text" class="gf-form-input width-30" ng-model='dashboard.description'></input>
</div> </div>
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-label width-7"> <label class="gf-form-label width-7">
......
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