label : "Confirm on batch deletion",\r
type : "boolean",\r
defaultValue : true\r
+ },\r
+ "slc.batch.autoclear" : {\r
+ label : "Autoclear batch on execution",\r
+ type : "boolean",\r
+ defaultValue : false\r
}\r
}\r
},\r
menu : "Launcher",\r
toolbar : "batch",\r
callback : function(e) {\r
- if (this.getBatchAgentId()) {\r
- this.executeBatchOnAgent(this.getBatchAgentId());\r
+ var batchAgentId = this.getBatchAgentId();\r
+ if (!batchAgentId) {\r
+ return; \r
}\r
+ var prefName = "slc.batch.autoclear";\r
+ var prefValue = this.getRiaPreferenceValue(prefName);\r
+ if(prefValue !== null){\r
+ this.executeBatchOnAgent(batchAgentId, prefValue);\r
+ return;\r
+ }\r
+ var modal = new org.argeo.ria.components.Modal("Clear?", null);\r
+ modal.addYesNoReminder("Do you want to clear the batch automatically after execution?", prefName);\r
+ modal.addListener("cancel", function(e){\r
+ this.executeBatchOnAgent(batchAgentId, false);\r
+ }, this);\r
+ modal.addListener("ok", function(e){\r
+ this.executeBatchOnAgent(batchAgentId, true);\r
+ }, this);\r
+ modal.attachAndShow(); \r
},\r
command : null\r
},\r
* @param agentUuid\r
* {String} The id of the target agent\r
*/\r
- executeBatchOnAgent : function(agentUuid) {\r
+ executeBatchOnAgent : function(agentUuid, clearBatch) {\r
var selection = this.list.getChildren();\r
if (!selection.length)\r
return;\r
var batchEntrySpec = selection[i].getUserData("batchEntrySpec");\r
slcExecMessage.addBatchEntrySpec(batchEntrySpec);\r
}\r
- var req = org.argeo.slc.ria.SlcApi.getNewSlcExecutionService(\r
- agentUuid, slcExecMessage.toXml());\r
- req.send();\r
- // Force logs refresh right now!\r
- qx.event.Timer.once(function() {\r
- var command = org.argeo.ria.event.CommandsManager\r
- .getInstance().getCommandById("reloadlogs");\r
- if (command) {\r
- command.execute();\r
- }\r
- }, this, 2000);\r
+ try{\r
+ var xmlMessage = slcExecMessage.toXml();\r
+ var req = org.argeo.slc.ria.SlcApi.getNewSlcExecutionService(\r
+ agentUuid, xmlMessage);\r
+ req.send();\r
+ // Force logs refresh right now!\r
+ qx.event.Timer.once(function() {\r
+ var command = org.argeo.ria.event.CommandsManager\r
+ .getInstance().getCommandById("reloadlogs");\r
+ if (command) {\r
+ command.execute();\r
+ }\r
+ }, this, 2000);\r
+ if(clearBatch){\r
+ req.addListener("completed", function(e){\r
+ this.list.removeAll();\r
+ }, this);\r
+ } \r
+ }catch(e){\r
+ this.error(e); \r
+ }\r
},\r
\r
clearBatchForAgentId : function(agentId){\r