]>
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();
79 initComponent: function() {
94 } else if (me
.column4
) {
130 } else if (me
.column1
) {
143 items
: me
.column2
|| [], // allow empty column
155 throw "unsupported config";
159 if (me
.advancedItems
) {
164 items
: me
.advancedItems
,
167 me
.advancedItems
= undefined;
168 } else if (me
.advancedColumn1
) {
174 items
: me
.advancedColumn1
,
180 items
: me
.advancedColumn2
|| [], // allow empty column
184 me
.advancedColumn1
= undefined;
185 me
.advancedColumn2
= undefined;
187 if (me
.advancedColumnB
) {
192 items
: me
.advancedColumnB
,
194 me
.advancedColumnB
= undefined;
199 me
.hasAdvanced
= true;
212 itemId
: 'advancedContainer',
213 hidden
: !me
.showAdvanced
,
222 if (me
.useFieldContainer
) {
225 items
: Ext
.apply(me
.useFieldContainer
, {
227 defaultType
: 'container',
234 defaultType
: 'container',