From 7f17f7444a91fae0ff9931000fe47ad87efe38f8 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 16 Jun 2020 11:13:34 +0200 Subject: [PATCH] ui: add DiskList and DirectoryList this also contains an adapted CreateDirectory window for now this is mostly copied, since refactoring was not that straightforward (changed parameters, etc.) Signed-off-by: Dominik Csapak --- www/DirectoryList.js | 90 +++++++++++++++++++++++++++++++++++ www/Makefile | 2 + www/NavigationTree.js | 19 +++++++- www/window/CreateDirectory.js | 47 ++++++++++++++++++ 4 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 www/DirectoryList.js create mode 100644 www/window/CreateDirectory.js diff --git a/www/DirectoryList.js b/www/DirectoryList.js new file mode 100644 index 00000000..00531fd0 --- /dev/null +++ b/www/DirectoryList.js @@ -0,0 +1,90 @@ +Ext.define('PBS.admin.Directorylist', { + extend: 'Ext.grid.Panel', + xtype: 'pbsDirectoryList', + + stateful: true, + stateId: 'grid-node-directory', + + emptyText: gettext('No Mount-Units found'), + + controller: { + xclass: 'Ext.app.ViewController', + + createDirectory: function() { + let me = this; + Ext.create('PBS.window.CreateDirectory', { + listeners: { + destroy: function() { + me.reload(); + }, + }, + }).show(); + }, + + reload: function() { + let me = this; + let store = me.getView().getStore(); + store.load(); + store.sort(); + }, + + init: function(view) { + let me = this; + Proxmox.Utils.monStoreErrors(view, view.getStore(), true); + me.reload(); + }, + }, + + + rootVisible: false, + useArrows: true, + + tbar: [ + { + text: gettext('Reload'), + iconCls: 'fa fa-refresh', + handler: 'reload', + }, + { + text: gettext('Create') + ': Directory', + handler: 'createDirectory', + }, + ], + + columns: [ + { + text: gettext('Path'), + dataIndex: 'path', + flex: 1, + }, + { + header: gettext('Device'), + flex: 1, + dataIndex: 'device', + }, + { + header: gettext('Filesystem'), + width: 100, + dataIndex: 'filesystem', + }, + { + header: gettext('Options'), + width: 100, + dataIndex: 'options', + }, + { + header: gettext('Unit File'), + hidden: true, + dataIndex: 'unitfile', + }, + ], + + store: { + fields: ['path', 'device', 'filesystem', 'options', 'unitfile'], + proxy: { + type: 'proxmox', + url: '/api2/json/nodes/localhost/disks/directory', + }, + sorters: 'path', + }, +}); diff --git a/www/Makefile b/www/Makefile index 878a6e9d..5a84d43e 100644 --- a/www/Makefile +++ b/www/Makefile @@ -18,11 +18,13 @@ JSSRC= \ window/SyncJobEdit.js \ window/ACLEdit.js \ window/DataStoreEdit.js \ + window/CreateDirectory.js \ dashboard/DataStoreStatistics.js \ dashboard/LongestTasks.js \ dashboard/RunningTasks.js \ dashboard/TaskSummary.js \ Utils.js \ + DirectoryList.js \ LoginView.js \ VersionInfo.js \ SystemConfiguration.js \ diff --git a/www/NavigationTree.js b/www/NavigationTree.js index 68831d3c..16b8c73a 100644 --- a/www/NavigationTree.js +++ b/www/NavigationTree.js @@ -54,7 +54,24 @@ Ext.define('PBS.store.NavigationStore', { text: gettext('Administration'), iconCls: 'fa fa-wrench', path: 'pbsServerAdministration', - leaf: true + expanded: true, + leaf: false, + children: [ + { + text: gettext('Disks'), + iconCls: 'fa fa-hdd-o', + path: 'pmxDiskList', + leaf: false, + children: [ + { + text: Proxmox.Utils.directoryText, + iconCls: 'fa fa-folder', + path: 'pbsDirectoryList', + leaf: true, + }, + ] + } + ] }, { text: gettext('Data Store'), diff --git a/www/window/CreateDirectory.js b/www/window/CreateDirectory.js new file mode 100644 index 00000000..3d6570a7 --- /dev/null +++ b/www/window/CreateDirectory.js @@ -0,0 +1,47 @@ +Ext.define('PBS.window.CreateDirectory', { + extend: 'Proxmox.window.Edit', + xtype: 'pbsCreateDirectory', + + subject: Proxmox.Utils.directoryText, + showProgress: true, + isCreate: true, + url: '/nodes/localhost/disks/directory', + method: 'POST', + + items: [ + { + xtype: 'pmxDiskSelector', + name: 'disk', + valueField: 'name', + typeProperty: 'usage-type', + nodename: 'localhost', + 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-datastore', + fieldLabel: gettext('Add Data Store'), + value: '1', + }, + ], +}); +