Source
/*
** Zabbix
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/**
* In case if user has set incredibly long notification timeout - they would end up never seeing them, because JS
* would execute scheduled timeout immediately. So limit the upper bound.
*/
ZBX_Notification.max_timeout = Math.pow(2, 30);
/**
* Represents notification object.
*
* @param {object} raw A server or LS format of this notification.
*/
function ZBX_Notification(raw) {
/*
* These are pseudo that properties will cycle back into store, to be reused when rendering next time.
* If `received_at` property has not been set it is first render. This property might be updated to a new client
* time when it's raw state changes from unresolved into resolved.
*/
this._raw = {
snoozed: false,
received_at: raw.received_at || (+new Date / 1000)
};
this.updateRaw(raw);
this.node = this.makeNode();
}
/**
* @return {string}
*/
ZBX_Notification.prototype.getId = function() {
return this._raw.eventid;
};
/**
* @return {object}
*/
ZBX_Notification.prototype.getRaw = function() {
return this._raw;
};
/**
* Merge another raw object into current. If resolution state changes into resolved during this merge, then