ui: ds content: add reload button, use view controller

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2019-12-20 17:17:44 +01:00
parent d9c38ddc1b
commit f1baa7f4fc
2 changed files with 36 additions and 25 deletions

View File

@ -29,7 +29,8 @@ pam = "0.7"
pam-sys = "0.5" pam-sys = "0.5"
percent-encoding = "2.1" percent-encoding = "2.1"
pin-utils = "0.1.0-alpha" pin-utils = "0.1.0-alpha"
proxmox = { git = "ssh://gitolite3@proxdev.maurer-it.com/rust/proxmox", version = "0.1", features = [ "sortable-macro", "api-macro" ] } #proxmox = { git = "ssh://gitolite3@proxdev.maurer-it.com/rust/proxmox", version = "0.1", features = [ "sortable-macro", "api-macro" ] }
proxmox = { path = "/root/sources/pbs/proxmox/proxmox", version = "0.1", features = [ "sortable-macro", "api-macro" ] }
regex = "1.2" regex = "1.2"
rustyline = "5.0.5" rustyline = "5.0.5"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View File

@ -13,6 +13,32 @@ Ext.define('PBS.DataStoreContent', {
extend: 'Ext.grid.GridPanel', extend: 'Ext.grid.GridPanel',
alias: 'widget.pbsDataStoreContent', alias: 'widget.pbsDataStoreContent',
controller: {
xclass: 'Ext.app.ViewController',
init: function(view) {
if (!view.datastore) {
throw "no datastore specified";
}
view.title = gettext('Data Store Content: ') + view.datastore;
Proxmox.Utils.monStoreErrors(view, view.store, true);
this.reload(); // initial load
},
reload: function() {
var view = this.getView();
let url = `/api2/json/admin/datastore/${view.datastore}/snapshots`;
view.store.setProxy({
type: 'proxmox',
url: url
});
view.store.load();
},
},
columns: [ columns: [
{ {
header: gettext('Type'), header: gettext('Type'),
@ -42,32 +68,16 @@ Ext.define('PBS.DataStoreContent', {
}, },
], ],
tbar: [
{
text: gettext('Reload'),
iconCls: 'fa fa-refresh',
handler: 'reload',
},
],
store: { store: {
model: 'pbs-data-store-content', model: 'pbs-data-store-content',
sorters: 'name', 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();
Proxmox.Utils.monStoreErrors(me, me.store, true);
me.reload(); // initial load
}
}); });