Skip to content

Home Information - Your home, your data, organized.

Python

Added integration id to labels when toggling entities in views.

Anthony Cassandrac8a47c1590cf
diff --git a/src/hi/apps/collection/templates/collection/edit/panes/collection_entity_toggle.html b/src/hi/apps/collection/templates/collection/edit/panes/collection_entity_toggle.html
index 46c67c50..4647590b 100644
--- a/src/hi/apps/collection/templates/collection/edit/panes/collection_entity_toggle.html
+++ b/src/hi/apps/collection/templates/collection/edit/panes/collection_entity_toggle.html
@@ -8,7 +8,7 @@
<input type="checkbox" id="entity-toggle-collection-checkbox-{{ entity.id }}" name="checkbox_state"
{% if exists_in_collection %}checked{% endif %}
onchange-async="true" >
- <label for="entity-toggle-collection-checkbox-{{ entity.id }}">{{ entity.name }}</label>
+ <label for="entity-toggle-collection-checkbox-{{ entity.id }}">{{ entity.name }} <small>[{{ entity.integration_id }}]</small></label>
</form>
</div>
</div>
diff --git a/src/hi/apps/config/urls.py b/src/hi/apps/config/urls.py
index b8271eda..b8292c75 100644
--- a/src/hi/apps/config/urls.py
+++ b/src/hi/apps/config/urls.py
@@ -9,4 +9,8 @@ urlpatterns = [
views.ConfigSettingsView.as_view(),
name='config_settings' ),
+ re_path( r'^internal$',
+ views.ConfigInternalView.as_view(),
+ name='config_interns' ),
+
]
diff --git a/src/hi/apps/config/views.py b/src/hi/apps/config/views.py
index d3ecdbf1..a74e98fa 100644
--- a/src/hi/apps/config/views.py
+++ b/src/hi/apps/config/views.py
@@ -1,6 +1,10 @@
from django.db import transaction
from django.shortcuts import render
+from django.conf import settings
+from django.http import JsonResponse
+from django.views.generic import View
+
import hi.apps.common.antinode as antinode
from hi.enums import ViewMode, ViewType
@@ -127,3 +131,26 @@ class ConfigSettingsView( ConfigPageView, SettingsMixin ):
return antinode.refresh_response()
+class ConfigInternalView( View ):
+
+ @classmethod
+ def get_config_data(self):
+ return {
+ 'allowed_hosts': settings.ALLOWED_HOSTS,
+ 'redis_host': settings.REDIS_HOST,
+ 'redis_port': settings.REDIS_PORT,
+ 'cors_allowed_origins': settings.CORS_ALLOWED_ORIGINS,
+ 'csp_default_src': settings.CSP_DEFAULT_SRC,
+ 'csp_connect_src': settings.CSP_CONNECT_SRC,
+ 'csp_frame_src': settings.CSP_FRAME_SRC,
+ 'csp_script_src': settings.CSP_SCRIPT_SRC,
+ 'csp_style_src': settings.CSP_STYLE_SRC,
+ 'csp_media_src': settings.CSP_MEDIA_SRC,
+ 'csp_img_src': settings.CSP_IMG_SRC,
+ 'csp_child_src': settings.CSP_CHILD_SRC,
+ 'csp_font_src': settings.CSP_FONT_SRC,
+ }
+
+ def get(self, request, *args, **kwargs):
+ data = self.get_config_data()
+ return JsonResponse( data, safe = False )
diff --git a/src/hi/apps/location/templates/location/edit/panes/location_view_entity_toggle.html b/src/hi/apps/location/templates/location/edit/panes/location_view_entity_toggle.html
index b4d1af80..034f649b 100644
--- a/src/hi/apps/location/templates/location/edit/panes/location_view_entity_toggle.html
+++ b/src/hi/apps/location/templates/location/edit/panes/location_view_entity_toggle.html
@@ -8,7 +8,7 @@
<input type="checkbox" id="entity-toggle-location-checkbox-{{ entity.id }}" name="checkbox_state"
{% if exists_in_view %}checked{% endif %}
onchange-async="true" >
- <label for="entity-toggle-location-checkbox-{{ entity.id }}">{{ entity.name }}</label>
+ <label for="entity-toggle-location-checkbox-{{ entity.id }}">{{ entity.name }} <small>[{{ entity.integration_id }}]</small></label>
</form>
</div>
</div>