]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - src/panel/InputPanel.js
1 Ext
.define('Proxmox.panel.InputPanel', {
2 extend
: 'Ext.panel.Panel',
3 alias
: ['widget.inputpanel'],
6 // notify owning container that it should display a help button
8 Ext
.GlobalEvents
.fireEvent('proxmoxShowHelp', this.onlineHelp
);
11 deactivate: function() {
12 if (this.onlineHelp
) {
13 Ext
.GlobalEvents
.fireEvent('proxmoxHideHelp', this.onlineHelp
);
19 // override this with an URL to a relevant chapter of the pve manual
20 // setting this will display a help button in our parent panel
21 onlineHelp
: undefined,
23 // will be set if the inputpanel has advanced items
26 // if the panel has advanced items, this will determine if they are shown by default
29 // overwrite this to modify submit data
30 onGetValues: function(values
) {
34 getValues: function(dirtyOnly
) {
37 if (Ext
.isFunction(me
.onGetValues
)) {
43 Ext
.Array
.each(me
.query('[isFormField]'), function(field
) {
44 if (!dirtyOnly
|| field
.isDirty()) {
45 Proxmox
.Utils
.assemble_field_data(values
, field
.getSubmitData());
49 return me
.onGetValues(values
);
52 setAdvancedVisible: function(visible
) {
54 let advItems
= me
.getComponent('advancedContainer');
56 advItems
.setVisible(visible
);
60 setValues: function(values
) {
63 let form
= me
.up('form');
65 Ext
.iterate(values
, function(fieldId
, val
) {
66 let fields
= me
.query('[isFormField][name=' + fieldId
+ ']');
67 for (const field
of fields
) {
70 if (form
.trackResetOnLoad
) {
71 field
.resetOriginalValue();
80 * +---------------------------------------------------------------------+
82 * +---------------------------------------------------------------------+
84 * | +---------------+---------------+---------------+---------------+ |
85 * | | column1 | column2 | column3 | column4 | |
86 * | | panel, anchor | panel, anchor | panel, anchor | panel, anchor | |
87 * | +---------------+---------------+---------------+---------------+ |
88 * +---------------------------------------------------------------------+
90 * +---------------------------------------------------------------------+
92 initComponent: function() {
104 me
.items
= undefined;
105 } else if (me
.column4
) {
149 } else if (me
.column1
) {
173 items
: me
.column2
|| [], // allow empty column
186 throw "unsupported config";
190 if (me
.advancedItems
) {
194 items
: me
.advancedItems
,
197 me
.advancedItems
= undefined;
198 } else if (me
.advancedColumn1
|| me
.advancedColumn2
|| me
.advancedColumnB
) {
213 items
: me
.advancedColumn1
|| [], // allow empty column
217 items
: me
.advancedColumn2
|| [], // allow empty column
223 me
.advancedColumn1
= undefined;
224 me
.advancedColumn2
= undefined;
226 if (me
.advancedColumnB
) {
230 items
: me
.advancedColumnB
,
232 me
.advancedColumnB
= undefined;
237 me
.hasAdvanced
= true;
248 itemId
: 'advancedContainer',
249 hidden
: !me
.showAdvanced
,
262 defaultType
: 'container',