Skip to content
Permalink
Browse files

feat(alarms): HELM-114: alarm property for whether it is a situation

  • Loading branch information...
RangerRick committed Dec 3, 2018
1 parent 940f11c commit a54b6270566c282b57c42a3f88d662a373ebe44c
Showing with 8 additions and 0 deletions.
  1. +5 −0 src/model/OnmsAlarm.ts
  2. +3 −0 test/dao/AlarmDAO.spec.ts
@@ -116,6 +116,11 @@ export class OnmsAlarm implements IHasUrlValue {
/** link to the alarm details page on the source instance */
public detailsPage: string;

/** whether the alarm is a situation */
public get isSituation() {
return this.relatedAlarms && this.relatedAlarms.length > 0;
}

public get urlValue() {
return String(this.id);
}
@@ -167,6 +167,7 @@ describe('AlarmDAO with v2 API', () => {
expect(alarm.id).toEqual(6806);
// Spot check some of the known properties
expect(alarm.location).toEqual('Default');
expect(alarm.isSituation).not.toBeTruthy();
expect(alarm.lastEvent.label).toEqual('OpenNMS-defined node event: nodeDown');
expect(alarm.lastEvent.location).toEqual('Default');
expect(alarm.detailsPage).toEqual('http://demo.opennms.org/opennms/alarm/detail.htm?id=6806');
@@ -293,6 +294,7 @@ describe('AlarmDAO with AlarmSummaryDTO', () => {
return dao.find(filter).then((alarms) => {
expect(alarms.length).toEqual(4);
expect(alarms[0].id).toEqual(8);
expect(alarms[0].isSituation).toBeTruthy();
expect(alarms[0].relatedAlarms.length).toEqual(3);
expect(alarms[0].relatedAlarms[0].id).toEqual(5);
expect(alarms[0].relatedAlarms[0].type).toEqual(2);
@@ -321,6 +323,7 @@ describe('Extended Situation tests', () => {
return dao.find(filter).then((alarms) => {
expect(alarms.length).toEqual(1);
expect(alarms[0].id).toEqual(243);
expect(alarms[0].isSituation).toBeTruthy();
expect(alarms[0].relatedAlarms.length).toEqual(3);
expect(alarms[0].affectedNodeCount).toEqual(1);
});

0 comments on commit a54b627

Please sign in to comment.
You can’t perform that action at this time.