use Checkbox from widget toolkit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2017-12-05 14:06:40 +01:00 committed by Dominik Csapak
parent 70fb5dc57a
commit 896c0d5019
35 changed files with 61 additions and 106 deletions

View File

@ -22,7 +22,6 @@ JSSRC= \
data/ResourceStore.js \
data/model/RRDModels.js \
form/VLanField.js \
form/Checkbox.js \
form/RRDTypeSelector.js \
form/KVComboBox.js \
form/Boolean.js \

View File

@ -116,7 +116,7 @@ Ext.define('PVE.CephCreateOsd', {
emptyText: 'use OSD disk'
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'bluestore',
fieldLabel: 'Bluestore',
uncheckedValue: '0',
@ -139,7 +139,7 @@ Ext.define('PVE.CephRemoveOsd', {
method: 'DELETE',
items: [
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'cleanup',
checked: true,
labelWidth: 130,

View File

@ -49,7 +49,7 @@ Ext.define('PVE.CephCreatePool', {
allowBlank: false
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('Add Storages'),
name: 'add_storages'
}

View File

@ -47,7 +47,7 @@ Ext.define('PVE.dc.ACLAdd', {
if (!me.path) {
items.push({
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'propagate',
checked: true,
uncheckedValue: 0,

View File

@ -83,7 +83,7 @@ Ext.define('PVE.dc.AuthEdit', {
}
column1.push({
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('Default'),
name: 'default',
uncheckedValue: 0
@ -115,7 +115,7 @@ Ext.define('PVE.dc.AuthEdit', {
submitEmptyText: false
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
fieldLabel: 'SSL',
name: 'secure',
uncheckedValue: 0

View File

@ -182,7 +182,7 @@ Ext.define('PVE.dc.BackupEdit', {
name: 'mode'
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('Enable'),
name: 'enabled',
uncheckedValue: 0,

View File

@ -92,7 +92,7 @@ Ext.define('PVE.dc.UserEdit', {
fieldLabel: gettext('Expire')
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('Enabled'),
name: 'enable',
uncheckedValue: 0,

View File

@ -1,44 +0,0 @@
Ext.define('PVE.form.Checkbox', {
extend: 'Ext.form.field.Checkbox',
alias: ['widget.pvecheckbox'],
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]);
}
}
});

View File

@ -36,7 +36,7 @@ Ext.define('PVE.FirewallOptions', {
subject: text,
fieldDefaults: { labelWidth: labelWidth || 100 },
items: {
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
defaultValue: defaultValue || 0,
checked: defaultValue ? true : false,
name: name,

View File

@ -151,7 +151,7 @@ Ext.define('PVE.FirewallRulePanel', {
me.column2 = [
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'enable',
checked: false,
uncheckedValue: 0,
@ -337,7 +337,7 @@ Ext.define('PVE.FirewallGroupRuleEdit', {
column1: column1,
column2: [
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'enable',
checked: false,
uncheckedValue: 0,

View File

@ -52,7 +52,7 @@ Ext.define('PVE.window.ReplicaEdit', {
name: 'comment'
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'enabled',
defaultValue: 'on',
checked: true,

View File

@ -164,13 +164,13 @@ Ext.define('PVE.ha.GroupInputPanel', {
me.column2 = [
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'restricted',
uncheckedValue: 0,
fieldLabel: 'restricted'
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'nofailback',
uncheckedValue: 0,
fieldLabel: 'nofailback'

View File

@ -216,7 +216,7 @@ Ext.define('PVE.lxc.CreateWizard', {
allowBlank: true
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'unprivileged',
value: '',
listeners: {

View File

@ -218,7 +218,7 @@ Ext.define('PVE.lxc.MountPointInputPanel', {
allowBlank: true
});
me.quota = Ext.createWidget('pvecheckbox', {
me.quota = Ext.createWidget('proxmoxcheckbox', {
name: 'quota',
defaultValue: 0,
disabled: me.unprivileged,
@ -232,15 +232,15 @@ Ext.define('PVE.lxc.MountPointInputPanel', {
if (!isroot) {
me.column2.splice(1, 0, {
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'ro',
defaultValue: 0,
fieldLabel: gettext('Read-only'),
hidden: me.insideWizard
});
me.backup = Ext.createWidget('pvecheckbox',{
xtype: 'pvecheckbox',
me.backup = Ext.createWidget('proxmoxcheckbox',{
xtype: 'proxmoxcheckbox',
name: 'backup',
fieldLabel: gettext('Backup')
});
@ -248,7 +248,7 @@ Ext.define('PVE.lxc.MountPointInputPanel', {
me.column2.push(me.backup);
}
me.column2.push({
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'noreplicate',
fieldLabel: gettext('Skip replication')
});

View File

@ -146,7 +146,7 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
allowBlank: true
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('Firewall'),
name: 'firewall',
checked: cdata.firewall

View File

@ -30,7 +30,7 @@ Ext.define('PVE.lxc.Options', {
xtype: 'pveWindowEdit',
subject: gettext('Start at boot'),
items: {
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'onboot',
uncheckedValue: 0,
defaultValue: 0,
@ -64,7 +64,7 @@ Ext.define('PVE.lxc.Options', {
xtype: 'pveWindowEdit',
subject: '/dev/console',
items: {
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'console',
uncheckedValue: 0,
defaultValue: 1,
@ -121,7 +121,7 @@ Ext.define('PVE.lxc.Options', {
xtype: 'pveWindowEdit',
subject: gettext('Protection'),
items: {
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'protection',
uncheckedValue: 0,
defaultValue: 0,

View File

@ -213,7 +213,7 @@ Ext.define('PVE.IPSetCidrEdit', {
column1: column1,
column2: [
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'nomatch',
checked: false,
uncheckedValue: 0,

View File

@ -218,25 +218,25 @@ Ext.define('PVE.qemu.HDInputPanel', {
fieldLabel: gettext('Cache')
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('No backup'),
name: 'nobackup'
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
hidden: me.insideWizard,
fieldLabel: gettext('Skip replication'),
name: 'noreplicate'
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('Discard'),
disabled: me.confid && !me.confid.match(/^scsi/),
reference: 'discard',
name: 'discard'
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
disabled: me.confid && !me.confid.match(/^(virtio|scsi)/),
fieldLabel: 'IO thread',
reference: 'iothread',

View File

@ -68,7 +68,7 @@ Ext.define('PVE.window.HDMove', {
});
items.push({
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('Delete source'),
name: 'deleteDisk',
uncheckedValue: 0,

View File

@ -67,7 +67,7 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
labelWidth: labelWidth
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
hotplug: me.hotplug,
name: 'ballooning',
value: '1',

View File

@ -100,7 +100,7 @@ Ext.define('PVE.qemu.NetworkInputPanel', {
},
me.bridgesel,
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('Firewall'),
name: 'firewall',
labelAlign: 'right'
@ -158,7 +158,7 @@ Ext.define('PVE.qemu.NetworkInputPanel', {
allowBlank: true
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('Disconnect'),
name: 'disconnect'
}

View File

@ -59,7 +59,7 @@ Ext.define('PVE.qemu.Options', {
xtype: 'pveWindowEdit',
subject: gettext('Start at boot'),
items: {
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'onboot',
uncheckedValue: 0,
defaultValue: 0,
@ -129,7 +129,7 @@ Ext.define('PVE.qemu.Options', {
xtype: 'pveWindowEdit',
subject: gettext('Use tablet for pointer'),
items: {
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'tablet',
checked: true,
uncheckedValue: 0,
@ -164,7 +164,7 @@ Ext.define('PVE.qemu.Options', {
xtype: 'pveWindowEdit',
subject: gettext('ACPI support'),
items: {
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'acpi',
checked: true,
uncheckedValue: 0,
@ -194,7 +194,7 @@ Ext.define('PVE.qemu.Options', {
xtype: 'pveWindowEdit',
subject: gettext('KVM hardware virtualization'),
items: {
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'kvm',
checked: true,
uncheckedValue: 0,
@ -212,7 +212,7 @@ Ext.define('PVE.qemu.Options', {
xtype: 'pveWindowEdit',
subject: gettext('Freeze CPU at startup'),
items: {
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'freeze',
uncheckedValue: 0,
defaultValue: 0,
@ -230,7 +230,7 @@ Ext.define('PVE.qemu.Options', {
xtype: 'pveWindowEdit',
subject: gettext('Use local time for RTC'),
items: {
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'localtime',
uncheckedValue: 0,
defaultValue: 0,
@ -271,7 +271,7 @@ Ext.define('PVE.qemu.Options', {
xtype: 'pveWindowEdit',
subject: gettext('Qemu Agent'),
items: {
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'agent',
uncheckedValue: 0,
defaultValue: 0,
@ -288,7 +288,7 @@ Ext.define('PVE.qemu.Options', {
xtype: 'pveWindowEdit',
subject: gettext('Protection'),
items: {
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'protection',
uncheckedValue: 0,
defaultValue: 0,

View File

@ -93,7 +93,7 @@ Ext.define('PVE.qemu.ProcessorInputPanel', {
}
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('Enable NUMA'),
name: 'numa',
uncheckedValue: 0
@ -121,7 +121,7 @@ Ext.define('PVE.qemu.ProcessorInputPanel', {
me.column2.push({
hidden: me.insideWizard,
disabled: me.insideWizard,
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
fieldLabel: me.flagLabels[i] || flag,
name: flag,
uncheckedValue: 0

View File

@ -91,7 +91,7 @@ Ext.define('PVE.window.Snapshot', {
});
} else {
items.push({
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'vmstate',
uncheckedValue: 0,
defaultValue: 0,

View File

@ -49,14 +49,14 @@ Ext.define('PVE.storage.DirInputPanel', {
me.column2 = [
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'enable',
checked: true,
uncheckedValue: 0,
fieldLabel: gettext('Enable')
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'shared',
uncheckedValue: 0,
fieldLabel: gettext('Shared')

View File

@ -141,7 +141,7 @@ Ext.define('PVE.storage.GlusterFsInputPanel', {
autoSelect: false
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'enable',
checked: true,
uncheckedValue: 0,

View File

@ -127,7 +127,7 @@ Ext.define('PVE.storage.IScsiInputPanel', {
autoSelect: false
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'enable',
checked: true,
uncheckedValue: 0,

View File

@ -201,14 +201,14 @@ Ext.define('PVE.storage.LVMInputPanel', {
autoSelect: false
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'enable',
checked: true,
uncheckedValue: 0,
fieldLabel: gettext('Enable')
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'shared',
uncheckedValue: 0,
fieldLabel: gettext('Shared')

View File

@ -195,7 +195,7 @@ Ext.define('PVE.storage.LvmThinInputPanel', {
autoSelect: false
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'enable',
checked: true,
uncheckedValue: 0,

View File

@ -136,7 +136,7 @@ Ext.define('PVE.storage.NFSInputPanel', {
autoSelect: false
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'enable',
checked: true,
uncheckedValue: 0,

View File

@ -76,7 +76,7 @@ Ext.define('PVE.storage.RBDInputPanel', {
/*jslint confusion: true*/
me.column2 = [
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'enable',
checked: true,
uncheckedValue: 0,
@ -92,7 +92,7 @@ Ext.define('PVE.storage.RBDInputPanel', {
allowBlank: false
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'krbd',
uncheckedValue: 0,
fieldLabel: 'KRBD'

View File

@ -42,7 +42,7 @@ Ext.define('PVE.storage.SheepdogInputPanel', {
me.column2 = [
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'enable',
checked: true,
uncheckedValue: 0,

View File

@ -71,7 +71,7 @@ Ext.define('PVE.storage.ZFSInputPanel', {
me.column2 = [
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'enable',
checked: true,
uncheckedValue: 0,
@ -85,14 +85,14 @@ Ext.define('PVE.storage.ZFSInputPanel', {
allowBlank: false
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'sparse',
checked: false,
uncheckedValue: 0,
fieldLabel: gettext('Thin provision')
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'writecache',
checked: true,
uncheckedValue: 0,

View File

@ -96,14 +96,14 @@ Ext.define('PVE.storage.ZFSPoolInputPanel', {
/*jslint confusion: false*/
me.column2 = [
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'enable',
checked: true,
uncheckedValue: 0,
fieldLabel: gettext('Enable')
},
{
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'sparse',
checked: false,
uncheckedValue: 0,

View File

@ -55,7 +55,7 @@ Ext.define('PVE.window.Restore', {
if (me.vmtype === 'lxc') {
items.push({
xtype: 'pvecheckbox',
xtype: 'proxmoxcheckbox',
name: 'unprivileged',
value: '',
fieldLabel: gettext('Unprivileged container')