Merge pull request #2638 from kravets-levko/bug/dashboard-not-rendering-empty-query

Dashboard stops rendering when adding widget with empty query
This commit is contained in:
Arik Fraimovich 2018-07-02 12:07:42 +03:00 committed by GitHub
commit 140d0ae14f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 27 deletions

View File

@ -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;
@ -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' },

View File

@ -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';