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=0574296710dd1943a28b6835353d59ea005593ae;hb=e0be1cede09ad3163fd389e327191cac8ccea575;hp=6a7f50b8e2efc7f24aee4fa1591d859863e23475;hpb=bf27bbe08d2a25a36bd91a1a116cce196e0537f8;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 6a7f50b8e..057429671 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 @@ -5,7 +5,16 @@ qx.Class.define("org.argeo.slc.ria.BatchView", { extend : qx.ui.container.Composite, implement : [org.argeo.ria.components.IView], - + include : [org.argeo.ria.session.MPrefHolder], + statics : { + riaPreferences : { + "slc.batch.delete.confirm" : { + label : "Confirm on batch deletion", + type : "boolean", + defaultValue : true + } + } + }, properties : { /** @@ -16,7 +25,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView", init : { "submitform" : { label : "Execute Batch", - icon : "resource/slc/media-playback-start.png", + icon : "org.argeo.slc.ria/media-playback-start.png", shortcut : null, enabled : false, menu : "Launcher", @@ -31,7 +40,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView", /* "toggleopenonadd" : { label : "Auto edit on Add", - icon : "resource/slc/document-open.png", + icon : "org.argeo.slc.ria/document-open.png", shortcut : null, enabled : true, toggle : true, @@ -46,7 +55,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView", }, "editexecutionspecs" : { label : "Edit Execution Specs", - icon : "resource/slc/document-open.png", + icon : "org.argeo.slc.ria/document-open.png", shortcut : null, enabled : false, menu : "Launcher", @@ -75,26 +84,34 @@ qx.Class.define("org.argeo.slc.ria.BatchView", */ "removefrombatch" : { label : "Remove from batch", - icon : "resource/slc/edit-delete.png", + icon : "org.argeo.slc.ria/edit-delete.png", shortcut : null, enabled : false, menu : "Launcher", toolbar : "batch", callback : function(e) { var sel = this.list.getSortedSelection(); - var modal = new org.argeo.ria.components.Modal("Confirm", null); - modal.addConfirm("Are you sure you want to remove
the selected test" - + (sel.length > 1 ? "s" : "") - + " from the Batch?"); - modal.addListener("ok", function() { - for (var i = 0; i < sel.length; i++) { - this.list.remove(sel[i]); - } - if (!this.list.hasChildren()) { - this.setBatchAgentId(null); - } - }, this); - modal.attachAndShow(); + var confirmPref = this.getRiaPreferenceValue("slc.batch.delete.confirm"); + this.debug(confirmPref); + var execution = function() { + for (var i = 0; i < sel.length; i++) { + this.list.remove(sel[i]); + } + if (!this.list.hasChildren()) { + this.setBatchAgentId(null); + } + } + if(confirmPref){ + var modal = new org.argeo.ria.components.Modal("Confirm", null); + modal.addConfirm("Are you sure you want to remove
the selected test" + + (sel.length > 1 ? "s" : "") + + " from the Batch?"); + modal.addListener("ok", execution, this); + modal.attachAndShow(); + }else{ + execution = qx.lang.Function.bind(execution, this); + execution(); + } }, selectionChange : function(viewId, selection) { if (viewId != "batch:list") @@ -107,7 +124,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView", }, "clearbatch" : { label : "Clear batch", - icon : "resource/slc/user-trash-full.png", + icon : "org.argeo.slc.ria/user-trash-full.png", shortcut : null, enabled : true, menu : "Launcher", @@ -269,7 +286,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView", this.dropDecorator = new qx.ui.decoration.Background(); this.dropDecorator.set({ - backgroundImage : "resource/slc/drophere.gif", + backgroundImage : "org.argeo.slc.ria/drophere.gif", backgroundRepeat : "no-repeat" }); @@ -346,7 +363,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView", var batchEntry = new org.argeo.slc.ria.execution.BatchEntrySpec( executionModule, executionFlow); var label = batchEntry.getLabel(); - var icon = target.getIcon() || "resource/slc/office-document.png"; + var icon = target.getIcon() || "org.argeo.slc.ria/office-document.png"; var item = new qx.ui.form.ListItem(label, icon); /* item.addListener("dblclick", function(e) { @@ -388,17 +405,22 @@ qx.Class.define("org.argeo.slc.ria.BatchView", var batchEntrySpec = selection[i].getUserData("batchEntrySpec"); slcExecMessage.addBatchEntrySpec(batchEntrySpec); } - var req = org.argeo.slc.ria.SlcApi.getNewSlcExecutionService( - agentUuid, slcExecMessage.toXml()); - req.send(); - // Force logs refresh right now! - qx.event.Timer.once(function() { - var command = org.argeo.ria.event.CommandsManager - .getInstance().getCommandById("reloadlogs"); - if (command) { - command.execute(); - } - }, this, 2000); + try{ + var xmlMessage = slcExecMessage.toXml(); + var req = org.argeo.slc.ria.SlcApi.getNewSlcExecutionService( + agentUuid, xmlMessage); + req.send(); + // Force logs refresh right now! + qx.event.Timer.once(function() { + var command = org.argeo.ria.event.CommandsManager + .getInstance().getCommandById("reloadlogs"); + if (command) { + command.execute(); + } + }, this, 2000); + }catch(e){ + this.error(e); + } }, clearBatchForAgentId : function(agentId){