ui: datastore content: refactor to more schematic definition

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2019-12-20 17:03:28 +01:00
parent ed61472b36
commit 9d4ebe3dfe
1 changed files with 39 additions and 42 deletions

View File

@ -7,32 +7,6 @@ Ext.define('PBS.DataStoreContent', {
extend: 'Ext.grid.GridPanel',
alias: 'widget.pbsDataStoreContent',
initComponent : function() {
var me = this;
if (!me.datastore) {
throw "no datastore specified";
}
me.title = gettext('Data Store Content: ') + me.datastore;
var store = new Ext.data.Store({
model: 'pbs-data-store-content',
sorters: 'name',
});
var reload = function() {
var url = '/api2/json/admin/datastore/' + me.datastore + '/snapshots';
me.store.setProxy({
type: 'proxmox',
url: url
});
me.store.load();
};
Ext.apply(me, {
store: store,
columns: [
{
header: gettext('Type'),
@ -52,12 +26,35 @@ Ext.define('PBS.DataStoreContent', {
dataIndex: 'backup-time',
renderer: Proxmox.Utils.render_timestamp,
flex: 1
}
},
],
store: {
model: 'pbs-data-store-content',
sorters: 'name',
},
reload: function() {
let url = `/api2/json/admin/datastore/${this.datastore}/snapshots`;
this.store.setProxy({
type: 'proxmox',
url: url
});
this.store.load();
},
initComponent : function() {
var me = this;
if (!me.datastore) {
throw "no datastore specified";
}
me.title = gettext('Data Store Content: ') + me.datastore;
me.callParent();
reload();
Proxmox.Utils.monStoreErrors(me, me.store, true);
me.reload(); // initial load
}
});