]> git.proxmox.com Git - pve-manager.git/blob - www/manager6/panel/BackupAdvancedOptions.js
d29c7ddbaa1e969ede73acbf1f3188ced9fe0799
[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 controller: {
16 xclass: 'Ext.app.ViewController',
17 },
18
19 onGetValues: function(formValues) {
20 if (this.needMask) { // isMasked() may not yet be true if not rendered once
21 return {};
22 }
23
24 let options = { 'delete': [] };
25
26 let performance = {};
27 let performanceOptions = ['max-workers', 'pbs-entries-max'];
28
29 for (const [key, value] of Object.entries(formValues)) {
30 if (performanceOptions.includes(key)) {
31 performance[key] = value;
32 // deleteEmpty is not currently implemented for pveBandwidthField
33 } else if (key === 'bwlimit' && value === '') {
34 options.delete.push('bwlimit');
35 } else if (key === 'delete') {
36 if (Array.isArray(value)) {
37 value.filter(opt => !performanceOptions.includes(opt)).forEach(
38 opt => options.delete.push(opt),
39 );
40 } else if (!performanceOptions.includes(formValues.delete)) {
41 options.delete.push(value);
42 }
43 } else {
44 options[key] = value;
45 }
46 }
47
48 if (Object.keys(performance).length > 0) {
49 options.performance = PVE.Parser.printPropertyString(performance);
50 } else {
51 options.delete.push('performance');
52 }
53
54 if (this.isCreate) {
55 delete options.delete;
56 }
57
58 return options;
59 },
60
61 updateCompression: function(value, disabled) {
62 this.lookup('zstdThreadCount').setDisabled(disabled || value !== 'zstd');
63 },
64
65 items: [
66 {
67 xtype: 'pveTwoColumnContainer',
68 startColumn: {
69 xtype: 'pveBandwidthField',
70 name: 'bwlimit',
71 fieldLabel: gettext('Bandwidth Limit'),
72 emptyText: gettext('Fallback'),
73 backendUnit: 'KiB',
74 allowZero: true,
75 emptyValue: '',
76 autoEl: {
77 tag: 'div',
78 'data-qtip': Ext.String.format(gettext('Use {0} for unlimited'), 0),
79 },
80 },
81 endFlex: 2,
82 endColumn: {
83 xtype: 'displayfield',
84 value: `${gettext('Limit I/O bandwidth.')} ${Ext.String.format(gettext("Schema default: {0}"), 0)}`,
85 },
86 },
87 {
88 xtype: 'pveTwoColumnContainer',
89 startColumn: {
90 xtype: 'proxmoxintegerfield',
91 name: 'zstd',
92 reference: 'zstdThreadCount',
93 fieldLabel: Ext.String.format(gettext('{0} Threads'), 'Zstd'),
94 fieldStyle: 'text-align: right',
95 emptyText: gettext('Fallback'),
96 minValue: 0,
97 cbind: {
98 deleteEmpty: '{!isCreate}',
99 },
100 autoEl: {
101 tag: 'div',
102 'data-qtip': gettext('With 0, half of the available cores are used'),
103 },
104 },
105 endFlex: 2,
106 endColumn: {
107 xtype: 'displayfield',
108 value: `${gettext('Threads used for zstd compression (non-PBS).')} ${Ext.String.format(gettext("Schema default: {0}"), 1)}`,
109 },
110 },
111 {
112 xtype: 'pveTwoColumnContainer',
113 startColumn: {
114 xtype: 'proxmoxintegerfield',
115 name: 'max-workers',
116 minValue: 1,
117 maxValue: 256,
118 fieldLabel: gettext('IO-Workers'),
119 fieldStyle: 'text-align: right',
120 emptyText: gettext('Fallback'),
121 cbind: {
122 deleteEmpty: '{!isCreate}',
123 },
124 },
125 endFlex: 2,
126 endColumn: {
127 xtype: 'displayfield',
128 value: `${gettext('I/O workers in the QEMU process (VMs only).')} ${Ext.String.format(gettext("Schema default: {0}"), 16)}`,
129 },
130 },
131 {
132 // It's part of the 'performance' property string, so have a field to preserve the
133 // value, but don't expose it. It's a rather niche setting and difficult to
134 // convey/understand what it does.
135 xtype: 'proxmoxintegerfield',
136 name: 'pbs-entries-max',
137 hidden: true,
138 fieldLabel: 'TODO',
139 fieldStyle: 'text-align: right',
140 emptyText: 'TODO',
141 cbind: {
142 deleteEmpty: '{!isCreate}',
143 },
144 },
145 {
146 xtype: 'pveTwoColumnContainer',
147 startColumn: {
148 xtype: 'proxmoxcheckbox',
149 fieldLabel: gettext('Repeat missed'),
150 name: 'repeat-missed',
151 uncheckedValue: 0,
152 defaultValue: 0,
153 cbind: {
154 deleteDefaultValue: '{!isCreate}',
155 },
156 },
157 endFlex: 2,
158 endColumn: {
159 xtype: 'displayfield',
160 value: gettext("Run jobs as soon as possible if they couldn't start on schedule, for example, due to the node being offline."),
161 },
162 },
163 {
164 xtype: 'component',
165 padding: '5 1',
166 html: `<span class="pmx-hint">${gettext('Note')}</span>: ${
167 gettext("The node-specific 'vzdump.conf' or, if this is not set, the default from the config schema is used to determine fallback values.")}`,
168 },
169 ],
170 });