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 <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-06-16 11:13:34 +02:00 committed by Dietmar Maurer
parent fb5a066500
commit 7f17f7444a
4 changed files with 157 additions and 1 deletions

90
www/DirectoryList.js Normal file
View File

@ -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',
},
});

View File

@ -18,11 +18,13 @@ JSSRC= \
window/SyncJobEdit.js \ window/SyncJobEdit.js \
window/ACLEdit.js \ window/ACLEdit.js \
window/DataStoreEdit.js \ window/DataStoreEdit.js \
window/CreateDirectory.js \
dashboard/DataStoreStatistics.js \ dashboard/DataStoreStatistics.js \
dashboard/LongestTasks.js \ dashboard/LongestTasks.js \
dashboard/RunningTasks.js \ dashboard/RunningTasks.js \
dashboard/TaskSummary.js \ dashboard/TaskSummary.js \
Utils.js \ Utils.js \
DirectoryList.js \
LoginView.js \ LoginView.js \
VersionInfo.js \ VersionInfo.js \
SystemConfiguration.js \ SystemConfiguration.js \

View File

@ -54,7 +54,24 @@ Ext.define('PBS.store.NavigationStore', {
text: gettext('Administration'), text: gettext('Administration'),
iconCls: 'fa fa-wrench', iconCls: 'fa fa-wrench',
path: 'pbsServerAdministration', 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'), text: gettext('Data Store'),

View File

@ -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',
},
],
});