Skip to content

Commit

Permalink
TestResults 2nd level data load and view by Test
Browse files Browse the repository at this point in the history
  • Loading branch information
evlach committed Jun 4, 2014
1 parent 791bdc4 commit 60313a0
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 41 deletions.
7 changes: 7 additions & 0 deletions js/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
this.criteriosLevel = "AAA";
this.criterios = [];
this.technologies = [];
this.techniques = [];
this.tests = [];
this.ats = [];
this.uas = [];
this.oss = [];
Expand Down Expand Up @@ -60,6 +62,8 @@
URL_SERVICE_TESTRESULT_BYTEST_OVERVIEW: "testresult/browse/bytest/overview/", //{techNameId}

URL_SERVICE_TESTRESULT_FULLVIEWTECHNIQUE: "testresult/browse/fullviewtechnique/",
URL_SERVICE_TESTRESULT_FULLVIEWTEST: "testresult/browse/fullviewtest/", //{testUnitId}

URL_SERVICE_TESTRESULT_VIEWTECHNIQUE: "testresult/browse/resultsview/",
URL_SERVICE_TESTRESULT_TREE_AT: "testresult/browse/at/tree",
URL_SERVICE_TESTRESULT_TREE_UA: "testresult/browse/ua/tree",
Expand Down Expand Up @@ -175,6 +179,9 @@
getResultsFullViewByTechnique : function(filter, techniqueNameId, callback, targetE){
ajax(accessdb.config.services.URL_SERVICE_TESTRESULT_FULLVIEWTECHNIQUE + techniqueNameId, "POST", filter, callback, targetE);
},
getResultsFullViewByTest : function(filter, testId, callback, targetE){
ajax(accessdb.config.services.URL_SERVICE_TESTRESULT_FULLVIEWTEST + testId, "POST", filter, callback, targetE);
},
getATVersionsOfATName : function(name, callback){
var query = "select distinct testingProfile.assistiveTechnology.version.text " +
"from TestResult where testingProfile.assistiveTechnology.name='"+name+"'";
Expand Down
25 changes: 25 additions & 0 deletions js/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ window.accessdb.Models.AppRouter = Backbone.Router.extend({
"results.html": "results",
"results-technique.html/:id": "results-technique",
"results-test.html/:id": "results-test",
"results-details.html/ua/:ua/uaver/:uaVer/at/:at/atver/:atVer/filter/:filter": "results-details",
"results-details.html/ua/:ua/uaver/:uaVer/at/:at/atver/:atVer": "results-details",
"test-run.html/:id": "test-run",
"test-run.html": "test-run",
"test.html/:id": "test",
Expand Down Expand Up @@ -71,7 +73,30 @@ window.accessdb.appRouter.on('route:results-technique', function (id) {
accessdb.TestResultsFullViewByTechnique.reload({techNameId : id});
});
window.accessdb.appRouter.on('route:results-test', function (id) {
this.params.testUnitId = id;

window.accessdb.appRouter.loadPage("results-test");
accessdb.TreeHelper.loadTrees();
accessdb.TestResultsFullViewByTest = new accessdb.Views.TestResultsFullViewByTest();
accessdb.TestResultsFullViewByTest.reload({testUnitId : id});
});
window.accessdb.appRouter.on('route:results-details', function (ua, uaVer, at, atVer, filter) {
if(filter){
if(Utils.urlParam(filter)!==null)
filter = JSON.parse(decodeURI(filter));
else
filter = accessdb.filters[accessdb.appRouter.page] || new accessdb.Models.Filter(accessdb.appRouter.page);
accessdb.filters[accessdb.appRouter.page] = filter;
}

ua = Utils.urlParam(ua);
uaVer = Utils.urlParam(uaVer);
at = Utils.urlParam(at);
atVer = Utils.urlParam(atVer);

console.log("fil......ter");
console.log(filter);
window.accessdb.appRouter.loadPage("results-details");
//accessdb.TreeHelper.loadTrees();
//accessdb.TestResultsDataOverview = new accessdb.Views.TestResultsDataOverview();
//accessdb.TestResultsDataOverview.reload();
Expand Down
48 changes: 47 additions & 1 deletion js/testresult-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ accessdb.Views.TestResultsFullViewByTechnique = function (){
this.results = null;
this.render = function(){
if(this.results){
var template = _.template( $("#TestResultsFullViewByTechnique_template").html(), {results: this.results} );
var filter = accessdb.filters[accessdb.appRouter.page];
var template = _.template( $("#TestResultsFullViewByTechnique_template").html(), {results: this.results, filter: filter} );
this.$el.html( template );
this.$el.find('.chart').peity("pie", {
fill: ["green", "#f98"]
Expand Down Expand Up @@ -187,4 +188,49 @@ accessdb.Views.TestResultsFullViewByTechniqueRelatedTests = function (){
});
}
}
};

accessdb.Views.TestResultsFullViewByTest = function (){
this.$el = $("#TestResultsFullViewByTestDiv");
this.results = null;
this.render = function(){
if(this.results){
var filter = accessdb.filters[accessdb.appRouter.page];
var template = _.template( $("#TestResultsFullViewByTechnique_template").html(), {results: this.results, filter: filter} );
this.$el.html( template );
this.$el.find('.chart').peity("pie", {
fill: ["green", "#f98"]
});
}
};
this.fetch = function (params, callback){
var self = this;
if (!params || params.length<1 ){
console.warn("No filter defined!");
callback("No filter defined!", null);
}
else {
accessdb.API.TESTRESULT.getResultsFullViewByTest(params.filter, params.testUnitId, function (error, data, status) {
if(!error){
console.log(data);
self.results = data;
callback(null, self.results);
}
else
callback(error);
});
}
};
this.reload = function(params){
var pageId = accessdb.config.PAGE_ID_PREFIX+"results-test";
if(accessdb.appRouter.page === pageId){
var self = this;
params = params || {};
params.filter = accessdb.filters[pageId];
this.fetch(params, function(error, data){
if(!error)
self.render();
});
}
}
};
2 changes: 2 additions & 0 deletions js/tree-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ accessdb.TreeHelper = {
accessdb.TestResultsDataOverview.reload();
if(accessdb.TestResultsFullViewByTechnique)
accessdb.TestResultsFullViewByTechnique.reload({techNameId : accessdb.appRouter.params.techniqueNameId});
if(accessdb.TestResultsFullViewByTest)
accessdb.TestResultsFullViewByTest.reload({techNameId : accessdb.appRouter.params.testUnitId});
TestUnit.loadTestsTree();
},
uncheckTestFromTree: function (liId) {
Expand Down
6 changes: 5 additions & 1 deletion js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ Array.prototype.remove = function () {

function Utils() {
};

Utils.urlParam=function (s){
if(s==="null")
s=null;
return s;
};
Utils.UIRoleAdapt = function () {
var userRoles = accessdb.session.get("userRoles") || [];
$(".accessdbUserMessage").html("");
Expand Down
2 changes: 1 addition & 1 deletion pages/results-details.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<article id="axsdb-page-tech-results">
<article id="axsdb-page-results-details">
<h1 class="page-title">
Accessibility Support Database
</h1>
Expand Down
45 changes: 12 additions & 33 deletions pages/results-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,6 @@ <h2>Details for Technique <span><strong>H4:</strong> Creating a logical tab orde
<div class="column-filters">
<h3>Filter test cases</h3>
<form action="#">
<div class="">
<h4>Conformance Level</h4>
<div>
<div>
<label><input type="radio" data-axsdb-filtertype="wcaglevel" name="conformance" value="AAA"> A &amp; AA &amp; AAA</label>
</div>
<div>
<label><input type="radio" data-axsdb-filtertype="wcaglevel" checked name="conformance" value="AA"> A &amp; AA</label>
</div>
<div>
<label><input type="radio" data-axsdb-filtertype="wcaglevel" name="conformance" value="A"> A</label>
</div>
</div>
</div>
<div class="">
<h4>Success Criteria</h4>
<div class="criteriaTreeDiv" data-axsdb-filtertype="WCAG">
</div>
</div>
<div class="">
<h4>Assistive Technology</h4>
<div class="atTreeDiv" data-axsdb-filtertype="AssistiveTechnology"></div>
Expand All @@ -45,19 +26,14 @@ <h4>Browser</h4>
<h4>Operating System</h4>
<div class="osTreeDiv" data-axsdb-filtertype="Platform"></div>
</div>
<div class="">
<h4>Web Technology</h4>
<div class="webTechTreeDiv" data-axsdb-filtertype="WebTechnology"></div>
</div>


</form>
</div>
</aside>
<div class="column-second">
<table class="result-details">
<caption>In the columns, you can find browser versions.<br>The rows show assistive technologies.</caption>
<thead>
<div id="TestResultsFullViewByTestDiv">
<table class="result-details">
<caption>In the columns, you can find browser versions.<br>The rows show assistive technologies.</caption>
<thead>
<tr>
<th rowspan="2" colspan="2"> </th>
<th colspan="3" scope="colgroup">Firefox</th>
Expand All @@ -70,8 +46,8 @@ <h4>Web Technology</h4>
<th scope="col" data-accessdbproductver="10" data-accessdbproductname="Internet Explorer"><span class="visuallyhidden">Internet Explorer</span> 10</th>
<th scope="col" data-accessdbproductver="11" data-accessdbproductname="Internet Explorer"><span class="visuallyhidden">Internet Explorer</span> 11</th>
</tr>
</thead>
<tbody>
</thead>
<tbody>
<tr>
<th data-accessdbproductver="" data-accessdbproductname="" colspan="2" scope="row">None</th>
<td class="untested">Not tested</td>
Expand Down Expand Up @@ -125,9 +101,12 @@ <h4>Web Technology</h4>
<td class="untested">Not tested</td>
<td class="untested">Not tested</td>
<td><span class="chart">0/1</span> <a title="show test results of this combination" href="" class="TestResultFullViewTechniqueAnchor">0/1</a></td>
</tr>
</tbody>
</table>
</tr>
</tbody>
</table>
</div>


</div>
</div>
</div>
Expand Down
35 changes: 30 additions & 5 deletions templates.html
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ <h4>Test Results</h4>
<ul id="RelatedTestCases">
<% _.each(results, function(r) { %>
<li>
<strong><%= r.testUnitId %>:</strong> <a href="<%= r.testUnitId %>"> <%= r.testTitle %></a>
<strong><%= r.testUnitId %>:</strong> <a href="#/results-test.html/<%= r.testUnitId %>"> <%= r.testTitle %></a>
<a href="#/results-test.html/<%= r.testUnitId %>" class="btn btn-small">
<span class="chart" style="display:none"><%= r.noOfPass %>/<%= r.noOfAll %></span>
<%= r.noOfPass %>/<%= r.noOfAll %>
Expand Down Expand Up @@ -365,17 +365,38 @@ <h4>Test Results</h4>
<script type="text/template" id="TestResultsFullViewByTechnique_template">
<table class="result-details">
<caption>In the columns, you can find browser versions.<br>The rows show assistive technologies.</caption>
<% lresults = results.length %>
<% lresults = results.length
accessdb.p = {
ua : undefined,
uaVer : undefined,
at: undefined,
atVer : undefined,
toUrl : function(){
var url = "ua/" + (this.ua || "null");
url = url + "/uaver/" + (this.uaVer || "null");
url = url + "/at/" + (this.at || "null");
url = url + "/atver/" + (this.atVer || "null");
console.log(filter);
url = url + "/filter/" + encodeURI(JSON.stringify(filter));
return url;
}
};
%>
<% firstrow = true %>
<% _.each(results.rows, function(row) {
if (firstrow) { %>
<thead>
<% } %>
<tr>
<% firstcol = true %>
<% firstcol = true;

%>
<% _.each(row, function(col) {
if (firstrow) {
if (col.product) { %>
if (col.product) {
accessdb.p.ua = col.product.name;
accessdb.p.uaVer = col.product.version.text;
%>
<th scope="col" data-accessdbproductver="<%= col.product.version.text %>" data-accessdbproductname="<%= col.product.name %>"><span class="visuallyhiddenFIXME"><%= col.product.name %></span> <%= col.product.version.text %></th>
<% }
else { %>
Expand All @@ -385,6 +406,8 @@ <h4>Test Results</h4>
else{
if (firstcol ) {
if (col.product && col.product.name ) {
accessdb.p.at = col.product.name;
accessdb.p.atVer = col.product.version.text;
%>
<th data-accessdbproductver="<%= col.product.version.text %>" data-accessdbproductname="<%= col.product.name %>" colspan="2" scope="row"><%=col.product.name %></th>
<th scope="row"><span class="visuallyhidden"><%=col.product.name %></span> <%= col.product.version.text %></th>
Expand All @@ -396,7 +419,9 @@ <h4>Test Results</h4>
else {
if(parseInt(col.noOfAll)>0){
%>
<td><span class="chart"><%=col.noOfPass %>/<%=col.noOfAll %></span> <a title="show test results of this combination" href="" class="TestResultFullViewTechniqueAnchor"><%=col.noOfPass %>/<%=col.noOfAll %></a></td>
<td><span class="chart"><%=col.noOfPass %>/<%=col.noOfAll %></span>
<a title="show test results of this combination" href="#/results-details.html/<%=accessdb.p.toUrl() %>" class="TestResultFullViewTechniqueAnchor"><%=col.noOfPass %>/<%=col.noOfAll %></a>
</td>
<%
} else { %>
<td class="untested">Not tested</td>
Expand Down

0 comments on commit 60313a0

Please sign in to comment.