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

Templated UI #1476

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Templated UI #1476

wants to merge 10 commits into from

Conversation

iainfogg
Copy link
Collaborator

CURRENTLY DRAFT, DO NOT MERGE

This PR moves all the HTML templates, plus the simpler HTML page content generation, out into HTML template files. These files are then filled out by Jinja2 (a templating library).

web.py will ultimately just be responsible for gathering the data that's needed for each web page, and passing that data to the templating engine so it can build out the HTML that's required for each page.

However, for now, some pages still have logic in web.py which generates HTML, but now this is just for filling the content block in the middle of each template. Over time, these will transition out.

@@ -430,28 +431,36 @@ async def html_log(self, request):
start_line = line[0:27]
rest_line = line[27:]

if "error" in line_lower:
text += "<tr><td>{}</td><td nowrap><font color=#ff3333>{}</font> {}</td></tr>\n".format(lineno, start_line, rest_line)
if (
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@springfall2008 this bit is where lines are filtered in/out - lines that shouldn't be seen are simply not added to the list that's passed through to the template.

@iainfogg
Copy link
Collaborator Author

@springfall2008 I created a PR to make it easier to see the differences, and also to make discussing it easier - it was really hard to see the comments you'd made on the commit, there was no way to simply show all comments.

Also, you flagged a couple of lines as having merge issues, I couldn't see any changes to them in the PR when I created it. Let me know in this PR if you think there's still an issue.

Can you tag me in any comments please so I get notified, otherwise they're a bit hard to spot in the midst of everything else?

@@ -17,6 +17,7 @@
from datetime import datetime, timedelta
import hashlib
import traceback
from environment import is_appdaemon_environment
Copy link
Owner

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

Copy link
Collaborator Author

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

@springfall2008
Copy link
Owner

I don't spot any obvious errors apart from the one comment I made about the file list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants