Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard stops rendering when adding widget with empty query #2638

Merged
merged 1 commit into from
Jul 2, 2018
Merged
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
56 changes: 30 additions & 26 deletions client/app/services/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,6 @@ function collectParams(parts) {
return parameters;
}

class QueryResultError {
constructor(errorMessage) {
this.errorMessage = errorMessage;
}

getError() {
return this.errorMessage;
}

static getStatus() {
return 'failed';
}

static getData() {
return null;
}

static getLog() {
return null;
}

static getChartData() {
return null;
}
}

class Parameter {
constructor(parameter) {
this.title = parameter.title;
Expand Down Expand Up @@ -170,6 +144,36 @@ class Parameters {
}

function QueryResource($resource, $http, $q, $location, currentUser, QueryResult) {
class QueryResultError {
constructor(errorMessage) {
this.errorMessage = errorMessage;
}

getError() {
return this.errorMessage;
}

toPromise() {
return $q.reject(this.getError());
}

static getStatus() {
return 'failed';
}

static getData() {
return null;
}

static getLog() {
return null;
}

static getChartData() {
return null;
}
}

const Query = $resource(
'api/queries/:id',
{ id: '@id' },
Expand Down
2 changes: 1 addition & 1 deletion client/app/visualizations/chart/plotly/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
isArray, isNumber, isString, isUndefined, includes, min, max, has, find,
each, values, sortBy, identity, filter, map, extend, reduce,
each, values, sortBy, identity, filter, map, extend, reduce,
} from 'lodash';
import moment from 'moment';
import { createFormatter, formatSimpleTemplate } from '@/lib/value-format';
Expand Down