-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from square/bquenaudon.2019-03-20.benoit
Bquenaudon.2019 03 20.benoit
- Loading branch information
Showing
6 changed files
with
297 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
window.runs["20190319153912aaab"] = [ | ||
{ | ||
"file": "btc.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": [] | ||
}, | ||
{ | ||
"name": "idle", | ||
"file": "card.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": ["mooncake"] | ||
}, | ||
{ | ||
"name": "idle", | ||
"file": "boost.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": ["mooncake"] | ||
} | ||
{ | ||
"file": "btc.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": [] | ||
}, | ||
{ | ||
"name": "idle", | ||
"file": "card.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": ["mooncake"] | ||
}, | ||
{ | ||
"name": "idle", | ||
"file": "boost.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": ["mooncake"] | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
window.runs["20190319153912aaab"] = [ | ||
{ | ||
"file": "btc.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": [] | ||
}, | ||
{ | ||
"name": "idle", | ||
"file": "boost.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": ["mooncake"] | ||
}, | ||
{ | ||
"name": "idle", | ||
"file": "keypad.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": ["mooncake"] | ||
}, | ||
{ | ||
"name": "idle", | ||
"file": "deposit.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": ["mooncake"] | ||
} | ||
window.runs["20190319153917bcfe"] = [ | ||
{ | ||
"file": "btc.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": [] | ||
}, | ||
{ | ||
"name": "idle", | ||
"file": "boost.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": ["mooncake"] | ||
}, | ||
{ | ||
"name": "idle", | ||
"file": "keypad.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": ["mooncake"] | ||
}, | ||
{ | ||
"name": "idle", | ||
"file": "deposit.webp", | ||
"test": "com.squareup.cash.boost.BoostView#active", | ||
"timestamp": "2019-03-14T16:13:48Z", | ||
"tags": ["mooncake"] | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ window.all_runs = [ | |
"20190319153912aaab", | ||
"20190319153917bcfe" | ||
] | ||
window.runs = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
class Run { | ||
constructor(id, shots) { | ||
this.id = id | ||
this.shots = shots | ||
} | ||
} | ||
|
||
function deleteme() { | ||
const obj = { | ||
'shot': { | ||
'name': 'idle', | ||
'method': "active", | ||
'class': "BoostView", | ||
'package': "com.squareup.cash.boost", | ||
'runs': [ | ||
{ | ||
'run': '20190319153912aaab', | ||
'file': 'boost.webp', | ||
'timestamp': '16:13:48', | ||
}, | ||
{ | ||
'run': '20190319153912cced', | ||
'file': 'boost.webp', | ||
'timestamp': '16:13:48' | ||
}, | ||
{ | ||
'run': '20190319153912oooz', | ||
'file': 'boost.webp', | ||
'timestamp': '16:13:48' | ||
} | ||
] | ||
} | ||
} | ||
} | ||
|
||
class Shot { | ||
constructor(name, test) { | ||
this.name = name | ||
this.test = test // split into method, class, package | ||
this.runs = [] | ||
} | ||
|
||
add(runId, file, timestamp) { | ||
this.runs.push( | ||
{ | ||
'run': runId, | ||
'file': file, | ||
'timestamp': timestamp // parse? | ||
} | ||
) | ||
} | ||
|
||
inflate() { | ||
// create div.screen | ||
// set img | ||
// set test details | ||
// add circles | ||
} | ||
} | ||
|
||
class PaparazziRenderer { | ||
constructor() { | ||
this.currentRuns = {} | ||
this.lockedRunIds = [] | ||
} | ||
|
||
start() { | ||
for (let runId of window.all_runs) { | ||
this.loadRunScript(runId) | ||
} | ||
setInterval(this.refresh.bind(this), 1000) | ||
// refresh only last run and rerender | ||
} | ||
|
||
render(run) { | ||
if (this.currentRuns[run.id] | ||
&& JSON.stringify(this.currentRuns[run.id]) == JSON.stringify(run)) { | ||
return | ||
} | ||
this.currentRuns[run.id] = run | ||
console.log('rendering', run) | ||
} | ||
|
||
renderAll() { | ||
for (let runId in window.runs) { | ||
if (this.lockedRunIds.includes(runId)) { | ||
continue | ||
} | ||
this.loadRunScript(runId) | ||
|
||
this.render(new Run(runId, window.runs[runId])) | ||
|
||
const lastRunId = window.all_runs[window.all_runs.length - 1] | ||
if (runId != lastRunId) { | ||
this.lockedRunIds.push(runId) | ||
delete this.currentRuns[runId] | ||
} | ||
} | ||
} | ||
|
||
refresh() { | ||
if (window.all_runs.length == 0) return | ||
|
||
this.renderAll() | ||
} | ||
|
||
loadRunScript(runId) { | ||
const script = document.createElement('script') | ||
script.src = `${runId}/run.js` | ||
script.onload = function () { | ||
this.remove() | ||
} | ||
document.head.appendChild(script) | ||
} | ||
} | ||
|
||
const paparazziRenderer = new PaparazziRenderer() | ||
console.log(paparazziRenderer) | ||
paparazziRenderer.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<style type="text/css"> | ||
body { | ||
background: #212121; | ||
text-align: center; | ||
} | ||
|
||
.screen { | ||
margin: 0.2em; | ||
display: inline-block; | ||
position: relative; | ||
} | ||
|
||
.overlay { | ||
position: absolute; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
background: rgba(25, 0, 237, .68); | ||
color: #fff; | ||
opacity: 1; | ||
/* TODO set to 0 */ | ||
transition: 150ms; | ||
} | ||
|
||
.overlay:hover { | ||
opacity: 1; | ||
} | ||
|
||
.test__details { | ||
text-align: left; | ||
padding-left: 1em; | ||
} | ||
|
||
.test__details__name, | ||
.test__details__class, | ||
.test__details__package { | ||
line-height: 0.7em; | ||
} | ||
|
||
.test__details__timestamp { | ||
margin-top: 2em; | ||
} | ||
|
||
.test__details__selector { | ||
width: 16px; | ||
height: 16px; | ||
border-radius: 50%; | ||
display: inline-block; | ||
border: 2px solid #fff; | ||
margin: .1em; | ||
margin-bottom: 1.3em; | ||
margin-top: 1em; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body center> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/boost.webp"> | ||
<div class="overlay"> | ||
<p class="test__details test__details__name">active idle</p> | ||
<p class="test__details test__details__class">BoostView</p> | ||
<p class="test__details test__details__package">com.squareup.cash.boost</p> | ||
<p class="test__details test__details__timestamp">16:13:48</p> | ||
<div class="test__details__selector"></div> | ||
<div class="test__details__selector"></div> | ||
<div class="test__details__selector"></div> | ||
<div class="test__details__selector"></div> | ||
<div class="test__details__selector"></div> | ||
<div class="test__details__selector"></div> | ||
<div class="test__details__selector"></div> | ||
<div class="test__details__selector"></div> | ||
<div class="test__details__selector"></div> | ||
<div class="test__details__selector"></div> | ||
</div> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/btc.webp"> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/card.webp"> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/boost.webp"> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/btc.webp"> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/card.webp"> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/boost.webp"> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/btc.webp"> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/card.webp"> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/boost.webp"> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/btc.webp"> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/card.webp"> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/boost.webp"> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/btc.webp"> | ||
</div> | ||
<div class="screen"> | ||
<img width="300" src="20190319153912aaab/card.webp"> | ||
</div> | ||
|
||
</body> | ||
|
||
</html> |