X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=server%2Forg.argeo.slc.ria%2Fsrc%2Fargeo-ria-lib%2Fslc%2Fclass%2Forg%2Fargeo%2Fslc%2Fria%2FBatchView.js;h=78715de0403652f23aad1095fc6ccf67ba59daa7;hb=096964f665fc3b0e3d233b498b8b30823ae5fa36;hp=0574296710dd1943a28b6835353d59ea005593ae;hpb=0d3e11ceb470772cd6bc7218d23bc6985ad6f56b;p=gpl%2Fargeo-slc.git diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/BatchView.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/BatchView.js index 057429671..78715de04 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/BatchView.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/BatchView.js @@ -12,6 +12,11 @@ qx.Class.define("org.argeo.slc.ria.BatchView", label : "Confirm on batch deletion", type : "boolean", defaultValue : true + }, + "slc.batch.autoclear" : { + label : "Autoclear batch on execution", + type : "boolean", + defaultValue : false } } }, @@ -31,9 +36,25 @@ qx.Class.define("org.argeo.slc.ria.BatchView", menu : "Launcher", toolbar : "batch", callback : function(e) { - if (this.getBatchAgentId()) { - this.executeBatchOnAgent(this.getBatchAgentId()); + var batchAgentId = this.getBatchAgentId(); + if (!batchAgentId) { + return; } + var prefName = "slc.batch.autoclear"; + var prefValue = this.getRiaPreferenceValue(prefName); + if(prefValue !== null){ + this.executeBatchOnAgent(batchAgentId, prefValue); + return; + } + var modal = new org.argeo.ria.components.Modal("Clear?", null); + modal.addYesNoReminder("Do you want to clear the batch automatically after execution?", prefName); + modal.addListener("cancel", function(e){ + this.executeBatchOnAgent(batchAgentId, false); + }, this); + modal.addListener("ok", function(e){ + this.executeBatchOnAgent(batchAgentId, true); + }, this); + modal.attachAndShow(); }, command : null }, @@ -396,7 +417,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView", * @param agentUuid * {String} The id of the target agent */ - executeBatchOnAgent : function(agentUuid) { + executeBatchOnAgent : function(agentUuid, clearBatch) { var selection = this.list.getChildren(); if (!selection.length) return; @@ -418,6 +439,11 @@ qx.Class.define("org.argeo.slc.ria.BatchView", command.execute(); } }, this, 2000); + if(clearBatch){ + req.addListener("completed", function(e){ + this.list.removeAll(); + }, this); + } }catch(e){ this.error(e); }