switch MP selector to integer input

instead of combobox - 256 elements are too much.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2018-09-05 11:37:11 +02:00 committed by Thomas Lamprecht
parent 483bd394f8
commit 85e6b368d1

View File

@ -27,17 +27,17 @@ Ext.define('PVE.lxc.MountPointInputPanel', {
onGetValues: function(values) { onGetValues: function(values) {
var me = this; var me = this;
var confid = me.confid || values.mpsel; var confid = me.confid || "mp"+values.mpid;
values.file = me.down('field[name=file]').getValue(); values.file = me.down('field[name=file]').getValue();
if (me.unused) { if (me.unused) {
confid = values.mpsel; confid = "mp"+values.mpid;
} else if (me.isCreate) { } else if (me.isCreate) {
values.file = values.hdstorage + ':' + values.disksize; values.file = values.hdstorage + ':' + values.disksize;
} }
// delete unnecessary fields // delete unnecessary fields
delete values.mpsel; delete values.mpid;
delete values.hdstorage; delete values.hdstorage;
delete values.disksize; delete values.disksize;
delete values.diskformat; delete values.diskformat;
@ -65,7 +65,7 @@ Ext.define('PVE.lxc.MountPointInputPanel', {
PVE.Utils.forEachMP(function(bus, i) { PVE.Utils.forEachMP(function(bus, i) {
var name = "mp" + i.toString(); var name = "mp" + i.toString();
if (!Ext.isDefined(vmconfig[name])) { if (!Ext.isDefined(vmconfig[name])) {
me.down('field[name=mpsel]').setValue(name); me.down('field[name=mpid]').setValue(i);
return false; return false;
} }
}); });
@ -83,7 +83,7 @@ Ext.define('PVE.lxc.MountPointInputPanel', {
xclass: 'Ext.app.ViewController', xclass: 'Ext.app.ViewController',
control: { control: {
'field[name=mpsel]': { 'field[name=mpid]': {
change: function(field, value) { change: function(field, value) {
field.validate(); field.validate();
} }
@ -154,10 +154,11 @@ Ext.define('PVE.lxc.MountPointInputPanel', {
column1: [ column1: [
{ {
xtype: 'proxmoxKVComboBox', xtype: 'proxmoxintegerfield',
name: 'mpsel', name: 'mpid',
fieldLabel: gettext('Mount Point'), fieldLabel: gettext('Mount Point ID'),
matchFieldWidth: false, minValue: 0,
maxValue: PVE.Utils.mp_counts.mps - 1,
hidden: true, hidden: true,
allowBlank: false, allowBlank: false,
disabled: true, disabled: true,
@ -165,20 +166,12 @@ Ext.define('PVE.lxc.MountPointInputPanel', {
hidden: '{hasMP}', hidden: '{hasMP}',
disabled: '{hasMP}' disabled: '{hasMP}'
}, },
comboItems: (function(){
var mps = [];
PVE.Utils.forEachMP(function(bus,i) {
var name = 'mp' + i.toString();
mps.push([name,name]);
});
return mps;
}()),
validator: function(value) { validator: function(value) {
var me = this.up('inputpanel'); var me = this.up('inputpanel');
if (!me.rendered) { if (!me.rendered) {
return; return;
} }
if (Ext.isDefined(me.vmconfig[value])) { if (Ext.isDefined(me.vmconfig["mp"+value])) {
return "Mount point is already in use."; return "Mount point is already in use.";
} }
/*jslint confusion: true*/ /*jslint confusion: true*/