success to create new script
This commit is contained in:
parent
5a928f1108
commit
1b0fa87719
|
@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||||
|
@ -209,17 +210,18 @@ public class ScriptController extends BaseController {
|
||||||
operateScriptServerResponseModel.getFailCauseString());
|
operateScriptServerResponseModel.getFailCauseString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@RequestMapping(value="submitScriptCreated/{scriptName}")
|
||||||
@RequestMapping("submitScriptCreated/{scriptName}")
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Map<String, Object> submitScriptCreated(
|
public Map<String, Object> submitScriptCreated(
|
||||||
@ModelAttribute("accessToken") String accessToken,
|
@ModelAttribute("accessToken") String accessToken,
|
||||||
// @RequestBody ScenarioModel scenarioModel,
|
@RequestParam String runScenarioModelStr,
|
||||||
@RequestBody RunScenarioModel runScenarioModel,
|
|
||||||
@PathVariable String scriptName,
|
@PathVariable String scriptName,
|
||||||
@RequestParam(required = false) MultipartFile[] paramFiles) {
|
@RequestParam(required = false) MultipartFile[] paramFiles
|
||||||
|
) {
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
Gson gson = new Gson();
|
||||||
|
RunScenarioModel runScenarioModel = gson.fromJson(runScenarioModelStr, RunScenarioModel.class);
|
||||||
|
|
||||||
// RunScenarioModel runScenarioModel = this.getScriptService()
|
// RunScenarioModel runScenarioModel = this.getScriptService()
|
||||||
// .createRunScenarioModel(scenarioModel.getUsePlugins(),
|
// .createRunScenarioModel(scenarioModel.getUsePlugins(),
|
||||||
// scenarioModel.getBehaviors());
|
// scenarioModel.getBehaviors());
|
||||||
|
|
|
@ -4,7 +4,8 @@ $(function() {
|
||||||
// usePlugin.getPluginList();
|
// usePlugin.getPluginList();
|
||||||
|
|
||||||
$("#submitScript").click(function() {
|
$("#submitScript").click(function() {
|
||||||
var pages = behavior.getPages();
|
var plugins = usePlugin.getPlugins();
|
||||||
submitScript(pages);
|
var pages = usePlugin.getPages();
|
||||||
|
submitScript(pages,plugins);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,32 +28,29 @@ function CollectScriptData(behavior) {
|
||||||
// this.behaviors = behaviors;
|
// this.behaviors = behaviors;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
function submitScript(pages) {
|
function submitScript(pages,usePlugins) {
|
||||||
// var usePlugins = scriptDataModel.usePlugin;
|
|
||||||
// var behaviors = collectScriptData.collectBehavior();
|
|
||||||
// var scenarioModel = new ScenarioModel(usePlugins, behaviors);
|
|
||||||
// if (usePlugins.length == 0 || behaviors.length == 0) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
var scriptName = $("#scriptName").val();
|
var scriptName = $("#scriptName").val();
|
||||||
if (scriptName == undefined || scriptName == "") {
|
if (scriptName == undefined || scriptName == "") {
|
||||||
alert("need a script name!")
|
alert("need a script name!")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// $.ajax({
|
var runScenarioModel = new RunScenarioModel(0,usePlugins,new Array(),pages);
|
||||||
// type : "POST",
|
|
||||||
// url : "submitScriptCreated" + "/" + scriptName,
|
$.ajax({
|
||||||
// data : JSON.stringify(scenarioModel),
|
type : "POST",
|
||||||
|
url : "submitScriptCreated" + "/" + scriptName,
|
||||||
|
data :{runScenarioModelStr: JSON.stringify(runScenarioModel)},//JSON.stringify(runScenarioModel),
|
||||||
// dataType : "json",
|
// dataType : "json",
|
||||||
// contentType : "application/json",
|
// contentType : "application/json",
|
||||||
// success : function(data) {
|
success : function(data) {
|
||||||
// if (!data.success) {
|
if (!data.success) {
|
||||||
// return;
|
return;
|
||||||
// } else {
|
} else {
|
||||||
// alert("success");
|
alert("success");
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,8 @@ function UsePluginViewModel(id, name) {
|
||||||
function UsePlugin(behaviorListContainerId) {
|
function UsePlugin(behaviorListContainerId) {
|
||||||
var containerId = "usePluginList";
|
var containerId = "usePluginList";
|
||||||
// var usePlugin = this;
|
// var usePlugin = this;
|
||||||
|
|
||||||
var behavior = new Behavior(this,"useBehaviorList");
|
var behavior = new Behavior(this,"useBehaviorList");
|
||||||
|
var paramDataCollector = new DataCollector();
|
||||||
|
|
||||||
var index = 1;
|
var index = 1;
|
||||||
var usePluginEditorMap = new HashMap();
|
var usePluginEditorMap = new HashMap();
|
||||||
|
@ -180,12 +179,10 @@ function UsePlugin(behaviorListContainerId) {
|
||||||
for ( var i = 0; i < keys.length; i++) {
|
for ( var i = 0; i < keys.length; i++) {
|
||||||
var id = keys[i];
|
var id = keys[i];
|
||||||
var usePluginViewModel = map.get(id);
|
var usePluginViewModel = map.get(id);
|
||||||
|
var usePluginContainer = usePluginEditorMap.get(id);
|
||||||
var usePluginContainer = usePluginEditorMap
|
var params = paramDataCollector.getUnitParams($(
|
||||||
.get(id);
|
|
||||||
var params = this.paramDataCollector.getUnitParams($(
|
|
||||||
usePluginContainer).find(".editor"));
|
usePluginContainer).find(".editor"));
|
||||||
usePlugins.push(new UsePluginModel(usePluginViewModel.id, pluginName, params));
|
usePlugins.push(new UsePluginModel(usePluginViewModel.id, usePluginViewModel.name,usePluginViewModel.nickName, params));
|
||||||
}
|
}
|
||||||
return usePlugins;
|
return usePlugins;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue