Skip to content

Home Information - Your home, your data, organized.

Python

Refactoring oif UI and code for conole controls and side panel.

Anthony Cassandracd5c39f01443
diff --git a/src/hi/apps/collection/templates/collection/panes/collection_view.html b/src/hi/apps/collection/templates/collection/panes/collection_view.html
index 49982fd7..0bf90aba 100644
--- a/src/hi/apps/collection/templates/collection/panes/collection_view.html
+++ b/src/hi/apps/collection/templates/collection/panes/collection_view.html
@@ -5,7 +5,7 @@
<div class="row">
{% for entity_status_data in entity_status_data_list %}
<div id="{{ entity_status_data.entity.html_id }}"
- class="col-4 {% if request.view_parameters.is_editing %}draggable{% endif %}"
+ class="{% if entity_status_data_list|length == 1 %}col-12{% elif entity_status_data_list|length <= 4 %}col-6{% else %}col-4{% endif %} {% if request.view_parameters.is_editing %}draggable{% endif %}"
{% if request.view_parameters.is_editing %}draggable="true"{% endif %} >
{% include "entity/panes/entity_status_card.html" with entity_status_data=entity_status_data %}
</div>
diff --git a/src/hi/apps/collection/views.py b/src/hi/apps/collection/views.py
index 1dc3e272..8fb22f7d 100644
--- a/src/hi/apps/collection/views.py
+++ b/src/hi/apps/collection/views.py
@@ -48,7 +48,7 @@ class CollectionViewView( HiGridView, CollectionViewMixin ):
def get_main_template_name( self ) -> str:
return 'collection/panes/collection_view.html'
- def get_template_context( self, request, *args, **kwargs ):
+ def get_main_template_context( self, request, *args, **kwargs ):
collection = self.get_collection( request, *args, **kwargs )
if self.should_force_sync_request(
diff --git a/src/hi/apps/config/views.py b/src/hi/apps/config/views.py
index 3238e56e..32e1f218 100644
--- a/src/hi/apps/config/views.py
+++ b/src/hi/apps/config/views.py
@@ -72,7 +72,7 @@ class ConfigSettingsView( ConfigPageView ):
def get_main_template_name( self ) -> str:
return 'config/panes/settings.html'
- def get_template_context( self, request, *args, **kwargs ):
+ def get_main_template_context( self, request, *args, **kwargs ):
subsystem_list = SettingsManager().get_subsystems()
diff --git a/src/hi/apps/console/templates/console/panes/sleep_mode_control.html b/src/hi/apps/console/templates/console/panes/sleep_mode_control.html
index 0a0809e7..459b44fa 100644
--- a/src/hi/apps/console/templates/console/panes/sleep_mode_control.html
+++ b/src/hi/apps/console/templates/console/panes/sleep_mode_control.html
@@ -1,4 +1,2 @@
<button class="btn btn-secondary btn-control" role="button"
-onclick="Hi.settings.enableSleepMode();">
- SLEEP
-</button>
+ onclick="Hi.settings.enableSleepMode();">SLEEP</button>
diff --git a/src/hi/apps/entity/templates/entity/panes/camera_controls.html b/src/hi/apps/entity/templates/entity/panes/camera_controls.html
new file mode 100644
index 00000000..043ffecc
--- /dev/null
+++ b/src/hi/apps/entity/templates/entity/panes/camera_controls.html
@@ -0,0 +1 @@
+CAMERA CONTROLS
diff --git a/src/hi/apps/event/views.py b/src/hi/apps/event/views.py
index 20cb3c04..fbabfa43 100644
--- a/src/hi/apps/event/views.py
+++ b/src/hi/apps/event/views.py
@@ -18,7 +18,7 @@ class EventDefinitionsView( ConfigPageView ):
def get_main_template_name( self ) -> str:
return 'event/panes/event_definitions.html'
- def get_template_context( self, request, *args, **kwargs ):
+ def get_main_template_context( self, request, *args, **kwargs ):
event_definition_list = list(
EventDefinition.objects.prefetch_related(
'event_clauses',
diff --git a/src/hi/apps/location/templates/location/panes/location_drop_down.html b/src/hi/apps/location/templates/location/panes/location_dropdown.html
similarity index 100%
rename from src/hi/apps/location/templates/location/panes/location_drop_down.html
rename to src/hi/apps/location/templates/location/panes/location_dropdown.html
diff --git a/src/hi/apps/location/views.py b/src/hi/apps/location/views.py
index 941d929c..d294370f 100644
--- a/src/hi/apps/location/views.py
+++ b/src/hi/apps/location/views.py
@@ -43,7 +43,7 @@ class LocationViewView( HiGridView, LocationViewMixin ):
def get_main_template_name( self ) -> str:
return self.LOCATION_VIEW_TEMPLATE_NAME
- def get_template_context( self, request, *args, **kwargs ):
+ def get_main_template_context( self, request, *args, **kwargs ):
location_view = self.get_location_view( request, *args, **kwargs )
if self.should_force_sync_request(
diff --git a/src/hi/apps/monitor/monitor_manager.py b/src/hi/apps/monitor/monitor_manager.py
index 299b1860..a6a0f196 100644
--- a/src/hi/apps/monitor/monitor_manager.py
+++ b/src/hi/apps/monitor/monitor_manager.py
@@ -3,6 +3,7 @@ import logging
from typing import List, Type
from django.apps import apps
+from django.conf import settings
from hi.apps.common.singleton import Singleton
from hi.apps.common.module_utils import import_module_safe
@@ -31,6 +32,11 @@ class AppMonitorManager( Singleton ):
monitor = monitor_class()
self._monitor_map[monitor.id] = monitor
if not monitor.is_running:
+
+ if settings.DEBUG and settings.SUPPRESS_MONITORS:
+ logger.debug(f"Skipping monitor: {monitor.id}. See SUPPRESS_MONITORS = True")
+ return
+
logger.debug(f"Starting monitor: {monitor.id}")
asyncio.run_coroutine_threadsafe( monitor.start(), self._event_loop )
continue
diff --git a/src/hi/apps/security/security_manager.py b/src/hi/apps/security/security_manager.py
index 958b6d64..73590ec1 100644
--- a/src/hi/apps/security/security_manager.py
+++ b/src/hi/apps/security/security_manager.py
@@ -25,13 +25,13 @@ logger = logging.getLogger(__name__)
class SecurityManager(Singleton):
DEFAULT_TRANSITION_DELAY_SECS = 5 * 60
- SECURITY_STATE_LABEL_DELAYED_AWAY = 'Delayed'
+ SECURITY_STATE_LABEL_DELAYED_AWAY = 'Away (Delayed)'
SECURITY_STATE_LABEL_SNOOZED = 'Snoozed'
SECURITY_STATE_CACHE_KEY = 'hi.security.state'
def __init_singleton__(self):
- self._security_state = None
+ self._security_state = SecurityState.default()
self._security_level = SecurityLevel.OFF
self._delayed_security_state_timer = None
@@ -64,17 +64,29 @@ class SecurityManager(Singleton):
def get_security_status_data(self) -> SecurityStatusData:
self._security_status_lock.acquire()
try:
- current_security_state_label = self._security_state.label
+ current_action_label = self._security_state.label
+ if self._security_state == SecurityState.DAY:
+ current_action_value = str(SecurityStateAction.SET_DAY)
+ elif self._security_state == SecurityState.NIGHT:
+ current_action_value = str(SecurityStateAction.SET_NIGHT)
+ elif self._security_state == SecurityState.AWAY:
+ current_action_value = str(SecurityStateAction.SET_AWAY)
+ else:
+ current_action_value = str(SecurityStateAction.DISABLE)
+
if self._delayed_security_state:
if self._delayed_security_state == SecurityState.AWAY:
- current_security_state_label = self.SECURITY_STATE_LABEL_DELAYED_AWAY
+ current_action_label = self.SECURITY_STATE_LABEL_DELAYED_AWAY
+ current_action_value = str(SecurityStateAction.SET_AWAY)
else:
- current_security_state_label = self.SECURITY_STATE_LABEL_SNOOZED
+ current_action_label = self.SECURITY_STATE_LABEL_SNOOZED
+ current_action_value = str(SecurityStateAction.SNOOZE)
return SecurityStatusData(
current_security_level = self._security_level,
current_security_state = self._security_state,
- current_security_state_label = current_security_state_label,
+ current_action_value = current_action_value,
+ current_action_label = current_action_label,
)
finally:
self._security_status_lock.release()
diff --git a/src/hi/apps/security/templates/security/panes/security_state_control.html b/src/hi/apps/security/templates/security/panes/security_state_control.html
index 17f647e5..6de894d2 100644
--- a/src/hi/apps/security/templates/security/panes/security_state_control.html
+++ b/src/hi/apps/security/templates/security/panes/security_state_control.html
@@ -1,26 +1,18 @@
<div id="{{ DIVID.SECURITY_STATE_CONTROL }}">
- <div class="dropdown">
- <button class="btn btn-secondary btn-control dropdown-toggle" type="button"
- id="hi-location-menu" data-toggle="dropdown">
- Security: {{ security_status_data.current_security_state_label }}
- <span class="caret"></span>
- </button>
- <div class="dropdown-menu"
- role="menu" aria-labelledby="hi-location-menu">
- {% for value, label in security_status_data.security_state_action_choices %}
- {% if forloop.counter > 1 %}
- <div class="dropdown-divider"></div>
- {% endif %}
- <a role="menuitem" class="dropdown-item plain"
- href="{% url 'security_state_action' action=value %} "
- data-async="#{{ DIVID.SECURITY_STATE_CONTROL }}" data-mode="replace">
- {{ label }}
- </a>
- {% empty %}
- <div class="dropdown-item alert alert-secondary text-center">
- <em>No security states.</em>
- </div>
- {% endfor %}
- </div>
+ <div>SECURITY STATE</div>
+ {% for action_value, action_label in security_status_data.security_state_action_choices %}
+ <a class="btn {% if action_value == security_status_data.current_action_value %}btn-primary{% else %}btn-info{% endif %} btn-control"
+ href="{% url 'security_state_action' action=action_value %} "
+ data-async="#{{ DIVID.SECURITY_STATE_CONTROL }}" data-mode="replace">
+ {% if action_value == security_status_data.current_action_value %}
+ {{ security_status_data.current_action_label }}
+ {% else %}
+ {{ action_label }}
+ {% endif %}
+ </a>
+ {% empty %}
+ <div class="dropdown-item alert alert-secondary text-center">
+ <em>No security states.</em>
</div>
+ {% endfor %}
</div>
diff --git a/src/hi/apps/security/transient_models.py b/src/hi/apps/security/transient_models.py
index be9dad04..24047615 100644
--- a/src/hi/apps/security/transient_models.py
+++ b/src/hi/apps/security/transient_models.py
@@ -7,13 +7,14 @@ from .enums import SecurityLevel, SecurityState, SecurityStateAction
@dataclass
class SecurityStatusData:
- current_security_state : SecurityState
- current_security_level : SecurityLevel
- current_security_state_label : str = None
+ current_security_state : SecurityState
+ current_security_level : SecurityLevel
+ current_action_label : str = None
+ current_action_value : str = None
def __post_init__(self):
- if not self.current_security_state_label:
- self.current_security_state_label = self.current_security_state.label
+ if not self.current_action_label:
+ self.current_action_label = self.current_security_state.label
return
@property
diff --git a/src/hi/apps/sense/templates/sense/panes/sensor_history_list.html b/src/hi/apps/sense/templates/sense/panes/sensor_history_list.html
index c77a89eb..f347ec84 100644
--- a/src/hi/apps/sense/templates/sense/panes/sensor_history_list.html
+++ b/src/hi/apps/sense/templates/sense/panes/sensor_history_list.html
@@ -2,7 +2,6 @@
{% for sensor_history in sensor_history_list %}
<li>
Response[{{ sensor_history.id }}]: {{ sensor_history.value }} [{{ sensor_history.response_datetime }}]
- <h2>DETAILS: {{ sensor_history.details }}</h2>
{% if sensor_history.details %}
<a href="{% url 'sense_sensor_history_details' sensor_history_id=sensor_history.id %}"
data-async="true">Details</a>
diff --git a/src/hi/hi_grid_view.py b/src/hi/hi_grid_view.py
index ecfca28e..a712d7c1 100644
--- a/src/hi/hi_grid_view.py
+++ b/src/hi/hi_grid_view.py
@@ -39,7 +39,7 @@ class HiGridView(View):
- This URL parameter for the side content also allows page refresh keeping the context of the display.
- For this to work, the view that produces the dioe content (async) should subclass HiSideView.
- For normal case for a View that only wants to populate the main content pane asynchronously:
- - Subclass this and provide get_main_template_name() and get_template_context()
+ - Subclass this and provide get_main_template_name() and get_main_template_context()
"""
HI_GRID_TEMPLATE_NAME = 'pages/hi_grid.html'
@@ -50,32 +50,62 @@ class HiGridView(View):
def get_main_template_name( self ) -> str:
raise NotImplementedError('Subclasses must override this method.')
- def get_template_context( self, request, *args, **kwargs ) -> Dict[ str, str ]:
+ def get_main_template_context( self, request, *args, **kwargs ) -> Dict[ str, str ]:
""" Can raise exceptions like BadRequest, Http404, ForceRedirectException, etc. """
raise NotImplementedError('Subclasses must override this method.')
- def get_top_template_name( self ) -> str:
- return self.TOP_TEMPLATE_NAME
+ def get_main_template_name_and_context( self ) -> str:
+ """ Can raise exceptions like BadRequest, Http404, ForceRedirectException, etc. """
+ raise NotImplementedError('Subclasses must override this method.')
- def get_bottom_template_name( self ) -> str:
- return self.BOTTOM_TEMPLATE_NAME
-
- def get_top_template_context( self, request, *args, **kwargs ):
+ def get_top_template_name_and_context( self, request, *args, **kwargs ):
+ """ Subclasses can override this i sneeded. """
if not request.view_parameters.location:
return dict()
location_list = list( Location.objects.all() )
location_view_list = list( request.view_parameters.location.views.order_by( 'order_id' ))
- return {
+ context = {
'location_view_list': location_view_list,
'location_list': location_list,
}
+ return ( self.TOP_TEMPLATE_NAME, context )
- def get_bottom_template_context( self, request, *args, **kwargs ):
+ def get_bottom_template_name_and_context( self, request, *args, **kwargs ):
+ """ Subclasses can override this i sneeded. """
collection_list = list( Collection.objects.all().order_by( 'order_id' ))
- return {
+ context = {
'security_status_data': SecurityManager().get_security_status_data(),
'collection_list': collection_list,
}
+ return ( self.BOTTOM_TEMPLATE_NAME, context )
+
+ def get_side_template_name_and_context( self, request, *args, **kwargs ):
+ """ Subclasses can override this i sneeded. """
+ try:
+ side_url = self.get_side_url_from_request_url( request )
+ side_view, side_kwargs = self.get_side_view_from_url( side_url )
+
+ if not side_view:
+ if request.view_parameters.is_editing:
+ if request.view_parameters.view_type.is_location_view:
+ side_view = LocationViewManageItemsView()
+
+ elif request.view_parameters.view_type.is_collection:
+ side_view = CollectionManageItemsView()
+
+ if not side_view:
+ return ( self.SIDE_DEFAULT_TEMPLATE_NAME, dict() )
+
+ if not isinstance( side_view, HiSideView ):
+ raise ValueError( f'Side URL has view not side class: {side_view.__class__.__name__}' )
+
+ template_name = side_view.get_template_name()
+ template_context = side_view.get_template_context( request, **side_kwargs )
+ return ( template_name, template_context )
+
+ except Exception as e:
+ logger.exception( e )
+ return ( self.SIDE_DEFAULT_TEMPLATE_NAME, dict() )
def get(self, request, *args, **kwargs):
if is_ajax( request ):
@@ -84,22 +114,29 @@ class HiGridView(View):
def get_synchronous_response( self, request, *args, **kwargs ):
try:
- context = self.get_template_context( request, *args, **kwargs )
+ context = self.get_main_template_context( request, *args, **kwargs )
except ForceRedirectException as fde:
return redirect( fde.url )
( side_template_name,
side_template_context ) = self.get_side_template_name_and_context( request, *args, **kwargs )
+ ( top_template_name,
+ top_template_context ) = self.get_top_template_name_and_context( request, *args, **kwargs )
+
+ ( bottom_template_name,
+ bottom_template_context ) = self.get_bottom_template_name_and_context( request, *args, **kwargs )
+
context.update( side_template_context )
+ context.update( top_template_context )
+ context.update( bottom_template_context )
+
context.update({
- 'top_template_name': self.get_top_template_name(),
- 'bottom_template_name': self.get_bottom_template_name(),
'main_template_name': self.get_main_template_name(),
'side_template_name': side_template_name,
+ 'top_template_name': top_template_name,
+ 'bottom_template_name': bottom_template_name,
})
- context.update( self.get_top_template_context( request, *args, **kwargs ))
- context.update( self.get_bottom_template_context( request, *args, **kwargs ))
return render( request, self.HI_GRID_TEMPLATE_NAME, context )
@@ -123,7 +160,7 @@ class HiGridView(View):
def get_content( self, request, *args, **kwargs ) -> str:
template_name = self.get_main_template_name()
template = get_template( template_name )
- context = self.get_template_context( request, *args, **kwargs )
+ context = self.get_main_template_context( request, *args, **kwargs )
return template.render( context, request = request )
def get_push_url( self, request ):
@@ -154,33 +191,6 @@ class HiGridView(View):
return push_url
- def get_side_template_name_and_context( self, request, *args, **kwargs ):
- try:
- side_url = self.get_side_url_from_request_url( request )
- side_view, side_kwargs = self.get_side_view_from_url( side_url )
-
- if not side_view:
- if request.view_parameters.is_editing:
- if request.view_parameters.view_type.is_location_view:
- side_view = LocationViewManageItemsView()
-
- elif request.view_parameters.view_type.is_collection:
- side_view = CollectionManageItemsView()
-
- if not side_view:
- return ( self.SIDE_DEFAULT_TEMPLATE_NAME, dict() )
-
- if not isinstance( side_view, HiSideView ):
- raise ValueError( f'Side URL has view not side class: {side_view.__class__.__name__}' )
-
- template_name = side_view.get_template_name()
- template_context = side_view.get_template_context( request, **side_kwargs )
- return ( template_name, template_context )
-
- except Exception as e:
- logger.exception( e )
- return ( self.SIDE_DEFAULT_TEMPLATE_NAME, dict() )
-
def get_side_url_from_request_url( self, request ):
full_url = request.get_full_path()
diff --git a/src/hi/integrations/integration_manager.py b/src/hi/integrations/integration_manager.py
index d2f6004e..09af6e3b 100644
--- a/src/hi/integrations/integration_manager.py
+++ b/src/hi/integrations/integration_manager.py
@@ -6,6 +6,7 @@ from threading import Lock
from typing import Dict, List
from django.apps import apps
+from django.conf import settings
from django.db import transaction
from hi.apps.attribute.enums import AttributeType
@@ -131,6 +132,11 @@ class IntegrationManager( Singleton ):
self._monitor_map[integration_id] = monitor
if not monitor.is_running:
+
+ if settings.DEBUG and settings.SUPPRESS_MONITORS:
+ logger.debug(f"Skipping monitor: {integration_id}. See SUPPRESS_MONITORS = True")
+ return
+
logger.debug(f"Starting monitor: {integration_id}")
asyncio.run_coroutine_threadsafe( monitor.start(), self._event_loop )
return
diff --git a/src/hi/integrations/views.py b/src/hi/integrations/views.py
index 16381d63..fe0ef044 100644
--- a/src/hi/integrations/views.py
+++ b/src/hi/integrations/views.py
@@ -23,7 +23,7 @@ class IntegrationHomeView( ConfigPageView ):
def get_main_template_name( self ) -> str:
return 'integrations/pages/no_integrations.html'
- def get_template_context( self, request, *args, **kwargs ):
+ def get_main_template_context( self, request, *args, **kwargs ):
integration_data = IntegrationManager().get_default_integration_data()
if not integration_data:
@@ -150,7 +150,7 @@ class IntegrationManageView( ConfigPageView ):
def get_main_template_name( self ) -> str:
return 'integrations/pages/integration_manage.html'
- def get_template_context( self, request, *args, **kwargs ):
+ def get_main_template_context( self, request, *args, **kwargs ):
integration_manager = IntegrationManager()
integration_id = kwargs.get('integration_id')
diff --git a/src/hi/settings/base.py b/src/hi/settings/base.py
index 30ae791c..9c092e4c 100644
--- a/src/hi/settings/base.py
+++ b/src/hi/settings/base.py
@@ -275,6 +275,7 @@ PIPELINE = {
'js_before_content': {
'source_filenames': (
'js/jquery-3.7.0.min.js',
+ 'js/cookie.js',
'js/antinode.js',
'js/autosize.min.js',
'js/main.js',
@@ -368,3 +369,9 @@ BASE_URL_FOR_EMAIL_LINKS = 'https://{SITE_DOMAIN}'
# When tests functionalityt requires knowing if in unit test context.
UNIT_TESTING = False
+
+# In development and debugging, the debug noise and interference from the
+# background periodic monitoring tasks can be a problem. This gives a way
+# to turn them off with one setting.
+#
+SUPPRESS_MONITORS = False
diff --git a/src/hi/settings/development.py b/src/hi/settings/development.py
index c118ccfa..06e182d2 100644
--- a/src/hi/settings/development.py
+++ b/src/hi/settings/development.py
@@ -130,3 +130,5 @@ BASE_URL_FOR_EMAIL_LINKS = 'http:/127.0.0.1:8000/'
# Uncomment to suppress email sending and write to console.
#
# EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
+
+SUPPRESS_MONITORS = False
diff --git a/src/hi/static/js/cookie.js b/src/hi/static/js/cookie.js
new file mode 100644
index 00000000..7f3dffde
--- /dev/null
+++ b/src/hi/static/js/cookie.js
@@ -0,0 +1,151 @@
+/*!
+ * JavaScript Cookie v2.1.2
+ * https://github.com/js-cookie/js-cookie
+ *
+ * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
+ * Released under the MIT license
+ */
+;(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(factory);
+ } else if (typeof exports === 'object') {
+ module.exports = factory();
+ } else {
+ var OldCookies = window.Cookies;
+ var api = window.Cookies = factory();
+ api.noConflict = function () {
+ window.Cookies = OldCookies;
+ return api;
+ };
+ }
+}(function () {
+ function extend () {
+ var i = 0;
+ var result = {};
+ for (; i < arguments.length; i++) {
+ var attributes = arguments[ i ];
+ for (var key in attributes) {
+ result[key] = attributes[key];
+ }
+ }
+ return result;
+ }
+
+ function init (converter) {
+ function api (key, value, attributes) {
+ var result;
+ if (typeof document === 'undefined') {
+ return;
+ }
+
+ // Write
+
+ if (arguments.length > 1) {
+ attributes = extend({
+ path: '/'
+ }, api.defaults, attributes);
+
+ if (typeof attributes.expires === 'number') {
+ var expires = new Date();
+ expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
+ attributes.expires = expires;
+ }
+
+ try {
+ result = JSON.stringify(value);
+ if (/^[\{\[]/.test(result)) {
+ value = result;
+ }
+ } catch (e) {}
+
+ if (!converter.write) {
+ value = encodeURIComponent(String(value))
+ .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
+ } else {
+ value = converter.write(value, key);
+ }
+
+ key = encodeURIComponent(String(key));
+ key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
+ key = key.replace(/[\(\)]/g, escape);
+
+ return (document.cookie = [
+ key, '=', value,
+ attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE
+ attributes.path && '; path=' + attributes.path,
+ attributes.domain && '; domain=' + attributes.domain,
+ attributes.secure ? '; secure' : ''
+ ].join(''));
+ }
+
+ // Read
+
+ if (!key) {
+ result = {};
+ }
+
+ // To prevent the for loop in the first place assign an empty array
+ // in case there are no cookies at all. Also prevents odd result when
+ // calling "get()"
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
+ var rdecode = /(%[0-9A-Z]{2})+/g;
+ var i = 0;
+
+ for (; i < cookies.length; i++) {
+ var parts = cookies[i].split('=');
+ var cookie = parts.slice(1).join('=');
+
+ if (cookie.charAt(0) === '"') {
+ cookie = cookie.slice(1, -1);
+ }
+
+ try {
+ var name = parts[0].replace(rdecode, decodeURIComponent);
+ cookie = converter.read ?
+ converter.read(cookie, name) : converter(cookie, name) ||
+ cookie.replace(rdecode, decodeURIComponent);
+
+ if (this.json) {
+ try {
+ cookie = JSON.parse(cookie);
+ } catch (e) {}
+ }
+
+ if (key === name) {
+ result = cookie;
+ break;
+ }
+
+ if (!key) {
+ result[name] = cookie;
+ }
+ } catch (e) {}
+ }
+
+ return result;
+ }
+
+ api.set = api;
+ api.get = function (key) {
+ return api(key);
+ };
+ api.getJSON = function () {
+ return api.apply({
+ json: true
+ }, [].slice.call(arguments));
+ };
+ api.defaults = {};
+
+ api.remove = function (key, attributes) {
+ api(key, '', extend(attributes, {
+ expires: -1
+ }));
+ };
+
+ api.withConverter = init;
+
+ return api;
+ }
+
+ return init(function () {});
+}));
diff --git a/src/hi/static/js/status.js b/src/hi/static/js/status.js
index de6b4ca2..5d572f4a 100644
--- a/src/hi/static/js/status.js
+++ b/src/hi/static/js/status.js
@@ -64,6 +64,14 @@
}
function fetchServerResponse() {
+ if ( Hi.isEditMode ) {
+ if ( Hi.DEBUG ) { console.log( "Skipping polling server. Edit mode active." ); }
+ Hi.watchdog.ok( ServerPollingWatchdogType );
+ clearServerPollingTimer();
+ setServerPollingTimer();
+ return;
+ }
+
if ( Hi.DEBUG ) { console.log( "Polling server..." ); }
clearServerPollingTimer();
diff --git a/src/hi/templates/panes/bottom_buttons.html b/src/hi/templates/panes/bottom_buttons.html
index f12f5f09..9f4e25d9 100644
--- a/src/hi/templates/panes/bottom_buttons.html
+++ b/src/hi/templates/panes/bottom_buttons.html
@@ -2,7 +2,6 @@
<div class="d-flex justify-content-between">
{% include "collection/panes/collection_buttons.html" %}
<div class="d-flex justify-content-end">
- {% include "security/panes/security_state_control.html" %}
<div>
{% include "console/panes/audio_control.html" %}
</div>
@@ -12,18 +11,11 @@
<div>
{% include "console/panes/console_lock_button.html" %}
</div>
- <div>
- <a href="{% url 'event_history' %}"
- class="btn btn-secondary btn-control" role="button"
- data-async="true" >
- EVENTS
- </a>
- </div>
<div>
<a href="{% url 'config_settings' %}"
class="btn btn-tertiary btn-control" role="button"
data-async="true" >
- ADMIN
+ SETTINGS
</a>
</div>
</div>
diff --git a/src/hi/templates/panes/side.html b/src/hi/templates/panes/side.html
index b3a9ebe0..e5fb8bee 100644
--- a/src/hi/templates/panes/side.html
+++ b/src/hi/templates/panes/side.html
@@ -1 +1,23 @@
-SIDE DEFAULT
+<div id="hi-side-info">
+ <div class="text-center mt-4 pt-4">
+ <div>INFO</div>
+ <div class="pt-2 mb-4 pb-4">Coming Soon.</div>
+ </div>
+</div>
+<div>
+</div>
+<div class="row">
+ <div class="col-6">
+ {% include "entity/panes/camera_controls.html" %}
+ </div>
+ <div class="col-6">
+ {% include "security/panes/security_state_control.html" %}
+ </div>
+</div>
+<div>
+ <a href="{% url 'event_history' %}"
+ class="btn btn-secondary btn-control" role="button"
+ data-async="true" >
+ HISTORY
+ </a>
+</div>
diff --git a/src/hi/templates/panes/top_buttons.html b/src/hi/templates/panes/top_buttons.html
index c610b7b4..ad26f9eb 100644
--- a/src/hi/templates/panes/top_buttons.html
+++ b/src/hi/templates/panes/top_buttons.html
@@ -2,7 +2,7 @@
<div class="d-flex justify-content-between">
{% include "location/panes/location_view_buttons.html" %}
<div class="d-flex justify-content-end">
- {% include "location/panes/location_drop_down.html" %}
+ {% include "location/panes/location_dropdown.html" %}
<div>
{% if request.view_parameters.is_editing %}
<a href="{% url 'edit_end' %}"