Source
xxxxxxxxxx
<?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/>.
**/
?>
window.dashboard_share_edit_popup = new class {
init({dashboard, user_group_row_template, user_row_template}) {
this.user_group_row_template = new Template(user_group_row_template);
this.user_row_template = new Template(user_row_template);
this._addPopupValues({'object': 'private', 'values': [dashboard.private]});
this._addPopupValues({'object': 'userid', 'values': dashboard.users});
this._addPopupValues({'object': 'usrgrpid', 'values': dashboard.userGroups});
/**
* @see init.js add.popup event
*/
window.addPopupValues = (list) => {
this._addPopupValues(list);
};
}
submit() {
const overlay = overlays_stack.getById('dashboard_share_edit');
const form = overlay.$dialogue.$body[0].querySelector('form');
overlay.setLoading();
const curl = new Curl('zabbix.php');
curl.setArgument('action', 'dashboard.share.update');
fetch(curl.getUrl(), {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(getFormFields(form))
})
.then((response) => response.json())
.then((response) => {
clearMessages();
if ('error' in response) {
throw {error: response.error};
}
overlayDialogueDestroy(overlay.dialogueid);
const message_box = makeMessageBox('good', response.success.messages, response.success.title);
addMessage(message_box);
})