* [pve-devel] [PATCH manager v2 1/5] ui: resource map tree: make 'ok' status clearer @ 2023-06-21 7:41 Dominik Csapak 2023-06-21 7:41 ` [pve-devel] [PATCH manager v2 2/5] ui: pci map edit: reintroduce warnings checks Dominik Csapak ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: Dominik Csapak @ 2023-06-21 7:41 UTC (permalink / raw) To: pve-devel by changing into 'mapping matches host data' which indicates that the configured values matches the host information also for the pci and usb map selectors Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> --- www/manager6/form/PCIMapSelector.js | 2 +- www/manager6/form/USBMapSelector.js | 2 +- www/manager6/tree/ResourceMapTree.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/www/manager6/form/PCIMapSelector.js b/www/manager6/form/PCIMapSelector.js index 4dca62ea..1bc73ec0 100644 --- a/www/manager6/form/PCIMapSelector.js +++ b/www/manager6/form/PCIMapSelector.js @@ -48,7 +48,7 @@ Ext.define('PVE.form.PCIMapSelector', { let me = this; if (!Ext.isArray(value) || !value?.length) { - return `<i class="fa fa-check-circle good"></i> ${gettext('Mapping OK')}`; + return `<i class="fa fa-check-circle good"></i> ${gettext('Mapping matches host data')}`; } let checks = []; diff --git a/www/manager6/form/USBMapSelector.js b/www/manager6/form/USBMapSelector.js index 990ef30f..6a33754a 100644 --- a/www/manager6/form/USBMapSelector.js +++ b/www/manager6/form/USBMapSelector.js @@ -34,7 +34,7 @@ Ext.define('PVE.form.USBMapSelector', { let me = this; if (!Ext.isArray(value) || !value?.length) { - return `<i class="fa fa-check-circle good"></i> ${gettext('Mapping OK')}`; + return `<i class="fa fa-check-circle good"></i> ${gettext('Mapping matches host data')}`; } let errors = []; diff --git a/www/manager6/tree/ResourceMapTree.js b/www/manager6/tree/ResourceMapTree.js index df50b63a..02717042 100644 --- a/www/manager6/tree/ResourceMapTree.js +++ b/www/manager6/tree/ResourceMapTree.js @@ -228,7 +228,7 @@ Ext.define('PVE.tree.ResourceMapTree', { } else { let state = value ? 'good' : 'critical'; iconCls = PVE.Utils.get_health_icon(state, true); - status = value ? gettext("OK") : record.data.errmsg || Proxmox.Utils.unknownText; + status = value ? gettext("Mapping matches host data") : record.data.errmsg || Proxmox.Utils.unknownText; } return `<i class="fa ${iconCls}"></i> ${status}`; }, -- 2.30.2 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH manager v2 2/5] ui: pci map edit: reintroduce warnings checks 2023-06-21 7:41 [pve-devel] [PATCH manager v2 1/5] ui: resource map tree: make 'ok' status clearer Dominik Csapak @ 2023-06-21 7:41 ` Dominik Csapak 2023-06-21 7:41 ` [pve-devel] [PATCH manager v2 3/5] ui: pci/usb map edit: improve new host mappings dialog Dominik Csapak ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: Dominik Csapak @ 2023-06-21 7:41 UTC (permalink / raw) To: pve-devel they got lost in my last rebase/refactor. the onLoadCallBack is used to check by the window if there are iommu groups at all, and the checkIsolated function checks if the selected ones are in a separate group (in regards to the other devices) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> --- factored out the store lookup @fiona, i opted to get the selected values via getValue, because via the store it's not really possible, and via the selector requires knowledge of how the selector works internally (lookup the grid, get the selection) www/manager6/form/MultiPCISelector.js | 5 ++++ www/manager6/window/PCIMapEdit.js | 41 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/www/manager6/form/MultiPCISelector.js b/www/manager6/form/MultiPCISelector.js index e1ef691a..d4fb6364 100644 --- a/www/manager6/form/MultiPCISelector.js +++ b/www/manager6/form/MultiPCISelector.js @@ -8,6 +8,9 @@ Ext.define('PVE.form.MultiPCISelector', { field: 'Ext.form.field.Field', }, + // will be called after loading finished + onLoadCallBack: Ext.emptyFn, + getValue: function() { let me = this; return me.value ?? []; @@ -287,6 +290,8 @@ Ext.define('PVE.form.MultiPCISelector', { me.callParent(); + me.mon(me.getStore(), 'load', me.onLoadCallBack); + Proxmox.Utils.monStoreErrors(me, me.getStore(), true); me.setNodename(nodename); diff --git a/www/manager6/window/PCIMapEdit.js b/www/manager6/window/PCIMapEdit.js index 516678e0..8c1a95e3 100644 --- a/www/manager6/window/PCIMapEdit.js +++ b/www/manager6/window/PCIMapEdit.js @@ -70,6 +70,46 @@ Ext.define('PVE.window.PCIMapEditWindow', { me.lookup('iommu_warning').setVisible( records.every((val) => val.data.iommugroup === -1), ); + + let value = me.lookup('pciselector').getValue(); + me.checkIsolated(value); + }, + + checkIsolated: function(value) { + let me = this; + + let store = me.lookup('pciselector').getStore(); + + let isIsolated = function(entry) { + let isolated = true; + let parsed = PVE.Parser.parsePropertyString(entry); + parsed.iommugroup = parseInt(parsed.iommugroup, 10); + if (!parsed.iommugroup) { + return isolated; + } + store.each(({ data }) => { + let isSubDevice = data.id.startsWith(parsed.path); + if (data.iommugroup === parsed.iommugroup && data.id !== parsed.path && !isSubDevice) { + isolated = false; + return false; + } + return true; + }); + return isolated; + }; + + let showWarning = false; + if (Ext.isArray(value)) { + for (const entry of value) { + if (!isIsolated(entry)) { + showWarning = true; + break; + } + } + } else { + showWarning = isIsolated(value); + } + me.lookup('group_warning').setVisible(showWarning); }, mdevChange: function(mdevField, value) { @@ -83,6 +123,7 @@ Ext.define('PVE.window.PCIMapEditWindow', { pciChange: function(_field, value) { let me = this; me.lookup('multiple_warning').setVisible(Ext.isArray(value) && value.length > 1); + me.checkIsolated(value); }, control: { -- 2.30.2 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH manager v2 3/5] ui: pci/usb map edit: improve new host mappings dialog 2023-06-21 7:41 [pve-devel] [PATCH manager v2 1/5] ui: resource map tree: make 'ok' status clearer Dominik Csapak 2023-06-21 7:41 ` [pve-devel] [PATCH manager v2 2/5] ui: pci map edit: reintroduce warnings checks Dominik Csapak @ 2023-06-21 7:41 ` Dominik Csapak 2023-06-21 7:41 ` [pve-devel] [PATCH manager v2 4/5] ui: pci map edit: fix typos in warnings and use gettexts Dominik Csapak ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: Dominik Csapak @ 2023-06-21 7:41 UTC (permalink / raw) To: pve-devel by disallowing nodes to be selected where a mapping already exists Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> --- changes from v1: * dont' disable autoselect, the first allowed node will be selected * for usb mappings too www/manager6/window/PCIMapEdit.js | 9 ++++++++- www/manager6/window/USBMapEdit.js | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/www/manager6/window/PCIMapEdit.js b/www/manager6/window/PCIMapEdit.js index 8c1a95e3..f243362b 100644 --- a/www/manager6/window/PCIMapEdit.js +++ b/www/manager6/window/PCIMapEdit.js @@ -58,7 +58,13 @@ Ext.define('PVE.window.PCIMapEditWindow', { let me = this; let view = me.getView(); me.originalMap = [...values.map]; - values.map = PVE.Parser.filterPropertyStringList(values.map, (e) => e.node === view.nodename); + let configuredNodes = []; + values.map = PVE.Parser.filterPropertyStringList(values.map, (e) => { + configuredNodes.push(e.node); + return e.node === view.nodename; + }); + + me.lookup('nodeselector').disallowedNodes = configuredNodes; return values; }, @@ -203,6 +209,7 @@ Ext.define('PVE.window.PCIMapEditWindow', { name: 'node', editConfig: { xtype: 'pveNodeSelector', + reference: 'nodeselector', }, cbind: { editable: '{!nodename}', diff --git a/www/manager6/window/USBMapEdit.js b/www/manager6/window/USBMapEdit.js index 80f8e785..f36f1d03 100644 --- a/www/manager6/window/USBMapEdit.js +++ b/www/manager6/window/USBMapEdit.js @@ -71,13 +71,16 @@ Ext.define('PVE.window.USBMapEditWindow', { let me = this; let view = me.getView(); me.originalMap = [...values.map]; + let configuredNodes = []; PVE.Parser.filterPropertyStringList(values.map, (e) => { + configuredNodes.push(e.node); if (e.node === view.nodename) { values = e; } return false; }); + me.lookup('nodeselector').disallowedNodes = configuredNodes; if (values.path) { values.usb = 'path'; } @@ -145,6 +148,7 @@ Ext.define('PVE.window.USBMapEditWindow', { name: 'node', editConfig: { xtype: 'pveNodeSelector', + reference: 'nodeselector', }, cbind: { editable: '{!nodename}', -- 2.30.2 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH manager v2 4/5] ui: pci map edit: fix typos in warnings and use gettexts 2023-06-21 7:41 [pve-devel] [PATCH manager v2 1/5] ui: resource map tree: make 'ok' status clearer Dominik Csapak 2023-06-21 7:41 ` [pve-devel] [PATCH manager v2 2/5] ui: pci map edit: reintroduce warnings checks Dominik Csapak 2023-06-21 7:41 ` [pve-devel] [PATCH manager v2 3/5] ui: pci/usb map edit: improve new host mappings dialog Dominik Csapak @ 2023-06-21 7:41 ` Dominik Csapak 2023-06-21 7:41 ` [pve-devel] [PATCH manager v2 5/5] ui: pci/usb mapping: rework mapping panel for better user experience Dominik Csapak 2023-06-21 8:07 ` [pve-devel] applied: [PATCH manager v2 1/5] ui: resource map tree: make 'ok' status clearer Thomas Lamprecht 4 siblings, 0 replies; 6+ messages in thread From: Dominik Csapak @ 2023-06-21 7:41 UTC (permalink / raw) To: pve-devel so they can be translated Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> --- new in v2 www/manager6/window/PCIMapEdit.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/www/manager6/window/PCIMapEdit.js b/www/manager6/window/PCIMapEdit.js index f243362b..2b268719 100644 --- a/www/manager6/window/PCIMapEdit.js +++ b/www/manager6/window/PCIMapEdit.js @@ -163,8 +163,7 @@ Ext.define('PVE.window.PCIMapEditWindow', { hidden: true, columnWidth: 1, padding: '0 0 10 0', - value: 'No IOMMU detected, please activate it.' + - 'See Documentation for further information.', + value: gettext('No IOMMU detected, please activate it. See Documentation for further information.'), userCls: 'pmx-hint', }, { @@ -173,8 +172,7 @@ Ext.define('PVE.window.PCIMapEditWindow', { hidden: true, columnWidth: 1, padding: '0 0 10 0', - value: 'When multiple devices are selected, the first free one will be chosen' + - ' on guest start.', + value: gettext('When multiple devices are selected, the first free one will be chosen on guest start.'), userCls: 'pmx-hint', }, { @@ -184,7 +182,7 @@ Ext.define('PVE.window.PCIMapEditWindow', { columnWidth: 1, padding: '0 0 10 0', itemId: 'iommuwarning', - value: 'The selected Device is not in a seperate IOMMU group, make sure this is intended.', + value: gettext('A selected device is not in a separate IOMMU group, make sure this is intended.'), userCls: 'pmx-hint', }, ], -- 2.30.2 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH manager v2 5/5] ui: pci/usb mapping: rework mapping panel for better user experience 2023-06-21 7:41 [pve-devel] [PATCH manager v2 1/5] ui: resource map tree: make 'ok' status clearer Dominik Csapak ` (2 preceding siblings ...) 2023-06-21 7:41 ` [pve-devel] [PATCH manager v2 4/5] ui: pci map edit: fix typos in warnings and use gettexts Dominik Csapak @ 2023-06-21 7:41 ` Dominik Csapak 2023-06-21 8:07 ` [pve-devel] applied: [PATCH manager v2 1/5] ui: resource map tree: make 'ok' status clearer Thomas Lamprecht 4 siblings, 0 replies; 6+ messages in thread From: Dominik Csapak @ 2023-06-21 7:41 UTC (permalink / raw) To: pve-devel by removing the confusing buttons in the toolbar and adding them as actions in an actioncolumn. There a only relevant actions are visible and get a more expressive tooltip with this, we now differentiate between 4 modes of the edit window: * create a new mapping altogether - shows all fields * edit existing mapping on top level - show only 'global' fields (comment, mdev), so no mappings * add new host mapping - shows nodeselector, mapping (and mdev, but disabled) (informational only) * edit existing host mapping - show selected node (displayfield) mdev and mappings, but only mappings are editable we have to split the nodeselector into two fields, since the disabling cbind does not pass through to the editconfig (and thus makes the form invalid if we try that) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> --- changes from rfc: * for usb mappings too, so they are consistent * moved the action column to second place * hide/disable add button when there are mappings for every node * use a bit different class to hide the buttons, because otherwise the grid cells would have the wrong height (since they would not get the styling of the font-awesome icon) www/css/ext6-pve.css | 5 + www/manager6/tree/ResourceMapTree.js | 178 +++++++++++++++++---------- www/manager6/window/PCIMapEdit.js | 40 ++++-- www/manager6/window/USBMapEdit.js | 49 ++++++-- 4 files changed, 183 insertions(+), 89 deletions(-) diff --git a/www/css/ext6-pve.css b/www/css/ext6-pve.css index 3af64255..edae462b 100644 --- a/www/css/ext6-pve.css +++ b/www/css/ext6-pve.css @@ -704,3 +704,8 @@ table.osds td:first-of-type { .x-grid-item .x-item-disabled { opacity: 0.3; } + +.pmx-action-hidden:before { + opacity: 0.0; + cursor: default; +} diff --git a/www/manager6/tree/ResourceMapTree.js b/www/manager6/tree/ResourceMapTree.js index 02717042..4c476909 100644 --- a/www/manager6/tree/ResourceMapTree.js +++ b/www/manager6/tree/ResourceMapTree.js @@ -49,44 +49,89 @@ Ext.define('PVE.tree.ResourceMapTree', { }); }, - addHost: function() { + add: function(_grid, _rI, _cI, _item, _e, rec) { let me = this; - me.edit(false); + if (rec.data.type !== 'entry') { + return; + } + + me.openMapEditWindow(rec.data.name); }, - edit: function(includeNodename = true) { + editDblClick: function() { let me = this; let view = me.getView(); let selection = view.getSelection(); - if (!selection || !selection.length) { + if (!selection || selection.length < 1) { return; } - let rec = selection[0]; - if (!view.canConfigure || (rec.data.type === 'entry' && includeNodename)) { + + me.edit(selection[0]); + }, + + editAction: function(_grid, _rI, _cI, _item, _e, rec) { + this.edit(rec); + }, + + edit: function(rec) { + let me = this; + if (rec.data.type === 'map') { return; } + me.openMapEditWindow(rec.data.name, rec.data.node, rec.data.type === 'entry'); + }, + + openMapEditWindow: function(name, nodename, entryOnly) { + let me = this; + let view = me.getView(); + Ext.create(view.editWindowClass, { - url: `${view.baseUrl}/${rec.data.name}`, + url: `${view.baseUrl}/${name}`, autoShow: true, autoLoad: true, - nodename: includeNodename ? rec.data.node : undefined, - name: rec.data.name, + entryOnly, + nodename, + name, listeners: { destroy: () => me.load(), }, }); }, - remove: function() { + remove: function(_grid, _rI, _cI, _item, _e, rec) { let me = this; + let msg, id; let view = me.getView(); - let selection = view.getSelection(); - if (!selection || !selection.length) { - return; + let confirmMsg; + switch (rec.data.type) { + case 'entry': + msg = gettext("Are you sure you want to remove '{0}'"); + confirmMsg = Ext.String.format(msg, rec.data.name); + break; + case 'node': + msg = gettext("Are you sure you want to remove '{0}' entries for '{1}'"); + confirmMsg = Ext.String.format(msg, rec.data.node, rec.data.name); + break; + case 'map': + msg = gettext("Are you sure you want to remove '{0}' on '{1}' for '{2}'"); + id = rec.data[view.entryIdProperty]; + confirmMsg = Ext.String.format(msg, id, rec.data.node, rec.data.name); + break; + default: + throw "invalid type"; } + Ext.Msg.confirm(gettext('Confirm'), confirmMsg, function(btn) { + if (btn === 'yes') { + me.executeRemove(rec.data); + } + }); + }, + + executeRemove: function(data) { + let me = this; + let view = me.getView(); - let data = selection[0].data; let url = `${view.baseUrl}/${data.name}`; let method = 'PUT'; let params = { @@ -233,6 +278,18 @@ Ext.define('PVE.tree.ResourceMapTree', { return `<i class="fa ${iconCls}"></i> ${status}`; }, + getAddClass: function(v, mD, rec) { + let cls = 'fa fa-plus-circle'; + if (rec.data.type !== 'entry' || rec.data.children?.length >= PVE.data.ResourceStore.getNodes().length) { + cls += ' pmx-action-hidden'; + } + return cls; + }, + + isAddDisabled: function(v, r, c, i, rec) { + return rec.data.type !== 'entry' || rec.data.children?.length >= PVE.data.ResourceStore.getNodes().length; + }, + init: function(view) { let me = this; @@ -254,63 +311,56 @@ Ext.define('PVE.tree.ResourceMapTree', { tbar: [ { - text: gettext('Add mapping'), + text: gettext('Add'), handler: 'addMapping', cbind: { disabled: '{!canConfigure}', }, }, - { - xtype: 'proxmoxButton', - text: gettext('New Host mapping'), - disabled: true, - parentXType: 'treepanel', - enableFn: function(_rec) { - return this.up('treepanel').canConfigure; - }, - handler: 'addHost', - }, - { - xtype: 'proxmoxButton', - text: gettext('Edit'), - disabled: true, - parentXType: 'treepanel', - enableFn: function(rec) { - return rec && rec.data.type !== 'entry' && this.up('treepanel').canConfigure; - }, - handler: 'edit', - }, - { - xtype: 'proxmoxButton', - parentXType: 'treepanel', - handler: 'remove', - disabled: true, - text: gettext('Remove'), - enableFn: function(rec) { - return rec && this.up('treepanel').canConfigure; - }, - confirmMsg: function(rec) { - let msg, id; - let view = this.up('treepanel'); - switch (rec.data.type) { - case 'entry': - msg = gettext("Are you sure you want to remove '{0}'"); - return Ext.String.format(msg, rec.data.name); - case 'node': - msg = gettext("Are you sure you want to remove '{0}' entries for '{1}'"); - return Ext.String.format(msg, rec.data.node, rec.data.name); - case 'map': - msg = gettext("Are you sure you want to remove '{0}' on '{1}' for '{2}'"); - id = rec.data[view.entryIdProperty]; - return Ext.String.format(msg, id, rec.data.node, rec.data.name); - default: - throw "invalid type"; - } - }, - }, ], listeners: { - itemdblclick: 'edit', + itemdblclick: 'editDblClick', + }, + + initComponent: function() { + let me = this; + + let columns = [...me.columns]; + columns.splice(1, 0, { + xtype: 'actioncolumn', + text: gettext('Actions'), + width: 80, + items: [ + { + getTip: (v, m, { data }) => + Ext.String.format(gettext("Add new host mapping for '{0}'"), data.name), + getClass: 'getAddClass', + isActionDisabled: 'isAddDisabled', + handler: 'add', + }, + { + iconCls: 'fa fa-pencil', + getTip: (v, m, { data }) => data.type === 'entry' + ? Ext.String.format(gettext("Edit Mapping '{0}'"), data.name) + : Ext.String.format(gettext("Edit Mapping '{0}' for '{1}'"), data.name, data.node), + getClass: (v, m, { data }) => data.type !== 'map' ? 'fa fa-pencil' : 'pmx-hidden', + isActionDisabled: (v, r, c, i, rec) => rec.data.type === 'map', + handler: 'editAction', + }, + { + iconCls: 'fa fa-trash-o', + getTip: (v, m, { data }) => data.type === 'entry' + ? Ext.String.format(gettext("Remove '{0}'"), data.name) + : data.type === 'node' + ? Ext.String.format(gettext("Remove mapping for '{0}'"), data.node) + : Ext.String.format(gettext("Remove mapping '{0}'"), data.path), + handler: 'remove', + }, + ], + }); + me.columns = columns; + + me.callParent(); }, }); diff --git a/www/manager6/window/PCIMapEdit.js b/www/manager6/window/PCIMapEdit.js index 2b268719..d43f04eb 100644 --- a/www/manager6/window/PCIMapEdit.js +++ b/www/manager6/window/PCIMapEdit.js @@ -13,8 +13,12 @@ Ext.define('PVE.window.PCIMapEditWindow', { cbindData: function(initialConfig) { let me = this; - me.isCreate = !me.name || !me.nodename; + me.isCreate = (!me.name || !me.nodename) && !me.entryOnly; me.method = me.name ? 'PUT' : 'POST'; + me.hideMapping = !!me.entryOnly; + me.hideComment = me.name && !me.entryOnly; + me.hideNodeSelector = me.nodename || me.entryOnly; + me.hideNode = !me.nodename || !me.hideNodeSelector; return { name: me.name, nodename: me.nodename, @@ -201,35 +205,41 @@ Ext.define('PVE.window.PCIMapEditWindow', { allowBlank: false, }, { - xtype: 'pmxDisplayEditField', + xtype: 'displayfield', fieldLabel: gettext('Mapping on Node'), labelWidth: 120, name: 'node', - editConfig: { - xtype: 'pveNodeSelector', - reference: 'nodeselector', - }, cbind: { - editable: '{!nodename}', value: '{nodename}', + disabled: '{hideNode}', + hidden: '{hideNode}', + }, + allowBlank: false, + }, + { + xtype: 'pveNodeSelector', + reference: 'nodeselector', + fieldLabel: gettext('Mapping on Node'), + labelWidth: 120, + name: 'node', + cbind: { + disabled: '{hideNodeSelector}', + hidden: '{hideNodeSelector}', }, allowBlank: false, }, ], column2: [ - { - // as spacer - xtype: 'displayfield', - }, { xtype: 'proxmoxcheckbox', - fieldLabel: gettext('Mediated Devices'), - labelWidth: 120, + fieldLabel: gettext('Use with Mediated Devices'), + labelWidth: 200, reference: 'mdev', name: 'mdev', cbind: { deleteEmpty: '{!isCreate}', + disabled: '{hideComment}', }, }, ], @@ -244,6 +254,8 @@ Ext.define('PVE.window.PCIMapEditWindow', { name: 'map', cbind: { nodename: '{nodename}', + disabled: '{hideMapping}', + hidden: '{hideMapping}', }, allowBlank: false, onLoadCallBack: 'checkIommu', @@ -257,6 +269,8 @@ Ext.define('PVE.window.PCIMapEditWindow', { name: 'description', cbind: { deleteEmpty: '{!isCreate}', + disabled: '{hideComment}', + hidden: '{hideComment}', }, }, ], diff --git a/www/manager6/window/USBMapEdit.js b/www/manager6/window/USBMapEdit.js index f36f1d03..358f0778 100644 --- a/www/manager6/window/USBMapEdit.js +++ b/www/manager6/window/USBMapEdit.js @@ -7,6 +7,10 @@ Ext.define('PVE.window.USBMapEditWindow', { let me = this; me.isCreate = !me.name; me.method = me.isCreate ? 'POST' : 'PUT'; + me.hideMapping = !!me.entryOnly; + me.hideComment = me.name && !me.entryOnly; + me.hideNodeSelector = me.nodename || me.entryOnly; + me.hideNode = !me.nodename || !me.hideNodeSelector; return { name: me.name, nodename: me.nodename, @@ -53,12 +57,14 @@ Ext.define('PVE.window.USBMapEditWindow', { if (me.originalMap) { map = PVE.Parser.filterPropertyStringList(me.originalMap, (e) => e.node !== values.node); } - map.push(PVE.Parser.printPropertyString(values)); + if (values.id) { + map.push(PVE.Parser.printPropertyString(values)); + } - values = { - map, - description, - }; + values = { map }; + if (description) { + values.description = description; + } if (view.isCreate) { values.id = name; @@ -143,16 +149,26 @@ Ext.define('PVE.window.USBMapEditWindow', { allowBlank: false, }, { - xtype: 'pmxDisplayEditField', - fieldLabel: gettext('Node'), + xtype: 'displayfield', + fieldLabel: gettext('Mapping on Node'), + labelWidth: 120, name: 'node', - editConfig: { - xtype: 'pveNodeSelector', - reference: 'nodeselector', - }, cbind: { - editable: '{!nodename}', value: '{nodename}', + disabled: '{hideNode}', + hidden: '{hideNode}', + }, + allowBlank: false, + }, + { + xtype: 'pveNodeSelector', + reference: 'nodeselector', + fieldLabel: gettext('Mapping on Node'), + labelWidth: 120, + name: 'node', + cbind: { + disabled: '{hideNodeSelector}', + hidden: '{hideNodeSelector}', }, allowBlank: false, }, @@ -163,6 +179,10 @@ Ext.define('PVE.window.USBMapEditWindow', { xtype: 'fieldcontainer', defaultType: 'radiofield', layout: 'fit', + cbind: { + disabled: '{hideMapping}', + hidden: '{hideMapping}', + }, items: [ { name: 'usb', @@ -178,6 +198,7 @@ Ext.define('PVE.window.USBMapEditWindow', { name: 'id', cbind: { nodename: '{nodename}', + disabled: '{hideMapping}', }, editable: true, allowBlank: false, @@ -214,6 +235,10 @@ Ext.define('PVE.window.USBMapEditWindow', { fieldLabel: gettext('Comment'), submitValue: true, name: 'description', + cbind: { + disabled: '{hideComment}', + hidden: '{hideComment}', + }, }, ], }, -- 2.30.2 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] applied: [PATCH manager v2 1/5] ui: resource map tree: make 'ok' status clearer 2023-06-21 7:41 [pve-devel] [PATCH manager v2 1/5] ui: resource map tree: make 'ok' status clearer Dominik Csapak ` (3 preceding siblings ...) 2023-06-21 7:41 ` [pve-devel] [PATCH manager v2 5/5] ui: pci/usb mapping: rework mapping panel for better user experience Dominik Csapak @ 2023-06-21 8:07 ` Thomas Lamprecht 4 siblings, 0 replies; 6+ messages in thread From: Thomas Lamprecht @ 2023-06-21 8:07 UTC (permalink / raw) To: Proxmox VE development discussion, Dominik Csapak Am 21/06/2023 um 09:41 schrieb Dominik Csapak: > by changing into 'mapping matches host data' which indicates that the > configured values matches the host information > > also for the pci and usb map selectors > > Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> > --- > www/manager6/form/PCIMapSelector.js | 2 +- > www/manager6/form/USBMapSelector.js | 2 +- > www/manager6/tree/ResourceMapTree.js | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > applied series, thanks! ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-06-21 8:07 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-06-21 7:41 [pve-devel] [PATCH manager v2 1/5] ui: resource map tree: make 'ok' status clearer Dominik Csapak 2023-06-21 7:41 ` [pve-devel] [PATCH manager v2 2/5] ui: pci map edit: reintroduce warnings checks Dominik Csapak 2023-06-21 7:41 ` [pve-devel] [PATCH manager v2 3/5] ui: pci/usb map edit: improve new host mappings dialog Dominik Csapak 2023-06-21 7:41 ` [pve-devel] [PATCH manager v2 4/5] ui: pci map edit: fix typos in warnings and use gettexts Dominik Csapak 2023-06-21 7:41 ` [pve-devel] [PATCH manager v2 5/5] ui: pci/usb mapping: rework mapping panel for better user experience Dominik Csapak 2023-06-21 8:07 ` [pve-devel] applied: [PATCH manager v2 1/5] ui: resource map tree: make 'ok' status clearer Thomas Lamprecht
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox