Source
xxxxxxxxxx
if (this._can_edit_dashboards && (this._dashboard.templateid === null || this._dynamic_hostid === null)) {
/*
** Zabbix
** Copyright (C) 2001-2022 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.
**/
const ZBX_WIDGET_VIEW_MODE_NORMAL = 0;
const ZBX_WIDGET_VIEW_MODE_HIDDEN_HEADER = 1;
const WIDGET_STATE_INITIAL = 'initial';
const WIDGET_STATE_ACTIVE = 'active';
const WIDGET_STATE_INACTIVE = 'inactive';
const WIDGET_STATE_DESTROYED = 'destroyed';
const WIDGET_EVENT_EDIT = 'widget-edit';
const WIDGET_EVENT_ACTIONS = 'widget-actions';
const WIDGET_EVENT_ENTER = 'widget-enter';
const WIDGET_EVENT_LEAVE = 'widget-leave';
const WIDGET_EVENT_BEFORE_UPDATE = 'widget-before-update';
const WIDGET_EVENT_AFTER_UPDATE = 'widget-after-update';
const WIDGET_EVENT_COPY = 'widget-copy';
const WIDGET_EVENT_PASTE = 'widget-paste';
const WIDGET_EVENT_DELETE = 'widget-delete';
class CWidget extends CBaseComponent {
constructor({
type,
name,
view_mode,
fields,
configuration,
defaults,
widgetid = null,
pos = null,
is_new,
rf_rate,
dashboard,
dashboard_page,
cell_width,
cell_height,
min_rows,
is_editable,
is_edit_mode,
can_edit_dashboards,
time_period,
dynamic_hostid,
scope_id,
unique_id
}) {
super(document.createElement('div'));
this._type = type;
this._name = name;
this._view_mode = view_mode;
this._fields = fields;
this._configuration = configuration;
this._defaults = defaults;
this._widgetid = widgetid;
this._pos = pos;
this._is_new = is_new;
this._rf_rate = rf_rate;
this._dashboard = {
templateid: dashboard.templateid,
dashboardid: dashboard.dashboardid
};
this._dashboard_page = {
unique_id: dashboard_page.unique_id
};
this._cell_width = cell_width;
this._cell_height = cell_height;
this._min_rows = min_rows;
this._is_editable = is_editable;
this._is_edit_mode = is_edit_mode;