[pve-devel] [PATCH manager] ext6migrate: fix model behaviour for KVComboBox
Dominik Csapak
d.csapak at proxmox.com
Mon Feb 29 11:37:52 CET 2016
we used an empty value for the Key-Value ComboBox for defaults.
With extjs6, if the idProperty of a model is empty, they generate
a name for it, which breaks our logic for submitting
(currently we checked if this is empty, and send a delete command
to our api)
instead, we use the value 'default' and check for it when we submit
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/Utils.js | 8 ++++----
www/manager6/dc/AuthEdit.js | 2 +-
www/manager6/dc/OptionView.js | 6 +++---
www/manager6/form/Boolean.js | 2 +-
www/manager6/form/CPUModelSelector.js | 2 +-
www/manager6/form/CacheTypeSelector.js | 2 +-
www/manager6/form/CompressionSelector.js | 2 +-
www/manager6/form/KVComboBox.js | 2 +-
www/manager6/form/ScsiHwSelector.js | 2 +-
9 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index f2de778..bf60b03 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -228,7 +228,7 @@ Ext.define('PVE.Utils', { statics: {
},
kvm_keymap_array: function() {
- var data = [['', PVE.Utils.render_kvm_language('')]];
+ var data = [['default', PVE.Utils.render_kvm_language('')]];
Ext.Object.each(PVE.Utils.kvm_keymaps, function(key, value) {
data.push([key, PVE.Utils.render_kvm_language(value)]);
});
@@ -237,7 +237,7 @@ Ext.define('PVE.Utils', { statics: {
},
render_console_viewer: function(value) {
- if (!value) {
+ if (!value || value === 'default') {
return PVE.Utils.defaultText + ' (HTML5)';
} else if (value === 'vv') {
return 'SPICE (remote-viewer)';
@@ -302,7 +302,7 @@ Ext.define('PVE.Utils', { statics: {
},
kvm_vga_driver_array: function() {
- var data = [['', PVE.Utils.render_kvm_vga_driver('')]];
+ var data = [['default', PVE.Utils.render_kvm_vga_driver('')]];
Ext.Object.each(PVE.Utils.kvm_vga_drivers, function(key, value) {
data.push([key, PVE.Utils.render_kvm_vga_driver(value)]);
});
@@ -765,7 +765,7 @@ Ext.define('PVE.Utils', { statics: {
},
format_boolean_with_default: function(value) {
- if (Ext.isDefined(value) && value !== '') {
+ if (Ext.isDefined(value) && value !== 'default') {
return value ? PVE.Utils.yesText : PVE.Utils.noText;
}
return PVE.Utils.defaultText;
diff --git a/www/manager6/dc/AuthEdit.js b/www/manager6/dc/AuthEdit.js
index e096dd1..c5bc0f3 100644
--- a/www/manager6/dc/AuthEdit.js
+++ b/www/manager6/dc/AuthEdit.js
@@ -128,7 +128,7 @@ Ext.define('PVE.dc.AuthEdit', {
deleteEmpty: !me.create,
value: '',
fieldLabel: gettext('TFA'),
- comboItems: [ ['', PVE.Utils.noneText], ['oath', 'OATH'], ['yubico', 'Yubico']],
+ comboItems: [ ['default', PVE.Utils.noneText], ['oath', 'OATH'], ['yubico', 'Yubico']],
listeners: {
change: function(f, value) {
if (!me.rendered) {
diff --git a/www/manager6/dc/OptionView.js b/www/manager6/dc/OptionView.js
index 5abb2c7..7e89091 100644
--- a/www/manager6/dc/OptionView.js
+++ b/www/manager6/dc/OptionView.js
@@ -34,7 +34,7 @@ Ext.define('PVE.dc.KeyboardEdit', {
items: {
xtype: 'VNCKeyboardSelector',
name: 'keyboard',
- value: '',
+ value: 'default',
fieldLabel: gettext('Keyboard Layout')
}
});
@@ -53,7 +53,7 @@ Ext.define('PVE.dc.ConsoleViewerEdit', {
var data = [];
- Ext.Array.each(['', 'vv', 'html5'], function(value) {
+ Ext.Array.each(['default','vv', 'html5'], function(value) {
data.push([value, PVE.Utils.render_console_viewer(value)]);
});
@@ -62,7 +62,7 @@ Ext.define('PVE.dc.ConsoleViewerEdit', {
items: {
xtype: 'pveKVComboBox',
name: 'console',
- value: '',
+ value: 'default',
fieldLabel: gettext('Console Viewer'),
comboItems: data,
}
diff --git a/www/manager6/form/Boolean.js b/www/manager6/form/Boolean.js
index 1bcba95..f30b0f8 100644
--- a/www/manager6/form/Boolean.js
+++ b/www/manager6/form/Boolean.js
@@ -7,7 +7,7 @@ Ext.define('PVE.form.Boolean', {
var me = this;
me.data = [
- ['', gettext('Default')],
+ ['default', gettext('Default')],
[1, gettext('Yes')],
[0, gettext('No')]
];
diff --git a/www/manager6/form/CPUModelSelector.js b/www/manager6/form/CPUModelSelector.js
index 901aab5..bd897a5 100644
--- a/www/manager6/form/CPUModelSelector.js
+++ b/www/manager6/form/CPUModelSelector.js
@@ -6,7 +6,7 @@ Ext.define('PVE.form.CPUModelSelector', {
var me = this;
me.data = [
- ['', PVE.Utils.defaultText + ' (kvm64)'],
+ ['default', PVE.Utils.defaultText + ' (kvm64)'],
['486', '486'],
['athlon', 'athlon'],
['core2duo', 'core2duo'],
diff --git a/www/manager6/form/CacheTypeSelector.js b/www/manager6/form/CacheTypeSelector.js
index 3d96981..2b312ed 100644
--- a/www/manager6/form/CacheTypeSelector.js
+++ b/www/manager6/form/CacheTypeSelector.js
@@ -6,7 +6,7 @@ Ext.define('PVE.form.CacheTypeSelector', {
var me = this;
me.data = [
- ['', PVE.Utils.defaultText + " (" + gettext('No cache') + ")"],
+ ['default', PVE.Utils.defaultText + " (" + gettext('No cache') + ")"],
['directsync', 'Direct sync'],
['writethrough', 'Write through'],
['writeback', 'Write back'],
diff --git a/www/manager6/form/CompressionSelector.js b/www/manager6/form/CompressionSelector.js
index 0c96eab..514827e 100644
--- a/www/manager6/form/CompressionSelector.js
+++ b/www/manager6/form/CompressionSelector.js
@@ -2,7 +2,7 @@ Ext.define('PVE.form.CompressionSelector', {
extend: 'PVE.form.KVComboBox',
alias: ['widget.pveCompressionSelector'],
comboItems: [
- ['', PVE.Utils.noneText],
+ ['default', PVE.Utils.noneText],
['lzo', 'LZO (' + gettext('fast') + ')'],
['gzip', 'GZIP (' + gettext('good') + ')']
]
diff --git a/www/manager6/form/KVComboBox.js b/www/manager6/form/KVComboBox.js
index b80a062..b1ddf3f 100644
--- a/www/manager6/form/KVComboBox.js
+++ b/www/manager6/form/KVComboBox.js
@@ -22,7 +22,7 @@ Ext.define('PVE.form.KVComboBox', {
val;
if (!me.disabled && me.submitValue) {
val = me.getSubmitValue();
- if (val !== null && val !== '') {
+ if (val !== null && val !== '' && val !== 'default') {
data = {};
data[me.getName()] = val;
} else if (me.deleteEmpty) {
diff --git a/www/manager6/form/ScsiHwSelector.js b/www/manager6/form/ScsiHwSelector.js
index dc868c5..189f859 100644
--- a/www/manager6/form/ScsiHwSelector.js
+++ b/www/manager6/form/ScsiHwSelector.js
@@ -6,7 +6,7 @@ Ext.define('PVE.form.ScsiHwSelector', {
var me = this;
me.data = [
- ['', PVE.Utils.render_scsihw('')],
+ ['default', PVE.Utils.render_scsihw('')],
['lsi', PVE.Utils.render_scsihw('lsi')],
['lsi53c810', PVE.Utils.render_scsihw('lsi53c810')],
['megasas', PVE.Utils.render_scsihw('megasas')],
--
2.1.4
More information about the pve-devel
mailing list