SettingModuleService.js 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. MWF.xApplication.Setting.ServiceModuleDocument = new Class({
  2. Extends: MWF.xApplication.Setting.Document,
  3. load: function(){
  4. this.node = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.contentAreaNode);
  5. this.titleName = new Element("div", {"styles": this.explorer.css.explorerContentTitleNode}).inject(this.node);
  6. this.titleName.set("text", this.lp.ui_moduleSetting_service);
  7. this.uploadTitleNode = new Element("div",{"styles":this.css.explorerContentItemTitleNode}).inject(this.contentAreaNode);
  8. this.uploadTitleNode.set("text",this.lp.resource_upload);
  9. this.uploadFileNode = new Element("input",{"type":"file","styles":this.css.explorerContentInputInforNode}).inject(this.contentAreaNode);
  10. this.ctlTitleNode = new Element("div",{"styles":this.css.explorerContentItemTitleNode}).inject(this.contentAreaNode);
  11. this.ctlTitleNode.set("text",this.lp.service_ctl);
  12. this.ctlNode = new Element("div",{"styles":this.css.explorerContentInputInforNode}).inject(this.contentAreaNode);
  13. this.ctlSelectNode = new Element("select").inject(this.ctlNode);
  14. new Element("option",{"value":"customJar","text":"customJar"}).inject(this.ctlSelectNode);
  15. new Element("option",{"value":"customWar","text":"customWar"}).inject(this.ctlSelectNode);
  16. new Element("option",{"value":"storeJar","text":"storeJar"}).inject(this.ctlSelectNode);
  17. new Element("option",{"value":"storeWar","text":"storeWar"}).inject(this.ctlSelectNode);
  18. this.nodeTitleNode = new Element("div",{"styles":this.css.explorerContentItemTitleNode}).inject(this.contentAreaNode);
  19. this.nodeTitleNode.set("text",this.lp.service_node);
  20. this.serverNode = new Element("div",{"styles":this.css.explorerContentInputInforNode}).inject(this.contentAreaNode);
  21. this.nodeSelectNode = new Element("select").inject(this.serverNode);
  22. new Element("option", {
  23. "value": "*",
  24. "text": this.lp.service_allNode
  25. }).inject(this.nodeSelectNode);
  26. o2.Actions.load("x_program_center").CommandAction.getNodeInfoList(
  27. function( json ){
  28. var nodeList = json.data.nodeList;
  29. nodeList.each(function (node) {
  30. new Element("option", {
  31. "value": node.node.nodeAgentPort,
  32. "text": node.nodeAddress
  33. }).inject(this.nodeSelectNode);
  34. }.bind(this));
  35. }.bind(this),null, false
  36. );
  37. this.submitNode = new Element("div",{"styles":this.css.explorerContentInputInforNode}).inject(this.contentAreaNode);
  38. this.submitBtnNode = new Element("button",{"styles":this.css.explorerContentButtonNode,"text":this.lp.ok}).inject(this.submitNode);
  39. this.submitNode.setStyle("margin-top","40px");
  40. this.submitBtnNode.addEvent("click",function () {
  41. var files = this.uploadFileNode.files;
  42. if (files.length) {
  43. var file = files[0];
  44. var nodePort = this.nodeSelectNode.getElement("option:selected").get("value");
  45. var nodeName = this.nodeSelectNode.getElement("option:selected").get("text");
  46. if(nodePort==="*") nodeName = "*";
  47. var formData = new FormData();
  48. formData.append("file", file);
  49. formData.append("fileName", file.name);
  50. formData.append("ctl", this.ctlSelectNode.get("value"));
  51. formData.append("nodeName", nodeName);
  52. formData.append("nodePort", nodePort);
  53. o2.Actions.load("x_program_center").CommandAction.upload(formData,null,function (json){
  54. this.app.notice(this.lp.service_success, "success", this.appContentNode);
  55. }.bind(this),null,false);
  56. }
  57. }.bind(this))
  58. }
  59. });