fix the behavior
This commit is contained in:
parent
e8528765ae
commit
80c22f6085
|
@ -174,4 +174,5 @@ result-deleteGraph=Delete Graph
|
|||
result-testStatus=Test Status
|
||||
result-vuser=VUs Active
|
||||
result-request=Requests
|
||||
result-loadingInfo=Please wait,loading result data...
|
||||
result-loadingInfo=Please wait,loading result data...
|
||||
testPlan-view=View Result
|
|
@ -175,4 +175,5 @@ result-deleteGraph=\u5220\u9664\u56FE
|
|||
result-testStatus=\u6D4B\u8BD5\u72B6\u6001
|
||||
result-vuser=\u5E76\u53D1\u7528\u6237
|
||||
result-request=\u53D1\u9001\u8BF7\u6C42
|
||||
result-loadingInfo=\u8BF7\u7A0D\u7B49\uFF0C\u6B63\u5728\u52A0\u8F7D\u6570\u636E
|
||||
result-loadingInfo=\u8BF7\u7A0D\u7B49\uFF0C\u6B63\u5728\u52A0\u8F7D\u6570\u636E
|
||||
testPlan-view=\u67E5\u770B\u7ED3\u679C
|
|
@ -9,7 +9,8 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description"
|
||||
content="Bench4Q, a new method for QOS benchmarking.">
|
||||
<link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css" rel="stylesheet">
|
||||
<link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css"
|
||||
rel="stylesheet">
|
||||
<link href="lib/chrisma/css/opa-icons.css" rel="stylesheet">
|
||||
<link
|
||||
href="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.2/css/bootstrap-responsive.css"
|
||||
|
@ -106,11 +107,11 @@
|
|||
<table class="table table-condensed " id="testPlanTab">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><fmt:message key="testplanrunid" /></th>
|
||||
<th>ID</th>
|
||||
<th><fmt:message key="datecreated" /></th>
|
||||
<th><fmt:message key="name" /></th>
|
||||
<th><fmt:message key="status" /></th>
|
||||
|
||||
<th><fmt:message key="createdatetime" /></th>
|
||||
<th><fmt:message key="testPlan-view" /></th>
|
||||
<th><fmt:message key="actions" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -141,6 +142,7 @@
|
|||
<script src="script/base.js"></script>
|
||||
<script src="script/scriptTable.js"></script>
|
||||
<script src="script/bench4q.table.js"></script>
|
||||
<script src="script/Share/TestStatusMap.js"></script>
|
||||
<script src="script/loadTestPlans.js"></script>
|
||||
<script src="script/home.js"></script>
|
||||
</fmt:bundle>
|
||||
|
|
|
@ -25,4 +25,5 @@ test-PendingNoEnoughCurrentLoad=PendingNoEnoughCurrentLoad
|
|||
test-Error=Error
|
||||
test-ErrorInSubmitTask=ErrorInSubmitTask
|
||||
test-ErrorInDistributeLoadForScript=ErrorInDistributeLoadForScript
|
||||
test-Complete=Complete
|
||||
test-Complete=Complete
|
||||
view=View
|
|
@ -19,5 +19,6 @@ test-PendingNoEnoughMaxLoad=\u8D44\u6E90\u4E0D\u8DB3
|
|||
test-PendingNoEnoughCurrentLoad=\u7B49\u5F85\u8D44\u6E90
|
||||
test-Error=\u9519\u8BEF
|
||||
test-ErrorInSubmitTask=\u63D0\u4EA4\u9519\u8BEF
|
||||
test-ErrorInDistributeLoadForScript=\u5206\u53D1\u6587\u4EF6\u9519\u8BEF
|
||||
test-Complete=\u5B8C\u6210
|
||||
test-ErrorInDistributeLoadForScript=\u5206\u53D1\u4EE3\u7406\u9519\u8BEF
|
||||
test-Complete=\u5B8C\u6210
|
||||
view=\u67E5\u770B
|
|
@ -166,7 +166,7 @@ body {
|
|||
src="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.1/bootstrap.min.js"></script>
|
||||
<script src="lib/chrisma/js/jquery.cookie.js"></script>
|
||||
<script
|
||||
src='http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.js'></script>
|
||||
src='http://cdn.datatables.net/1.10.0/js/jquery.dataTables.min.js'></script>
|
||||
<script src="lib/chrisma/js/theme.js"></script>
|
||||
<script src="lib/chrisma/js/jquery.cookie.js"></script>
|
||||
<script src="script/base.js"></script>
|
||||
|
|
|
@ -1,22 +1,49 @@
|
|||
var table=$('#scriptTab');
|
||||
var table = $('#scriptTab');
|
||||
$(document).ready(function() {
|
||||
setTable();
|
||||
var testsTableModel = new Array("testPlanRunId", "id", "createDateTime",
|
||||
"currentStatus");
|
||||
var loadTestPlanActionButton = downloadButton;
|
||||
loadTests($('#testPlanTab'), testsTableModel,5,loadTestPlanActionButton) ;
|
||||
loadScript(table,1);
|
||||
loadTestPlans($("#testPlanTab"));
|
||||
loadScript(table, 1);
|
||||
});
|
||||
|
||||
function setTable(){
|
||||
$(".table").dataTable(
|
||||
{
|
||||
bAutoWidth: true,
|
||||
bLengthChange :false,
|
||||
iDisplayLength: 5,
|
||||
bFilter:false,
|
||||
bInfo:false,
|
||||
"sPaginationType": "bootstrap"
|
||||
}
|
||||
);
|
||||
function setTable() {
|
||||
$("#scriptTab").dataTable({
|
||||
"bAutoWidth" : false,
|
||||
"aoColumns" : [ {
|
||||
"sWidth" : "20%"
|
||||
}, {
|
||||
"sWidth" : "20%"
|
||||
}, {
|
||||
"sWidth" : "30%"
|
||||
}, {
|
||||
"sWidth" : "30%"
|
||||
} ],
|
||||
bLengthChange : false,
|
||||
iDisplayLength : 5,
|
||||
bFilter : false,
|
||||
bInfo : false,
|
||||
"sPaginationType" : "bootstrap"
|
||||
});
|
||||
|
||||
$("#testPlanTab").dataTable({
|
||||
|
||||
"bAutoWidth" : false,
|
||||
"aoColumns" : [ {
|
||||
"sWidth" : "10%"
|
||||
}, {
|
||||
"sWidth" : "10%"
|
||||
}, {
|
||||
"sWidth" : "15%"
|
||||
}, {
|
||||
"sWidth" : "30%"
|
||||
}, {
|
||||
"sWidth" : "15%"
|
||||
}, {
|
||||
"sWidth" : "20%"
|
||||
} ],
|
||||
bLengthChange : false,
|
||||
iDisplayLength : 5,
|
||||
bFilter : false,
|
||||
bInfo : false,
|
||||
"sPaginationType" : "bootstrap"
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,93 +1,43 @@
|
|||
var downloadButton = "<a class='btn btn-success download' ><i class='icon-zoom-in icon-white'></i>Report</a>"
|
||||
+ " ";
|
||||
var deleteButton = "<a class='btn btn-info delete'><i class='icon-trash icon-white'></i>Delete</a>";
|
||||
var testsTableModel = new Array("testPlanRunId", "id", "createDateTime",
|
||||
"currentStatus");
|
||||
var testPlanColumnIndex = {
|
||||
"RunId" : 0,
|
||||
"ID" : 1,
|
||||
"Create Time" : 2,
|
||||
"Status" : 3
|
||||
};
|
||||
function loadTestPlans(table) {
|
||||
|
||||
|
||||
function loadTests(table, model,loadLength,actionButton) {
|
||||
var downLoadButton = "<a class='btn btn-success download' >"+$.i18n.prop('report')+"</a>";
|
||||
var deleteButton = "<a class='btn btn-info delete'>"+$.i18n.prop('delete')+"</a>";
|
||||
var viewResult = "<a class='btn btn-info result'><i class='icon-zoom-in icon-white'></i>"
|
||||
+ $.i18n.prop('view') +" "+"</a>";
|
||||
table.dataTable().fnClearTable();
|
||||
|
||||
$.post("loadTestPlans", {}, function(data) {
|
||||
$.get("loadTestPlans", {}, function(data) {
|
||||
if (data.success) {
|
||||
data=data.data;
|
||||
if (data.list != null){
|
||||
if(loadLength<0)
|
||||
loadLength=data.list.length;
|
||||
if(data.list.length<loadLength)
|
||||
loadLength=data.list.length;
|
||||
for ( var i = 0; i < loadLength; i++)
|
||||
table.dataTable().fnAddData(
|
||||
|
||||
extractRowData(data.list[i], model, actionButton));
|
||||
var testPlans = data.testPlans;
|
||||
for ( var i = 0; i < testPlans.length; i++) {
|
||||
var addRow = table.dataTable().fnAddData(
|
||||
[ i, testPlans[i].name,testStatusMap( testPlans[i].currentStatus),
|
||||
new Date(testPlans[i].createDateTime),
|
||||
viewResult, deleteButton + downLoadButton ]);
|
||||
var tr = table.dataTable().fnSettings().aoData[addRow[0]].nTr;
|
||||
$(tr).attr("testPlanRunId", testPlans[i].testPlanRunId);
|
||||
$(tr).attr("id", testPlans[i].id);
|
||||
}
|
||||
|
||||
|
||||
var nodes= table.fnGetNodes();
|
||||
for ( var i = 0; i <nodes.length; i++) {
|
||||
var testPlanIdColumn = $($(nodes[i]).children("td")
|
||||
.eq(0));
|
||||
var testPlanId = testPlanIdColumn.text();
|
||||
testPlanIdColumn.html("")
|
||||
var href = "<a href='result.jsp?testPlanId=" + testPlanId + "'>"
|
||||
+ testPlanId + "</a>"
|
||||
testPlanIdColumn.html(href);
|
||||
}
|
||||
}
|
||||
else
|
||||
alert(data.failedMessage);
|
||||
} else {
|
||||
alert($.i18n.prop('fail'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
$('.download').click(function(e) {
|
||||
e.preventDefault();
|
||||
downloadResult(this);
|
||||
var testPlanId = $(this).closest("tr").attr("id");
|
||||
downloadResult(testPlanId);
|
||||
});
|
||||
$('.delete').click(function(e) {
|
||||
e.preventDefault();
|
||||
deleteTest(this);
|
||||
var testPlanId = $(this).closest("tr").attr("id");
|
||||
var row= $(this).closest("tr");
|
||||
deleteTest(testPlanId,table,row);
|
||||
});
|
||||
$('.result').click(function(e) {
|
||||
e.preventDefault();
|
||||
var testPlanId = $(this).closest("tr").attr("testPlanRunId");
|
||||
window.open("result.jsp?testPlanId=" + testPlanId);
|
||||
});
|
||||
}, "json");
|
||||
|
||||
}
|
||||
|
||||
function viewResult(obj) {
|
||||
var testRunId = getColumn(testPlanColumnIndex.RunId);
|
||||
|
||||
}
|
||||
function downloadResult(obj) {
|
||||
var testRunId = getColumn(obj, testPlanColumnIndex.RunId);
|
||||
var form = $("<form>");// 定义一个form表单
|
||||
form.attr("style", "display:none");
|
||||
form.attr("method", "post");
|
||||
form.attr("action", "downloadReport");
|
||||
var input1 = $("<input>");
|
||||
input1.attr("type", "hidden");
|
||||
input1.attr("name", "testPlanId");
|
||||
input1.attr("value", testRunId);
|
||||
$("body").append(form);
|
||||
form.append(input1);
|
||||
form.submit();
|
||||
}
|
||||
function deleteTest(obj) {
|
||||
var testPlanId = getColumn(obj, testPlanColumnIndex.ID);//
|
||||
$.post("deleteTest", {
|
||||
testPlanId : testPlanId
|
||||
}, function(data) {
|
||||
|
||||
if (data.success) {
|
||||
var table = getTable(obj);
|
||||
var row = getRow(obj);
|
||||
$(table).dataTable().fnDeleteRow(row.rowIndex - 1);
|
||||
} else {
|
||||
alert(data.failedMessage);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
|
@ -1,10 +1,9 @@
|
|||
var viewButton = "<a class='btn btn-success' onClick='editScript(this)' ><i class='icon-zoom-in icon-white'></i>View</a>"
|
||||
+ " ";
|
||||
var editButton = "<a class='btn btn-success' onClick='editScript(this)' ><i class='icon-edit icon-white'></i>Edit</a>"
|
||||
|
||||
var editButton = "<a class='btn btn-success' onClick='editScript(this)' ><i class='icon-edit icon-white'></i>Edit</a>";
|
||||
+ " ";
|
||||
var deleteButton = "<a class='btn btn-info' onClick='deleteScript(this)'><i class='icon-trash icon-white'></i>Delete</a>";
|
||||
function loadScript(table, actionId) {
|
||||
|
||||
|
||||
table.dataTable().fnClearTable();
|
||||
$.post("loadScripts", {}, function(data) {
|
||||
if (data.success) {
|
||||
|
@ -33,6 +32,8 @@ function addScriptAction() {
|
|||
});
|
||||
}
|
||||
function addScriptTableRow(table, data, actionId) {
|
||||
var viewButton = "<a class='btn btn-success' onClick='editScript(this)' ><i class='icon-zoom-in icon-white'></i>"+ $.i18n.prop('view')+"</a>";
|
||||
+ " ";
|
||||
var time = new Date(data.createDateTime);
|
||||
time.setTime(data.createDateTime);
|
||||
switch (actionId) {
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
$(document).ready(function() {
|
||||
var table = $("#table");
|
||||
|
||||
loadTestPlans(table);
|
||||
});
|
||||
|
||||
function loadTestPlans(table) {
|
||||
|
||||
var downLoadButton = "<a class='btn btn-success download' >"+$.i18n.prop('report')+"</a>";
|
||||
var deleteButton = "<a class='btn btn-info delete'>"+$.i18n.prop('delete')+"</a>";
|
||||
var viewResult = "<a class='btn btn-info result'>"
|
||||
+ $.i18n.prop('testPlan-view') +" "+"</a>";
|
||||
table.dataTable().fnClearTable();
|
||||
$.get("loadTestPlans", {}, function(data) {
|
||||
if (data.success) {
|
||||
var testPlans = data.testPlans;
|
||||
for ( var i = 0; i < testPlans.length; i++) {
|
||||
var addRow = table.dataTable().fnAddData(
|
||||
[ i, testPlans[i].name,testStatusMap( testPlans[i].currentStatus),
|
||||
new Date(testPlans[i].createDateTime),
|
||||
viewResult, deleteButton + downLoadButton ]);
|
||||
var tr = table.dataTable().fnSettings().aoData[addRow[0]].nTr;
|
||||
$(tr).attr("testPlanRunId", testPlans[i].testPlanRunId);
|
||||
$(tr).attr("id", testPlans[i].id);
|
||||
}
|
||||
|
||||
} else {
|
||||
alert($.i18n.prop('fail'));
|
||||
|
||||
}
|
||||
|
||||
$('.download').click(function(e) {
|
||||
e.preventDefault();
|
||||
var testPlanId = $(this).closest("tr").attr("id");
|
||||
downloadResult(testPlanId);
|
||||
});
|
||||
$('.delete').click(function(e) {
|
||||
e.preventDefault();
|
||||
var testPlanId = $(this).closest("tr").attr("id");
|
||||
var row= $(this).closest("tr");
|
||||
deleteTest(testPlanId,table,row);
|
||||
});
|
||||
$('.result').click(function(e) {
|
||||
e.preventDefault();
|
||||
var testPlanId = $(this).closest("tr").attr("testPlanRunId");
|
||||
window.open("result.jsp?testPlanId=" + testPlanId);
|
||||
});
|
||||
}, "json");
|
||||
}
|
||||
function downloadResult(testPlanId) {
|
||||
var form = $("<form>");// 定义一个form表单
|
||||
form.attr("style", "display:none");
|
||||
form.attr("method", "post");
|
||||
form.attr("action", "downloadReport");
|
||||
var input1 = $("<input>");
|
||||
input1.attr("type", "hidden");
|
||||
input1.attr("name", "testPlanId");
|
||||
input1.attr("value", testPlanId);
|
||||
$("body").append(form);
|
||||
form.append(input1);
|
||||
form.submit();
|
||||
}
|
||||
function deleteTest(testPlanId,table,row) {
|
||||
$.post("deleteTest", {
|
||||
testPlanId : testPlanId
|
||||
}, function(data) {
|
||||
if (data.success) {
|
||||
$(table).dataTable().fnDeleteRow(row.index());
|
||||
} else {
|
||||
alert($.i18n.prop('fail'));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
function Behavior() {
|
||||
this.addButton = "<img src='images/add.png' alt='details' title='details' class='show-detail'>";
|
||||
this.deleteButton = "<img src='images/add.png' alt='details' title='details' class='delete-detail'>";
|
||||
this.table = $("#url").dataTable();
|
||||
this.table = $("#url").DataTable();
|
||||
this.loadBehaviorResults = function(testPlanId, scripts) {
|
||||
var table = $("#url").DataTable();
|
||||
var map = new HashMap();
|
||||
|
@ -46,7 +46,7 @@ function Behavior() {
|
|||
}
|
||||
this.insertDataToTable = function(table, map) {
|
||||
|
||||
table.fnClearTable();
|
||||
table.clear();
|
||||
for ( var k = 0; k < map.length(); k++) {
|
||||
var names = map.getKeys();
|
||||
var behaviors = map.get(names[k]).behaviorBriefModels;
|
||||
|
@ -56,9 +56,10 @@ function Behavior() {
|
|||
|
||||
for ( var j = 0; j < behaviors.length; j++) {
|
||||
var data = behaviors[j];
|
||||
table.fnAddData([ this.addButton, data.behaviorUrl, names[k],
|
||||
data.totalCount, data.successfulCount ]);
|
||||
var rowNode=table.row.add([this.addButton,data.behaviorUrl,names[k],data.totalCount,data.successfulCount]);
|
||||
rowNode.data(behaviors[i].detailStatusCodeResultModels);
|
||||
}
|
||||
table.draw();
|
||||
}
|
||||
this.addEvent();
|
||||
}
|
||||
|
@ -106,14 +107,13 @@ function Behavior() {
|
|||
|
||||
var tr = $(this).closest('tr');
|
||||
var row = behavior.table.row(tr);
|
||||
row.child.hide();
|
||||
row.child(behavior.createDetailTable(row.data())).show();
|
||||
|
||||
});
|
||||
$(".delete-detail").click(function() {
|
||||
var tr = $(this).closest('tr');
|
||||
var row = behavior.table.row(tr);
|
||||
|
||||
// row.child(behavior.gcreateDetailTable() ).show();
|
||||
row.child().hide();
|
||||
|
||||
});
|
||||
};
|
||||
|
|
|
@ -6,9 +6,8 @@ $(function() {
|
|||
var testPlan = getTestInfo(testPlanId);
|
||||
// getTestBrief();
|
||||
loadPageResult(testPlanId, testPlan.scripts);
|
||||
|
||||
// var behavior = new Behavior();
|
||||
// behavior.loadBehaviorResults(testPlanId, testPlan.scripts);
|
||||
var behavior = new Behavior();
|
||||
behavior.loadBehaviorResults(testPlanId, testPlan.scripts);
|
||||
var tree = getResultTree(testPlanId);
|
||||
var chart = new Chart();
|
||||
chart.createChart($("#chart"));
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
$(document).ready(function() {
|
||||
var table = $("#table");
|
||||
|
||||
loadTestPlans(table);
|
||||
});
|
||||
|
||||
|
||||
function downloadResult(testPlanId) {
|
||||
var form = $("<form>");// 定义一个form表单
|
||||
form.attr("style", "display:none");
|
||||
form.attr("method", "post");
|
||||
form.attr("action", "downloadReport");
|
||||
var input1 = $("<input>");
|
||||
input1.attr("type", "hidden");
|
||||
input1.attr("name", "testPlanId");
|
||||
input1.attr("value", testPlanId);
|
||||
$("body").append(form);
|
||||
form.append(input1);
|
||||
form.submit();
|
||||
}
|
||||
function deleteTest(testPlanId,table,row) {
|
||||
$.post("deleteTest", {
|
||||
testPlanId : testPlanId
|
||||
}, function(data) {
|
||||
if (data.success) {
|
||||
$(table).dataTable().fnDeleteRow(row.index());
|
||||
} else {
|
||||
alert($.i18n.prop('fail'));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
|
@ -131,8 +131,9 @@ body {
|
|||
<script src="lib/chrisma/js/theme.js"></script>
|
||||
<script src="script/base.js"></script>
|
||||
<script src="script/bench4q.table.js"></script>
|
||||
<script src="script/loadTestPlans.js"></script>
|
||||
<script src="script/Share/TestStatusMap.js"></script>
|
||||
<script src="script/testPlans.js"></script>
|
||||
<script src="script/testplans.js"></script>
|
||||
</fmt:bundle>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue