ui: tape: add PoolConfig

CRUD interface to manage media pools

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-01-28 12:59:50 +01:00 committed by Dietmar Maurer
parent c642aec128
commit dec3147501
2 changed files with 120 additions and 0 deletions

View File

@ -23,6 +23,7 @@ TAPE_UI_FILES= \
tape/BackupOverview.js \ tape/BackupOverview.js \
tape/ChangerStatus.js \ tape/ChangerStatus.js \
tape/DriveConfig.js \ tape/DriveConfig.js \
tape/PoolConfig.js \
TapeManagement.js TapeManagement.js
endif endif

119
www/tape/PoolConfig.js Normal file
View File

@ -0,0 +1,119 @@
Ext.define('pbs-model-media-pool', {
extend: 'Ext.data.Model',
fields: ['drive', 'name', 'allocation', 'retention', 'template', 'encrypt'],
idProperty: 'name',
});
Ext.define('PBS.TapeManagement.PoolPanel', {
extend: 'Ext.grid.Panel',
alias: 'widget.pbsMediaPoolPanel',
controller: {
xclass: 'Ext.app.ViewController',
onAdd: function() {
let me = this;
Ext.create('PBS.TapeManagement.PoolEditWindow', {
listeners: {
destroy: function() {
me.reload();
},
},
}).show();
},
onEdit: function() {
let me = this;
let view = me.getView();
let selection = view.getSelection();
if (!selection || selection.length < 1) {
return;
}
Ext.create('PBS.TapeManagement.PoolEditWindow', {
poolid: selection[0].data.name,
autoLoad: true,
listeners: {
destroy: () => me.reload(),
},
}).show();
},
reload: function() {
this.getView().getStore().rstore.load();
},
stopStore: function() {
this.getView().getStore().rstore.stopUpdate();
},
startStore: function() {
this.getView().getStore().rstore.startUpdate();
},
},
listeners: {
beforedestroy: 'stopStore',
deactivate: 'stopStore',
activate: 'startStore',
itemdblclick: 'onEdit',
},
store: {
type: 'diff',
rstore: {
type: 'update',
storeid: 'proxmox-tape-media-pools',
model: 'pbs-model-media-pool',
proxy: {
type: 'proxmox',
url: "/api2/json/config/media-pool",
},
},
sorters: 'name',
},
tbar: [
{
text: gettext('Add'),
xtype: 'proxmoxButton',
handler: 'onAdd',
selModel: false,
},
'-',
{
text: gettext('Edit'),
xtype: 'proxmoxButton',
handler: 'onEdit',
disabled: true,
},
{
xtype: 'proxmoxStdRemoveButton',
baseurl: '/api2/extjs/config/media-pool',
callback: 'reload',
},
],
columns: [
{
text: gettext('Name'),
dataIndex: 'name',
},
{
text: gettext('Drive'),
dataIndex: 'drive',
},
{
text: gettext('Allocation'),
dataIndex: 'allocation',
},
{
text: gettext('Retention'),
dataIndex: 'retention',
},
{
text: gettext('Encryption Fingerprint'),
dataIndex: 'encryption',
},
],
});