]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/panel/BackupAdvancedOptions.js
ui: backup job: rework hint about fallback config and make it less flashy
[pve-manager.git] / www / manager6 / panel / BackupAdvancedOptions.js
CommitLineData
bb4741c7
FE
1/*
2 * Input panel for advanced backup options intended to be used as part of an edit/create window.
3 */
4Ext.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
9f2b84be
FE
15 controller: {
16 xclass: 'Ext.app.ViewController',
17 },
18
bb4741c7
FE
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
9f2b84be
FE
61 updateCompression: function(value, disabled) {
62 if (!disabled && value === 'zstd') {
63 this.lookup('zstdThreadCount').setDisabled(false);
64 } else {
65 this.lookup('zstdThreadCount').setDisabled(true);
66 }
67 },
68
bb4741c7
FE
69 column1: [
70 {
71 xtype: 'pveBandwidthField',
72 name: 'bwlimit',
73 fieldLabel: gettext('Bandwidth Limit'),
74 emptyText: gettext('use fallback'),
75 backendUnit: 'KiB',
76 allowZero: true,
77 emptyValue: '',
78 autoEl: {
79 tag: 'div',
80 'data-qtip': Ext.String.format(gettext('Use {0} for unlimited'), 0),
81 },
82 },
83 {
84 xtype: 'proxmoxintegerfield',
85 name: 'zstd',
9f2b84be 86 reference: 'zstdThreadCount',
bb4741c7
FE
87 fieldLabel: Ext.String.format(gettext('{0} Threads'), 'Zstd'),
88 fieldStyle: 'text-align: right',
89 emptyText: gettext('use fallback'),
90 minValue: 0,
91 cbind: {
92 deleteEmpty: '{!isCreate}',
93 },
94 autoEl: {
95 tag: 'div',
96 'data-qtip': gettext('With 0, half of the available cores are used'),
97 },
98 },
99 {
100 xtype: 'proxmoxintegerfield',
101 name: 'max-workers',
102 minValue: 1,
103 maxValue: 256,
104 fieldLabel: gettext('VM Workers'),
105 fieldStyle: 'text-align: right',
106 emptyText: gettext('use fallback'),
107 cbind: {
108 deleteEmpty: '{!isCreate}',
109 },
110 },
111 {
112 // It's part of the 'performance' property string, so have a field to preserve the
113 // value, but don't expose it. It's a rather niche setting and difficult to
114 // convey/understand what it does.
115 xtype: 'proxmoxintegerfield',
116 name: 'pbs-entries-max',
117 hidden: true,
118 fieldLabel: 'TODO',
119 fieldStyle: 'text-align: right',
120 emptyText: gettext('use fallback'),
121 cbind: {
122 deleteEmpty: '{!isCreate}',
123 },
124 },
1d777a46
FE
125 {
126 xtype: 'proxmoxcheckbox',
127 fieldLabel: gettext('Repeat missed'),
128 name: 'repeat-missed',
129 uncheckedValue: 0,
130 defaultValue: 0,
131 cbind: {
132 deleteDefaultValue: '{!isCreate}',
133 },
134 },
bb4741c7
FE
135 ],
136
137 column2: [
138 {
139 xtype: 'displayfield',
140 value: gettext('Limit I/O bandwidth'),
141 },
142 {
143 xtype: 'displayfield',
144 value: `${gettext('Threads used for zstd compression')} (${gettext('non-PBS')})`,
145 },
146 {
147 xtype: 'displayfield',
148 value: `${gettext('I/O workers in the QEMU process')} (${gettext('VM only')})`,
149 },
150 {
151 xtype: 'displayfield',
152 value: 'TODO',
153 hidden: true, // see definition of pbs-entries-max field
154 },
1d777a46
FE
155 {
156 xtype: 'displayfield',
157 value: gettext('Run missed jobs as soon as possible'),
158 },
bb4741c7
FE
159 ],
160
161 columnB: [
162 {
163 xtype: 'component',
bb4741c7 164 padding: '5 1',
a32a5c4a
TL
165 html: `<span class="pmx-hint">${gettext('Note')}</span>: ${
166 gettext("The node-specific vzdump.conf is used to determine fallback values")}`,
bb4741c7
FE
167 },
168 ],
169});