From 60313a0b74153e4c8a8c1ec636ea26ce350a3613 Mon Sep 17 00:00:00 2001 From: Evangelos Vlachogiannis Date: Wed, 4 Jun 2014 16:26:54 +0200 Subject: [PATCH] TestResults 2nd level data load and view by Test --- js/API.js | 7 ++++++ js/router.js | 25 ++++++++++++++++++++ js/testresult-views.js | 48 +++++++++++++++++++++++++++++++++++++- js/tree-helper.js | 2 ++ js/utils.js | 6 ++++- pages/results-details.html | 2 +- pages/results-test.html | 45 ++++++++++------------------------- templates.html | 35 +++++++++++++++++++++++---- 8 files changed, 129 insertions(+), 41 deletions(-) diff --git a/js/API.js b/js/API.js index b5c2262..59033f5 100644 --- a/js/API.js +++ b/js/API.js @@ -27,6 +27,8 @@ this.criteriosLevel = "AAA"; this.criterios = []; this.technologies = []; + this.techniques = []; + this.tests = []; this.ats = []; this.uas = []; this.oss = []; @@ -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", @@ -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+"'"; diff --git a/js/router.js b/js/router.js index 199cc5d..0b340e7 100644 --- a/js/router.js +++ b/js/router.js @@ -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", @@ -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(); diff --git a/js/testresult-views.js b/js/testresult-views.js index 56e1f76..7c8a469 100644 --- a/js/testresult-views.js +++ b/js/testresult-views.js @@ -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"] @@ -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(); + }); + } + } }; \ No newline at end of file diff --git a/js/tree-helper.js b/js/tree-helper.js index 29bc865..aff59ce 100644 --- a/js/tree-helper.js +++ b/js/tree-helper.js @@ -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) { diff --git a/js/utils.js b/js/utils.js index a214aa7..d975254 100644 --- a/js/utils.js +++ b/js/utils.js @@ -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(""); diff --git a/pages/results-details.html b/pages/results-details.html index 150ddbb..f946a40 100644 --- a/pages/results-details.html +++ b/pages/results-details.html @@ -1,4 +1,4 @@ -
+

Accessibility Support Database

diff --git a/pages/results-test.html b/pages/results-test.html index 14b5431..9c95f9e 100644 --- a/pages/results-test.html +++ b/pages/results-test.html @@ -14,25 +14,6 @@

Details for Technique H4: Creating a logical tab orde

Filter test cases

-
-

Conformance Level

-
-
- -
-
- -
-
- -
-
-
-
-

Success Criteria

-
-
-

Assistive Technology

@@ -45,19 +26,14 @@

Browser

Operating System

-
-

Web Technology

-
-
- -
- - - +
+
In the columns, you can find browser versions.
The rows show assistive technologies.
+ + @@ -70,8 +46,8 @@

Web Technology

- - + + @@ -125,9 +101,12 @@

Web Technology

- - -
In the columns, you can find browser versions.
The rows show assistive technologies.
  Firefox Internet Explorer 10 Internet Explorer 11
None Not tested Not tested Not tested 0/1 0/1
+ + + +
+ + diff --git a/templates.html b/templates.html index b5c363a..fed25b1 100644 --- a/templates.html +++ b/templates.html @@ -316,7 +316,7 @@

Test Results