]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/BatchView.js
Cleaning, ref management, label/tooltips in tree, etc.
[gpl/argeo-slc.git] / server / org.argeo.slc.ria / src / argeo-ria-lib / slc / class / org / argeo / slc / ria / BatchView.js
index 4ca360b1b5ef1d6d138a1030bdb4f3ceb31c36e9..0574296710dd1943a28b6835353d59ea005593ae 100644 (file)
@@ -5,7 +5,16 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
 {\r
        extend : qx.ui.container.Composite,\r
        implement : [org.argeo.ria.components.IView], \r
-\r
+       include : [org.argeo.ria.session.MPrefHolder],\r
+       statics : {\r
+               riaPreferences : {\r
+                       "slc.batch.delete.confirm" : {\r
+                               label : "Confirm on batch deletion",\r
+                               type  : "boolean",\r
+                               defaultValue  : true\r
+                       }\r
+               }\r
+       },\r
        properties : \r
        {\r
                /**\r
@@ -82,19 +91,27 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
                                        toolbar : "batch",\r
                                        callback : function(e) {\r
                                                var sel = this.list.getSortedSelection();\r
-                                               var modal = new org.argeo.ria.components.Modal("Confirm", null);\r
-                                               modal.addConfirm("Are you sure you want to remove<br> the selected test"\r
-                                                                               + (sel.length > 1 ? "s" : "")\r
-                                                                               + " from the Batch?");\r
-                                               modal.addListener("ok", function() {\r
-                                                                       for (var i = 0; i < sel.length; i++) {\r
-                                                                               this.list.remove(sel[i]);\r
-                                                                       }\r
-                                                                       if (!this.list.hasChildren()) {\r
-                                                                               this.setBatchAgentId(null);\r
-                                                                       }\r
-                                                               }, this);\r
-                                               modal.attachAndShow();\r
+                                               var confirmPref = this.getRiaPreferenceValue("slc.batch.delete.confirm");\r
+                                               this.debug(confirmPref);\r
+                                               var execution = function() {\r
+                                                       for (var i = 0; i < sel.length; i++) {\r
+                                                               this.list.remove(sel[i]);\r
+                                                       }\r
+                                                       if (!this.list.hasChildren()) {\r
+                                                               this.setBatchAgentId(null);\r
+                                                       }\r
+                                               }\r
+                                               if(confirmPref){\r
+                                                       var modal = new org.argeo.ria.components.Modal("Confirm", null);\r
+                                                       modal.addConfirm("Are you sure you want to remove<br> the selected test"\r
+                                                                                       + (sel.length > 1 ? "s" : "")\r
+                                                                                       + " from the Batch?");\r
+                                                       modal.addListener("ok", execution, this);\r
+                                                       modal.attachAndShow();\r
+                                               }else{\r
+                                                       execution = qx.lang.Function.bind(execution, this);\r
+                                                       execution();\r
+                                               }\r
                                        },\r
                                        selectionChange : function(viewId, selection) {\r
                                                if (viewId != "batch:list")\r
@@ -388,17 +405,22 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
                                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
+                       }catch(e){\r
+                               this.error(e);                          \r
+                       }\r
                },\r
                \r
                clearBatchForAgentId : function(agentId){\r