diff --git a/Bench4Q-Agent/src/main/java/org/bench4q/agent/plugin/basic/http/ui.xml b/Bench4Q-Agent/src/main/java/org/bench4q/agent/plugin/basic/http/ui.xml index 91ba98a7..00a8d872 100644 --- a/Bench4Q-Agent/src/main/java/org/bench4q/agent/plugin/basic/http/ui.xml +++ b/Bench4Q-Agent/src/main/java/org/bench4q/agent/plugin/basic/http/ui.xml @@ -7,7 +7,7 @@ - + @@ -31,11 +31,12 @@ - + + label="The regular expression of extracting variables from response" + required="false">
@@ -48,7 +49,7 @@ - +
@@ -58,7 +59,8 @@ + label="The regular expression of extracting variables from response" + required="false">
@@ -71,7 +73,7 @@ - +
@@ -81,7 +83,8 @@ + label="The regular expression of extracting variables from response" + required="false">
diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/plugin/ParamInfo.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/plugin/ParamInfo.java index e0696d2b..efed25ff 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/plugin/ParamInfo.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/plugin/ParamInfo.java @@ -19,6 +19,7 @@ public class ParamInfo { private int id; private String name; private String lable; + private String required; private ParamType paramType; private ParamsContainer paramsContainer; @@ -50,6 +51,15 @@ public class ParamInfo { public void setLable(String lable) { this.lable = lable; } + + @Column(name = "required") + public String getRequired() { + return required; + } + + public void setRequired(String required) { + this.required = required; + } @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER) @JoinColumn(name = "typeId", nullable = false) diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/factory/PluginEntityFactory.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/factory/PluginEntityFactory.java index 233ec15c..58cafbc5 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/factory/PluginEntityFactory.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/factory/PluginEntityFactory.java @@ -165,6 +165,8 @@ public class PluginEntityFactory { ParamInfo paramInfo = new ParamInfo(); paramInfo.setLable(XmlParseHelper.getAttribute(paramElement, "label")); paramInfo.setName(XmlParseHelper.getAttribute(paramElement, "name")); + paramInfo.setRequired(XmlParseHelper.getAttribute(paramElement, + "required")); paramInfo.setParamType(ParamTypeFactory .createParamTypeInfo(XmlParseHelper .getSingleChild(paramElement))); diff --git a/Bench4Q-Web/src/main/webapp/css/result.css b/Bench4Q-Web/src/main/webapp/css/result.css index 825b8624..44d5e7ed 100644 --- a/Bench4Q-Web/src/main/webapp/css/result.css +++ b/Bench4Q-Web/src/main/webapp/css/result.css @@ -95,6 +95,11 @@ margin-bottom:5px } +.testHeader .span-brief .value{ + color:#317eac; + font-size:19px +} + .testHeader .span-brief h4{ font-size:23px } diff --git a/Bench4Q-Web/src/main/webapp/result.jsp b/Bench4Q-Web/src/main/webapp/result.jsp index 76483e98..2e2d8382 100644 --- a/Bench4Q-Web/src/main/webapp/result.jsp +++ b/Bench4Q-Web/src/main/webapp/result.jsp @@ -46,15 +46,15 @@ body {

-
+

-
+

-
+
<%--
diff --git a/Bench4Q-Web/src/main/webapp/script/scriptManager/containerFactory.js b/Bench4Q-Web/src/main/webapp/script/scriptManager/containerFactory.js index cfb1ca62..fe78bc68 100644 --- a/Bench4Q-Web/src/main/webapp/script/scriptManager/containerFactory.js +++ b/Bench4Q-Web/src/main/webapp/script/scriptManager/containerFactory.js @@ -22,9 +22,9 @@ ContainerFactory.prototype.createEditorContainer = function(header, id, containerInfo[i].name == ""; } if (containerInfo[i].children == null) { - + console.log(containerInfo[i]); this.appendEdtiors(container, containerInfo[i].label, - containerInfo[i].nameCN, containerInfo[i].name, + containerInfo[i].nameCN, containerInfo[i].required, containerInfo[i].name, containerInfo[i].paramTypeModel,containerInfo[i].value == null ?"":containerInfo[i].value); } else { $(container).append( @@ -39,29 +39,30 @@ ContainerFactory.prototype.createEditorContainer = function(header, id, }; -ContainerFactory.prototype.appendEdtiors = function(container, label, name, id, +ContainerFactory.prototype.appendEdtiors = function(container, label, name, required, id, editorInfo, value) { var editorFactory = new EditorFactory(); if (editorInfo.type.toLowerCase() == "field") { + console.log("required:"+required); $(container).append( - editorFactory.createField(label, name, editorInfo.size, id,value)); + editorFactory.createField(label, name, required, editorInfo.size, id,value)); } else if (editorInfo.type.toLowerCase() == "nfield") { $(container).append( editorFactory - .createMultiField(label, name, editorInfo.size, id,value)); + .createMultiField(label, name, required, editorInfo.size, id,value)); } else if (editorInfo.type.toLowerCase() == "table") { $(container).append( - editorFactory.createTable(label, name, editorInfo.cols, id,value)); + editorFactory.createTable(label, name, required, editorInfo.cols, id,value)); } else if (editorInfo.type.toLowerCase() == "file") { $(container).append( - editorFactory.createFile(lable, name, editorInfo.size, id,value)); + editorFactory.createFile(lable, name, required, editorInfo.size, id,value)); } else if (editorInfo.type.toLowerCase() == "date") { $(container).append( - editorFactory.createDate(label, name, editorInfo.size, id,value)); + editorFactory.createDate(label, name, required, editorInfo.size, id,value)); } else if (editorInfo.type.toLowerCase() == "select") { $(container).append( editorFactory.createSelect(label, name, editorInfo.size, diff --git a/Bench4Q-Web/src/main/webapp/script/scriptManager/contentVerification.js b/Bench4Q-Web/src/main/webapp/script/scriptManager/contentVerification.js index b2628b00..35af054c 100644 --- a/Bench4Q-Web/src/main/webapp/script/scriptManager/contentVerification.js +++ b/Bench4Q-Web/src/main/webapp/script/scriptManager/contentVerification.js @@ -1,6 +1,5 @@ $(document).ready(function(){ $("#behaviorEditor").on("focusout",".editor input",function(){ console.log(this); - alert("This input field has lost its focus."); }) }); \ No newline at end of file diff --git a/Bench4Q-Web/src/main/webapp/script/scriptManager/editorFactory.js b/Bench4Q-Web/src/main/webapp/script/scriptManager/editorFactory.js index f273819a..8f8d361f 100644 --- a/Bench4Q-Web/src/main/webapp/script/scriptManager/editorFactory.js +++ b/Bench4Q-Web/src/main/webapp/script/scriptManager/editorFactory.js @@ -50,14 +50,14 @@ EditorFactory.prototype.createChoice = function(value, defaultValue, name, return div; } -EditorFactory.prototype.createField = function(label, name, size, id, value) { +EditorFactory.prototype.createField = function(label, name, required, size, id, value) { var div = this.createBaseEditor(label, id); $(div).children(".editor").attr("editorType", "field"); - $(div).children(".editor").append(this.createFieldLine(size, name, value)); + $(div).children(".editor").append(this.createFieldLine(size, name, required, value)); return div; } -EditorFactory.prototype.createMultiField = function(label, name, size, id, +EditorFactory.prototype.createMultiField = function(label, name, required, size, id, value) { var div = this.createBaseEditor(label, id); $(div).children(".editor").attr("editorType", "multiField"); @@ -65,7 +65,7 @@ EditorFactory.prototype.createMultiField = function(label, name, size, id, var values = value.split(";"); for (var i = 0; i < values.length; i++) { $(div).children(".editor").append( - this.createFieldLine(size, name, values[i])); + this.createFieldLine(size, name, required, values[i])); } } @@ -94,19 +94,22 @@ EditorFactory.prototype.createMultiField = function(label, name, size, id, return div; } -EditorFactory.prototype.createFieldLine = function(size, name, value) { +EditorFactory.prototype.createFieldLine = function(size, name, required, value) { var fieldDiv = document.createElement("div"); $(fieldDiv).addClass("field"); var fieldName = document.createElement("label"); $(fieldName).html(name); var field = document.createElement("input"); $(field).attr("type", "text"); + if(required=="true"){ + $(field).attr("required", "required"); + } // $(field).attr("maxlength", size); $(field).attr("value", value); $(fieldDiv).append(fieldName.outerHTML + field.outerHTML); return fieldDiv; } -EditorFactory.prototype.createFile = function(label, name, size, id, value) { +EditorFactory.prototype.createFile = function(label, name, required, size, id, value) { if (size == null || size <= 0) { size = 150; } @@ -119,6 +122,9 @@ EditorFactory.prototype.createFile = function(label, name, size, id, value) { $(fieldName).html(name); var file = document.createElement("input"); $(file).attr("type", "file"); + if(required == "true"){ + $(field).attr("required", "required"); + } // $(field).attr("maxlength", size); $(fileEditor).append(fieldName.outerHTML + file.outerHTML); $(div).children(".editor").append(fileEditor); @@ -134,7 +140,7 @@ EditorFactory.prototype.createTable = /** * @param value * @returns */ -function(label, name, cols, id, value) { +function(label, name, required, cols, id, value) { var div = this.createBaseEditor(label, id); $(div).children(".editor").attr("editorType", "table"); @@ -152,7 +158,7 @@ function(label, name, cols, id, value) { function(event) { event.preventDefault(); $(this).parent().children("table").children("tbody").append( - createTr(event.data.headers, event.data.fieldName)); + createTr(event.data.headers, event.data.fieldName, required)); }); var deleteButton = document.createElement("button"); $(deleteButton).html("remove"); @@ -188,7 +194,7 @@ function(label, name, cols, id, value) { var tbody = document.createElement("tbody"); $(thead).append(createHeader(headers)); for (var i = 0; i < values.length; i++) {//this minus one because there is a "|;" in the end of value string - $(tbody).append(createTr(headers, name, values[i])); + $(tbody).append(createTr(headers, name, required, values[i])); } $(table).append(thead); @@ -208,7 +214,7 @@ function(label, name, cols, id, value) { } return tr; } - function createTr(headers, name, value) { + function createTr(headers, name, required, value) { value == null? value="":value; var values = value.split("|"); var tr = document.createElement("tr"); @@ -220,6 +226,9 @@ function(label, name, cols, id, value) { var input = document.createElement("input"); $(input).attr("type", "text"); $(input).attr("style","width:"+"90%"); + if(required == "true"){ + $(field).attr("required", "required"); + } if(values[i] != undefined){ $(input).val(values[i].split("=")[1]); } @@ -259,7 +268,7 @@ EditorFactory.prototype.createSelect = function(label, name, size, options, id, $(div).children(".editor").append(select); return div; } -EditorFactory.prototype.createDate = function(label, name, size, id, value) { +EditorFactory.prototype.createDate = function(label, name, required, size, id, value) { if (size == null || size < 0) { size = 150 @@ -270,6 +279,9 @@ EditorFactory.prototype.createDate = function(label, name, size, id, value) { $(dateLabel).html(name); var date = document.createElement("input"); $(date).attr("type", "date"); + if(required == "true"){ + $(field).attr("required", "required"); + } $(div).children(".editor").append(dateLabel); $(div).children(".editor").append(date); return div;