Skip to content

Commit 53e044a

Browse files
committed
Add initial cut of templating
1 parent dc23355 commit 53e044a

File tree

9 files changed

+330
-98
lines changed

9 files changed

+330
-98
lines changed

apps/predbat/templates/apps.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{% extends "layout.html" %}
2+
3+
{% block title %}Home{% endblock %}
4+
5+
{% block content %}
6+
<h2>Predbat Apps.yaml</h2>
7+
8+
<div id="apps">
9+
{% autoescape false %}
10+
{{ apps_html }}
11+
{% endautoescape %}
12+
</div>
13+
{% endblock %}

apps/predbat/templates/charts.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{% extends "layout.html" %}
2+
3+
{% block title %}Home{% endblock %}
4+
5+
{% block content %}
6+
<h2>{{ chart_title }} Chart</h2>
7+
- <a href="./charts?chart=Battery">Battery</a>
8+
<a href="./charts?chart=Power">Power</a>
9+
<a href="./charts?chart=Cost">Cost</a>
10+
<a href="./charts?chart=Rates">Rates</a>
11+
<a href="./charts?chart=InDay">InDay</a>
12+
<a href="./charts?chart=PV">PV</a>
13+
<a href="./charts?chart=PV7">PV7</a>
14+
<div id="chart">
15+
{% autoescape false %}
16+
{{ chart_html }}
17+
{% endautoescape %}
18+
</div>
19+
{% endblock %}

apps/predbat/templates/config.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{% extends "layout.html" %}
2+
3+
{% block title %}Home{% endblock %}
4+
5+
{% block content %}
6+
<h2>Predbat Config</h2>
7+
8+
<div id="apps">
9+
{% autoescape false %}
10+
{{ config_html }}
11+
{% endautoescape %}
12+
</div>
13+
{% endblock %}

apps/predbat/templates/dash.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% extends "layout.html" %}
2+
3+
{% block title %}Home{% endblock %}
4+
5+
6+
{% block content %}
7+
{% autoescape false %}
8+
{{ dash_html }}
9+
{% endautoescape %}
10+
{% endblock %}

apps/predbat/templates/docs.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% extends "layout.html" %}
2+
3+
{% block title %}Home{% endblock %}
4+
5+
{% block content %}
6+
<div class="iframe-container">
7+
<iframe src="https://springfall2008.github.io/batpred/" class="main-frame" name="main_frame"></iframe>
8+
</div>
9+
{% endblock %}

apps/predbat/templates/layout.html

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<title>Predbat Web Interface</title>
5+
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/css/materialdesignicons.min.css" rel="stylesheet">
6+
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
7+
<style>
8+
body, html {
9+
margin: 0;
10+
padding: 0;
11+
height: 100%;
12+
}
13+
.iframe-container {
14+
display: flex;
15+
flex-direction: column;
16+
height: 90vh;
17+
}
18+
/* Style for the top menu iframe */
19+
.menu-frame {
20+
height: 80px; /* Adjust the height of the menu bar */
21+
width: 100%;
22+
border: none;
23+
overflow: hidden;
24+
}
25+
/* Style for the full height iframe */
26+
.main-frame {
27+
flex-grow: 1;
28+
width: 100%;
29+
border: none;
30+
}
31+
body {
32+
font-family: Arial, sans-serif;
33+
text-align: left;
34+
margin: 5px;
35+
background-color: #ffffff;
36+
color: #333;
37+
}
38+
h1 {
39+
color: #4CAF50;
40+
}
41+
h2 {
42+
color: #4CAF50;
43+
display: inline
44+
}
45+
table {
46+
border-collapse: collapse;
47+
padding: 1px;
48+
border: 1px solid blue;
49+
}
50+
th,
51+
td {
52+
text-align: left;
53+
padding: 5px;
54+
vertical-align: top;
55+
}
56+
th {
57+
background-color: #4CAF50;
58+
color: white;
59+
}
60+
.default {
61+
background-color: #FFFFFF;
62+
}
63+
.modified {
64+
background-color: #FFCCCC;
65+
}
66+
</style>
67+
{% if refresh is defined %}
68+
<meta http-equiv="refresh" content="{{ refresh }}" >
69+
{% endif %}
70+
71+
</head>
72+
<body>
73+
<div>
74+
<table>
75+
<tr>
76+
<td><h2>Predbat</h2></td><td><img src="https://github-production-user-asset-6210df.s3.amazonaws.com/48591903/249456079-e98a0720-d2cf-4b71-94ab-97fe09b3cee1.png" width="50" height="50"></td>
77+
<td><a href="./">Dash</a></td>
78+
<td><a href="./plan">Plan</a></td>
79+
<td><a href="./charts">Charts</a></td>
80+
<td><a href="./config">Config</a></td>
81+
<td><a href="./apps">apps.yaml</a></td>
82+
<td><a href="./log?warnings">Log</a></td>
83+
<td><a href="./docs">Docs</a></td>
84+
</tr>
85+
</table>
86+
</div>
87+
{% block content %}{% endblock %}
88+
</body>
89+
</html>

apps/predbat/templates/logs.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{% extends "layout.html" %}
2+
3+
{% block title %}Home{% endblock %}
4+
5+
6+
{% block content %}
7+
<h2>Logfile ({% if errors %}Errors{% elif warnings %}Warnings{% else %}All{% endif %})</h2>
8+
- <a href="./log">All</a> <a href="./log?warnings">Warnings</a> <a href="./log?errors">Errors</a><br>
9+
<table width=100%>
10+
{% for line in lines %}
11+
<tr><td>{{ line.line_no}}</td><td nowrap><font color="#{% if "error" in line.rest_line.lower() %}ff3333{% elif not errors and "warn" in line.rest_line.lower()%}ffA500{% else %}33cc33{% endif %}">{{ line.start_line }}</font> {{ line.rest_line }}</td></tr>
12+
{% endfor %}
13+
</table>
14+
{% autoescape false %}
15+
{% endautoescape %}
16+
{% endblock %}

apps/predbat/templates/plan.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% extends "layout.html" %}
2+
3+
{% block title %}Home{% endblock %}
4+
5+
6+
{% block content %}
7+
Plan
8+
{% autoescape false %}
9+
{{ plan_html }}
10+
{% endautoescape %}
11+
{% endblock %}

0 commit comments

Comments
 (0)