]> git.proxmox.com Git - proxmox-backup.git/commitdiff
ui: add DiskList and DirectoryList
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 16 Jun 2020 09:13:34 +0000 (11:13 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 16 Jun 2020 11:36:32 +0000 (13:36 +0200)
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 <d.csapak@proxmox.com>
www/DirectoryList.js [new file with mode: 0644]
www/Makefile
www/NavigationTree.js
www/window/CreateDirectory.js [new file with mode: 0644]

diff --git a/www/DirectoryList.js b/www/DirectoryList.js
new file mode 100644 (file)
index 0000000..00531fd
--- /dev/null
@@ -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',
+    },
+});
index 878a6e9d75170e0668f51c1053097aa7436bbd27..5a84d43eaf056386391e9355c1f09f8be8684c89 100644 (file)
@@ -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                          \
index 68831d3cec8bd9b12cb1b14f0f0112eac136f6f0..16b8c73a0e136ca7deebe8eb01e899fb94e65155 100644 (file)
@@ -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 (file)
index 0000000..3d6570a
--- /dev/null
@@ -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',
+       },
+    ],
+});
+