[pve-devel] [PATCH manager 4/4] add Directory list/create gui
Dominik Csapak
d.csapak at proxmox.com
Mon Jul 30 10:26:10 CEST 2018
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/node/Config.js | 7 ++
www/manager6/node/Directory.js | 159 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 167 insertions(+)
create mode 100644 www/manager6/node/Directory.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 0077c873..72b01896 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -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 \
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index fb70f39a..6c4b7f1a 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -281,6 +281,13 @@ Ext.define('PVE.node.Config', {
xtype: 'pveLVMThinList'
},
{
+ title: Proxmox.Utils.directoryText,
+ itemId: 'directory',
+ iconCls: 'fa fa-folder',
+ groups: ['storage'],
+ xtype: 'pveDirectoryList'
+ },
+ {
title: 'Ceph',
itemId: 'ceph',
iconCls: 'fa fa-ceph',
diff --git a/www/manager6/node/Directory.js b/www/manager6/node/Directory.js
new file mode 100644
index 00000000..8d4831d4
--- /dev/null
+++ b/www/manager6/node/Directory.js
@@ -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();
+ }
+});
+
--
2.11.0
More information about the pve-devel
mailing list