ui: add NotifyOptions edit window
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
10db4717f1
commit
65595e169f
@ -28,6 +28,7 @@ JSSRC= \
|
|||||||
window/FileBrowser.js \
|
window/FileBrowser.js \
|
||||||
window/NotesEdit.js \
|
window/NotesEdit.js \
|
||||||
window/RemoteEdit.js \
|
window/RemoteEdit.js \
|
||||||
|
window/NotifyOptions.js \
|
||||||
window/SyncJobEdit.js \
|
window/SyncJobEdit.js \
|
||||||
window/UserEdit.js \
|
window/UserEdit.js \
|
||||||
window/UserPassword.js \
|
window/UserPassword.js \
|
||||||
|
@ -11,6 +11,10 @@ const proxmoxOnlineHelpInfo = {
|
|||||||
"link": "/docs/sysadmin.html#chapter-zfs",
|
"link": "/docs/sysadmin.html#chapter-zfs",
|
||||||
"title": "ZFS on Linux"
|
"title": "ZFS on Linux"
|
||||||
},
|
},
|
||||||
|
"maintenance-notification": {
|
||||||
|
"link": "/docs/maintenance.html#maintenance-notification",
|
||||||
|
"title": "Notifications"
|
||||||
|
},
|
||||||
"backup-remote": {
|
"backup-remote": {
|
||||||
"link": "/docs/managing-remotes.html#backup-remote",
|
"link": "/docs/managing-remotes.html#backup-remote",
|
||||||
"title": ":term:`Remote`"
|
"title": ":term:`Remote`"
|
||||||
|
101
www/window/NotifyOptions.js
Normal file
101
www/window/NotifyOptions.js
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
Ext.define('PBS.form.NotifyType', {
|
||||||
|
extend: 'Proxmox.form.KVComboBox',
|
||||||
|
alias: 'widget.pbsNotifyType',
|
||||||
|
|
||||||
|
comboItems: [
|
||||||
|
['__default__', gettext('Default (Always)')],
|
||||||
|
['always', gettext('Always')],
|
||||||
|
['error', gettext('Errors')],
|
||||||
|
['never', gettext('Never')],
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
Ext.define('PBS.window.NotifyOptions', {
|
||||||
|
extend: 'Proxmox.window.Edit',
|
||||||
|
xtype: 'pbsNotifyOptionEdit',
|
||||||
|
mixins: ['Proxmox.Mixin.CBind'],
|
||||||
|
|
||||||
|
onlineHelp: 'maintenance_notification',
|
||||||
|
|
||||||
|
user: undefined,
|
||||||
|
tokenname: undefined,
|
||||||
|
|
||||||
|
isAdd: false,
|
||||||
|
isCreate: false,
|
||||||
|
|
||||||
|
subject: gettext('Datastore Options'),
|
||||||
|
// hack to avoid that the trigger of the combogrid fields open on window show
|
||||||
|
defaultFocus: 'proxmoxHelpButton',
|
||||||
|
|
||||||
|
width: 450,
|
||||||
|
fieldDefaults: {
|
||||||
|
labelWidth: 120,
|
||||||
|
},
|
||||||
|
|
||||||
|
items: {
|
||||||
|
xtype: 'inputpanel',
|
||||||
|
onGetValues: function(values) {
|
||||||
|
let notify = {};
|
||||||
|
for (const k of ['verify', 'sync', 'gc']) {
|
||||||
|
notify[k] = values[k];
|
||||||
|
delete values[k];
|
||||||
|
}
|
||||||
|
values.notify = PBS.Utils.printPropertyString(notify);
|
||||||
|
|
||||||
|
PBS.Utils.delete_if_default(values, 'notify', '');
|
||||||
|
PBS.Utils.delete_if_default(values, 'notify-user', '');
|
||||||
|
|
||||||
|
return values;
|
||||||
|
},
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
xtype: 'pbsUserSelector',
|
||||||
|
name: 'notify-user',
|
||||||
|
fieldLabel: gettext('Notify User'),
|
||||||
|
emptyText: gettext('root@pam'),
|
||||||
|
value: null,
|
||||||
|
allowBlank: true,
|
||||||
|
renderer: Ext.String.htmlEncode,
|
||||||
|
deleteEmpty: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'pbsNotifyType',
|
||||||
|
name: 'verify',
|
||||||
|
fieldLabel: gettext('Verification Jobs'),
|
||||||
|
value: '__default__',
|
||||||
|
deleteEmpty: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'pbsNotifyType',
|
||||||
|
name: 'sync',
|
||||||
|
fieldLabel: gettext('Sync Jobs'),
|
||||||
|
value: '__default__',
|
||||||
|
deleteEmpty: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'pbsNotifyType',
|
||||||
|
name: 'gc',
|
||||||
|
fieldLabel: gettext('Garbage Collection'),
|
||||||
|
value: '__default__',
|
||||||
|
deleteEmpty: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
setValues: function(values) {
|
||||||
|
let me = this;
|
||||||
|
|
||||||
|
// we only handle a reduced set of options here
|
||||||
|
let options = {
|
||||||
|
'notify-user': values['notify-user'],
|
||||||
|
'verify-new': values['verify-new'],
|
||||||
|
};
|
||||||
|
|
||||||
|
let notify = {};
|
||||||
|
if (values.notify) {
|
||||||
|
notify = PBS.Utils.parsePropertyString(values.notify);
|
||||||
|
}
|
||||||
|
Object.assign(options, notify);
|
||||||
|
|
||||||
|
me.callParent([options]);
|
||||||
|
},
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user