toolbar : "batch",\r
callback : function(e) {\r
var sel = this.list.getSortedSelection();\r
- var confirmPref = this.getRiaPreferenceValue("slc.batch.delete.confirm");\r
- this.debug(confirmPref);\r
+ var confirmPref = this.getRiaPreferenceValue("slc.batch.delete.confirm"); \r
var execution = function() {\r
for (var i = 0; i < sel.length; i++) {\r
this.list.remove(sel[i]);\r
var executionFlow = target.getUserData("executionFlow");\r
var batchEntry = new org.argeo.slc.ria.execution.BatchEntrySpec(\r
executionModule, executionFlow);\r
- var label = batchEntry.getLabel();\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
- this.getCommands()["editexecutionspecs"].command\r
- .execute();\r
- }, this);\r
- */\r
- item.setUserData("batchEntrySpec", batchEntry);\r
+\r
+ this.appendBatchEntrySpec(batchEntry, target.getIcon(), after); \r
+ },\r
+ \r
+ appendBatchEntrySpec: function(batchEntrySpec, icon, after){\r
+ \r
+ var item = new qx.ui.form.ListItem(batchEntrySpec.getLabel(), icon || "org.argeo.slc.ria/system.png");\r
+ item.setUserData("batchEntrySpec", batchEntrySpec);\r
item.setPaddingTop(1);\r
item.setPaddingBottom(2);\r
if (after) {\r
this.list.add(item);\r
}\r
this.list.select(item);\r
- /*\r
- if (this.getAutoOpen() && !skipAutoOpen) {\r
- this.getCommands()["editexecutionspecs"].command.execute();\r
- }\r
- */\r
+ \r
},\r
\r
/**\r
}\r
try{\r
var xmlMessage = slcExecMessage.toXml();\r
+ if(!window.xmlExecStub){\r
+ window.xmlExecStub = {};\r
+ }\r
+ window.xmlExecStub[slcExecMessage.getUuid()] = qx.xml.Document.fromString(xmlMessage);\r
var req = org.argeo.slc.ria.SlcApi.getNewSlcExecutionService(\r
agentUuid, xmlMessage);\r
req.send();\r
if(clearBatch){\r
req.addListener("completed", function(e){\r
this.list.removeAll();\r
+ this.setBatchAgentId(null);\r
}, this);\r
} \r
}catch(e){\r
this._reloadLogger();\r
},\r
command : null\r
- } \r
+ },\r
+ "openrealized" : {\r
+ label : "Re-open",\r
+ icon : "org.argeo.slc.ria/document-open.png",\r
+ shortcut : "Control+o",\r
+ enabled : false,\r
+ menu : null,\r
+ toolbar : "realized",\r
+ callback : function(e){\r
+ var selection = this.getViewSelection();\r
+ var rowData = selection.getNodes()[0];\r
+ this.openRealized(rowData);\r
+ },\r
+ selectionChange : function(viewId, selection){\r
+ if(viewId != "logger") return;\r
+ this.setEnabled((selection!=null && selection.length==1));\r
+ },\r
+ command : null\r
+ }\r
}\r
}\r
},\r
this.UIBus.removeListener("updateSlcExecutionStatus", this._reloadLogger, this);\r
},\r
\r
+ openRealized : function(logData){\r
+ \r
+ // DEBUG PURPOSE\r
+ var CHECK_HOST = false;\r
+ \r
+ var uuid = logData[2];\r
+ var host = "charlie";// logData[1];\r
+ \r
+ \r
+ // 1. Check that both associated views are here\r
+ var batchView;\r
+ var flowsView;\r
+ try{\r
+ batchView = org.argeo.ria.components.ViewsManager.getInstance().getViewPaneById("batch").getContent();\r
+ flowsView = org.argeo.ria.components.ViewsManager.getInstance().getViewPaneById("selector").getContent();\r
+ }catch(e){\r
+ this.debug("Cannot find either bath or flows IView!");\r
+ }\r
+ if(!batchView || !flowsView) return; \r
+ \r
+ // 2. Check that at least a host with the same name exists.\r
+ var agentsMap = flowsView.getAgentsMap(); \r
+ var currentBatchId = batchView.getBatchAgentId();\r
+ if(currentBatchId != null){\r
+ var currentHost = agentsMap[currentBatchId];\r
+ if(currentHost != host){\r
+ this.error("Cannot re-open these flows on a different host. Please clear the batch first.");\r
+ return;\r
+ }\r
+ } \r
+ if(!qx.lang.Object.contains(agentsMap, host)){\r
+ this.error("Cannot find any agent running on '"+host+"'! Please start an agent on this host.");\r
+ return;\r
+ }\r
+ //console.log(currentBatchId);\r
+ if(currentBatchId == null){\r
+ var defaultId = qx.lang.Object.getKeyFromValue(agentsMap, host);\r
+ batchView.setBatchAgentId(defaultId);\r
+ }\r
+ \r
+ // 3. Call service to load execution message\r
+ if(!window.xmlExecStub || !window.xmlExecStub[uuid]){\r
+ throw new Error("Cannot find window.xmlExecStub['"+uuid+"']");\r
+ return;\r
+ }\r
+ var xmlDoc = window.xmlExecStub[uuid];\r
+ \r
+ // 4. Now send all realized flows to the batch\r
+ var realizedFlows = org.argeo.ria.util.Element.selectNodes(xmlDoc, "slc:slc-execution/realized-flows/slc:realized-flow");\r
+ for(var i=0;i<realizedFlows.length;i++){\r
+ var newEntrySpec = new org.argeo.slc.ria.execution.BatchEntrySpec(null, null, realizedFlows[i]); \r
+ batchView.appendBatchEntrySpec(newEntrySpec);\r
+ }\r
+ },\r
+ \r
/**\r
* Creates the applet layout\r
*/\r
return new qx.ui.table.columnmodel.Resize(obj)\r
}\r
});\r
- this.logPane.setDecorator(null);\r
- this._initLogger();\r
- this.add(this.logPane, {edge:'center'});\r
- },\r
- \r
- /**\r
- * Initialize the log table.\r
- */\r
- _initLogger : function(){\r
- this.logPane.set({ \r
+ var selectionModel = this.logPane.getSelectionModel();\r
+ selectionModel.addListener("changeSelection", function(e){\r
+ var viewSelection = this.getViewSelection();\r
+ viewSelection.setViewId("logger");\r
+ viewSelection.clear();\r
+ selectionModel.iterateSelection(function(index){\r
+ viewSelection.addNode(this.logModel.getRowData(index));\r
+ }, this);\r
+ }, this);\r
+ \r
+ this.logPane.set({ \r
+ decorator : null,\r
statusBarVisible: false,\r
showCellFocusIndicator:false\r
});\r
columnModel.getBehavior().setWidth(0, "30%");\r
columnModel.getBehavior().setWidth(1, "15%");\r
columnModel.getBehavior().setWidth(3, "12%"); \r
+ \r
+ this.add(this.logPane, {edge:'center'});\r
},\r
\r
/**\r
* @param module {org.argeo.slc.ria.execution.Module} Reference module\r
* @param flow {org.argeo.slc.ria.execution.Flow} Reference flow\r
*/\r
- construct : function(module, flow){\r
+ construct : function(module, flow, xmlElement){\r
this.base(arguments);\r
- this.setModule(module);\r
- this.setFlow(flow);\r
- this.setOriginalSpec(flow.getExecutionSpec());\r
- this.setName(flow.getExecutionSpec().getName());\r
+ if(xmlElement){\r
+ this.fromXml(xmlElement);\r
+ }else{\r
+ this.setModule(module);\r
+ this.setFlow(flow);\r
+ this.setOriginalSpec(flow.getExecutionSpec());\r
+ this.setName(flow.getExecutionSpec().getName());\r
+ }\r
this.fetchInstanceValues();\r
},\r
\r
\r
},\r
\r
+ fromXml : function(xmlElement){\r
+ var parser = org.argeo.ria.util.Element;\r
+ var simpleModule = new org.argeo.slc.ria.execution.Module();\r
+ simpleModule.setName(parser.getSingleNodeText(xmlElement, "slc:module-name"));\r
+ simpleModule.setVersion(parser.getSingleNodeText(xmlElement, "slc:module-version"));\r
+ this.setModule(simpleModule);\r
+ \r
+ var spec = new org.argeo.slc.ria.execution.Spec();\r
+ var flow = new org.argeo.slc.ria.execution.Flow();\r
+ spec.setXmlNode(parser.selectSingleNode(xmlElement, "slc:default-execution-spec"));\r
+ flow.setXmlNode(parser.selectSingleNode(xmlElement, "slc:execution-flow-descriptor"));\r
+ flow.setExecutionSpec(spec);\r
+ this.setOriginalSpec(spec);\r
+ this.setFlow(flow);\r
+ this.setName(spec.getName());\r
+ \r
+ },\r
+ \r
/**\r
* Fetch the Spec Values with the Flow Values to make the current instance value\r
*/\r