[pve-devel] [PATCH v10 manager 11/19] ui: multi disk edit: allow setting config ID when adding disk
Fabian Ebner
f.ebner at proxmox.com
Wed Apr 6 10:04:08 CEST 2022
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
www/manager6/panel/MultiDiskEdit.js | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/www/manager6/panel/MultiDiskEdit.js b/www/manager6/panel/MultiDiskEdit.js
index c1fd0617..7ba8246a 100644
--- a/www/manager6/panel/MultiDiskEdit.js
+++ b/www/manager6/panel/MultiDiskEdit.js
@@ -34,26 +34,35 @@ Ext.define('PVE.panel.MultiDiskPanel', {
// define in subclass
diskSorter: undefined,
- addDisk: function() {
+ addDisk: function(confid) {
let me = this;
let grid = me.lookup('grid');
let store = grid.getStore();
// get free disk id
let vmconfig = me.getVMConfig(true);
- let nextFreeDisk = me.getNextFreeDisk(vmconfig);
- if (!nextFreeDisk) {
+
+ if (!confid) {
+ let nextFreeDisk = me.getNextFreeDisk(vmconfig);
+ if (!nextFreeDisk) {
+ return;
+ }
+ confid = nextFreeDisk.confid;
+ }
+
+ if (store.findRecord('name', confid, 0, false, true, true) !== null) {
+ console.warn(`multi disk panel - disk for ${confid} already defined!`);
return;
}
// add store entry + panel
let itemId = 'disk-card-' + ++Ext.idSeed;
let rec = store.add({
- name: nextFreeDisk.confid,
+ name: confid,
itemId,
})[0];
- let panel = me.addPanel(itemId, vmconfig, nextFreeDisk.confid);
+ let panel = me.addPanel(itemId, vmconfig, confid);
panel.updateVMConfig(vmconfig);
// we need to setup a validitychange handler, so that we can show
--
2.30.2
More information about the pve-devel
mailing list