Skip to content

Commit

Permalink
UI improvements (#22)
Browse files Browse the repository at this point in the history
- Improve exporter table look
- Show alert if datasource is not available
- Export only from metric panels #15
  • Loading branch information
rozetko authored Sep 27, 2018
1 parent 39c08c9 commit 1fa0741
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
4 changes: 4 additions & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ class Ctrl extends MetricsPanelCtrl {
let datasourceName = panel.datasource;
let datasource = await this._getDatasourceByName(datasourceName);
let datasourceId = datasource.id;
if(this._datasourceRequest[datasourceId] === undefined) {
appEvents.emit('alert-error', ['Error while exporting from datasource', `Datasource ${datasourceName} is not available`]);
throw new Error(`_datasourceRequest[${datasourceId}] is undefined`);
}
this._datasourceRequest[datasourceId].type = datasource.type;

let formattedUrl = this.templateSrv.replace(this.panel.backendUrl);
Expand Down
31 changes: 5 additions & 26 deletions src/partials/module.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,19 @@
</tr>
</thead>
<tbody>
<tr
class="panel"
ng-repeat-start="panel in ctrl.panels"
ng-if="panel.targets.length > 0"
>
<tr ng-repeat-start="panel in ctrl.panels"></tr>
<tr class="target" ng-repeat-end ng-repeat="target in panel.targets" ng-if="panel.datasource">
<td>
{{ panel.title }}
</td>
<td>-</td>
<td>
{{ panel.datasource }}
</td>
<td>
<button class="btn gf-form-btn btn-primary" type="button" ng-click="ctrl.toggleTargetRows(panel.id)">
<i class="fa fa-chevron-down" ng-if="!ctrl.showRows[panel.id]"></i>
<i class="fa fa-chevron-up" ng-if="ctrl.showRows[panel.id]"></i>
</button>
</td>
</tr>

<tr
class="target"
ng-repeat-end
ng-repeat="target in panel.targets"
ng-if="ctrl.showRows[panel.id]"
>
<td></td>
<td>
<span class="template-variable">
{{ target.refId }}
</span>
: {{ target.measurement }}
</td>
<td></td>
<td>
{{ panel.datasource || '-' }}
</td>
<td>
<button class="btn gf-form-btn btn-primary" type="button" ng-click="ctrl.showExportModal(panel.id, target)">
Export
Expand Down

0 comments on commit 1fa0741

Please sign in to comment.