2021-01-28 11:59:50 +00:00
|
|
|
Ext.define('pbs-model-media-pool', {
|
|
|
|
extend: 'Ext.data.Model',
|
2021-03-02 10:43:25 +00:00
|
|
|
fields: [
|
|
|
|
'name', 'allocation', 'retention', 'template', 'encrypt', 'comment',
|
|
|
|
{
|
|
|
|
name: 'encryption',
|
|
|
|
type: 'bool',
|
|
|
|
calculate: function(data) {
|
|
|
|
return !!data.encrypt;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2021-01-28 11:59:50 +00:00
|
|
|
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();
|
|
|
|
},
|
2021-03-03 14:00:53 +00:00
|
|
|
|
|
|
|
init: function(view) {
|
|
|
|
Proxmox.Utils.monStoreErrors(view, view.getStore().rstore);
|
|
|
|
},
|
2021-01-28 11:59:50 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
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',
|
2021-02-04 12:56:31 +00:00
|
|
|
flex: 1,
|
2021-01-28 11:59:50 +00:00
|
|
|
},
|
|
|
|
{
|
2021-03-28 11:28:36 +00:00
|
|
|
text: gettext('Allocation Policy'),
|
2021-01-28 11:59:50 +00:00
|
|
|
dataIndex: 'allocation',
|
|
|
|
},
|
|
|
|
{
|
2021-03-28 11:28:36 +00:00
|
|
|
text: gettext('Retention Policy'),
|
2021-01-28 11:59:50 +00:00
|
|
|
dataIndex: 'retention',
|
2021-03-02 10:43:25 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext('Encryption'),
|
|
|
|
dataIndex: 'encryption',
|
|
|
|
renderer: Proxmox.Utils.format_boolean,
|
2021-01-28 11:59:50 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext('Encryption Fingerprint'),
|
2021-01-28 14:50:01 +00:00
|
|
|
dataIndex: 'encrypt',
|
2021-03-02 10:43:25 +00:00
|
|
|
hidden: true,
|
|
|
|
flex: 3,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext('Comment'),
|
|
|
|
dataIndex: 'comment',
|
2021-02-04 12:56:31 +00:00
|
|
|
flex: 3,
|
2021-01-28 11:59:50 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|