Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/add-text-flipping' into add-text…
Browse files Browse the repository at this point in the history
…-flipping

# Conflicts:
#	dist/css/status_panel.css.map
#	dist/editor.html
#	dist/status_ctrl.js.map
  • Loading branch information
LLIyRiK committed Mar 2, 2017
2 parents 0bee93b + 09638a7 commit 5b6999e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
3 changes: 3 additions & 0 deletions dist/css/status_panel.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions dist/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ <h5 class="section-heading">Thresholds for measurement: {{ measurement.refId }}<
<span class="gf-form-label width-12">
Aggregation
<info-popover mode="right-normal">
What to do if the query returns multiple data points.<br />
<strong>Note:</strong> 'None' will select the first value.
What to do if the query returns multiple data points.
</info-popover>
</span>
<div class="gf-form-select-wrapper max-width-12">
Expand Down
25 changes: 12 additions & 13 deletions dist/status_ctrl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ <h5 class="section-heading">{{ measurement.alias }}</h5>
</div>
<gf-form-switch class="gf-form"
label-class="width-12"

label="Make panel gray when no data" checked="ctrl.panel.isGrayColor"
on-change="ctrl.onRender()"></gf-form-switch>
</div>
Expand Down Expand Up @@ -72,8 +73,7 @@ <h5 class="section-heading">Thresholds for measurement: {{ measurement.refId }}<
<span class="gf-form-label width-12">
Aggregation
<info-popover mode="right-normal">
What to do if the query returns multiple data points.<br />
<strong>Note:</strong> 'None' will select the first value.
What to do if the query returns multiple data points.
</info-popover>
</span>
<div class="gf-form-select-wrapper max-width-12">
Expand Down
19 changes: 12 additions & 7 deletions src/status_ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class StatusPluginCtrl extends MetricsPanelCtrl {
//this.log = $log.debug;
this.filter = $filter;

this.aggregations = ['None', 'Max', 'Min', 'Sum'];
this.aggregations = ['Last', 'First', 'Max', 'Min', 'Sum', 'Avg'];

this.panel.flipTime = this.panel.flipTime || 5;

Expand Down Expand Up @@ -100,17 +100,22 @@ export class StatusPluginCtrl extends MetricsPanelCtrl {

switch (target.aggregation) {
case 'Max':
value = _.max(s.datapoints, (point) => { return point[0]; })[0];
value = s.stats.max;
break;
case 'Min':
value = _.min(s.datapoints, (point) => { return point[0]; })[0];
value = s.stats.min;
break;
case 'Sum':
value = 0;
_.each(s.datapoints, (point) => { value += point[0] });
value = s.stats.total;
break;
default:
case 'Avg':
value = s.stats.avg;
break;
case 'First':
value = s.datapoints[0][0];
break;
default:
value = s.datapoints[s.datapoints.length - 1][0];
}

s.display_value = value;
Expand Down Expand Up @@ -185,7 +190,7 @@ export class StatusPluginCtrl extends MetricsPanelCtrl {
alias: seriesData.target
});

//series.flotpairs = series.getFlotPairs(this.panel.nullPointMode);
series.flotpairs = series.getFlotPairs("connected");

return series;
}
Expand Down

0 comments on commit 5b6999e

Please sign in to comment.