diff --git a/www/Makefile b/www/Makefile index 9a6ff357..27a89d90 100644 --- a/www/Makefile +++ b/www/Makefile @@ -23,6 +23,7 @@ TAPE_UI_FILES= \ tape/BackupOverview.js \ tape/ChangerStatus.js \ tape/DriveConfig.js \ + tape/PoolConfig.js \ TapeManagement.js endif diff --git a/www/tape/PoolConfig.js b/www/tape/PoolConfig.js new file mode 100644 index 00000000..1782d9dc --- /dev/null +++ b/www/tape/PoolConfig.js @@ -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', + }, + ], +}); +