Permalink
Browse files

fix(dao): fix handling of 204s in Grafana - the data is null

  • Loading branch information...
j-white committed Aug 1, 2017
1 parent ee7dbda commit 55028cba0ab6fd879540933fd2436815bcf5a6dd
Showing with 5 additions and 5 deletions.
  1. +2 −2 src/api/OnmsResult.ts
  2. +1 −1 src/dao/AlarmDAO.ts
  3. +1 −1 src/dao/EventDAO.ts
  4. +1 −1 src/dao/NodeDAO.ts
View
@@ -17,8 +17,8 @@ export class OnmsResult<T> {
/** Create a new "No Content" result. */
public static noContent() {
// Use an empty string for the data
return new OnmsResult('', 'No Content', 204);
// Use a null string for the data
return new OnmsResult(null, 'No Content', 204);
}
/** The data, if any. */
View
@@ -80,7 +80,7 @@ export class AlarmDAO extends AbstractDAO<number, OnmsAlarm> {
public getData(result: any): OnmsAlarm[] {
let data = result.data;
if (this.getCount(data) > 0 && data.alarm) {
if (data !== null && this.getCount(data) > 0 && data.alarm) {
data = data.alarm;
} else {
data = [];
View
@@ -41,7 +41,7 @@ export class EventDAO extends AbstractDAO<number, OnmsEvent> {
return this.http.get(this.pathToEventsEndpoint(), opts).then((result) => {
let data = result.data;
if (this.getCount(data) > 0 && data.event) {
if (data !== null && this.getCount(data) > 0 && data.event) {
data = data.event;
} else {
data = [];
View
@@ -63,7 +63,7 @@ export class NodeDAO extends AbstractDAO<number, OnmsNode> {
return this.http.get(this.pathToNodesEndpoint(), opts).then((result) => {
let data = result.data;
if (this.getCount(data) > 0 && data.node) {
if (data !== null && this.getCount(data) > 0 && data.node) {
data = data.node;
} else {
data = [];

0 comments on commit 55028cb

Please sign in to comment.