triggers panel: fix undefined username in acknowledges #393
This commit is contained in:
@@ -243,16 +243,7 @@ export class TriggerPanelCtrl extends PanelCtrl {
|
||||
});
|
||||
|
||||
if (event) {
|
||||
trigger.acknowledges = _.map(event.acknowledges, ack => {
|
||||
let timestamp = moment.unix(ack.clock);
|
||||
if (this.panel.customLastChangeFormat) {
|
||||
ack.time = timestamp.format(this.panel.lastChangeFormat);
|
||||
} else {
|
||||
ack.time = timestamp.format(this.defaultTimeFormat);
|
||||
}
|
||||
ack.user = ack.alias + ' (' + ack.name + ' ' + ack.surname + ')';
|
||||
return ack;
|
||||
});
|
||||
trigger.acknowledges = _.map(event.acknowledges, this.formatAcknowledge.bind(this));
|
||||
}
|
||||
|
||||
if (!trigger.lastEvent.eventid) {
|
||||
@@ -264,6 +255,21 @@ export class TriggerPanelCtrl extends PanelCtrl {
|
||||
});
|
||||
}
|
||||
|
||||
formatAcknowledge(ack) {
|
||||
let timestamp = moment.unix(ack.clock);
|
||||
if (this.panel.customLastChangeFormat) {
|
||||
ack.time = timestamp.format(this.panel.lastChangeFormat);
|
||||
} else {
|
||||
ack.time = timestamp.format(this.defaultTimeFormat);
|
||||
}
|
||||
ack.user = ack.alias || '';
|
||||
if (ack.name || ack.surname) {
|
||||
const fullName = `${ack.name || ''} ${ack.surname || ''}`;
|
||||
ack.user += ` (${fullName})`;
|
||||
}
|
||||
return ack;
|
||||
}
|
||||
|
||||
filterTriggersPre(triggerList, ds) {
|
||||
// Filter triggers by description
|
||||
let triggerFilter = this.panel.targets[ds].trigger.filter;
|
||||
|
||||
Reference in New Issue
Block a user