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