-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Templated UI #1476
Draft
iainfogg
wants to merge
10
commits into
main
Choose a base branch
from
templated-ui
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Templated UI #1476
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
dc23355
Add Jinja2 to requirements
iainfogg 53e044a
Add initial cut of templating
iainfogg 7bec7f3
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 3b509b3
Add conditional loading
iainfogg 98c84b4
Merge remote-tracking branch 'origin/main' into templated-ui
iainfogg f7f3e22
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 28ce909
Fix messed up merge
iainfogg c3e9480
Another merge issue
iainfogg f6c83dc
Another merge issue
iainfogg 9dc9849
Web tidy-up
iainfogg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
def is_package_installed(package_name: str) -> bool: | ||
try: | ||
import importlib | ||
|
||
module = importlib.import_module(package_name) | ||
return True | ||
except ImportError: | ||
return False | ||
|
||
|
||
def is_jinja2_installed() -> bool: | ||
return is_package_installed("jinja2") | ||
|
||
|
||
def is_appdaemon_environment() -> bool: | ||
if is_package_installed("appdaemon"): | ||
return True | ||
else: | ||
return False |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% extends "layout.html" %} | ||
|
||
{% block title %}Home{% endblock %} | ||
|
||
{% block content %} | ||
<h2>Predbat Apps.yaml</h2> | ||
|
||
<div id="apps"> | ||
{% autoescape false %} | ||
{{ apps_html }} | ||
{% endautoescape %} | ||
</div> | ||
{% endblock %} |
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,19 @@ | ||
{% extends "layout.html" %} | ||
|
||
{% block title %}Home{% endblock %} | ||
|
||
{% block content %} | ||
<h2>{{ chart_title }} Chart</h2> | ||
- <a href="./charts?chart=Battery">Battery</a> | ||
<a href="./charts?chart=Power">Power</a> | ||
<a href="./charts?chart=Cost">Cost</a> | ||
<a href="./charts?chart=Rates">Rates</a> | ||
<a href="./charts?chart=InDay">InDay</a> | ||
<a href="./charts?chart=PV">PV</a> | ||
<a href="./charts?chart=PV7">PV7</a> | ||
<div id="chart"> | ||
{% autoescape false %} | ||
{{ chart_html }} | ||
{% endautoescape %} | ||
</div> | ||
{% endblock %} |
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,13 @@ | ||
{% extends "layout.html" %} | ||
|
||
{% block title %}Home{% endblock %} | ||
|
||
{% block content %} | ||
<h2>Predbat Config</h2> | ||
|
||
<div id="apps"> | ||
{% autoescape false %} | ||
{{ config_html }} | ||
{% endautoescape %} | ||
</div> | ||
{% endblock %} |
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,10 @@ | ||
{% extends "layout.html" %} | ||
|
||
{% block title %}Home{% endblock %} | ||
|
||
|
||
{% block content %} | ||
{% autoescape false %} | ||
{{ dash_html }} | ||
{% endautoescape %} | ||
{% endblock %} |
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,9 @@ | ||
{% extends "layout.html" %} | ||
|
||
{% block title %}Home{% endblock %} | ||
|
||
{% block content %} | ||
<div class="iframe-container"> | ||
<iframe src="https://springfall2008.github.io/batpred/" class="main-frame" name="main_frame"></iframe> | ||
</div> | ||
{% endblock %} |
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,89 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Predbat Web Interface</title> | ||
<link href="https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css" rel="stylesheet"> | ||
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script> | ||
<style> | ||
body, html { | ||
margin: 0; | ||
padding: 0; | ||
height: 100%; | ||
} | ||
.iframe-container { | ||
display: flex; | ||
flex-direction: column; | ||
height: 90vh; | ||
} | ||
/* Style for the top menu iframe */ | ||
.menu-frame { | ||
height: 80px; /* Adjust the height of the menu bar */ | ||
width: 100%; | ||
border: none; | ||
overflow: hidden; | ||
} | ||
/* Style for the full height iframe */ | ||
.main-frame { | ||
flex-grow: 1; | ||
width: 100%; | ||
border: none; | ||
} | ||
body { | ||
font-family: Arial, sans-serif; | ||
text-align: left; | ||
margin: 5px; | ||
background-color: #ffffff; | ||
color: #333; | ||
} | ||
h1 { | ||
color: #4CAF50; | ||
} | ||
h2 { | ||
color: #4CAF50; | ||
display: inline | ||
} | ||
table { | ||
border-collapse: collapse; | ||
padding: 1px; | ||
border: 1px solid blue; | ||
} | ||
th, | ||
td { | ||
text-align: left; | ||
padding: 5px; | ||
vertical-align: top; | ||
} | ||
th { | ||
background-color: #4CAF50; | ||
color: white; | ||
} | ||
.default { | ||
background-color: #FFFFFF; | ||
} | ||
.modified { | ||
background-color: #FFCCCC; | ||
} | ||
</style> | ||
{% if refresh is defined %} | ||
<meta http-equiv="refresh" content="{{ refresh }}" > | ||
{% endif %} | ||
|
||
</head> | ||
<body> | ||
<div> | ||
<table> | ||
<tr> | ||
<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> | ||
<td><a href="./">Dash</a></td> | ||
<td><a href="./plan">Plan</a></td> | ||
<td><a href="./charts">Charts</a></td> | ||
<td><a href="./config">Config</a></td> | ||
<td><a href="./apps">apps.yaml</a></td> | ||
<td><a href="./log?warnings">Log</a></td> | ||
<td><a href="./docs">Docs</a></td> | ||
</tr> | ||
</table> | ||
</div> | ||
{% block content %}{% endblock %} | ||
</body> | ||
</html> |
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,16 @@ | ||
{% extends "layout.html" %} | ||
|
||
{% block title %}Home{% endblock %} | ||
|
||
|
||
{% block content %} | ||
<h2>Logfile ({% if errors %}Errors{% elif warnings %}Warnings{% else %}All{% endif %})</h2> | ||
- <a href="./log">All</a> <a href="./log?warnings">Warnings</a> <a href="./log?errors">Errors</a><br> | ||
<table width=100%> | ||
{% for line in lines %} | ||
<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> | ||
{% endfor %} | ||
</table> | ||
{% autoescape false %} | ||
{% endautoescape %} | ||
{% endblock %} |
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,11 @@ | ||
{% extends "layout.html" %} | ||
|
||
{% block title %}Home{% endblock %} | ||
|
||
|
||
{% block content %} | ||
Plan | ||
{% autoescape false %} | ||
{{ plan_html }} | ||
{% endautoescape %} | ||
{% endblock %} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need to add environment.py to the file list for Predbat to download
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, sorry this has been stuck for a bit - been busy with other stuff @springfall2008