add LVM List/Create Gui

only let the user change the name of the vg

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2018-07-30 10:26:08 +02:00 committed by Dietmar Maurer
parent 676b5a9e9f
commit 6c4c85d018
3 changed files with 196 additions and 0 deletions

View File

@ -98,6 +98,7 @@ JSSRC= \
ceph/StatusDetail.js \
ceph/Config.js \
node/Disks.js \
node/LVM.js \
node/StatusView.js \
node/Summary.js \
node/Subscription.js \

View File

@ -266,6 +266,13 @@ Ext.define('PVE.node.Config', {
iconCls: 'fa fa-hdd-o',
xtype: 'pveNodeDiskList'
},
{
title: 'LVM',
itemId: 'lvm',
iconCls: 'fa fa-square',
groups: ['storage'],
xtype: 'pveLVMList'
},
{
title: 'Ceph',
itemId: 'ceph',

188
www/manager6/node/LVM.js Normal file
View File

@ -0,0 +1,188 @@
Ext.define('PVE.node.CreateLVM', {
extend: 'Proxmox.window.Edit',
xtype: 'pveCreateLVM',
subject: 'LVM Volume Group',
showProgress: true,
onlineHelp: 'chapter_storage',
initComponent : function() {
var me = this;
if (!me.nodename) {
throw "no node name specified";
}
me.isCreate = true;
Ext.applyIf(me, {
url: "/nodes/" + me.nodename + "/disks/lvm",
method: 'POST',
items: [
{
xtype: 'pveDiskSelector',
name: 'device',
nodename: me.nodename,
diskType: 'unused',
fieldLabel: gettext('Disk'),
allowBlank: false
},
{
xtype: 'proxmoxtextfield',
name: 'name',
fieldLabel: gettext('Name'),
allowBlank: false
},
{
xtype: 'proxmoxcheckbox',
name: 'add_storage',
fieldLabel: gettext('Add Storage'),
value: '1'
}
]
});
me.callParent();
}
});
Ext.define('PVE.node.LVMList', {
extend: 'Ext.tree.Panel',
xtype: 'pveLVMList',
emptyText: gettext('No Volume Groups found'),
stateful: true,
stateId: 'grid-node-lvm',
columns: [
{
xtype: 'treecolumn',
text: gettext('Name'),
dataIndex: 'name',
flex: 1
},
{
text: gettext('Number of LVs'),
dataIndex: 'lvcount',
width: 150,
align: 'right'
},
{
header: gettext('Usage'),
width: 110,
dataIndex: 'usage',
tdCls: 'x-progressbar-default-cell',
xtype: 'widgetcolumn',
widget: {
xtype: 'pveProgressBar'
}
},
{
header: gettext('Size'),
width: 100,
align: 'right',
sortable: true,
renderer: Proxmox.Utils.format_size,
dataIndex: 'size'
},
{
header: gettext('Free'),
width: 100,
align: 'right',
sortable: true,
renderer: Proxmox.Utils.format_size,
dataIndex: 'free'
}
],
rootVisible: false,
useArrows: true,
tbar: [
{
text: gettext('Reload'),
iconCls: 'fa fa-refresh',
handler: function() {
var me = this.up('panel');
me.reload();
}
},
{
text: gettext('Create') + ': Volume Group',
handler: function() {
var me = this.up('panel');
var win = Ext.create('PVE.node.CreateLVM', {
nodename: me.nodename,
taskDone: function() {
me.reload();
}
}).show();
}
}
],
reload: function() {
var me = this;
var sm = me.getSelectionModel();
Proxmox.Utils.API2Request({
url: "/nodes/" + me.nodename + "/disks/lvm",
waitMsgTarget: me,
method: 'GET',
failure: function(response, opts) {
Proxmox.Utils.setErrorMask(me, response.htmlStatus);
},
success: function(response, opts) {
sm.deselectAll();
me.setRootNode(response.result.data);
me.expandAll();
}
});
},
listeners: {
activate: function() {
var me = this;
me.reload();
}
},
initComponent: function() {
/*jslint confusion: true */
var me = this;
me.nodename = me.pveSelNode.data.node;
if (!me.nodename) {
throw "no node name specified";
}
var sm = Ext.create('Ext.selection.TreeModel', {});
Ext.apply(me, {
selModel: sm,
fields: ['name', 'size', 'free',
{
type: 'string',
name: 'iconCls',
calculate: function(data) {
var txt = 'fa x-fa-tree fa-';
txt += (data.leaf) ? 'hdd-o' : 'object-group';
return txt;
}
},
{
type: 'number',
name: 'usage',
calculate: function(data) {
return ((data.size-data.free)/data.size);
}
}
],
sorters: 'name'
});
me.callParent();
me.reload();
}
});