modify login.jsp and plugin-new.js
This commit is contained in:
parent
6ae331e61d
commit
e0e3c9c184
|
@ -115,7 +115,7 @@ Bench4Q is a new methodology for QoS benchmarking
|
||||||
</div>
|
</div>
|
||||||
<div style="height:2px; width:100%"></div>
|
<div style="height:2px; width:100%"></div>
|
||||||
<div>
|
<div>
|
||||||
<input type="text" id="username" name="username" style="font-size:18px; margin-left:40px; height:30px; width:300px;" onblur="checkName(this.value)"/>
|
<input autofocus type="text" id="username" name="username" style="font-size:18px; margin-left:40px; height:30px; width:300px;" onblur="checkName(this.value)"/>
|
||||||
<div id='alertUserName' style='display:none;color:red;margin-left:40px'>The username cannot be empty!</div>
|
<div id='alertUserName' style='display:none;color:red;margin-left:40px'>The username cannot be empty!</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="height:10px; width:100%"></div>
|
<div style="height:10px; width:100%"></div>
|
||||||
|
|
|
@ -164,7 +164,7 @@ body {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="showPluginMethod">
|
<div id="showPluginMethod" class="showPluginMethod">
|
||||||
<!-- 显示方法文档,开始动态生成 ,只显示一个-->
|
<!-- 显示方法文档,开始动态生成 ,只显示一个-->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ PluginMethodListModel = function(pluginName, methodList) {
|
||||||
};
|
};
|
||||||
var pluginList = new Array();
|
var pluginList = new Array();
|
||||||
var pluginMethodList = new Array();
|
var pluginMethodList = new Array();
|
||||||
|
var index = 0;
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
loadPluginList();
|
loadPluginList();
|
||||||
});
|
});
|
||||||
|
@ -74,11 +74,7 @@ function pluginFinish() {
|
||||||
data = item + "_" + num;
|
data = item + "_" + num;
|
||||||
pluginChoosedList.push(data);
|
pluginChoosedList.push(data);
|
||||||
num++;
|
num++;
|
||||||
/*
|
|
||||||
* //load选择的plugin的MethodList var aMethodList=getMethod(item);
|
|
||||||
* document.write(data); pluginMethodList.push(new
|
|
||||||
* PluginMethodListModel(data,aMethodList));
|
|
||||||
*/
|
|
||||||
var div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
var p = document.createElement("p");
|
var p = document.createElement("p");
|
||||||
var textNode = document.createTextNode(data);
|
var textNode = document.createTextNode(data);
|
||||||
|
@ -108,10 +104,12 @@ function showInsertPlugin(selectNode) {
|
||||||
$('#behaviorFinish').attr('disabled', true);
|
$('#behaviorFinish').attr('disabled', true);
|
||||||
var textNode = selectNode.firstChild;
|
var textNode = selectNode.firstChild;
|
||||||
var methodData = textNode.nodeValue;
|
var methodData = textNode.nodeValue;
|
||||||
|
|
||||||
// 请求master获取其method方法
|
|
||||||
getMethodList(methodData);
|
getMethodList(methodData);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeInsertPlugin(){
|
||||||
|
var last=document.getElementById("behaviorArea").lastChild;
|
||||||
|
document.getElementById("behaviorArea").removeChild(last);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMethodList(methodData) {
|
function getMethodList(methodData) {
|
||||||
|
@ -163,60 +161,41 @@ function show(selectedNode) {
|
||||||
var div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
var a = document.createElement("a");
|
var a = document.createElement("a");
|
||||||
var textNode = document.createTextNode(behaviorData);
|
var textNode = document.createTextNode(behaviorData);
|
||||||
a.setAttribute("class", "pluginChoosedList");// 样式设计
|
a.setAttribute("class", index);// 样式设计
|
||||||
a.setAttribute("onClick", "showMethodDocument(this)");// loadMethodParams
|
a.setAttribute("onClick", "showMethodDocument(this)");// loadMethodParams
|
||||||
a.setAttribute("style", "cursor:pointer;float:left;");
|
a.setAttribute("style", "cursor:pointer;float:left;");
|
||||||
a.appendChild(textNode);
|
a.appendChild(textNode);
|
||||||
div.appendChild(a);
|
div.appendChild(a);
|
||||||
|
|
||||||
document.getElementById('behaviorArea').appendChild(div);
|
document.getElementById('behaviorArea').appendChild(div);
|
||||||
|
loadMethodParams(behaviorData, index);
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showMethodDocument(selectedNode) {
|
function showMethodDocument(selectedNode) {
|
||||||
|
var behaviorIndex = $(selectedNode).attr("class");
|
||||||
var behaviorData = selectedNode.firstChild.nodeValue;
|
|
||||||
var temp;
|
|
||||||
var flag = false;
|
|
||||||
var length = $("#showPluginMethod").children().length;
|
var length = $("#showPluginMethod").children().length;
|
||||||
if (length == 0) {
|
var div = $("#showPluginMethod").children();
|
||||||
flag = false;
|
$(div[behaviorIndex]).attr("class", "show");
|
||||||
} else {
|
$(div[behaviorIndex]).show();
|
||||||
for (var j = 0; j < length; j++) {
|
|
||||||
var data=document.getElementById("showPluginMethod").childNodes[length].firstChild.firstChild.nodeValue;
|
|
||||||
if (data==behaviorData) {
|
|
||||||
// 该文档已经生成
|
|
||||||
// document.getElementById("showPluginMethod").childNodes[j].firstChild.firstChild.nodeValue==behaviorData;
|
|
||||||
flag = true;
|
|
||||||
temp = j;
|
|
||||||
for (var m = 0; m < length; m++) {
|
|
||||||
$('#showPluginMethod').children()[m].Attr("class", "hide");
|
|
||||||
}
|
|
||||||
$('#showPluginMethod').children()[temp].Attr("class", "");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (flag == false) {
|
|
||||||
// 文档没有生成过,需要调用函数生成该文档
|
|
||||||
for (var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
if ($('#showPluginMethod').children()[i].Attr("class", "")) {
|
// alert("i is "+i);
|
||||||
$('#showPluginMethod').children()[i].Attr("class", "hide");
|
// alert("id is "+div[i].getAttribute("id"));
|
||||||
|
if (div[i].getAttribute("id") != behaviorIndex) {
|
||||||
|
// alert(div[i].getAttribute("id")+"!="+behaviorIndex);
|
||||||
|
$(div[i]).hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadMethodParams(behaviorData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var methodParams = new Array();
|
function loadMethodParams(behaviorData, behaviorIndex) {
|
||||||
var temp;
|
var methodParams = new Array();
|
||||||
function loadMethodParams(behaviorData) {
|
|
||||||
var temp = behaviorData.split('.');
|
var temp = behaviorData.split('.');
|
||||||
var plugin = temp[0].split('_')[0];
|
var plugin = temp[0].split('_')[0];
|
||||||
var method = temp[1];
|
var method = temp[1];
|
||||||
var fieldHTML = "";
|
var fieldHTML = "";
|
||||||
var documentHtml = "";
|
var documentHtml = "";
|
||||||
var boxHeader="";
|
var boxHeader = "";
|
||||||
|
|
||||||
$
|
$
|
||||||
.post(
|
.post(
|
||||||
|
@ -230,7 +209,7 @@ function loadMethodParams(behaviorData) {
|
||||||
alert(data.failedMessage);
|
alert(data.failedMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data=data.data;
|
data = data.data;
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
methodParams.push(data[i]);
|
methodParams.push(data[i]);
|
||||||
}
|
}
|
||||||
|
@ -244,12 +223,12 @@ function loadMethodParams(behaviorData) {
|
||||||
fieldHTML += createField(
|
fieldHTML += createField(
|
||||||
methodParamModel.lable,
|
methodParamModel.lable,
|
||||||
methodParamModel.name,
|
methodParamModel.name,
|
||||||
paramTypeModel.size);
|
paramTypeModel.size, behaviorIndex);
|
||||||
} else if (paramTypeModel.type == "multiField") {
|
} else if (paramTypeModel.type == "multiField") {
|
||||||
fieldHTML += createMultiField(
|
fieldHTML += createMultiField(
|
||||||
methodParamModel.lable,
|
methodParamModel.lable,
|
||||||
methodParamModel.name,
|
methodParamModel.name,
|
||||||
paramTypeModel.size);
|
paramTypeModel.size, behaviorIndex);
|
||||||
} else if (paramTypeModel.type == "Table") {
|
} else if (paramTypeModel.type == "Table") {
|
||||||
fieldHTML += createTable(methodParamModel);
|
fieldHTML += createTable(methodParamModel);
|
||||||
} else if (paramTypeModel.type == "CheckBox") {
|
} else if (paramTypeModel.type == "CheckBox") {
|
||||||
|
@ -266,19 +245,89 @@ function loadMethodParams(behaviorData) {
|
||||||
+ "<a class='btn btn-minimize btn-round'><i class='icon-chevron-up'></i></a></div></div>";
|
+ "<a class='btn btn-minimize btn-round'><i class='icon-chevron-up'></i></a></div></div>";
|
||||||
|
|
||||||
documentHtml = "<div id='"
|
documentHtml = "<div id='"
|
||||||
+ behaviorData
|
+ behaviorIndex
|
||||||
+ "' class=''><p class='hide'>"
|
+ "' class='hide'><p class='hide'>"
|
||||||
+ behaviorData
|
+ behaviorData
|
||||||
+ "</p><div class='span10 showPluginDetails box'>"
|
+ "</p><div class='span10 showPluginDetails box'>"
|
||||||
+ boxHeader
|
+ boxHeader
|
||||||
+ "<div class='box-content'>"
|
+ "<div class='box-content'>"
|
||||||
+ fieldHTML
|
+ fieldHTML
|
||||||
+ "</div><div><button id='' type='submit' onClick='uploadBehavior(this);'>submit</button></div></div></div>";
|
+ "</div><div><button id='' type='submit' onClick='uploadBehavior(this);'>submit</button></div></div></div>";
|
||||||
|
|
||||||
document.getElementById("showPluginMethod").innerHTML += documentHtml;
|
document.getElementById("showPluginMethod").innerHTML += documentHtml;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//创建一个label加一个input的域
|
||||||
|
function createField(label, name, size, behaviorIndex) {
|
||||||
|
if (size == 0) {
|
||||||
|
size = 20;
|
||||||
|
}
|
||||||
|
var fieldHTML = "<div class='Field sample_frame' id='" + behaviorIndex
|
||||||
|
+ "_" + name + "'><p>" + label
|
||||||
|
+ "</p><div class='sample_sub_frame'>" + name
|
||||||
|
+ ":<input type='text' size=" + size + " id='" + name
|
||||||
|
+ "_input' value=''></input></div></div>";
|
||||||
|
return fieldHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建一个可以增加field的域
|
||||||
|
function createMultiField(label, name, size, behaviorIndex) {
|
||||||
|
if (size == 0) {
|
||||||
|
size = 20;
|
||||||
|
}
|
||||||
|
var multiFieldHTML = "<div class='MultiField sample_frame' id='"
|
||||||
|
+ behaviorIndex
|
||||||
|
+ "_"
|
||||||
|
+ name
|
||||||
|
+ "'><p>"
|
||||||
|
+ name
|
||||||
|
+ ":"
|
||||||
|
+ label
|
||||||
|
+ "</p><div class='sample_sub_frame'><button type='submit' onClick='addField("
|
||||||
|
+ size+","+ behaviorIndex
|
||||||
|
+ ");'>Add Field</button><button type='submit' onClick='removeField();'>RemoveAll</button><br><table id='addFieldTable_"
|
||||||
|
+ behaviorIndex + "'></table></div></div>";
|
||||||
|
return multiFieldHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
var field;
|
||||||
|
function addField(size,addId) {
|
||||||
|
if(document.getElementById("addFieldTable_"+addId).childNodes.length==0){
|
||||||
|
field=0;
|
||||||
|
}
|
||||||
|
//alert("addId:"+addId+",field:"+field);
|
||||||
|
var data = "field_" + field + ":";
|
||||||
|
field = field + 1;
|
||||||
|
var newTrNode = document.createElement("tr");
|
||||||
|
var newTdNode1 = document.createElement("td");
|
||||||
|
var newTdNode2 = document.createElement("td");
|
||||||
|
var newTdNode3 = document.createElement("td");
|
||||||
|
var i = document.createElement("i");
|
||||||
|
i.setAttribute("class", "icon-trash");
|
||||||
|
i.setAttribute("style", "cursor:pointer");
|
||||||
|
i.setAttribute("onClick", "deleteField(this)");
|
||||||
|
newTdNode1.setAttribute("style", "width:40px;cursor:pointer;");
|
||||||
|
newTdNode1.setAttribute("class", data);
|
||||||
|
newTdNode2.setAttribute("style", "width:40px;");
|
||||||
|
var textNode = document.createTextNode(data);
|
||||||
|
var inputNode = document.createElement("input");
|
||||||
|
inputNode.setAttribute("type", "text");
|
||||||
|
inputNode.setAttribute("size", size);
|
||||||
|
|
||||||
|
newTdNode1.appendChild(textNode);
|
||||||
|
newTdNode2.appendChild(inputNode);
|
||||||
|
newTdNode3.appendChild(i);
|
||||||
|
newTrNode.appendChild(newTdNode1);
|
||||||
|
newTrNode.appendChild(newTdNode2);
|
||||||
|
newTrNode.appendChild(newTdNode3);
|
||||||
|
document.getElementById("addFieldTable_"+addId).appendChild(newTrNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteField(selectedNode) {
|
||||||
|
var deletedNode = selectedNode.parentNode.parentNode;
|
||||||
|
var parentNode = deletedNode.parentNode;
|
||||||
|
parentNode.removeChild(deletedNode);
|
||||||
|
}
|
||||||
|
|
||||||
// 创建一个Table域
|
// 创建一个Table域
|
||||||
function createTable(methodParamModel) {
|
function createTable(methodParamModel) {
|
||||||
|
@ -403,72 +452,7 @@ function createCheckBox(methodParamModel) {
|
||||||
return divNode.innerHTML;
|
return divNode.innerHTML;
|
||||||
|
|
||||||
}
|
}
|
||||||
// 创建一个label加一个input的域
|
|
||||||
function createField(label, name, size) {
|
|
||||||
|
|
||||||
// document.write(label+","+name+","+size);
|
|
||||||
if (size == 0) {
|
|
||||||
size = 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
var fieldHTML = "<div class='Field sample_frame' id='" + name + "'><p>" + label
|
|
||||||
+ "</p><div class='sample_sub_frame'>" + name
|
|
||||||
+ ":<input type='text' size=" + size + " id='" + name
|
|
||||||
+ "_input' value=''></input></div></div>";
|
|
||||||
return fieldHTML;
|
|
||||||
|
|
||||||
}
|
|
||||||
// 创建一个可以增加field的域
|
|
||||||
function createMultiField(label, name, size) {
|
|
||||||
if (size == 0) {
|
|
||||||
size = 20;
|
|
||||||
}
|
|
||||||
var multiFieldHTML = "<div class='MultiField sample_frame' id='"
|
|
||||||
+ name
|
|
||||||
+ "'><p>"
|
|
||||||
+ name
|
|
||||||
+ ":"
|
|
||||||
+ label
|
|
||||||
+ "</p><div class='sample_sub_frame'><button type='submit' onClick='addField("
|
|
||||||
+ size
|
|
||||||
+ ");'>Add Field</button><button type='submit' onClick='removeField();'>RemoveAll</button><br><table id='addFieldTable'></table></div></div>";
|
|
||||||
|
|
||||||
return multiFieldHTML;
|
|
||||||
}
|
|
||||||
|
|
||||||
var field = 0;
|
|
||||||
function addField(size) {
|
|
||||||
var data = "field_" + field + ":";
|
|
||||||
field = field + 1;
|
|
||||||
var newTrNode = document.createElement("tr");
|
|
||||||
var newTdNode1 = document.createElement("td");
|
|
||||||
var newTdNode2 = document.createElement("td");
|
|
||||||
var newTdNode3 = document.createElement("td");
|
|
||||||
var i = document.createElement("i");
|
|
||||||
i.setAttribute("class", "icon-trash");
|
|
||||||
i.setAttribute("style", "cursor:pointer");
|
|
||||||
i.setAttribute("onClick", "deleteField(this)");
|
|
||||||
newTdNode1.setAttribute("style", "width:40px;cursor:pointer;");
|
|
||||||
newTdNode1.setAttribute("class", data);
|
|
||||||
newTdNode2.setAttribute("style", "width:40px;");
|
|
||||||
var textNode = document.createTextNode(data);
|
|
||||||
var inputNode = document.createElement("input");
|
|
||||||
inputNode.setAttribute("type", "text");
|
|
||||||
inputNode.setAttribute("size", size);
|
|
||||||
|
|
||||||
newTdNode1.appendChild(textNode);
|
|
||||||
newTdNode2.appendChild(inputNode);
|
|
||||||
newTdNode3.appendChild(i);
|
|
||||||
newTrNode.appendChild(newTdNode1);
|
|
||||||
newTrNode.appendChild(newTdNode2);
|
|
||||||
newTrNode.appendChild(newTdNode3);
|
|
||||||
document.getElementById("addFieldTable").appendChild(newTrNode);
|
|
||||||
}
|
|
||||||
function deleteField(selectedNode) {
|
|
||||||
var deletedNode = selectedNode.parentNode.parentNode;
|
|
||||||
var parentNode = deletedNode.parentNode;
|
|
||||||
parentNode.removeChild(deletedNode);
|
|
||||||
}
|
|
||||||
function removeField() {
|
function removeField() {
|
||||||
$('#addFieldTable').empty();
|
$('#addFieldTable').empty();
|
||||||
}
|
}
|
||||||
|
@ -489,7 +473,40 @@ $('#behaviorCancel').click(function() {
|
||||||
$('#myModal_Behavior').modal('hide');
|
$('#myModal_Behavior').modal('hide');
|
||||||
});
|
});
|
||||||
|
|
||||||
function uploadBehavior(selectNode) {
|
function uploadBehavior(selectedNode){
|
||||||
|
var uploadNode = selectNode.parentNode.previousSibling;
|
||||||
|
var div=uploadNode.childNodes;
|
||||||
|
var length=div.length;
|
||||||
|
|
||||||
|
var fieldList="";
|
||||||
|
var multiFieldList="";
|
||||||
|
var tableList="";
|
||||||
|
var checkList="";
|
||||||
|
|
||||||
|
for(var i=0;i<length;i++){
|
||||||
|
var node=div[i];
|
||||||
|
if(node.Attr("class")=="Field sample_frame"){
|
||||||
|
fieldList+=$(node).find("input").val()+",";
|
||||||
|
}else if(node.Attr("class")=="multiField sample_frame"){
|
||||||
|
var fieldNode=$(node.lastNode).find("table").children();
|
||||||
|
var fieldLength=fieldNode.length;
|
||||||
|
for(var j=0;j<fieldLength;j++){
|
||||||
|
multiFieldList+=$(fieldNode[j]).find("input").val()+",";
|
||||||
|
}
|
||||||
|
//多个multiField如何解决
|
||||||
|
}else if(node.Attr("class")=="Table sample_frame"){
|
||||||
|
|
||||||
|
}else if(node.Attr("class")=="CheckBox sample_frame"){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var uploadBehavior = new UploadBehaviorRequestModel(tableList, checkList,
|
||||||
|
fieldList, multiFieldList);
|
||||||
|
upload(uploadBehavior);
|
||||||
|
}
|
||||||
|
|
||||||
|
function uploadBehavior1(selectNode) {
|
||||||
var uploadNode = selectNode.parentNode.parentNode;
|
var uploadNode = selectNode.parentNode.parentNode;
|
||||||
var tableNum = 0;
|
var tableNum = 0;
|
||||||
var tableList = "";
|
var tableList = "";
|
||||||
|
|
Loading…
Reference in New Issue