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