Skip to content

Commit 61b51c0

Browse files
committed
heatmap: refactoring
1 parent 0fd96b9 commit 61b51c0

File tree

2 files changed

+25
-35
lines changed

2 files changed

+25
-35
lines changed

public/app/plugins/panel/heatmap/axes_editor.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ export class AxesEditorCtrl {
88
unitFormats: any;
99
logScales: any;
1010
dataFormats: any;
11-
yBucketOptions: any[];
12-
xBucketOptions: any[];
11+
yBucketModes: any[];
1312

1413
/** @ngInject */
1514
constructor($scope, uiSegmentSrv) {
@@ -31,24 +30,9 @@ export class AxesEditorCtrl {
3130
'Time series Pre-bucketed': 'tsbuckets'
3231
};
3332

34-
this.yBucketOptions = [
35-
{text: '5', value: '5'},
36-
{text: '10', value: '10'},
37-
{text: '20', value: '20'},
38-
{text: '30', value: '30'},
39-
{text: '50', value: '50'},
40-
];
41-
42-
this.xBucketOptions = [
43-
{text: '15', value: '15'},
44-
{text: '20', value: '20'},
45-
{text: '30', value: '30'},
46-
{text: '50', value: '50'},
47-
{text: '1m', value: '1m'},
48-
{text: '5m', value: '5m'},
49-
{text: '10m', value: '10m'},
50-
{text: '20m', value: '20m'},
51-
{text: '1h', value: '1h'},
33+
this.yBucketModes = [
34+
{text: 'Count', value: 'count'},
35+
{text: 'Interval', value: 'interval'},
5236
];
5337
}
5438

public/app/plugins/panel/heatmap/partials/axes_editor.html

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,25 @@
33
<h5 class="section-heading">Y Axis</h5>
44
<div class="gf-form">
55
<label class="gf-form-label width-6">Unit</label>
6-
<div class="gf-form-dropdown-typeahead max-width-15"
6+
<div class="gf-form-dropdown-typeahead max-width-10"
77
ng-model="ctrl.panel.yAxis.format"
88
dropdown-typeahead2="editor.unitFormats"
99
dropdown-typeahead-on-select="editor.setUnitFormat($subItem)">
1010
</div>
1111
</div>
1212
<div class="gf-form">
1313
<label class="gf-form-label width-6">Scale</label>
14-
<div class="gf-form-select-wrapper max-width-15">
14+
<div class="gf-form-select-wrapper max-width-10">
1515
<select class="gf-form-input" ng-model="ctrl.panel.yAxis.logBase" ng-options="v as k for (k, v) in editor.logScales" ng-change="ctrl.refresh()"></select>
1616
</div>
1717
</div>
18-
<div class="gf-form-inline">
19-
<div class="gf-form">
20-
<label class="gf-form-label width-6">Y-Min</label>
21-
<input type="text" class="gf-form-input width-5" placeholder="auto" empty-to-null ng-model="ctrl.panel.yAxis.min" ng-change="ctrl.render()" ng-model-onblur>
22-
</div>
23-
<div class="gf-form">
24-
<label class="gf-form-label">Y-Max</label>
25-
<input type="text" class="gf-form-input width-5" placeholder="auto" empty-to-null ng-model="ctrl.panel.yAxis.max" ng-change="ctrl.render()" ng-model-onblur>
26-
</div>
18+
<div class="gf-form">
19+
<label class="gf-form-label width-6">Y-Min</label>
20+
<input type="text" class="gf-form-input width-10" placeholder="auto" empty-to-null ng-model="ctrl.panel.yAxis.min" ng-change="ctrl.render()" ng-model-onblur>
21+
</div>
22+
<div class="gf-form">
23+
<label class="gf-form-label width-6">Y-Max</label>
24+
<input type="text" class="gf-form-input width-10" placeholder="auto" empty-to-null ng-model="ctrl.panel.yAxis.max" ng-change="ctrl.render()" ng-model-onblur>
2725
</div>
2826
<div class="gf-form">
2927
<label class="gf-form-label width-6">Decimals</label>
@@ -34,10 +32,18 @@ <h5 class="section-heading">Y Axis</h5>
3432
<div ng-show="ctrl.panel.yAxis.logBase === 1">
3533
<div class="gf-form-inline">
3634
<div class="gf-form">
37-
<label class="gf-form-label width-6">Buckets
38-
<info-popover mode="right-normal">Number of buckets for Y axis</info-popover>
39-
</label>
40-
<metric-segment-model css-class="width-10" property="ctrl.panel.yAxis.buckets" options="editor.yBucketOptions" on-change="ctrl.render()" select-mode="true"></metric-segment>
35+
<label class="gf-form-label width-6">Bucket</label>
36+
<div class="gf-form-select-wrapper width-7">
37+
<select class="input-small gf-form-input" ng-model="ctrl.panel.yAxis.bucketMode" ng-options="f.value as f.text for f in editor.yBucketModes" ng-change="ctrl.render()"></select>
38+
</div>
39+
<input type="number"
40+
class="gf-form-input width-5"
41+
placeholder="auto"
42+
ng-model="ctrl.panel.yAxis.bucketCount"
43+
ng-change="ctrl.render()"
44+
ng-model-onblur>
45+
</input>
46+
<info-popover mode="right-normal">Number of buckets for Y axis</info-popover>
4147
</div>
4248
</div>
4349
</div>

0 commit comments

Comments
 (0)