]> 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 6a7f50b8e2efc7f24aee4fa1591d859863e23475..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
@@ -16,7 +25,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
                        init : {\r
                                "submitform" : {\r
                                        label : "Execute Batch",\r
-                                       icon : "resource/slc/media-playback-start.png",\r
+                                       icon : "org.argeo.slc.ria/media-playback-start.png",\r
                                        shortcut : null,\r
                                        enabled : false,\r
                                        menu : "Launcher",\r
@@ -31,7 +40,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
                                /*\r
                                "toggleopenonadd" : {\r
                                        label : "Auto edit on Add",\r
-                                       icon : "resource/slc/document-open.png",\r
+                                       icon : "org.argeo.slc.ria/document-open.png",\r
                                        shortcut : null,\r
                                        enabled : true,\r
                                        toggle : true,\r
@@ -46,7 +55,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
                                },\r
                                "editexecutionspecs" : {\r
                                        label : "Edit Execution Specs",\r
-                                       icon : "resource/slc/document-open.png",\r
+                                       icon : "org.argeo.slc.ria/document-open.png",\r
                                        shortcut : null,\r
                                        enabled : false,\r
                                        menu : "Launcher",\r
@@ -75,26 +84,34 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
                                */\r
                                "removefrombatch" : {\r
                                        label : "Remove from batch",\r
-                                       icon : "resource/slc/edit-delete.png",\r
+                                       icon : "org.argeo.slc.ria/edit-delete.png",\r
                                        shortcut : null,\r
                                        enabled : false,\r
                                        menu : "Launcher",\r
                                        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
@@ -107,7 +124,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
                                },\r
                                "clearbatch" : {\r
                                        label : "Clear batch",\r
-                                       icon : "resource/slc/user-trash-full.png",\r
+                                       icon : "org.argeo.slc.ria/user-trash-full.png",\r
                                        shortcut : null,\r
                                        enabled : true,\r
                                        menu : "Launcher",\r
@@ -269,7 +286,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
 \r
                        this.dropDecorator = new qx.ui.decoration.Background();                 \r
                        this.dropDecorator.set({\r
-                               backgroundImage : "resource/slc/drophere.gif",\r
+                               backgroundImage : "org.argeo.slc.ria/drophere.gif",\r
                                backgroundRepeat : "no-repeat"\r
                        });\r
 \r
@@ -346,7 +363,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
                        var batchEntry = new org.argeo.slc.ria.execution.BatchEntrySpec(\r
                                        executionModule, executionFlow);\r
                        var label = batchEntry.getLabel();\r
-                       var icon = target.getIcon() || "resource/slc/office-document.png";\r
+                       var icon = target.getIcon() || "org.argeo.slc.ria/office-document.png";\r
                        var item = new qx.ui.form.ListItem(label, icon);\r
                        /*\r
                        item.addListener("dblclick", function(e) {\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