]> git.proxmox.com Git - pve-manager.git/blob - www/manager6/panel/BackupAdvancedOptions.js
close #4513: ui: backup job: add tab for advanced options
[pve-manager.git] / www / manager6 / panel / BackupAdvancedOptions.js
1 /*
2 * Input panel for advanced backup options intended to be used as part of an edit/create window.
3 */
4 Ext.define('PVE.panel.BackupAdvancedOptions', {
5 extend: 'Proxmox.panel.InputPanel',
6 xtype: 'pveBackupAdvancedOptionsPanel',
7 mixins: ['Proxmox.Mixin.CBind'],
8
9 cbindData: function() {
10 let me = this;
11 me.isCreate = !!me.isCreate;
12 return {};
13 },
14
15 onGetValues: function(formValues) {
16 if (this.needMask) { // isMasked() may not yet be true if not rendered once
17 return {};
18 }
19
20 let options = { 'delete': [] };
21
22 let performance = {};
23 let performanceOptions = ['max-workers', 'pbs-entries-max'];
24
25 for (const [key, value] of Object.entries(formValues)) {
26 if (performanceOptions.includes(key)) {
27 performance[key] = value;
28 // deleteEmpty is not currently implemented for pveBandwidthField
29 } else if (key === 'bwlimit' && value === '') {
30 options.delete.push('bwlimit');
31 } else if (key === 'delete') {
32 if (Array.isArray(value)) {
33 value.filter(opt => !performanceOptions.includes(opt)).forEach(
34 opt => options.delete.push(opt),
35 );
36 } else if (!performanceOptions.includes(formValues.delete)) {
37 options.delete.push(value);
38 }
39 } else {
40 options[key] = value;
41 }
42 }
43
44 if (Object.keys(performance).length > 0) {
45 options.performance = PVE.Parser.printPropertyString(performance);
46 } else {
47 options.delete.push('performance');
48 }
49
50 if (this.isCreate) {
51 delete options.delete;
52 }
53
54 return options;
55 },
56
57 column1: [
58 {
59 xtype: 'pveBandwidthField',
60 name: 'bwlimit',
61 fieldLabel: gettext('Bandwidth Limit'),
62 emptyText: gettext('use fallback'),
63 backendUnit: 'KiB',
64 allowZero: true,
65 emptyValue: '',
66 autoEl: {
67 tag: 'div',
68 'data-qtip': Ext.String.format(gettext('Use {0} for unlimited'), 0),
69 },
70 },
71 {
72 xtype: 'proxmoxintegerfield',
73 name: 'zstd',
74 fieldLabel: Ext.String.format(gettext('{0} Threads'), 'Zstd'),
75 fieldStyle: 'text-align: right',
76 emptyText: gettext('use fallback'),
77 minValue: 0,
78 cbind: {
79 deleteEmpty: '{!isCreate}',
80 },
81 autoEl: {
82 tag: 'div',
83 'data-qtip': gettext('With 0, half of the available cores are used'),
84 },
85 },
86 {
87 xtype: 'proxmoxintegerfield',
88 name: 'max-workers',
89 minValue: 1,
90 maxValue: 256,
91 fieldLabel: gettext('VM Workers'),
92 fieldStyle: 'text-align: right',
93 emptyText: gettext('use fallback'),
94 cbind: {
95 deleteEmpty: '{!isCreate}',
96 },
97 },
98 {
99 // It's part of the 'performance' property string, so have a field to preserve the
100 // value, but don't expose it. It's a rather niche setting and difficult to
101 // convey/understand what it does.
102 xtype: 'proxmoxintegerfield',
103 name: 'pbs-entries-max',
104 hidden: true,
105 fieldLabel: 'TODO',
106 fieldStyle: 'text-align: right',
107 emptyText: gettext('use fallback'),
108 cbind: {
109 deleteEmpty: '{!isCreate}',
110 },
111 },
112 ],
113
114 column2: [
115 {
116 xtype: 'displayfield',
117 value: gettext('Limit I/O bandwidth'),
118 },
119 {
120 xtype: 'displayfield',
121 value: `${gettext('Threads used for zstd compression')} (${gettext('non-PBS')})`,
122 },
123 {
124 xtype: 'displayfield',
125 value: `${gettext('I/O workers in the QEMU process')} (${gettext('VM only')})`,
126 },
127 {
128 xtype: 'displayfield',
129 value: 'TODO',
130 hidden: true, // see definition of pbs-entries-max field
131 },
132 ],
133
134 columnB: [
135 {
136 xtype: 'component',
137 userCls: 'pmx-hint',
138 padding: '5 1',
139 html: gettext("Note that vzdump.conf is used as a fallback"),
140 },
141 ],
142 });