when you change the one select,the others under it will change
This commit is contained in:
parent
f4ea880c12
commit
0ec1346631
|
@ -32,7 +32,7 @@ public abstract class BaseControllerService {
|
|||
public static final Properties prop = new Properties();
|
||||
|
||||
public BaseControllerService() {
|
||||
String masterIpFilePath;
|
||||
/*String masterIpFilePath;
|
||||
try {
|
||||
masterIpFilePath = BaseControllerService.class.getClassLoader()
|
||||
.getResource("").toURI().getPath()
|
||||
|
@ -47,9 +47,9 @@ public abstract class BaseControllerService {
|
|||
e1.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
|
||||
/*this.masterIP="127.0.0.1:7979/";*/
|
||||
this.masterIP="127.0.0.1:7979/";
|
||||
}
|
||||
|
||||
public HttpRequester getHttpRequester() {
|
||||
|
|
|
@ -25,7 +25,6 @@ function UrlModel() {
|
|||
$(document).ready(
|
||||
function() {
|
||||
/* testPlanId = getvars()['testPlanId']; */
|
||||
|
||||
testPlanId = 1;
|
||||
var scripts = new Array("www", "wxr");
|
||||
var allList = createScriptList(scripts, scriptResult);
|
||||
|
@ -91,7 +90,7 @@ function initTestScriptContainer(parent, data) {
|
|||
var table = createTable(containerModel.scriptList, tableClass, scriptInfo);
|
||||
box.children('.box-content').append(table);
|
||||
setTable(table);
|
||||
for ( var i = 0; i < data.length; i++) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
table.dataTable().fnAddData(
|
||||
[ data[i].scriptName, data[i].scriptId, data[i].requireLoad,
|
||||
data[i].config.warmUp, data[i].config.executeRange,
|
||||
|
@ -105,15 +104,15 @@ function initSUTContainer(data) {
|
|||
function createScriptList(scripts, scriptResult) {
|
||||
if (scripts.length == null || scripts.length <= 0)
|
||||
return;
|
||||
var list = new ChartList("Script", "", new Array());
|
||||
for ( var i = 0; i < scripts.length; i++) {
|
||||
list.child[i] = new ChartList("Result", scripts[i], new Array());
|
||||
var list = new treeNode("Script", "", new Array());
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
list.child[i] = new treeNode("Result", scripts[i], new Array());
|
||||
if (scriptResult == null && scriptResult.length <= 0)
|
||||
list.child[i].child = null;
|
||||
else {
|
||||
for ( var j = 0; j < scriptResult.length; j++) {
|
||||
list.child[i].child.push(new ChartList("", scriptResult[j],
|
||||
null));
|
||||
for (var j = 0; j < scriptResult.length; j++) {
|
||||
list.child[i].child
|
||||
.push(new treeNode("", scriptResult[j], null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,9 +124,9 @@ function initChart(parent, id, title, allList, initShowList, data) {
|
|||
parent.append(box);
|
||||
if (allList == null)
|
||||
alert("list is null");
|
||||
var excessList = createExcessList(allList, initShowList);
|
||||
var excessList = generateExcessList(allList, initShowList);
|
||||
if (initShowList == null)
|
||||
initShowList = new ChartList("", "", null);
|
||||
initShowList = new treeNode("", "", null);
|
||||
$('#addBtn').click({
|
||||
showList : excessList,
|
||||
id : id + "AddModal"
|
||||
|
@ -149,12 +148,32 @@ function initChart(parent, id, title, allList, initShowList, data) {
|
|||
}, function(event) {
|
||||
event.preventDefault();
|
||||
var addGraphModal = $('#' + id + 'AddModal');
|
||||
;
|
||||
var dataArray = getGraphOperData(addGraphModal);
|
||||
var dataArray = selectedDataArray(addGraphModal);
|
||||
addList(dataArray, event.data.addList);
|
||||
deleteList(dataArray, event.data.deleteList, 0);
|
||||
});
|
||||
|
||||
var selectAddContainer = $(addGraphModal.children(".modal-body"));
|
||||
selectAddContainer.change({
|
||||
div : addGraphModal,
|
||||
showList : excessList
|
||||
}, function(event) {
|
||||
var selectArray = $(this).children(".control-group").children(
|
||||
".controls").children("select");
|
||||
for (var i = 0; i < selectArray.length; i++) {
|
||||
if (selectArray[i].selectedIndex != 0) {
|
||||
var dataArray = selectedDataArray(event.data.div);
|
||||
if (i != selectArray.length - 1) {
|
||||
for (var j = i + 1; j <= dataArray.length; j++) {
|
||||
dataArray.pop();
|
||||
}
|
||||
var tree = childTree(dataArray, event.data.showList);
|
||||
showChildSelect($(this), i+1, tree);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
var deleteGraphModal = $('#' + id + 'DelModal');
|
||||
deleteGraphModal.children(".modal-footer").children("#ok").click({
|
||||
addList : excessList,
|
||||
|
@ -163,31 +182,84 @@ function initChart(parent, id, title, allList, initShowList, data) {
|
|||
event.preventDefault();
|
||||
var deleteGraphModal = $('#' + id + 'DelModal');
|
||||
;
|
||||
var dataArray = getGraphOperData(deleteGraphModal);
|
||||
var dataArray = selectedDataArray(deleteGraphModal);
|
||||
addList(dataArray, event.data.addList);
|
||||
deleteList(dataArray, event.data.deleteList, 0);
|
||||
});
|
||||
}
|
||||
function showGraphOperList(parent, list, select) {
|
||||
|
||||
if (list == null)
|
||||
}
|
||||
function childTree(selectedDataArray, showList) {
|
||||
if (showList == null)
|
||||
return null;
|
||||
if (showList.child == null)
|
||||
return null;
|
||||
if (selectedDataArray == null)
|
||||
return null;
|
||||
if (selectedDataArray.length == 0)
|
||||
return null;
|
||||
var tree = showList;
|
||||
for (var i = 0; i < selectedDataArray.length; i++) {
|
||||
for (var j = 0; j < tree.child.length; j++){
|
||||
if (tree.child[j].key == selectedDataArray[i].data) {
|
||||
tree = tree.child[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
|
||||
}
|
||||
function initSelectGraphDialog(parent, tree) {
|
||||
|
||||
if (tree == null)
|
||||
return;
|
||||
|
||||
if (list.child != null && list.child.length > 0) {
|
||||
if (select == null)
|
||||
select = list.child[0];
|
||||
if (tree.child != null && tree.child.length > 0) {
|
||||
|
||||
var selected = tree.child[0];
|
||||
var options = new Array();
|
||||
for ( var i = 0; i < list.child.length; i++) {
|
||||
options.push(list.child[i].key);
|
||||
for (var i = 0; i < tree.child.length; i++) {
|
||||
options.push(tree.child[i].key);
|
||||
}
|
||||
parent.append(createSingleList(list.childClass, options));
|
||||
showGraphOperList(parent, select, null);
|
||||
parent.append(createSingleList(tree.childClass, options));
|
||||
initSelectGraphDialog(parent, selected);
|
||||
}
|
||||
}
|
||||
function deleteGraph(model, currenGraphs) {
|
||||
function showChildSelect(parent, index, childTree) {
|
||||
if(childTree==null)
|
||||
return;
|
||||
if(childTree.child==null)
|
||||
return;
|
||||
deleteUnuedChildSelectAndlable(parent, index-1);
|
||||
|
||||
if (childTree == null)
|
||||
return;
|
||||
var selected = childTree.child[0];
|
||||
var options = new Array();
|
||||
for (var i = 0; i < childTree.child.length; i++) {
|
||||
options.push(childTree.child[i].key);
|
||||
}
|
||||
var nextChild = createSingleList(childTree.childClass, options);
|
||||
parent.append(nextChild);
|
||||
showChildSelect(parent, ++index, selected);
|
||||
}
|
||||
function createExcessList(allList, showList) {
|
||||
function deleteUnuedChildSelectAndlable(container, index) {
|
||||
var lableArray = $(container.children(".control-group")
|
||||
.children("lable"));
|
||||
var selectArray = $(container.children(".control-group")
|
||||
.children(".controls").children("select"));
|
||||
|
||||
var child=new Array();
|
||||
for (var i = 0; i <=index; i++) {
|
||||
child.push($(container.children('.control-group')[i]));
|
||||
}
|
||||
container.html("");
|
||||
|
||||
for(var i=0;i<=index;i++){
|
||||
container.append(child[i]);
|
||||
}
|
||||
}
|
||||
function generateExcessList(allList, showList) {
|
||||
if (allList == null)
|
||||
return null;
|
||||
if (allList.child == null)
|
||||
|
@ -196,13 +268,13 @@ function createExcessList(allList, showList) {
|
|||
return null;
|
||||
if (showList == null || showList.child.length == 0)
|
||||
return allList;
|
||||
var excessList = new ChartList(allList.childClass, allList.key, new Array());
|
||||
var excessList = new treeNode(allList.childClass, allList.key, new Array());
|
||||
var flag = false;
|
||||
for ( var i = 0; i < allList.child.length; i++) {
|
||||
for ( var j = 0; j < showList.child.length; j++) {
|
||||
for (var i = 0; i < allList.child.length; i++) {
|
||||
for (var j = 0; j < showList.child.length; j++) {
|
||||
if (allList.child[i].key == showList.child[j].key) {
|
||||
flag = true;
|
||||
var childExcessList = createExcessList(allList.child[i],
|
||||
var childExcessList = generateExcessList(allList.child[i],
|
||||
showList.child[j]);
|
||||
if (childExcessList.child != null
|
||||
&& childExcessList.child.length > 0)
|
||||
|
@ -221,7 +293,7 @@ function getvars() {
|
|||
var vars = [], hash;
|
||||
var hashes = window.location.href.slice(
|
||||
window.location.href.indexOf('?') + 1).split('&');
|
||||
for ( var i = 0; i < hashes.length; i++) {
|
||||
for (var i = 0; i < hashes.length; i++) {
|
||||
hash = hashes[i].split('=');
|
||||
vars.push(hash[0]);
|
||||
vars[hash[0]] = hash[1];
|
||||
|
@ -232,31 +304,31 @@ function getvars() {
|
|||
function graphOper(id, list) {
|
||||
var container = $("#" + id);
|
||||
container.children('.modal-body').html("");
|
||||
showGraphOperList(container.children('.modal-body'), list, null);
|
||||
initSelectGraphDialog(container.children('.modal-body'), list);
|
||||
|
||||
if (!container.is(":visible")) {
|
||||
container.modal('show');
|
||||
} else
|
||||
container.modal('hide');
|
||||
}
|
||||
function ChartList(childClass, key, child) {
|
||||
function treeNode(childClass, key, child) {
|
||||
this.childClass = childClass;
|
||||
this.key = key;
|
||||
this.child = child;
|
||||
}
|
||||
function addList(dataArray, list) {
|
||||
if (list == null) {
|
||||
alert("the list need to add graph is null");
|
||||
function addList(selectedDataArray, tree) {
|
||||
if (tree == null) {
|
||||
alert("the tree need to add graph is null");
|
||||
return;
|
||||
}
|
||||
if (list.child == null)
|
||||
list.child = new Array();
|
||||
var link = list;
|
||||
for ( var i = 0; i < dataArray.length; i++) {
|
||||
if (tree.child == null)
|
||||
tree.child = new Array();
|
||||
var link = tree;
|
||||
for (var i = 0; i < selectedDataArray.length; i++) {
|
||||
var flag = false;
|
||||
if (link.child != null) {
|
||||
for ( var j = 0; j < link.child.length; j++) {
|
||||
if (link.child[j].key == dataArray[i].data) {
|
||||
for (var j = 0; j < link.child.length; j++) {
|
||||
if (link.child[j].key == selectedDataArray[i].data) {
|
||||
flag = true;
|
||||
link = link.child[j];
|
||||
break;
|
||||
|
@ -269,7 +341,7 @@ function addList(dataArray, list) {
|
|||
link.child = new Array();
|
||||
link.childClass = dataArray[i].field;
|
||||
}
|
||||
var child = new ChartList("", dataArray[i].data, new Array());
|
||||
var child = new treeNode("", selectedDataArray[i].data, new Array());
|
||||
|
||||
link.child.push(child);
|
||||
link = child;
|
||||
|
@ -278,20 +350,20 @@ function addList(dataArray, list) {
|
|||
link.child = null;
|
||||
}
|
||||
|
||||
function deleteList(dataArray, list, index) {
|
||||
if (dataArray == null)
|
||||
function deleteList(selectedDataArray, tree, index) {
|
||||
if (selectedDataArray == null)
|
||||
return;
|
||||
if (dataArray.length == 0)
|
||||
if (selectedDataArray.length == 0)
|
||||
return;
|
||||
if (list.child == null) {
|
||||
if (tree.child == null) {
|
||||
return;
|
||||
}
|
||||
var parent = list;
|
||||
if (index >= dataArray.length || parent.child == null)
|
||||
var parent = tree;
|
||||
if (index >= selectedDataArray.length || parent.child == null)
|
||||
return;
|
||||
for ( var i = 0; i < parent.child.length; i++) {
|
||||
if (parent.child[i].key == dataArray[index].data) {
|
||||
deleteList(dataArray, parent.child[i], ++index);
|
||||
for (var i = 0; i < parent.child.length; i++) {
|
||||
if (parent.child[i].key == selectedDataArray[index].data) {
|
||||
deleteList(selectedDataArray, parent.child[i], ++index);
|
||||
if (parent.child[i].child == null)
|
||||
parent.child[i] = null;
|
||||
if (parent.child[i] == null)
|
||||
|
@ -303,21 +375,21 @@ function deleteList(dataArray, list, index) {
|
|||
}
|
||||
}
|
||||
|
||||
function getGraphOperData(div) {
|
||||
function selectedDataArray(div) {
|
||||
var dataArray = new Array();
|
||||
var lableArray = div.children(".modal-body").children(".control-group")
|
||||
.children("lable");
|
||||
var selectArray = div.children(".modal-body").children(".control-group")
|
||||
.children(".controls").children("select");
|
||||
for ( var i = 0; i < selectArray.length; i++) {
|
||||
var dataModel = new graphOperDataModel($(lableArray[i]).text(), $(
|
||||
for (var i = 0; i < selectArray.length; i++) {
|
||||
var dataModel = new selectedDataNode($(lableArray[i]).text(), $(
|
||||
selectArray[i]).find("option:selected").text());
|
||||
dataArray.push(dataModel);
|
||||
}
|
||||
return dataArray;
|
||||
|
||||
}
|
||||
function graphOperDataModel(field, data) {
|
||||
function selectedDataNode(field, data) {
|
||||
this.field = field;
|
||||
this.data = data;
|
||||
}
|
Loading…
Reference in New Issue