Source
<?php declare(strict_types = 0);
/*
** 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/>.
**/
/**
* @var CView $this
*/
?>
<script>
const view = {
init() {
this.initActionButtons();
this.expiresDaysHandler();
},
initActionButtons() {
document.addEventListener('click', (e) => {
if (e.target.classList.contains('js-create-token')) {
this.createToken();
}
else if (e.target.classList.contains('js-edit-token')) {
this.editToken(e.target.dataset.tokenid);
}
else if (e.target.classList.contains('js-massdelete-token')) {
this.massDeleteToken(e.target, Object.keys(chkbxRange.getSelectedIds()));
}
});
},
expiresDaysHandler() {
const filter_expires_state = document.getElementById('filter-expires-state');
const filter_expires_days = document.getElementById('filter-expires-days');
filter_expires_days.disabled = !filter_expires_state.checked;
},
createToken() {
this.openTokenPopup({admin_mode: '1'});
},
editToken(tokenid) {
const token_data = {tokenid, admin_mode: '1'};
this.openTokenPopup(token_data);
},
openTokenPopup(token_data) {
const overlay = PopUp('popup.token.edit', token_data, {
dialogueid: 'token_edit',
dialogue_class: 'modal-popup-generic',