提交 a683a0ed 编写于 作者: 蔡祥熠

Merge branch 'fix/Service.agent_interface_add_run' into 'wrdp'

Merge of fix/Service.agent_interface_add_run 服务管理的代理和接口增加调试功能  to wrdp

See merge request o2oa/o2oa!4703
......@@ -596,14 +596,13 @@ MWF.xDesktop.Actions.RestActions.Callback = new Class({
onSuccess: function(responseJSON, responseText){
if (responseJSON){
switch(responseJSON.type) {
case "success":
if (this.appendSuccess) this.appendSuccess(responseJSON);
if (this.success) return this.success(responseJSON, responseText);
return responseJSON;
break;
// case "success":
// if (this.appendSuccess) this.appendSuccess(responseJSON);
// if (this.success) return this.success(responseJSON, responseText);
// return responseJSON;
// break;
case "warn":
MWF.xDesktop.notice("info", {x: "right", y:"top"}, responseJSON.errorMessage.join("\n"));
if (this.appendSuccess) this.appendSuccess(responseJSON);
if (this.success) return this.success(responseJSON);
return responseJSON;
......@@ -612,6 +611,11 @@ MWF.xDesktop.Actions.RestActions.Callback = new Class({
return this.doError(null, responseText, responseJSON.message);
return responseJSON;
break;
default:
if (this.appendSuccess) this.appendSuccess(responseJSON);
if (this.success) return this.success(responseJSON, responseText);
return responseJSON;
break;
}
}else{
return this.doError(null, responseText, "");
......
......@@ -148,7 +148,8 @@ MWF.xScript.Environment = function(ev){
* orders.add(0, {name: "mobile", count: 10}, true);
*/
/**保存data对象。不触发事件
/**保存data对象。不触发事件。
* 不建议在queryLoad、beforeSave和afterSave中使用本方法。
* @method save
* @static
* @memberOf module:data
......@@ -2339,7 +2340,7 @@ MWF.xScript.Environment = function(ev){
"getData": function(){return new MWF.xScript.JSONData(_form.getData());},
/**保存当前表单所绑定的业务数据。<br/>
* this.form.save()会触发 beforeSave和afterSave事件,因此在beforeSave和afterSave中不允许使用本方法。
* this.form.save()会触发 beforeSave和afterSave事件,因此在beforeSave和afterSave中不允许使用本方法。同时不建议在queryLoad里使用本方法。
* @method save
* @static
* @param {Function} [callback] - 保存后的回调
......
......@@ -228,6 +228,7 @@ MWF.xApplication.service.AgentDesigner.Agent = new Class({
setButton : function(){
this.designer.propertyEnableButton.store("id", this.data.id);
this.designer.propertyDisableButton.store("id", this.data.id);
this.designer.propertyExecuteButton.store("id", this.data.id);
if( this.data.enable ){
this.designer.propertyEnableButton.setStyle("display","none");
this.designer.propertyDisableButton.setStyle("display", this.data.isNewAgent ? "none" : "" );
......
......@@ -602,6 +602,26 @@ MWF.xApplication.service.AgentDesigner.Main = new Class({
this.refresh();
}.bind(this));
}.bind(this));
node = new Element("div", {"styles": this.css.propertyItemTitleNode, "text": this.lp.debugger+":"}).inject(this.propertyContentArea);
var div = new Element("div", {"styles": this.css.propertyTextNode, "text": ""}).inject(this.propertyContentArea);
this.propertyExecuteButton = new Element("input", { type : "button", styles : this.css.propertyButton, "value": this.lp.run }).inject(div);
this.propertyExecuteButton.addEvent("click", function(){
var id = this.propertyExecuteButton.retrieve("id");
if( id )o2.Actions.load("x_program_center").AgentAction.execute(id, function () {
this.notice( this.lp.runSuccess, "success");
}.bind(this), function () {
this.notice("request processToolbars error: "+xhr.responseText, "error");
}.bind(this));
}.bind(this));
this.propertyExecuteButton.setStyle("margin","0px");
this.propertyOpenLogViewer = new Element("input", { type : "button", styles : this.css.propertyButton, "value": this.lp.openLogViewer }).inject(div);
this.propertyOpenLogViewer.addEvent("click", function(){
layout.openApplication(null, "LogViewer");
}.bind(this));
},
loadCronTooltip : function(){
MWF.xDesktop.requireApp("Template", "widget.CronPicker", null, false);
......
......@@ -22,6 +22,11 @@ MWF.xApplication.service.AgentDesigner.LP = {
"enable" : "Click to enable",
"disable" : "Click to disable",
"openLogViewer": "Open LogViewer",
"debugger": "Debug",
"run": "Simulation Run",
"runSuccess": "Run successfully",
"notice": {
"save_success": "Agent saved successfully!",
......
......@@ -16,6 +16,11 @@ MWF.xApplication.service.AgentDesigner.LP = {
"lastEndTime" : "最近结束时间",
"appointmentTime" : "预计下次执行时间",
"openLogViewer": "打开日志查看器",
"debugger": "调试",
"run": "模拟运行",
"runSuccess": "运行成功",
"true" : "",
"false" : "",
"enable" : "点击启用",
......
......@@ -64,6 +64,7 @@ MWF.xApplication.service.InvokeDesigner.Invoke = new Class({
this.page = this.tab.addTab(this.areaNode, this.data.name || this.designer.lp.newInvoke, (!this.data.isNewInvoke && this.data.id!=this.designer.options.id));
this.page.invoke = this;
this.page.addEvent("show", function(){
this.designer.currentPage = this.page;
this.designer.invokeListAreaNode.getChildren().each(function(node){
var scrtip = node.retrieve("invoke");
if (scrtip.id==this.data.id){
......@@ -230,6 +231,18 @@ MWF.xApplication.service.InvokeDesigner.Invoke = new Class({
this.setInvokeUrlText();
this.designer.propertyEnableTokenNode.addEvent("change", this.setInvokeUrlText.bind(this));
if(this.page){
this.designer.propertyRequireBodyNode.set("value", this.page.requireBody || "");
this.designer.propertyRunResultNode.set("html", this.page.executeResult || "");
}
this.setButton()
},
setButton : function(){
this.designer.propertyExecuteButton.store("id", this.data.id);
this.designer.propertyExecuteButton.store("alias", this.data.alias);
this.designer.propertyExecuteButton.store("name", this.data.name);
},
setInvokeUrlText: function(){
debugger
......@@ -265,7 +278,6 @@ MWF.xApplication.service.InvokeDesigner.Invoke = new Class({
addInclude: function(){
},
saveInvoke: function (data, success, failure) {
if (data.isNewInvoke) {
this.designer.actions.createInvoke(data, success, failure);
......@@ -327,7 +339,7 @@ MWF.xApplication.service.InvokeDesigner.Invoke = new Class({
this.isSave = false;
if( this.data.isNewInvoke ){
this.data.isNewInvoke = false;
//this.setButton();
this.setButton();
}
this.isChanged = false;
this.page.textNode.set("text", this.data.name);
......@@ -405,7 +417,7 @@ MWF.xApplication.service.InvokeDesigner.Invoke = new Class({
this.isSave = false;
if( this.data.isNewInvoke ){
this.data.isNewInvoke = false;
//this.setButton();
this.setButton();
}
this.data.isNewInvoke = false;
this.isChanged = false;
......
......@@ -611,7 +611,95 @@ MWF.xApplication.service.InvokeDesigner.Main = new Class({
node = new Element("div", {"styles": this.css.propertyItemTitleNode, "text": this.lp.invokeHead+":"}).inject(this.propertyContentArea);
this.propertyInvokeHeadTextNode = new Element("div", {"styles": this.css.propertyTextNode, "text": "Content-Type:application/json; charset=utf-8"}).inject(this.propertyContentArea);
this.propertyInvokeHeadTextNode.setStyles({
"height": "auto"
})
node = new Element("div", {"styles": this.css.propertyItemTitleNode, "text": this.lp.debugger+":"}).inject(this.propertyContentArea);
new Element("div", {"styles": this.css.propertyTextNode, "text": this.lp.requireArguments}).setStyles({
"word-break":"break-all",
"height" : "auto",
"line-height": "18px",
"margin-top": "10px",
"color": "#999999"
}).inject(this.propertyContentArea);
this.propertyRequireBodyNode = new Element("textarea", {
"styles": this.css.propertyInputAreaNode,
"value": "",
"events": {
change : function () {
debugger;
if(this.currentPage){
this.currentPage.requireBody = this.propertyRequireBodyNode.get("value");
}
}.bind(this)
}
}).inject(this.propertyContentArea);
new Element("div", {"styles": this.css.propertyTextNode, "text": this.lp.runResult}).setStyles({
"word-break":"break-all",
"height" : "auto",
"line-height": "18px",
"margin-top": "10px",
"color": "#999999"
}).inject(this.propertyContentArea);
this.propertyRunResultNode = new Element("div", {"styles": this.css.propertyTextNode}).inject(this.propertyContentArea);
this.propertyRunResultNode.set("style", "white-space: pre; font-size: 12px; word-break: break-all; word-wrap: break-word; height: auto; overflow:auto; margin-left:10px;");
var div = new Element("div", {"styles": this.css.propertyTextNode, "text": ""}).setStyles({
"margin-top": "10px"
}).inject(this.propertyContentArea);
this.propertyExecuteButton = new Element("input", { type : "button", styles : this.css.propertyButton, "value": this.lp.run }).inject(div);
this.propertyExecuteButton.addEvent("click", function(){
debugger;
var alias = this.propertyExecuteButton.retrieve("alias");
var name = this.propertyExecuteButton.retrieve("name");
var id = this.propertyExecuteButton.retrieve("id");
var body = this.propertyRequireBodyNode.get("value");
var bodyJson;
try{
bodyJson = JSON.parse(body);
}catch(e) {
}
if( id )o2.Actions.load("x_program_center").InvokeAction.execute( alias || name || id, bodyJson || body, function (json) {
var result;
try{
result = JSON.stringify(json, null, 4);
}catch (e) {
result = json;
}
if(this.currentPage){
this.currentPage.executeResult = result;
}
this.propertyRunResultNode.set("html",result);
this.notice( this.lp.runSuccess, "success");
}.bind(this), function (xhr) {
var result;
try{
result = JSON.stringify(xhr.responseText, null, 4);
}catch (e) {
result = xhr.responseText;
}
if(this.currentPage){
this.currentPage.executeResult = result;
}
this.propertyRunResultNode.set("html",result);
// this.notice("request processToolbars error: "+xhr.responseText, "error");
}.bind(this));
}.bind(this));
this.propertyExecuteButton.setStyle("margin","0px");
this.propertyOpenLogViewer = new Element("input", { type : "button", styles : this.css.propertyButton, "value": this.lp.openLogViewer }).inject(div);
this.propertyOpenLogViewer.addEvent("click", function(){
layout.openApplication(null, "LogViewer");
}.bind(this));
},
loadPropertyResize: function(){
// var size = this.propertyNode.getSize();
......
......@@ -25,8 +25,15 @@ MWF.xApplication.service.InvokeDesigner.LP = {
"invokeUri": "Invoke address",
"invokeMethod": "Invoke Method",
"enableToken": "Enable authentication",
"enableTokenInfo": "After enabling authentication, you must use the authentication client name and encrypted token to call the service",
"invokeHead": "head",
"openLogViewer": "Open LogViewer",
"debugger": "Debug",
"run": "Simulation Run",
"runSuccess": "Run successfully",
"requireArguments": "Request Arguments",
"runResult": "Execution Result",
"notice": {
"save_success": "The interface was saved successfully!",
......
......@@ -22,6 +22,14 @@ MWF.xApplication.service.InvokeDesigner.LP = {
"invokeMethod" : "调用方法",
"enableToken": "启用鉴权",
"enableTokenInfo": "启用鉴权后,您必须使用鉴权客户端名称和加密后的token来调用服务",
"invokeHead": "head",
"openLogViewer": "打开日志查看器",
"debugger": "调试",
"run": "模拟运行",
"runSuccess": "运行成功",
"requireArguments": "请求参数",
"runResult": "执行结果",
"notice": {
"save_success": "接口保存成功!",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册