Source
xxxxxxxxxx
* @param string options['context'] Determines whether the menu is made for host or template item.
/*
** 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/>.
**/
/**
* 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');
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
url.setArgument('action', 'showvalues');
url.setArgument('from', 'now-1h');
items.push({
label: t('Latest values'),
url: url.getUrl()
});
return [{
label: t('History'),
items: items
}];
}
/**
* Get menu popup host section data.
*
* @param {string} options['hostid'] Host ID.
* @param {array} options['scripts'] Host scripts (optional).
* @param {string} options['csrf_token'] CSRF token.
* @param {string} options[]['name'] Script name.
* @param {string} options[]['scriptid'] Script ID.
* @param {string} options[]['confirmation'] Confirmation text.
* @param {bool} options['showGraphs'] Link to Monitoring->Hosts->Graphs page.
* @param {bool} options['showDashboards'] Link to Monitoring->Hosts->Dashboards page.
* @param {bool} options['showWeb'] Link to Monitoring->Hosts->Web page.
* @param {bool} options['showTriggers'] Link to Monitoring->Problems page.
* @param {bool} options['hasGoTo'] "Go to" block in popup.
* @param {array} options['severities'] (optional)
* @param {bool} options['show_suppressed'] (optional)
* @param {array} options['urls'] (optional)
* @param {string} options['url'][]['label']
* @param {string} options['url'][]['url']
* @param {array} options['tags'] (optional)