From f29e0e836693327b15c8131347cdd6b6bbb57ac7 Mon Sep 17 00:00:00 2001 From: Ian Johnson Date: Fri, 19 Feb 2016 10:58:30 -0800 Subject: [PATCH] more test data. restructure rendering slightly to be per-suite --- electron/css/dataproofer.css | 23 +++++++++++++---------- electron/index.html | 4 ++-- electron/js/renderer.js | 26 ++++++++++++++++++++------ sample-datasets/geo-test.csv | 7 ++++--- sample-datasets/silk-road-arrests.csv | 2 +- 5 files changed, 40 insertions(+), 22 deletions(-) diff --git a/electron/css/dataproofer.css b/electron/css/dataproofer.css index 90f5e4e..ecc7386 100644 --- a/electron/css/dataproofer.css +++ b/electron/css/dataproofer.css @@ -62,7 +62,7 @@ button.tabletop-loader { Test specific CSS */ -.test-results { +.suites { padding: 5px; position: absolute; top: 0; @@ -70,7 +70,10 @@ button.tabletop-loader { height: calc(100% - 200px); overflow-y: scroll; } -.test-results .test { +.suite { + float: left; +} +.suite .test { margin: 3px; padding: 10px; margin-top: 10px; @@ -80,36 +83,36 @@ button.tabletop-loader { background-color: white; border-radius: 3px; } -.test-results .test:nth-child(odd) { +.suite .test:nth-child(odd) { background-color: #efefef; } -.test-results .test .passfail { +.suite .test .passfail { width: 20px; float:left; } -.test-results .test .message { +.suite .test .message { float:left; width: calc(100% - 245px); } -.test-results .test .test-header { +.suite .test .test-header { font-size: 14px; font-weight: bold; } -.test-results .test .test-column { +.suite .test .test-column { font-size: 12px; font-weight: bold; font-style: italic; } -.test-results .test .test-value { +.suite .test .test-value { font-weight: bold; font-family; Courier; } -.test-results .test .fingerprint { +.suite .test .fingerprint { width: 200px; float: right; margin-right: 25px; -} \ No newline at end of file +} diff --git a/electron/index.html b/electron/index.html index 626160d..e536205 100644 --- a/electron/index.html +++ b/electron/index.html @@ -58,7 +58,7 @@
-
+
@@ -71,6 +71,6 @@ - + diff --git a/electron/js/renderer.js b/electron/js/renderer.js index f24fd29..331b068 100644 --- a/electron/js/renderer.js +++ b/electron/js/renderer.js @@ -7,7 +7,11 @@ var Renderer = require('dataproofer').Rendering; function HTMLRenderer(config) { Renderer.call(this, config) window.rows = config.rows; - this.resultList = []; + var resultList = {} + config.suites.forEach(function(suite) { + resultList[suite.name] = [] + }) + this.resultList = resultList; var columns = []; Object.keys(rows[0]).forEach(function(col) { @@ -24,23 +28,33 @@ function HTMLRenderer(config) { var grid = new SlickGrid("#grid", rows, columns, options); this.grid = grid; - d3.select(".test-results").selectAll(".test").remove(); + d3.select(".suites").selectAll(".suite").remove(); + d3.select(".suites").selectAll(".suite") + .data(config.suites) + .enter().append("div") + .attr({ + class: function(d) { return "suite " + d.name } + }) + .append("h2").text(function(d) { return d.name }) + //d3.select(".test-results").selectAll(".test").remove(); } HTMLRenderer.prototype = Object.create(Renderer.prototype, {}) HTMLRenderer.prototype.constructor = HTMLRenderer; HTMLRenderer.prototype.addResult = function(suite, test, result) { - //console.log("add result", suite, test, result) + console.log(suite, test.name()); //console.log("this results", this.results); this.results[suite][test] = result; - this.resultList.push({ suite: suite, test: test, result: result }) + this.resultList[suite].push({ suite: suite, test: test, result: result }) // A reference to our SlickGrid table so we can manipulate it via the fingerprint var grid = this.grid; - var tests = d3.select(".test-results").selectAll(".test") - .data(this.resultList) + var container = d3.select("." + suite) + console.log("container", container) + var tests = container.selectAll(".test") + .data(this.resultList[suite]) var testsEnter = tests.enter().append("div").classed("test", true) testsEnter.append("div").classed("passfail", true) diff --git a/sample-datasets/geo-test.csv b/sample-datasets/geo-test.csv index 15a8058..a0f9f29 100644 --- a/sample-datasets/geo-test.csv +++ b/sample-datasets/geo-test.csv @@ -1,4 +1,5 @@ name,latlon,tag -enjalot,"1337.8162046,-122.2911677",cool -gerald,"37.8,-122.2911677",sweet -ejfox,"97.8162046,222.2911677",awesome +enjalot,"1337.8162046,-122.2911677",bad +gerald,"37.8,-122.2911677",good +ejfox,"97.8162046,222.2911677",bad +null island,"0,0",bad diff --git a/sample-datasets/silk-road-arrests.csv b/sample-datasets/silk-road-arrests.csv index 49830bf..578c7db 100644 --- a/sample-datasets/silk-road-arrests.csv +++ b/sample-datasets/silk-road-arrests.csv @@ -12,7 +12,7 @@ Laurence Lindberg,Contra Costa,California,USA,-121.9175345,37.9034806,administra Alicia Mitts,Contra Costa,California,USA,-121.9175345,37.9034806,administrative,5/28/2014,Produced and sold fake Xanax pills,,30 year-old part of Jeremy Donagal's Xanax drug ring,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation Thomas Elliott,Contra Costa,California,USA,-121.9175345,37.9034806,administrative,5/28/2014,Produced and sold fake Xanax pills,,39 year-old part of Jeremy Donagal's Xanax drug ring,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation Michael Tomada,Contra Costa,California,USA,-121.9175345,37.9034806,administrative,5/28/2014,Produced and sold fake Xanax pills,,42 year-old part of Jeremy Donagal's Xanax drug ring,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation -Christopher Neely,Contra Costa,California,USA,-121.9175345,37.9034806,administrative,5/28/2014,Produced and sold fake Xanax pills,,part of Jeremy Donagal's Xanax drug ring. Sitll at large.,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation +Christopher Neely,Contra Costa,California,USA,0,0,administrative,5/28/2014,Produced and sold fake Xanax pills,,part of Jeremy Donagal's Xanax drug ring. Sitll at large.,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation "Kenneth Koskiniemi,",Contra Costa,California,USA,-121.9175345,37.9034806,administrative,5/28/2014,Produced and sold fake Xanax pills,,37 year-old part of Jeremy Donagal's Xanax drug ring,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation Duston Kirk,Contra Costa,California,USA,-121.9175345,37.9034806,administrative,,Produced and sold fake Xanax pills,,38 year-old part of Jeremy Donagal's Xanax drug ring,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation Michael Gonzalez,Contra Costa,California,USA,-121.9175345,37.9034806,administrative,5/28/2014,Produced and sold fake Xanax pills,,41 year-old part of Jeremy Donagal's Xanax drug ring,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation