Преглед изворни кода

feat(export): work on export

Torkel Ödegaard пре 9 година
родитељ
комит
26ea0bc360

+ 1 - 0
public/app/features/dashboard/dashboardSrv.js

@@ -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 || '';

+ 3 - 1
public/app/features/dashboard/export/exporter.ts

@@ -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,

+ 1 - 1
public/app/features/dashboard/import/import.html

@@ -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>

+ 4 - 0
public/app/features/dashboard/import/import.ts

@@ -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 {
 
 
     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";
     }
     }

+ 6 - 2
public/app/features/dashboard/partials/settings.html

@@ -23,9 +23,13 @@
       <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>
-			<div class="gf-form">
+      <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 class="gf-form">
 				<label class="gf-form-label width-7">
 				<label class="gf-form-label width-7">
           Tags
           Tags
           <info-popover mode="right-normal">Press enter to a add tag</info-popover>
           <info-popover mode="right-normal">Press enter to a add tag</info-popover>