]>
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,
27 // this will determine if they are shown by default
30 // overwrite this to modify submit data
31 onGetValues: function(values
) {
35 getValues: function(dirtyOnly
) {
38 if (Ext
.isFunction(me
.onGetValues
)) {
44 Ext
.Array
.each(me
.query('[isFormField]'), function(field
) {
45 if (!dirtyOnly
|| field
.isDirty()) {
46 Proxmox
.Utils
.assemble_field_data(values
, field
.getSubmitData());
50 return me
.onGetValues(values
);
53 setAdvancedVisible: function(visible
) {
55 let advItems
= me
.getComponent('advancedContainer');
57 advItems
.setVisible(visible
);
61 setValues: function(values
) {
64 let form
= me
.up('form');
66 Ext
.iterate(values
, function(fieldId
, val
) {
67 let fields
= me
.query('[isFormField][name=' + fieldId
+ ']');
68 for (const field
of fields
) {
71 if (form
.trackResetOnLoad
) {
72 field
.resetOriginalValue();
81 * +---------------------------------------------------------------------+
83 * +---------------------------------------------------------------------+
85 * | +---------------+---------------+---------------+---------------+ |
86 * | | column1 | column2 | column3 | column4 | |
87 * | | panel, anchor | panel, anchor | panel, anchor | panel, anchor | |
88 * | +---------------+---------------+---------------+---------------+ |
89 * +---------------------------------------------------------------------+
91 * +---------------------------------------------------------------------+
93 initComponent: function() {
105 me
.items
= undefined;
106 } else if (me
.column4
) {
150 } else if (me
.column1
) {
174 items
: me
.column2
|| [], // allow empty column
187 throw "unsupported config";
191 if (me
.advancedItems
) {
195 items
: me
.advancedItems
,
198 me
.advancedItems
= undefined;
199 } else if (me
.advancedColumn1
|| me
.advancedColumn2
|| me
.advancedColumnB
) {
214 items
: me
.advancedColumn1
|| [], // allow empty column
218 items
: me
.advancedColumn2
|| [], // allow empty column
224 me
.advancedColumn1
= undefined;
225 me
.advancedColumn2
= undefined;
227 if (me
.advancedColumnB
) {
231 items
: me
.advancedColumnB
,
233 me
.advancedColumnB
= undefined;
238 me
.hasAdvanced
= true;
249 itemId
: 'advancedContainer',
250 hidden
: !me
.showAdvanced
,
263 defaultType
: 'container',