Source
xxxxxxxxxx
/*
** 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 Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/*
* The base class of all dashboard widgets. Depending on widget needs, it can be instantiated directly or be extended.
*/
class CWidget extends CWidgetBase {
/**
* Define initial state of the widget.
*
* Invoked on widget instantiation. No HTML or data manipulation must be done at this step.
*
* Possible widget state: WIDGET_STATE_INITIAL.
*/
onInitialize() {
}
/**
* Prepare widget for the first activation.
*
* An HTML structure can be created, but no data manipulation must be done at this step.
*
* Invoked once, before the first activation of the dashboard page.
*
* Possible widget state: WIDGET_STATE_INITIAL.
*/
onStart() {
}
/**
* Make the widget live! Activate custom event listeners.
*
* Widget update is requested automatically by invoking "promiseUpdate" method immediately and periodically later on
* until the widget is deactivated again (the dashboard page is switched away to display another dashboard page).
*
* Invoked on each activation of the dashboard page.
*
* Possible widget state: WIDGET_STATE_INACTIVE.
*/
onActivate() {
}
/**
* Stop any interactivity of the widget. Deactivate custom event listeners.
*
* Updating of the widget is automatically stopped at this step.
*
* Invoked on each deactivation of the dashboard page.
*
* Possible widget state: WIDGET_STATE_ACTIVE.