From 5f44899207b36ebebba4b281ee5f6ab432dc2482 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 26 Mar 2020 17:23:51 +0100 Subject: [PATCH] gui - DataStoreContent: move control code into controller (cleanup) --- www/DataStoreContent.js | 45 +++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/www/DataStoreContent.js b/www/DataStoreContent.js index 82beeb23..8c9d24af 100644 --- a/www/DataStoreContent.js +++ b/www/DataStoreContent.js @@ -114,6 +114,25 @@ Ext.define('PBS.DataStoreContent', { }); }, + + onPrune: function() { + var view = this.getView(); + + let rec = view.selModel.getSelection()[0]; + if (!(rec && rec.data)) return; + let data = rec.data; + if (data.leaf) return; + + if (!view.datastore) return; + + let win = Ext.create('PBS.DataStorePrune', { + datastore: view.datastore, + backup_type: data.backup_type, + backup_id: data.backup_id, + }); + win.on('destroy', this.reload, this); + win.show(); + } }, initComponent: function() { @@ -125,30 +144,8 @@ Ext.define('PBS.DataStoreContent', { text: gettext('Prune'), disabled: true, selModel: sm, - enableFn: function(record) { - return !record.data.leaf; - }, - handler: function() { - let rec = sm.getSelection()[0]; - if (!(rec && rec.data)) return; - let data = rec.data; - if (data.leaf) return; - - console.log(data); - - console.log("PRUNE GROUP: " + me.datastore); - - if (!me.datastore) return; - - let win = Ext.create('PBS.DataStorePrune', { - datastore: me.datastore, - backup_type: data.backup_type, - backup_id: data.backup_id, - }); - win.on('destroy', me.getController().reload, me.getController()); - win.show(); - - } + enableFn: function(record) { return !record.data.leaf; }, + handler: 'onPrune', }); Ext.apply(me, {