mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
table: minor table options improvement
This commit is contained in:
parent
ede827f5c0
commit
c17b5d1306
@ -17,9 +17,17 @@
|
|||||||
<span>{{column.text}}</span>
|
<span>{{column.text}}</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="gf-form">
|
<div class="gf-form" ng-show="editor.canSetColumns">
|
||||||
<metric-segment segment="editor.addColumnSegment" get-options="editor.getColumnOptions()" on-change="editor.addColumn()"></metric-segment>
|
<metric-segment segment="editor.addColumnSegment" get-options="editor.getColumnOptions()" on-change="editor.addColumn()"></metric-segment>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="gf-form" ng-hide="editor.canSetColumns">
|
||||||
|
<label class="gf-form-label">
|
||||||
|
Auto
|
||||||
|
<info-popover mode="right-normal" ng-if="editor.columnsHelpMessage">
|
||||||
|
{{editor.columnsHelpMessage}}
|
||||||
|
</info-popover>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ export class TablePanelEditorCtrl {
|
|||||||
fontSizes: any;
|
fontSizes: any;
|
||||||
addColumnSegment: any;
|
addColumnSegment: any;
|
||||||
getColumnNames: any;
|
getColumnNames: any;
|
||||||
|
canSetColumns: boolean;
|
||||||
|
columnsHelpMessage: string;
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
constructor($scope, private $q, private uiSegmentSrv) {
|
constructor($scope, private $q, private uiSegmentSrv) {
|
||||||
@ -24,8 +26,27 @@ export class TablePanelEditorCtrl {
|
|||||||
this.panel = this.panelCtrl.panel;
|
this.panel = this.panelCtrl.panel;
|
||||||
this.transformers = transformers;
|
this.transformers = transformers;
|
||||||
this.fontSizes = ['80%', '90%', '100%', '110%', '120%', '130%', '150%', '160%', '180%', '200%', '220%', '250%'];
|
this.fontSizes = ['80%', '90%', '100%', '110%', '120%', '130%', '150%', '160%', '180%', '200%', '220%', '250%'];
|
||||||
|
|
||||||
this.addColumnSegment = uiSegmentSrv.newPlusButton();
|
this.addColumnSegment = uiSegmentSrv.newPlusButton();
|
||||||
|
this.updateTransformHints();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateTransformHints() {
|
||||||
|
this.canSetColumns = false;
|
||||||
|
this.columnsHelpMessage = '';
|
||||||
|
|
||||||
|
switch (this.panel.transform) {
|
||||||
|
case "timeseries_aggregations": {
|
||||||
|
this.canSetColumns = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "json": {
|
||||||
|
this.canSetColumns = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "table": {
|
||||||
|
this.columnsHelpMessage = "Columns and their order are determined by the data query";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getColumnOptions() {
|
getColumnOptions() {
|
||||||
@ -57,6 +78,7 @@ export class TablePanelEditorCtrl {
|
|||||||
this.panel.columns.push({text: 'Avg', value: 'avg'});
|
this.panel.columns.push({text: 'Avg', value: 'avg'});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.updateTransformHints();
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user