mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-12-10 21:43:29 +00:00
add Checkbox.js
Copied from pve-manager
This commit is contained in:
parent
a0ec162067
commit
fccec7c6c2
1
Makefile
1
Makefile
@ -20,6 +20,7 @@ JSSRC= \
|
|||||||
data/ObjectStore.js \
|
data/ObjectStore.js \
|
||||||
data/TimezoneStore.js \
|
data/TimezoneStore.js \
|
||||||
form/TextField.js \
|
form/TextField.js \
|
||||||
|
form/Checkbox.js \
|
||||||
grid/ObjectGrid.js \
|
grid/ObjectGrid.js \
|
||||||
panel/InputPanel.js \
|
panel/InputPanel.js \
|
||||||
panel/LogView.js \
|
panel/LogView.js \
|
||||||
|
|||||||
44
form/Checkbox.js
Normal file
44
form/Checkbox.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
Ext.define('Proxmox.form.Checkbox', {
|
||||||
|
extend: 'Ext.form.field.Checkbox',
|
||||||
|
alias: ['widget.proxmoxcheckbox'],
|
||||||
|
|
||||||
|
defaultValue: undefined,
|
||||||
|
|
||||||
|
deleteDefaultValue: false,
|
||||||
|
deleteEmpty: false,
|
||||||
|
|
||||||
|
inputValue: '1',
|
||||||
|
|
||||||
|
getSubmitData: function() {
|
||||||
|
var me = this,
|
||||||
|
data = null,
|
||||||
|
val;
|
||||||
|
if (!me.disabled && me.submitValue) {
|
||||||
|
val = me.getSubmitValue();
|
||||||
|
if (val !== null) {
|
||||||
|
data = {};
|
||||||
|
if ((val == me.defaultValue) && me.deleteDefaultValue) {
|
||||||
|
data['delete'] = me.getName();
|
||||||
|
} else {
|
||||||
|
data[me.getName()] = val;
|
||||||
|
}
|
||||||
|
} else if (me.deleteEmpty) {
|
||||||
|
data = {};
|
||||||
|
data['delete'] = me.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
|
||||||
|
// also accept integer 1 as true
|
||||||
|
setRawValue: function(value) {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
if (value === 1) {
|
||||||
|
me.callParent([true]);
|
||||||
|
} else {
|
||||||
|
me.callParent([value]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
@ -45,7 +45,7 @@ Ext.define('Proxmox.node.NetworkEdit', {
|
|||||||
if (!(me.iftype === 'OVSIntPort' || me.iftype === 'OVSPort' ||
|
if (!(me.iftype === 'OVSIntPort' || me.iftype === 'OVSPort' ||
|
||||||
me.iftype === 'OVSBond')) {
|
me.iftype === 'OVSBond')) {
|
||||||
column2.push({
|
column2.push({
|
||||||
xtype: 'pvecheckbox',
|
xtype: 'proxmoxcheckbox',
|
||||||
fieldLabel: gettext('Autostart'),
|
fieldLabel: gettext('Autostart'),
|
||||||
name: 'autostart',
|
name: 'autostart',
|
||||||
uncheckedValue: 0,
|
uncheckedValue: 0,
|
||||||
@ -55,7 +55,7 @@ Ext.define('Proxmox.node.NetworkEdit', {
|
|||||||
|
|
||||||
if (me.iftype === 'bridge') {
|
if (me.iftype === 'bridge') {
|
||||||
column2.push({
|
column2.push({
|
||||||
xtype: 'pvecheckbox',
|
xtype: 'proxmoxcheckbox',
|
||||||
fieldLabel: gettext('VLAN aware'),
|
fieldLabel: gettext('VLAN aware'),
|
||||||
name: 'bridge_vlan_aware',
|
name: 'bridge_vlan_aware',
|
||||||
deleteEmpty: !me.create
|
deleteEmpty: !me.create
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user