From ad281d1bd94caa22d3b4739412c25fa12bf996e2 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 1 Apr 2019 08:08:34 +0200 Subject: [PATCH] www/DataStoreConfig.js: add button to start GC --- src/api2/admin/datastore.rs | 1 - www/DataStoreConfig.js | 25 +++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 0e35dd42..5cf7f159 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -282,7 +282,6 @@ fn api_method_prune() -> ApiMethod { ) } -// this is just a test for mutability/mutex handling - will remove later fn start_garbage_collection( param: Value, _info: &ApiMethod, diff --git a/www/DataStoreConfig.js b/www/DataStoreConfig.js index 2a9f2090..aee51348 100644 --- a/www/DataStoreConfig.js +++ b/www/DataStoreConfig.js @@ -26,7 +26,25 @@ Ext.define('PBS.DataStoreConfig', { store.load(); }; - var tbar = [ + var sm = Ext.create('Ext.selection.RowModel', {}); + + var gc_btn = new Proxmox.button.Button({ + text: gettext('Start GC'), + disabled: true, + selModel: sm, + handler: function() { + var rec = sm.getSelection()[0]; + Proxmox.Utils.API2Request({ + url: '/admin/datastore/' + rec.data.name + '/gc', + method: 'POST', + failure: function(response) { + Ext.Msg.alert(gettext('Error'), response.htmlStatus); + } + }); + } + }); + + var tbar = [ { text: gettext('Create'), handler: function() { @@ -35,12 +53,11 @@ Ext.define('PBS.DataStoreConfig', { //win.on('destroy', reload); //win.show(); } - } + }, + gc_btn //edit_btn, remove_btn ]; - var sm = Ext.create('Ext.selection.RowModel', {}); - Proxmox.Utils.monStoreErrors(me, store); Ext.apply(me, {