]>
Commit | Line | Data |
---|---|---|
bb4741c7 FE |
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 | ||
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 | ||
9486317c | 69 | items: [ |
bb4741c7 | 70 | { |
9486317c DC |
71 | xtype: 'pveTwoColumnContainer', |
72 | startColumn: { | |
73 | xtype: 'pveBandwidthField', | |
74 | name: 'bwlimit', | |
75 | fieldLabel: gettext('Bandwidth Limit'), | |
9e917dd7 | 76 | emptyText: gettext('Fallback'), |
9486317c DC |
77 | backendUnit: 'KiB', |
78 | allowZero: true, | |
79 | emptyValue: '', | |
80 | autoEl: { | |
81 | tag: 'div', | |
82 | 'data-qtip': Ext.String.format(gettext('Use {0} for unlimited'), 0), | |
83 | }, | |
84 | }, | |
85 | endFlex: 2, | |
86 | endColumn: { | |
87 | xtype: 'displayfield', | |
9e917dd7 | 88 | value: `${gettext('Limit I/O bandwidth.')} ${Ext.String.format(gettext("Schema default: {0}"), 0)}`, |
bb4741c7 FE |
89 | }, |
90 | }, | |
91 | { | |
9486317c DC |
92 | xtype: 'pveTwoColumnContainer', |
93 | startColumn: { | |
94 | xtype: 'proxmoxintegerfield', | |
95 | name: 'zstd', | |
96 | reference: 'zstdThreadCount', | |
97 | fieldLabel: Ext.String.format(gettext('{0} Threads'), 'Zstd'), | |
98 | fieldStyle: 'text-align: right', | |
9e917dd7 | 99 | emptyText: gettext('Fallback'), |
9486317c DC |
100 | minValue: 0, |
101 | cbind: { | |
102 | deleteEmpty: '{!isCreate}', | |
103 | }, | |
104 | autoEl: { | |
105 | tag: 'div', | |
106 | 'data-qtip': gettext('With 0, half of the available cores are used'), | |
107 | }, | |
bb4741c7 | 108 | }, |
9486317c DC |
109 | endFlex: 2, |
110 | endColumn: { | |
111 | xtype: 'displayfield', | |
9e917dd7 | 112 | value: `${gettext('Threads used for zstd compression (non-PBS).')} ${Ext.String.format(gettext("Schema default: {0}"), 1)}`, |
bb4741c7 FE |
113 | }, |
114 | }, | |
115 | { | |
9486317c DC |
116 | xtype: 'pveTwoColumnContainer', |
117 | startColumn: { | |
118 | xtype: 'proxmoxintegerfield', | |
119 | name: 'max-workers', | |
120 | minValue: 1, | |
121 | maxValue: 256, | |
122 | fieldLabel: gettext('IO-Workers'), | |
123 | fieldStyle: 'text-align: right', | |
9e917dd7 | 124 | emptyText: gettext('Fallback'), |
9486317c DC |
125 | cbind: { |
126 | deleteEmpty: '{!isCreate}', | |
127 | }, | |
128 | }, | |
129 | endFlex: 2, | |
130 | endColumn: { | |
131 | xtype: 'displayfield', | |
9e917dd7 | 132 | value: `${gettext('I/O workers in the QEMU process (VMs only).')} ${Ext.String.format(gettext("Schema default: {0}"), 16)}`, |
bb4741c7 FE |
133 | }, |
134 | }, | |
135 | { | |
136 | // It's part of the 'performance' property string, so have a field to preserve the | |
137 | // value, but don't expose it. It's a rather niche setting and difficult to | |
138 | // convey/understand what it does. | |
139 | xtype: 'proxmoxintegerfield', | |
140 | name: 'pbs-entries-max', | |
141 | hidden: true, | |
142 | fieldLabel: 'TODO', | |
143 | fieldStyle: 'text-align: right', | |
5abdd1e4 | 144 | emptyText: 'TODO', |
bb4741c7 FE |
145 | cbind: { |
146 | deleteEmpty: '{!isCreate}', | |
147 | }, | |
148 | }, | |
1d777a46 | 149 | { |
9486317c DC |
150 | xtype: 'pveTwoColumnContainer', |
151 | startColumn: { | |
152 | xtype: 'proxmoxcheckbox', | |
153 | fieldLabel: gettext('Repeat missed'), | |
154 | name: 'repeat-missed', | |
155 | uncheckedValue: 0, | |
156 | defaultValue: 0, | |
157 | cbind: { | |
158 | deleteDefaultValue: '{!isCreate}', | |
159 | }, | |
160 | }, | |
161 | endFlex: 2, | |
162 | endColumn: { | |
163 | xtype: 'displayfield', | |
164 | value: gettext("Run jobs as soon as possible if they couldn't start on schedule, for example, due to the node being offline."), | |
1d777a46 FE |
165 | }, |
166 | }, | |
bb4741c7 FE |
167 | { |
168 | xtype: 'component', | |
bb4741c7 | 169 | padding: '5 1', |
a32a5c4a | 170 | html: `<span class="pmx-hint">${gettext('Note')}</span>: ${ |
9e917dd7 | 171 | gettext("The node-specific 'vzdump.conf' or, if this is not set, the default from the config schema is used to determine fallback values.")}`, |
bb4741c7 FE |
172 | }, |
173 | ], | |
174 | }); |