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

Add script to generate RRD vs. screenshots comparisons #3946

Merged
merged 10 commits into from
Oct 23, 2023
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@ screenshot*.png
# Web demo app build
web_demo

# Screenshot comparison build
/compare_screenshot

.nox/
*.rrd
51 changes: 51 additions & 0 deletions scripts/screenshot_compare/assets/static/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
html {
/* Remove touch delay: */
touch-action: manipulation;
}

body {
background: #0d1011;
}

html,
body {
overflow: hidden;
margin: 0 !important;
padding: 0 !important;
height: 100%;
width: 100%;
}

.screen_splitter {
position: absolute;
height: 100vh;
width: 50vw;
}

.screen_splitter img {
position: absolute;
left: 50vw;
width: 50vw;
}

iframe {
margin-right: auto;
margin-left: auto;
display: block;
position: absolute;
box-sizing: border-box;
top: 0;
left: 0;
width: 50vw;
height: 100vh;

border: none;

/* canvas must be on top when visible */
z-index: 1000;
}

* {
font-family: sans-serif;
color: #cad8de;
}
30 changes: 30 additions & 0 deletions scripts/screenshot_compare/assets/templates/example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!-- Disable zooming: -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />

<head>
<title>Compare Screenshot</title>
<link rel="stylesheet" href="index.css" />
</head>

<body>
<div class="screen_splitter">
<iframe id="iframe" allowfullscreen src=""></iframe>
<img alt="" src="{{ example.screenshot_url }}" >
</div>



<script>
// set the iframe URL
let encodedUrl = encodeURIComponent(
window.location.protocol + "//" + window.location.host + "/examples/{{ example.name }}/data.rrd");
document.getElementById('iframe').src = "http://127.0.0.1:9090/?url=" + encodedUrl;
</script>
</body>
</html>


23 changes: 23 additions & 0 deletions scripts/screenshot_compare/assets/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!-- Disable zooming: -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />

<head>
<title>Screenshot compare</title>
<link rel="stylesheet" href="index.css" />
</head>

<body>

<ul>
{% for entry in examples %}
<li>
<a href="examples/{{ entry.name }}">{{ entry.name }}</a>
</li>
{% endfor %}
</ul>
</body>
</html>
Loading
Loading