Permalink
Browse files

feat(dao): expose the event label and locations (HELM-13)

  • Loading branch information...
j-white committed Aug 29, 2017
1 parent 0ea573f commit 3395039e9c5f81c399bee90acb304ac2a82e3dc3
View
@@ -321,6 +321,7 @@ export class AlarmDAO extends AbstractDAO<number, OnmsAlarm> {
alarm.description = data.description;
alarm.firstEventTime = this.toDate(data.firstEventTime);
alarm.lastEvent = this.eventDao.fromData(data.lastEvent);
alarm.location = data.location;
alarm.logMessage = data.logMessage;
alarm.reductionKey = data.reductionKey;
alarm.troubleTicket = data.troubleTicket;
View
@@ -71,6 +71,8 @@ export class EventDAO extends AbstractDAO<number, OnmsEvent> {
event.id = this.toNumber(data.id);
event.uei = data.uei;
event.label = data.label;
event.location = data.location;
event.nodeId = this.toNumber(data.nodeId);
event.nodeLabel = data.nodeLabel;
event.ipAddress = Util.toIPAddress(data.ipAddress);
View
@@ -46,6 +46,9 @@ export class OnmsAlarm {
/** the alarm's log message */
public logMessage: string;
/** which location the alarm originated from */
public location: string;
/** the alarm's reduction key */
public reductionKey: string;
View
@@ -15,6 +15,12 @@ export class OnmsEvent {
/** the UEI of this event */
public uei: string;
/** the label of this event as defined in the event configuration */
public label: string;
/** which location the event originated from */
public location: string;
/** the node's ID associated with this event */
public nodeId: number;
@@ -162,6 +162,10 @@ describe('AlarmDAO with v2 API', () => {
it('AlarmDAO.get(6806)', () => {
return dao.get(6806).then((alarm) => {
expect(alarm.id).toEqual(6806);
// Spot check some of the known properties
expect(alarm.location).toEqual('Default');
expect(alarm.lastEvent.label).toEqual('OpenNMS-defined node event: nodeDown');
expect(alarm.lastEvent.location).toEqual('Default');
});
});
it('AlarmDAO.find(id=6806)', () => {
@@ -22,9 +22,12 @@
"description": "<p>All interfaces on node wan4 are\n down.</p> <p>This event is generated when node\n outage processing determines that all interfaces on the node\n are down.</p> <p>New outage records have been\n created and service level availability calculations will be\n impacted until this outage is resolved.</p>",
"logMessage": "\n Node wan4 is down. \n ",
"log": "Y",
"display": "Y"
"display": "Y",
"label": "OpenNMS-defined node event: nodeDown",
"location": "Default"
},
"lastEventTime": 1498062027050,
"location": "Default",
"managedObjectInstance": null,
"managedObjectType": null,
"ossPrimaryKey": null,

0 comments on commit 3395039

Please sign in to comment.