From f1baa7f4fc463a5fbc2b61994e1ee2a7b7c49608 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 20 Dec 2019 17:17:44 +0100 Subject: [PATCH] ui: ds content: add reload button, use view controller Signed-off-by: Thomas Lamprecht --- Cargo.toml | 3 ++- www/DataStoreContent.js | 58 ++++++++++++++++++++++++----------------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c24719c7..abe0ee62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,8 @@ pam = "0.7" pam-sys = "0.5" percent-encoding = "2.1" 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" rustyline = "5.0.5" serde = { version = "1.0", features = ["derive"] } diff --git a/www/DataStoreContent.js b/www/DataStoreContent.js index 8ac001f4..aa24db60 100644 --- a/www/DataStoreContent.js +++ b/www/DataStoreContent.js @@ -13,6 +13,32 @@ Ext.define('PBS.DataStoreContent', { extend: 'Ext.grid.GridPanel', 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: [ { header: gettext('Type'), @@ -42,32 +68,16 @@ Ext.define('PBS.DataStoreContent', { }, ], + tbar: [ + { + text: gettext('Reload'), + iconCls: 'fa fa-refresh', + handler: 'reload', + }, + ], + 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(); - - Proxmox.Utils.monStoreErrors(me, me.store, true); - me.reload(); // initial load - } });