[pmg-devel] [PATCH pmg-gui 2/3] QuarantineList: improve savedPosition behaviour
Dominik Csapak
d.csapak at proxmox.com
Wed Apr 15 09:56:44 CEST 2020
by not saving the position across time or email changes, since that
makes no real sense. (The user cannot really know what will be selected,
in contrast to when the mails will be deleted etc.)
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
js/QuarantineList.js | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/js/QuarantineList.js b/js/QuarantineList.js
index 25749ab..57f1a6e 100644
--- a/js/QuarantineList.js
+++ b/js/QuarantineList.js
@@ -18,6 +18,8 @@ Ext.define('PMG.QuarantineList', {
to: 0
},
+ allowPositionSave: false,
+
controller: {
xclass: 'Ext.app.ViewController',
@@ -67,6 +69,7 @@ Ext.define('PMG.QuarantineList', {
load: function(callback) {
var me = this;
+ me.allowPositionSave = false;
var view = me.getView();
var store = view.getStore();
if (view.emailSelection) {
@@ -82,10 +85,13 @@ Ext.define('PMG.QuarantineList', {
me.savedPosition = store.getCount() - 1;
}
view.setSelection(store.getAt(me.savedPosition));
+ } else {
+ view.setSelection();
}
if (Ext.isFunction(callback)) {
callback();
}
+ me.allowPositionSave = true;
});
},
@@ -118,6 +124,9 @@ Ext.define('PMG.QuarantineList', {
var me = this;
var list = me.getView();
+ me.allowPositionSave = false;
+ me.savedPosition = undefined;
+
if (!value) {
return;
}
@@ -158,18 +167,23 @@ Ext.define('PMG.QuarantineList', {
changeEmail: function(tb, value) {
var me = this;
+ me.savedPosition = undefined;
+ me.allowPositionSave = false;
me.setUser(value);
me.load();
},
savePosition: function(grid, selected, eopts) {
+ let me = this;
+ if (!me.allowPositionSave) {
+ return;
+ }
if (!selected.length) {
+ me.savedPosition = undefined;
return;
}
- var me = this;
var view = me.getView();
-
var id = view.getStore().indexOf(selected[0]);
me.savedPosition = id;
--
2.20.1
More information about the pmg-devel
mailing list