mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-07-17 20:50:03 +00:00
(multi) disk selector: allow requesting partitions too
No functional change for existing users is intended. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
c91a73150f
commit
f340cf64fc
@ -8,6 +8,9 @@ Ext.define('Proxmox.form.DiskSelector', {
|
|||||||
// journal_disk: all disks with gpt
|
// journal_disk: all disks with gpt
|
||||||
diskType: undefined,
|
diskType: undefined,
|
||||||
|
|
||||||
|
// use include-partitions=1 as a parameter
|
||||||
|
includePartitions: false,
|
||||||
|
|
||||||
// the property the backend wnats for the type ('type' by default)
|
// the property the backend wnats for the type ('type' by default)
|
||||||
typeProperty: 'type',
|
typeProperty: 'type',
|
||||||
|
|
||||||
@ -53,6 +56,10 @@ Ext.define('Proxmox.form.DiskSelector', {
|
|||||||
extraParams[me.typeProperty] = me.diskType;
|
extraParams[me.typeProperty] = me.diskType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (me.includePartitions) {
|
||||||
|
extraParams['include-partitions'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
var store = Ext.create('Ext.data.Store', {
|
var store = Ext.create('Ext.data.Store', {
|
||||||
filterOnLoad: true,
|
filterOnLoad: true,
|
||||||
model: 'pmx-disk-list',
|
model: 'pmx-disk-list',
|
||||||
|
@ -24,6 +24,9 @@ Ext.define('Proxmox.form.MultiDiskSelector', {
|
|||||||
// the type of disks to show
|
// the type of disks to show
|
||||||
diskType: 'unused',
|
diskType: 'unused',
|
||||||
|
|
||||||
|
// add include-partitions=1 as a request parameter
|
||||||
|
includePartitions: false,
|
||||||
|
|
||||||
disks: [],
|
disks: [],
|
||||||
|
|
||||||
allowBlank: false,
|
allowBlank: false,
|
||||||
@ -141,22 +144,31 @@ Ext.define('Proxmox.form.MultiDiskSelector', {
|
|||||||
initComponent: function() {
|
initComponent: function() {
|
||||||
let me = this;
|
let me = this;
|
||||||
|
|
||||||
|
let extraParams = {};
|
||||||
|
|
||||||
if (!me.url) {
|
if (!me.url) {
|
||||||
if (!me.nodename) {
|
if (!me.nodename) {
|
||||||
throw "no url or nodename given";
|
throw "no url or nodename given";
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = me.nodename;
|
me.url = `/api2/json/nodes/${me.nodename}/disks/list`;
|
||||||
let param = me.typeParameter;
|
|
||||||
let type = me.diskType;
|
extraParams[me.typeParameter] = me.diskType;
|
||||||
me.url = `/api2/json/nodes/${node}/disks/list?${param}=${type}`;
|
|
||||||
|
if (me.includePartitions) {
|
||||||
|
extraParams['include-partitions'] = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
me.disks = [];
|
me.disks = [];
|
||||||
|
|
||||||
me.callParent();
|
me.callParent();
|
||||||
let store = me.getStore();
|
let store = me.getStore();
|
||||||
store.getProxy().setUrl(me.url);
|
store.setProxy({
|
||||||
|
type: 'proxmox',
|
||||||
|
url: me.url,
|
||||||
|
extraParams,
|
||||||
|
});
|
||||||
store.load();
|
store.load();
|
||||||
store.sort({ property: me.valueField });
|
store.sort({ property: me.valueField });
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user