pve-manager/www/manager6/form/DiskSelector.js
Dominik Csapak 676b5a9e9f move DiskSelector to its own file, for generic use
also set the default diskType to undefined and
change the api endpoint to /nodes/NODE/disks/list

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-08-02 12:40:45 +02:00

80 lines
1.5 KiB
JavaScript

Ext.define('PVE.form.DiskSelector', {
extend: 'Proxmox.form.ComboGrid',
xtype: 'pveDiskSelector',
// can be
// undefined: all
// unused: only unused
// journal_disk: all disks with gpt
diskType: undefined,
valueField: 'devpath',
displayField: 'devpath',
emptyText: gettext('No Disks unused'),
listConfig: {
columns: [
{
header: gettext('Device'),
width: 80,
sortable: true,
dataIndex: 'devpath'
},
{
header: gettext('Size'),
width: 60,
sortable: false,
renderer: Proxmox.Utils.format_size,
dataIndex: 'size'
},
{
header: gettext('Serial'),
flex: 1,
sortable: true,
dataIndex: 'serial'
}
]
},
initComponent: function() {
var me = this;
var nodename = me.nodename;
if (!nodename) {
throw "no node name specified";
}
var store = Ext.create('Ext.data.Store', {
filterOnLoad: true,
model: 'pve-disk-list',
proxy: {
type: 'proxmox',
url: "/api2/json/nodes/" + nodename + "/disks/list",
extraParams: { type: me.diskType }
},
sorters: [
{
property : 'devpath',
direction: 'ASC'
}
]
});
Ext.apply(me, {
store: store
});
me.callParent();
store.load();
}
}, function() {
Ext.define('pve-disk-list', {
extend: 'Ext.data.Model',
fields: [ 'devpath', 'used', { name: 'size', type: 'number'},
{name: 'osdid', type: 'number'},
'vendor', 'model', 'serial'],
idProperty: 'devpath'
});
});