Source
* @param bool options['isWriteable'] Whether user has read and write access to host and its items.
/*
** 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.
**/
/**
* Get menu popup history section data.
*
* @param string options['itemid'] Item ID.
* @param bool options['hasLatestGraphs'] Link to history page with showgraph action (optional).
*
* @return array
*/
function getMenuPopupHistory(options) {
var items = [],
url = new Curl('history.php', false);
if (!options.allowed_ui_latest_data) {
return [];
}
url.setArgument('itemids[]', options.itemid);
// latest graphs
if (typeof options.hasLatestGraphs !== 'undefined' && options.hasLatestGraphs) {
url.setArgument('action', 'showgraph');
url.setArgument('to', 'now');
url.setArgument('from', 'now-1h');
items.push({
label: t('Last hour graph'),
url: url.getUrl()
});
url.setArgument('from', 'now-7d');
items.push({
label: t('Last week graph'),
url: url.getUrl()
});
url.setArgument('from', 'now-1M');
items.push({
label: t('Last month graph'),
url: url.getUrl()
});
}
// latest values