removed redundant graph buttons, added status and esn as title text on camera name
parent
a00347c7ee
commit
fb10657e60
54
app.py
54
app.py
|
@ -19,14 +19,6 @@ logger = logging.getLogger()
|
||||||
from EagleEyev3 import *
|
from EagleEyev3 import *
|
||||||
from settings import config
|
from settings import config
|
||||||
|
|
||||||
logging.info(f"Using EagleEyev3 version {EagleEyev3.__version__}")
|
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
|
||||||
|
|
||||||
SESSION_TYPE = 'filesystem'
|
|
||||||
app.config.from_object(__name__)
|
|
||||||
Session(app)
|
|
||||||
|
|
||||||
|
|
||||||
# check if it could pull in a config object from settings.py
|
# check if it could pull in a config object from settings.py
|
||||||
|
@ -46,6 +38,37 @@ else:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
logging.info(f"Using EagleEyev3 version {EagleEyev3.__version__}")
|
||||||
|
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
SESSION_TYPE = 'filesystem'
|
||||||
|
app.config.from_object(__name__)
|
||||||
|
Session(app)
|
||||||
|
|
||||||
|
|
||||||
|
# flask routes
|
||||||
|
#
|
||||||
|
# Endpoint Methods Rule
|
||||||
|
# --------------------- ------- -------------------------------
|
||||||
|
# accounts GET /accounts
|
||||||
|
# camera__preivew_image GET /camera/<esn>/preview_image
|
||||||
|
# camera_detail GET /camera/<esn>/events/<int:days>
|
||||||
|
# camera_detail GET /camera/<esn>/events
|
||||||
|
# camera_live_preivew GET /camera/<esn>/preview
|
||||||
|
# camera_status_plot GET /camera/<esn>/status_plot
|
||||||
|
# cameras GET /cameras
|
||||||
|
# index GET /
|
||||||
|
# landing GET /landing
|
||||||
|
# login_callback GET /login_callback
|
||||||
|
# logout GET /logout
|
||||||
|
# static GET /static/<path:filename>
|
||||||
|
# switch_account GET /switch_account
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/landing')
|
@app.route('/landing')
|
||||||
def landing():
|
def landing():
|
||||||
|
|
||||||
|
@ -93,6 +116,18 @@ def index():
|
||||||
een.get_list_of_cameras()
|
een.get_list_of_cameras()
|
||||||
een.get_list_of_accounts()
|
een.get_list_of_accounts()
|
||||||
|
|
||||||
|
if len(een.accounts) > 0 and een.active_account == None:
|
||||||
|
# they need to pick and account
|
||||||
|
|
||||||
|
logging.info(f"redirecting to accounts.html because they don't have an active account { een.active_account }")
|
||||||
|
|
||||||
|
values = {
|
||||||
|
"current_user": een.current_user,
|
||||||
|
"accounts": een.accounts,
|
||||||
|
"active_account": een.active_account
|
||||||
|
}
|
||||||
|
redirect(url_for('accounts'))
|
||||||
|
|
||||||
values = {
|
values = {
|
||||||
"current_user": een.current_user,
|
"current_user": een.current_user,
|
||||||
"cameras": een.cameras,
|
"cameras": een.cameras,
|
||||||
|
@ -186,7 +221,8 @@ def switch_account():
|
||||||
|
|
||||||
|
|
||||||
if (account):
|
if (account):
|
||||||
# use the include code parameter to complete login process
|
# switch into account
|
||||||
|
logging.info(f"attempting to switch into account {account}")
|
||||||
een.login_from_reseller(target_account_id=account)
|
een.login_from_reseller(target_account_id=account)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ Werkzeug==2.3.6
|
||||||
gunicorn==20.1.0
|
gunicorn==20.1.0
|
||||||
cachelib==0.10.2
|
cachelib==0.10.2
|
||||||
Flask-Session==0.5.0
|
Flask-Session==0.5.0
|
||||||
EagleEyev3>=0.0.13
|
EagleEyev3>=0.0.14
|
||||||
tqdm
|
tqdm
|
||||||
pandas
|
pandas
|
||||||
numpy
|
numpy
|
||||||
|
|
|
@ -2,22 +2,22 @@
|
||||||
<h5>{{ template_values['camera'].name }}</h5>
|
<h5>{{ template_values['camera'].name }}</h5>
|
||||||
<a href="/camera/{{ template_values['camera'].id }}/events/3" hx-get="/camera/{{ template_values['camera'].id }}/events/3" hx-trigger="click" hx-target="#camera_status_events" hx-indicator=".progress">
|
<a href="/camera/{{ template_values['camera'].id }}/events/3" hx-get="/camera/{{ template_values['camera'].id }}/events/3" hx-trigger="click" hx-target="#camera_status_events" hx-indicator=".progress">
|
||||||
<button class="btn btn-outline-success">
|
<button class="btn btn-outline-success">
|
||||||
<i class="bi bi-calendar-event" title="click to load events list for 3 days">3x</i>
|
3x<i class="bi bi-calendar-event" title="click to load events list for 3 days"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<a href="/camera/{{ template_values['camera'].id }}/events/7" hx-get="/camera/{{ template_values['camera'].id }}/events/7" hx-trigger="click" hx-target="#camera_status_events" hx-indicator=".progress">
|
<a href="/camera/{{ template_values['camera'].id }}/events/7" hx-get="/camera/{{ template_values['camera'].id }}/events/7" hx-trigger="click" hx-target="#camera_status_events" hx-indicator=".progress">
|
||||||
<button class="btn btn-outline-success">
|
<button class="btn btn-outline-success">
|
||||||
<i class="bi bi-calendar-event" title="click to load events list for 7 days">7x</i>
|
7x<i class="bi bi-calendar-event" title="click to load events list for 7 days"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<a href="/camera/{{ template_values['camera'].id }}/events/14" hx-get="/camera/{{ template_values['camera'].id }}/events/14" hx-trigger="click" hx-target="#camera_status_events" hx-indicator=".progress">
|
<a href="/camera/{{ template_values['camera'].id }}/events/14" hx-get="/camera/{{ template_values['camera'].id }}/events/14" hx-trigger="click" hx-target="#camera_status_events" hx-indicator=".progress">
|
||||||
<button class="btn btn-outline-success">
|
<button class="btn btn-outline-success">
|
||||||
<i class="bi bi-calendar-event" title="click to load events list for 14 days">14x</i>
|
14x<i class="bi bi-calendar-event" title="click to load events list for 14 days"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<a href="/camera/{{ template_values['camera'].id }}/status_plot" hx-get="/camera/{{ template_values['camera'].id }}/status_plot" hx-trigger="click" hx-target="#camera_status_plot" hx-indicator=".progress">
|
<a href="/camera/{{ template_values['camera'].id }}/status_plot" hx-get="/camera/{{ template_values['camera'].id }}/status_plot" hx-trigger="click" hx-target="#camera_status_plot" hx-indicator=".progress">
|
||||||
<button class="btn btn-outline-success">
|
<button class="btn btn-outline-success">
|
||||||
<i class="bi bi-bar-chart" title="click to generate graph of events"></i>
|
Graph Events <i class="bi bi-bar-chart" title="click to generate graph of events"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
{% if template_values['events'] %}
|
{% if template_values['events'] %}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{% if camera.is_online() %}
|
{% if camera.is_online() %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-5 col-md-6 offset-1 left_text" style="overflow: hidden;">
|
<div class="col-sm-5 col-md-6 offset-1 left_text" style="overflow: hidden;">
|
||||||
{{ camera.name }}
|
<span title="ESN: {{ camera.id }}">{{ camera.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6 col-md-5">
|
<div class="col-sm-6 col-md-5">
|
||||||
<a href="/camera/{{ camera.id }}/preview" hx-get="/camera/{{ camera.id }}/preview" hx-trigger="click" hx-target="#camera_detail" hx-indicator=".progress">
|
<a href="/camera/{{ camera.id }}/preview" hx-get="/camera/{{ camera.id }}/preview" hx-trigger="click" hx-target="#camera_detail" hx-indicator=".progress">
|
||||||
|
@ -18,11 +18,11 @@
|
||||||
<i class="bi bi-calendar-event" title="click to load events list"></i>
|
<i class="bi bi-calendar-event" title="click to load events list"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<a href="/camera/{{ camera.id }}/status_plot" hx-get="/camera/{{ camera.id }}/status_plot" hx-trigger="click" hx-target="#camera_status_plot" hx-indicator=".progress">
|
<!-- <a href="/camera/{{ camera.id }}/status_plot" hx-get="/camera/{{ camera.id }}/status_plot" hx-trigger="click" hx-target="#camera_status_plot" hx-indicator=".progress">
|
||||||
<button class="btn btn-outline-success">
|
<button class="btn btn-outline-success">
|
||||||
<i class="bi bi-bar-chart" title="click to generate graph of events"></i>
|
<i class="bi bi-bar-chart" title="click to generate graph of events"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
{% if camera.is_offline() %}
|
{% if camera.is_offline() %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-5 col-md-6 offset-1 left_text" style="overflow: hidden;">
|
<div class="col-sm-5 col-md-6 offset-1 left_text" style="overflow: hidden;">
|
||||||
{{ camera.name }}
|
<span title="ESN: {{ camera.id }} Status: {{ camera.status['connectionStatus'] }}">{{ camera.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6 col-md-5">
|
<div class="col-sm-6 col-md-5">
|
||||||
<a href="/camera/{{ camera.id }}/preview" hx-get="/camera/{{ camera.id }}/preview" hx-trigger="click" hx-target="#camera_detail" hx-indicator=".progress">
|
<a href="/camera/{{ camera.id }}/preview" hx-get="/camera/{{ camera.id }}/preview" hx-trigger="click" hx-target="#camera_detail" hx-indicator=".progress">
|
||||||
|
@ -46,16 +46,16 @@
|
||||||
<i class="bi bi-calendar-event" title="click to load events list"></i>
|
<i class="bi bi-calendar-event" title="click to load events list"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<a href="/camera/{{ camera.id }}/status_plot" hx-get="/camera/{{ camera.id }}/status_plot" hx-trigger="click" hx-target="#camera_status_plot" hx-indicator=".progress">
|
<!-- <a href="/camera/{{ camera.id }}/status_plot" hx-get="/camera/{{ camera.id }}/status_plot" hx-trigger="click" hx-target="#camera_status_plot" hx-indicator=".progress">
|
||||||
<button class="btn btn-outline-success">
|
<button class="btn btn-outline-success">
|
||||||
<i class="bi bi-bar-chart" title="click to generate graph of events"></i>
|
<i class="bi bi-bar-chart" title="click to generate graph of events"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
<button hx-get="/cameras" hx-trigger="click" hx-target="#camera_list" class="btn btn-md btn-secondary" hx-indicator=".progress">load cameras</button>
|
<button hx-get="/cameras" hx-trigger="click" hx-target="#camera_list" class="btn btn-md btn-outline-success" hx-indicator=".progress">refresh <i class="bi bi-arrow-clockwise"></i></button>
|
||||||
<br>
|
<br>
|
||||||
|
|
Loading…
Reference in New Issue