mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-29 23:03:21 +00:00
displayedit: fixup to correct version
it seems I made an error and applied an older version.. Apply the correct one[0] with Dominiks comment addressed[1]. [0]: https://pve.proxmox.com/pipermail/pve-devel/2020-April/043037.html [1]: https://pve.proxmox.com/pipermail/pve-devel/2020-April/043043.html Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
809603790a
commit
a307714b53
@ -1,10 +1,12 @@
|
|||||||
Ext.define('Proxmox.form.field.DisplayEdit', {
|
Ext.define('Proxmox.form.field.DisplayEdit', {
|
||||||
extend: 'Ext.form.FieldContainer',
|
extend: 'Ext.form.FieldContainer',
|
||||||
alias: ['widget.pmxDisplayEditField'],
|
alias: 'widget.pmxDisplayEditField',
|
||||||
|
|
||||||
viewModel: {
|
viewModel: {
|
||||||
|
parent: null,
|
||||||
data: {
|
data: {
|
||||||
editable: false,
|
editable: false,
|
||||||
|
value: undefined,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -30,25 +32,30 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
|
|||||||
|
|
||||||
let displayConfig = {
|
let displayConfig = {
|
||||||
xtype: me.displayType,
|
xtype: me.displayType,
|
||||||
bind: {
|
bind: {},
|
||||||
hidden: '{editable}',
|
|
||||||
disabled: '{editable}',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
Ext.applyIf(displayConfig, me.initialConfig);
|
Ext.applyIf(displayConfig, me.initialConfig);
|
||||||
delete displayConfig.editConfig;
|
delete displayConfig.editConfig;
|
||||||
delete displayConfig.editable;
|
delete displayConfig.editable;
|
||||||
|
|
||||||
let editConfig = Ext.apply({}, me.editConfig); // clone, not reference!
|
let editConfig = Ext.apply({}, me.editConfig);
|
||||||
Ext.applyIf(editConfig, {
|
Ext.applyIf(editConfig, {
|
||||||
xtype: 'textfield',
|
xtype: 'textfield',
|
||||||
bind: {
|
bind: {},
|
||||||
hidden: '{!editable}',
|
|
||||||
disabled: '{!editable}',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
Ext.applyIf(editConfig, displayConfig);
|
Ext.applyIf(editConfig, displayConfig);
|
||||||
|
|
||||||
|
Ext.applyIf(displayConfig.bind, {
|
||||||
|
hidden: '{editable}',
|
||||||
|
disabled: '{editable}',
|
||||||
|
value: '{value}',
|
||||||
|
});
|
||||||
|
Ext.applyIf(editConfig.bind, {
|
||||||
|
hidden: '{!editable}',
|
||||||
|
disabled: '{!editable}',
|
||||||
|
value: '{value}',
|
||||||
|
});
|
||||||
|
|
||||||
// avoid glitch, start off correct even before viewmodel fixes it
|
// avoid glitch, start off correct even before viewmodel fixes it
|
||||||
editConfig.disabled = editConfig.hidden = !me.editable;
|
editConfig.disabled = editConfig.hidden = !me.editable;
|
||||||
displayConfig.disabled = displayConfig.hidden = !!me.editable;
|
displayConfig.disabled = displayConfig.hidden = !!me.editable;
|
||||||
@ -57,8 +64,8 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
|
|||||||
|
|
||||||
Ext.apply(me, {
|
Ext.apply(me, {
|
||||||
items: [
|
items: [
|
||||||
displayConfig,
|
|
||||||
editConfig,
|
editConfig,
|
||||||
|
displayConfig,
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user