From bf5e7d594369f94a1586775936c20ee131fdc358 Mon Sep 17 00:00:00 2001 From: fanfuxiaoran <495538672@qq.com> Date: Mon, 13 Jan 2014 14:52:40 +0800 Subject: [PATCH] add test result loading progress --- src/main/webapp/bench4q-css/demo.css | 17 ------- src/main/webapp/bench4q-css/result.css | 19 ++++++- src/main/webapp/demo.html | 29 ++++++++--- src/main/webapp/result.jsp | 50 ++++++++++--------- src/main/webapp/script/charts.js | 5 +- src/main/webapp/script/pieChart.js | 3 +- src/main/webapp/script/portManage-old.js | 29 ----------- src/main/webapp/script/result-table.js | 3 ++ .../{test-brief.js => result-test-brief.js} | 2 + src/main/webapp/script/result.js | 11 +++- src/main/webapp/testplans.jsp | 1 + 11 files changed, 88 insertions(+), 81 deletions(-) delete mode 100644 src/main/webapp/script/portManage-old.js rename src/main/webapp/script/{test-brief.js => result-test-brief.js} (94%) diff --git a/src/main/webapp/bench4q-css/demo.css b/src/main/webapp/bench4q-css/demo.css index d7b9af98..863bca47 100644 --- a/src/main/webapp/bench4q-css/demo.css +++ b/src/main/webapp/bench4q-css/demo.css @@ -1,7 +1,3 @@ -#center{ -margin:50px auto; -width:400px; -} #loading{ width:397px; height:49px; @@ -17,16 +13,3 @@ font-family:Tahoma; font-size:18px; line-height:48px; } -#message{ -width:200px; -height:35px; -font-family:Tahoma; -font-size:12px; -background-color:#d8e7f0; -border:1px solid #187CBE; -display:none; -line-height:35px; -text-align:center; -margin-bottom:10px; -margin-left:50px -} \ No newline at end of file diff --git a/src/main/webapp/bench4q-css/result.css b/src/main/webapp/bench4q-css/result.css index 78a462e7..3bdd6de9 100644 --- a/src/main/webapp/bench4q-css/result.css +++ b/src/main/webapp/bench4q-css/result.css @@ -86,4 +86,21 @@ margin-top: 5px; .innerTable thead:first-child tr:first-child th{ border-top: 1px solid #ccc; border-bottom:1px solid #ccc; -} \ No newline at end of file +} +#loading{ +width:397px; +height:49px; +background:url(/images/bak.png) no-repeat; +} +#loading div{ +width:0px; +height:48px; +background:url(/images/pro.png) no-repeat; +color:#fff; +text-align:center; +font-family:Tahoma; +font-size:18px; +line-height:48px; +} + + diff --git a/src/main/webapp/demo.html b/src/main/webapp/demo.html index ddb18464..db6993e9 100644 --- a/src/main/webapp/demo.html +++ b/src/main/webapp/demo.html @@ -2,7 +2,10 @@ + + + -
-
-
-
- +
Hello world
+
+ + + + \ No newline at end of file diff --git a/src/main/webapp/result.jsp b/src/main/webapp/result.jsp index f6d46310..78837936 100644 --- a/src/main/webapp/result.jsp +++ b/src/main/webapp/result.jsp @@ -152,30 +152,34 @@ body { cancel -
- - - - - - - - - - - - - - - - - - - - - + +
+ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/script/charts.js b/src/main/webapp/script/charts.js index 28f8d41c..c0e6b7ec 100644 --- a/src/main/webapp/script/charts.js +++ b/src/main/webapp/script/charts.js @@ -97,8 +97,9 @@ Chart.prototype.addGraph = function(model) { chart.addDataToGraph(chart,model,intervalId,data[i]); } } - else chart.addDataToGraph(chart,model,intervalId,data) - + else chart.addDataToGraph(chart,model,intervalId,data); + + loadItems.scriptBriefStatusAve=true; }, "json"); }, intervalTime); diff --git a/src/main/webapp/script/pieChart.js b/src/main/webapp/script/pieChart.js index 7ccabc54..5f07ee52 100644 --- a/src/main/webapp/script/pieChart.js +++ b/src/main/webapp/script/pieChart.js @@ -51,9 +51,10 @@ var UrlContentTypeDistribution = function(containerId, testPlanId) { for(var key in data) dataArray.push([key,data[key]]); chart.series[0].setData(dataArray); + loadItems.urlDistribution=true; } },"json"); - + if (testStatus == "Complete"&&i>=1) { clearInterval(intervalId); return; diff --git a/src/main/webapp/script/portManage-old.js b/src/main/webapp/script/portManage-old.js deleted file mode 100644 index c5ed384d..00000000 --- a/src/main/webapp/script/portManage-old.js +++ /dev/null @@ -1,29 +0,0 @@ -var table; -$(document).ready(function() { - table = new bench4q.table("Port"); - table.loadTable(); -}); - -function edittablerow(obj) { - var row = obj.parentNode.parentNode; - alert(row.rowIndex); -} - -function deletetablerow(obj) { - table.deleteTableRow(obj); -} - -function addPort() { - $("#port").val(0); - $("#portParam").modal('show'); -} - -function addPortToDB() { - $.post("addPortToPool", { - port : $("#port").val() - }, function(data) { - if (data ) { - table.loadTable(); - } - }); -} diff --git a/src/main/webapp/script/result-table.js b/src/main/webapp/script/result-table.js index e0cc13a5..d16362df 100644 --- a/src/main/webapp/script/result-table.js +++ b/src/main/webapp/script/result-table.js @@ -48,6 +48,8 @@ PageResult.prototype.addResultToTable = function() { var row = extractRowDataActionBefore(result[i], this.header, null); this.table.fnAddData(row); } + loadItems.pageResult=true; + } var PageResultModel = function(page, scriptPageBriefModel, scriptName) { this.page = page; @@ -197,6 +199,7 @@ BehaviorResult.prototype.addBehaviorsToTable = function() { this.header, this.actionAdd); this.table.fnAddData(row); } + loadItems.behaviorResult=true; } BehaviorResult.prototype.DetailAddListener = function() { var behaviorResult = this; diff --git a/src/main/webapp/script/test-brief.js b/src/main/webapp/script/result-test-brief.js similarity index 94% rename from src/main/webapp/script/test-brief.js rename to src/main/webapp/script/result-test-brief.js index 8d73e085..1e1e87a3 100644 --- a/src/main/webapp/script/test-brief.js +++ b/src/main/webapp/script/result-test-brief.js @@ -3,6 +3,7 @@ function getTestBrief(testPlanId) { showTestPlanStatusAsync(testPlanId); var startTime=0; showTestBriefStatus(startTime); + loadItems.testBrief=true; if(testStatus=="Complete") clearInterval(intervalId); },5000); @@ -24,6 +25,7 @@ function showTestBriefStatus(startTime){ startTime=data.time; $("#vu").html('VUs active

'+data.vus+'

'); $("#request").html('Requests

'+data.requests+'

'); + },"json"); } function getTestPlanStatus(testPlanId) { diff --git a/src/main/webapp/script/result.js b/src/main/webapp/script/result.js index 95a23458..adbdabab 100644 --- a/src/main/webapp/script/result.js +++ b/src/main/webapp/script/result.js @@ -1,9 +1,18 @@ +var LoadItems=function(){ + this.scriptBriefStatusAve=false; + this.pageResult=false; + this.behaviorResult=false; + this.urlDistribution=false; + this.testBrief=false; +}; +var loadItems=new LoadItems(); +var testStatus; $(document).ready( function() { testPlanId = getvars()['testPlanId']; - var testStatus; if (!getTestPlanStatus(testPlanId)) return; + doProgress(); getTestBrief(testPlanId); var tree = getResultInfoTree(testPlanId); var replaceArray = createUrlReplaceArray(testPlanId); diff --git a/src/main/webapp/testplans.jsp b/src/main/webapp/testplans.jsp index 522c9b55..c36a1b1e 100644 --- a/src/main/webapp/testplans.jsp +++ b/src/main/webapp/testplans.jsp @@ -120,6 +120,7 @@ body { +