disable stop-testplan button when test plan completed

This commit is contained in:
hmm 2014-09-10 11:13:38 +08:00
parent 25c9af9af1
commit f030705b35
1 changed files with 27 additions and 20 deletions

View File

@ -28,26 +28,33 @@ $(function() {
chartSelector.initChart();
graphButtonListener(chartSelector);
UrlContentTypeDistribution("pie-chart", testPlanRunId);
$("#stop-testplan").click(function() {
if ($("#status").attr("status") == "InRunning") {
$.post("stop/" + testPlanRunId, {}, function(data) {
if (data.success) {
$('#status').attr("status", "Complete");
var testStatus = testStatusMap("Complete");
$('#status').html("<h4>" + testStatus + '</h4>');
} else {
information($.i18n("stopTestPlan_fail"));
}
}).error(function(){
information($.i18n.prop('failed-connect-server'));
});
if(testPlan.currentStatus == "Complete"){
$("#stop-testplan").attr('disabled', true);
}else{
$("#stop-testplan").attr('disabled', false);
$("#stop-testplan").click(function() {
if ($("#status").attr("status") == "InRunning") {
$.post("stop/" + testPlanRunId, {}, function(data) {
if (data.success) {
$('#status').attr("status", "Complete");
var testStatus = testStatusMap("Complete");
$('#status').html("<h4>" + testStatus + '</h4>');
$("#stop-testplan").attr('disabled', true);
} else {
information($.i18n("stopTestPlan_fail"));
}
} else {
return;
}
}).error(function(){
information($.i18n.prop('failed-connect-server'));
});
});
} else {
return;
}
});
}
});
function getTestInfo(testPlanId) {
var testPlan;