add Directory list/create gui

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2018-07-30 10:26:10 +02:00 committed by Dietmar Maurer
parent 7f794dcb22
commit 5cae151d8f
3 changed files with 167 additions and 0 deletions

View File

@ -100,6 +100,7 @@ JSSRC= \
node/Disks.js \
node/LVM.js \
node/LVMThin.js \
node/Directory.js \
node/StatusView.js \
node/Summary.js \
node/Subscription.js \

View File

@ -280,6 +280,13 @@ Ext.define('PVE.node.Config', {
groups: ['storage'],
xtype: 'pveLVMThinList'
},
{
title: Proxmox.Utils.directoryText,
itemId: 'directory',
iconCls: 'fa fa-folder',
groups: ['storage'],
xtype: 'pveDirectoryList'
},
{
title: 'Ceph',
itemId: 'ceph',

View File

@ -0,0 +1,159 @@
Ext.define('PVE.node.CreateDirectory', {
extend: 'Proxmox.window.Edit',
xtype: 'pveCreateDirectory',
subject: Proxmox.Utils.directoryText,
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/directory",
method: 'POST',
items: [
{
xtype: 'pveDiskSelector',
name: 'device',
nodename: me.nodename,
diskType: 'unused',
fieldLabel: gettext('Disk'),
allowBlank: false
},
{
xtype: 'proxmoxKVComboBox',
comboItems: [
['ext4', 'ext4'],
['xfs', 'xfs']
],
fieldLabel: gettext('Filesystem'),
name: 'filesystem',
value: '',
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.Directorylist', {
extend: 'Ext.grid.Panel',
xtype: 'pveDirectoryList',
stateful: true,
stateId: 'grid-node-directory',
columns: [
{
text: gettext('Path'),
dataIndex: 'path',
flex: 1
},
{
header: gettext('Device'),
flex: 1,
dataIndex: 'device'
},
{
header: gettext('Type'),
width: 100,
dataIndex: 'type'
},
{
header: gettext('Options'),
width: 100,
dataIndex: 'options'
},
{
header: gettext('Unit File'),
hidden: true,
dataIndex: 'unitfile'
}
],
rootVisible: false,
useArrows: true,
tbar: [
{
text: gettext('Reload'),
iconCls: 'fa fa-refresh',
handler: function() {
var me = this.up('panel');
me.reload();
}
},
{
text: gettext('Create') + ': Directory',
handler: function() {
var me = this.up('panel');
var win = Ext.create('PVE.node.CreateDirectory', {
nodename: me.nodename
}).show();
win.on('destroy', function() { me.reload(); });
}
}
],
reload: function() {
var me = this;
me.store.load();
me.store.sort();
},
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";
}
Ext.apply(me, {
store: {
fields: ['path', 'device', 'type', 'options', 'unitfile' ],
proxy: {
type: 'proxmox',
url: "/api2/json/nodes/" + me.nodename + '/disks/directory'
},
sorters: 'path'
}
});
me.callParent();
Proxmox.Utils.monStoreErrors(me, me.getStore(), true);
me.reload();
}
});