-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
Static files for Home Assistant #426
Conversation
Hey @dsheehan, I was making some tweaks to the UI and I think I broke the dragability. Could you take a look when you have a chance? |
@@ -4,45 +4,44 @@ | |||
<head> | |||
<meta charset="UTF-8"> | |||
<title>Wyze-Bridge</title> | |||
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='site.css') }}" /> | |||
{% if show_video %} |
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.
restore guard flag
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='site.css') }}" /> | ||
{% if show_video %} | ||
<link rel="stylesheet" type="text/css" | ||
href="{{ 'static/site.css' if hass else url_for('static',filename='site.css') }}" /> |
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.
Flask recommends using url_for. In this case it's effectively building static/site.css
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.
Unfortunately url_for static seems to build the hrefs with a leading forward slash which breaks in HASS since the static files are located somewhere like: http://homeassistant.local:8123/api/hassio_ingress/FX8RhC_HKiSPRVURubziW8OCqGIxj-7s5kMt3L7RObU/static/site.css
and it tries to grab the static files from homeassistant.local:8123/static/
<h2>Detected {{cameras|length}} cameras:</h2> | ||
<label for="select_number_of_columns">Number of columns: </label> | ||
<input id="select_number_of_columns" type="number" min="1" max="10" value="{{ number_of_columns }}" /> | ||
|
||
<section class="cameras"> | ||
{% for camera in cameras.values() %} | ||
<div id="{{ camera.name_uri }}" draggable="true" class="camera"> | ||
<details open> |
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.
I prefer having the collapsable details element here, so I can collapse all the cameras I'm not interested in watching at the moment.
</video> | ||
{% elif camera.img %} | ||
<img class="refresh_img" src="{{camera.img}}" width="100%" /> |
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.
Restore class. Did you base this PR off an old commit?
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.
ahh, yes, changes were made from my HASS vm which may have been behind.
cameras=wb.get_cameras(), | ||
number_of_columns=number_of_columns, | ||
hass=wb.hass, | ||
version=wb.version, |
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.
In future, if we need more things from wb, we might want to see if we can pass in the entire wb object and reference it directly. (haven't tried)
app/frontend.py
Outdated
logging.basicConfig(level=logging.DEBUG) | ||
|
||
if __name__ == "__main__": | ||
logging.basicConfig(level=logging.CRITICAL) |
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.
Too my knowledge, this main isn't used by the Dockerfile, it's only for direct debugging, so might as well leave it at Debug. Flask invokes the create_app() directly IIRC.
app/templates/index.html
Outdated
camera.connected else 'OFFLINE'}}</span> | ||
</div> | ||
</summary> | ||
<div class="title"> |
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.
The extra div's are probably breaking the draggable logic in
docker-wyze-bridge/app/static/site.js
Line 73 in cb576d7
if (target && target !== dragEl && target.nodeName === 'DIV') { |
No description provided.