add filter button

This commit is contained in:
luqiong 2014-09-02 16:09:10 +08:00
parent e11965f251
commit 01a0e56f6e
2 changed files with 37 additions and 33 deletions

View File

@ -1,5 +1,6 @@
var script = new Array(); var script = new Array();
var filter = new Array(); var filter = new Array();
var filterArray = new Array();
$(document).ready(function() { $(document).ready(function() {
$.post("loadScripts", {}, function(data) { $.post("loadScripts", {}, function(data) {
if (!data.success) { if (!data.success) {
@ -33,42 +34,42 @@ function createFilter(){
return; return;
}else{ }else{
$('#selectFilter').show(); $('#selectFilter').show();
if(!document.getElementsByClassName('clicked')[0]){
var table = $("<table></table>");
data = data.filterTypeList; data = data.filterTypeList;
for ( var i = 0; i < data.length; i++) for ( var i = 0; i < data.length; i++)
filter.push(data[i]); filter.push(data[i]);
for( var j = 0; j < filter.length; j++){ for( var j = 0; j < filter.length; j++){
var textNode = document.createTextNode(filter[j]); var checkbox = createCheckbox(filter[j],filter[j]);
var checkboxNode = document.createElement("input"); if(j%2==0){
checkboxNode.setAttribute("type", "checkbox"); var tr = $("<tr></tr>");
checkboxNode.setAttribute("name", "filterList"); table.append(tr);
checkboxNode.setAttribute("id", "filterList"+j); }
checkboxNode.appendChild(textNode); tr.append(checkbox);
}
/* var line = $("<div style='cursor:pointer;'>"); $('#filterList').append(table);
line.click(function(){
document.getElementById(id).checked = true;
})
var input = $("<input type='radio' name="+name+" id="+id+">");
input.attr("value",value);
input.attr("text",text);
var span = $("<label for="+id+" style='cursor:pointer;'>");
span.html(text);
line.append(input);
line.append(span);
line.addClass("line");
*/
$('#filterList').append(checkboxNode);
} }
} }
}); });
} }
function createCheckbox(id,text){
var line = $("<td></td>");
line.click(function(){
document.getElementById(id).checked = true;
})
var input = $("<input type='checkbox' name='filterList' id="+id+">");
input.attr("text",text);
line.append(input);
line.append(document.createTextNode(text));
line.addClass("line");
return line;
}
$("#selectFilter #ok").click(function() { $("#selectFilter #ok").click(function() {
$("#selectFilter").hide(); $("#selectFilter").hide();
}); $("#selectFilter #ok").addClass("clicked");
filter=[];
$("#selectFilter #cancel").click(function() {
$("#selectFilter").hide();
}); });
function toggleTestExecutionPlan() { function toggleTestExecutionPlan() {
@ -525,7 +526,9 @@ function start() {
scriptList.push(new ScriptModel(scriptIdList[k], loadList[k], warmUp, scriptList.push(new ScriptModel(scriptIdList[k], loadList[k], warmUp,
coolDown, executeRange)); coolDown, executeRange));
} }
var filterSelected = $("#filterList div input[name='filterList']:checked");
for(var i=0;i<filterSelected.length;i++)
filterArray.push(filterSelected[i].id);
var name = $("#testConfigurationName").val(); var name = $("#testConfigurationName").val();
var testPlan = new TestPlanRequestModel(scriptList, ipList, name); var testPlan = new TestPlanRequestModel(scriptList, ipList, name);

View File

@ -24,6 +24,10 @@ body {
.sidebar-nav { .sidebar-nav {
padding: 9px 0; padding: 9px 0;
} }
.modal{
position:relative;
}
</style> </style>
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet"> <link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
<link href='css/bench4q.css' rel='stylesheet'> <link href='css/bench4q.css' rel='stylesheet'>
@ -199,9 +203,6 @@ body {
<button type="button" class="btn btn-primary btn-width" id="ok"> <button type="button" class="btn btn-primary btn-width" id="ok">
<fmt:message key="plugin_jsp_finish" /> <fmt:message key="plugin_jsp_finish" />
</button> </button>
<button type="button" class="btn btn-primary btn-width" id="cancel">
<fmt:message key="plugin_jsp_cancel" />
</button>
</div> </div>
</div> </div>
<div id="userConfigMessage" class="hide">all input can not <div id="userConfigMessage" class="hide">all input can not