Source
* Update app state according with configuration. Either update individual chart item schedulers or re-fetch
<?php
/*
** 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/>.
**/
?>
<script>
const view = {
_app: null,
_filter_form: null,
_data: null,
_resize_observer: null,
_container: null,
_filter_tags: new Map(),
_filter_tagnames: new Set(),
init({filter_form_name, data, timeline}) {
this._filter_form = document.querySelector(`[name="${filter_form_name}"]`);
this._container = document.querySelector('main');
this._data = data;
this.initSubfilter();
this.initCharts();
timeControl.addObject('charts_view', timeline, {
id: 'timeline_1',
domid: 'charts_view',
loadSBox: 0,
loadImage: 0,
dynamic: 0
});
timeControl.processObjects();
},
initSubfilter() {
for (const element of this._filter_form.querySelectorAll('.js-subfilter-unset')) {
this.setSubfilter(element.dataset.tag, element.dataset.value || null);
}
this._filter_form.addEventListener('click', (e) => {
const link = e.target;
if (link.classList.contains('js-subfilter-set')) {
this.setSubfilter(link.getAttribute('data-tag'), link.getAttribute('data-value'));
this.submitSubfilter();
}
else if (link.classList.contains('js-subfilter-unset')) {
this.unsetSubfilter(link.getAttribute('data-tag'), link.getAttribute('data-value'));
this.submitSubfilter();
}
});