Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions main/web/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,20 @@ <h3>Warning</h3>
<span flex></span>
<a class="md-button md-raised" ng-href="{{ embedLink }}" target="_blank">Embed link</a>
</div>
<div ng-show="screenState() != 'loading' && screenState() != 'error' && queryResult.name === 'select'">
<h3 class="md-title">Scalars</h3>
<md-list>
<md-list-item class="md-line-1" ng-repeat="row in queryResult.body">
<div ng-if="row.scalars">
<md-list>
<md-list-item class="md-line-1" ng-repeat="scalar in row.scalars">
{{ scalar.tagset }} {{ scalar.value }}
</md-list-item>
</md-list>
</div>
</md-list-item>
</md-list>
</div>
<div ng-show="screenState() != 'loading' && screenState() != 'error' && queryResult.name === 'select' && !queryResultIsEmpty()">
<google-chart class="metric-chart" data="selectResult" option="selectOptions" chart-type="inputModel.renderType"></google-chart>
</div>
Expand Down
14 changes: 9 additions & 5 deletions main/web/static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ module.controller("CommonController", function (
return false;
}
for (var i = 0; i < result.body.length; i++) {
if (result.body[i].series.length === 0) {
if (_.isArray(result.body[i].series) && result.body[i].series.length === 0) {
if (result.body.length == 1) {
$scope.queryEmptyMessage = "the query resulted in 0 series";
} else {
Expand Down Expand Up @@ -735,13 +735,11 @@ function convertProfileResponse(object) {
function convertSelectResponse(object) {
if (!(object && object.name == "select" &&
object.body &&
object.body.length &&
object.body[0].series &&
object.body[0].series.length &&
object.body[0].timerange)) {
object.body.length)) {
// invalid data.
return null;
}

var seriesOptions = {};
var series = [];
var labels = ["Time"];
Expand All @@ -750,6 +748,12 @@ function convertSelectResponse(object) {
for (var i = 0; i < object.body.length; i++) {
// Each of these is a list of series
var serieslist = object.body[i];

// sometimes select queries return only scalars
if(!serieslist.series) {
continue;
}

for (var j = 0; j < serieslist.series.length; j++) {
if (series.length < MAX_RENDERED) {
var s = object.body[i].series[j];
Expand Down