pve-manager/www/manager6/storage/ZFSPoolEdit.js
Stefan Hrdlicka 14d9ecc416 fix #2822: add iscsi, lvm, lvmthin & zfs storage for all cluster nodes
This adds a dropdown box for iSCSI, LVM, LVMThin & ZFS storage options where a
cluster node needs to be chosen. As default the current node is
selected. It restricts the the storage to be only availabe on the
selected node.

Signed-off-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
2022-12-21 16:24:04 +01:00

115 lines
2.3 KiB
JavaScript

Ext.define('PVE.storage.ZFSPoolSelector', {
extend: 'PVE.form.ComboBoxSetStoreNode',
alias: 'widget.pveZFSPoolSelector',
valueField: 'pool',
displayField: 'pool',
queryMode: 'local',
editable: false,
listConfig: {
loadingText: gettext('Scanning...'),
},
config: {
apiSuffix: '/scan/zfs',
},
setNodeName: function(value) {
let me = this;
me.callParent([value]);
me.getStore().load();
},
initComponent: function() {
var me = this;
if (!me.nodename) {
me.nodename = 'localhost';
}
var store = Ext.create('Ext.data.Store', {
autoLoad: {}, // true,
fields: ['pool', 'size', 'free'],
proxy: {
type: 'proxmox',
url: `${me.apiBaseUrl}${me.nodename}${me.apiSuffix}`,
},
});
store.sort('pool', 'ASC');
Ext.apply(me, {
store: store,
});
me.callParent();
},
});
Ext.define('PVE.storage.ZFSPoolInputPanel', {
extend: 'PVE.panel.StorageBase',
onlineHelp: 'storage_zfspool',
initComponent: function() {
var me = this;
me.column1 = [];
if (me.isCreate) {
me.column1.push({
xtype: 'pveStorageScanNodeSelector',
listeners: {
change: {
fn: function(field, value) {
me.lookup('zfsPoolSelector').setNodeName(value);
me.lookup('storageNodeRestriction').setValue(value);
},
},
},
});
me.column1.push(Ext.create('PVE.storage.ZFSPoolSelector', {
name: 'pool',
fieldLabel: gettext('ZFS Pool'),
reference: 'zfsPoolSelector',
allowBlank: false,
}));
} else {
me.column1.push(Ext.createWidget('displayfield', {
name: 'pool',
value: '',
fieldLabel: gettext('ZFS Pool'),
allowBlank: false,
}));
}
// value is an array,
// while before it was a string
me.column1.push(
{
xtype: 'pveContentTypeSelector',
cts: ['images', 'rootdir'],
fieldLabel: gettext('Content'),
name: 'content',
value: ['images', 'rootdir'],
multiSelect: true,
allowBlank: false,
});
me.column2 = [
{
xtype: 'proxmoxcheckbox',
name: 'sparse',
checked: false,
uncheckedValue: 0,
fieldLabel: gettext('Thin provision'),
},
{
xtype: 'textfield',
name: 'blocksize',
emptyText: '8k',
fieldLabel: gettext('Block Size'),
allowBlank: true,
},
];
me.callParent();
},
});