fix bug in testTask.js

This commit is contained in:
fanfuxiaoran 2014-02-21 13:44:45 +08:00
parent 453ddf7ae2
commit cc3e6a1b6d
2 changed files with 56 additions and 49 deletions

View File

@ -44,7 +44,7 @@ public class TestPlanInfo {
String accessToken,
String testPlanId,String caller) throws CustomGenericException,
JAXBException {
caller =caller+ "_getTestPlanInfo";
caller =caller+ "_TestPlanInfo:getTestPlanInfoFormDB";
String url = this.baseUrl + "/queryTestPlan/" + testPlanId;
TestPlanDBModel testPlanDBModel = (TestPlanDBModel) this
.getCommunicateWithMaster().getResponseModel(accessToken, url,

View File

@ -8,67 +8,74 @@ $('.datatable').dataTable({
"sLengthMenu" : "_MENU_ records per page"
}
});
var testPlanTaskList;
function testPlanTaskList() {
$('#testTaskList').dataTable().fnClearTable();
var statusHtml;
$.post("testPlanTaskList", {}, function(data) {
if (!data.success) {
alert(data.failedMessage);
return;
}
if(data.data.length==0)
return ;
data = data.data;
$
.post(
"testPlanTaskList",
{},
function(data) {
if (!data.success) {
alert(data.failedMessage);
return;
}
if (data.data.length == 0)
return;
data = data.data;
testPlanTaskList=data;
for ( var i = 0; i < data.length; i++) {
var $button = $("<div><a class='btn btn-info' ><i ></i></a></div>");
for ( var i = 0; i < data.length; i++) {
var $button = $("<div><a class='btn btn-info' ><i ></i></a></div>");
var $a = $($button.find("a")[0]);
var $i = $($a.find("i"));
switch (data[i].status) {
var $a = $($button.find("a")[0]);
var $i = $($a.find("i"));
switch (data[i].status) {
case "NotStart":
$i.text("NotStart");
break;
case "InRunning":
$i.text("InRunning");
$a.attr("onclick", "viewRealTimeResult(this)");
break;
case "PendingNoEnoughMaxLoad":
$i.text("PendingNoEnoughMaxLoad");
break;
case "PendingNoEnoughCurrentLoad":
$i.text("PendingNoEnoughCurrentLoad");
break;
case "Complete":
$i.text("Complete");
break;
case "Error":
$i.text("Error");
break;
case "NullError":
$i.text("Null");
break;
default:
$i.text("UnknownError");
break;
}
$('#testTaskList').dataTable().fnAddData(
[ i, data[i].name, $button.html() ]);
}
}, "json");
case "NotStart":
$i.text("NotStart");
break;
case "InRunning":
$i.text("InRunning");
$a.attr("onclick", "viewRealTimeResult(this)");
break;
case "PendingNoEnoughMaxLoad":
$i.text("PendingNoEnoughMaxLoad");
break;
case "PendingNoEnoughCurrentLoad":
$i.text("PendingNoEnoughCurrentLoad");
break;
case "Complete":
$i.text("Complete");
break;
case "Error":
$i.text("Error");
break;
case "NullError":
$i.text("Null");
break;
default:
$i.text("UnknownError");
break;
}
$('#testTaskList').dataTable().fnAddData(
[ i, data[i].name, $button.html() ]);
}
},"json");
}
function getTestPlanIdInTable(obj) {
var row = obj.parentNode.parentNode;
var testPlanName = $('#testTaskList>tbody').children("tr").eq(
row.rowIndex - 1).children("td").eq(1).text();
var testPlanId;
for ( var i = 0; i < testPlanTaskList.length; i++) {
if (testPlanName == testPlanTaskList[i].name)
if (testPlanName == testPlanTaskList[i].name) {
testPlanId = testPlanTaskList[i].id;
return testPlanId;
}
}
return testPlanId;
}
function viewRealTimeResult(obj) {
var testPlanId = getTestPlanIdInTable(obj);