Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bquenaudon.2019 03 20.benoit #3

Merged
merged 2 commits into from
Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions java-lib/src/main/resources/20190319153912aaab/run.js
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"]
}
];
56 changes: 28 additions & 28 deletions java-lib/src/main/resources/20190319153917bcfe/run.js
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"]
}
];
5 changes: 3 additions & 2 deletions java-lib/src/main/resources/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<!DOCTYPE html>
<html>

<style>
.template {
display: none;
}
</style>

<script src="current_run.js"></script>
<script src="index.js"></script>
<script src="paparazziRenderer.js"></script>
<script>

var x = 0;
Expand Down
1 change: 1 addition & 0 deletions java-lib/src/main/resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ window.all_runs = [
"20190319153912aaab",
"20190319153917bcfe"
]
window.runs = {}
119 changes: 119 additions & 0 deletions java-lib/src/main/resources/paparazziRenderer.js
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()
126 changes: 126 additions & 0 deletions java-lib/src/main/resources/testing.html
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>