From b74d174419cfb835d17810ae6d881fb629a00c1d Mon Sep 17 00:00:00 2001 From: tdruez <489057+tdruez@users.noreply.github.com> Date: Thu, 30 May 2024 08:33:50 +0400 Subject: [PATCH] Add visual indicator when an object also have tree in hierarchy view #70 (#126) Signed-off-by: tdruez --- CHANGELOG.rst | 4 + .../component_catalog/component_details.html | 2 +- .../includes/component_hierarchy.js.html | 140 ++++++++---------- .../tabs/tab_subcomponents.html | 4 +- component_catalog/tests/test_views.py | 6 +- component_catalog/views.py | 41 +++-- dje/templates/hierarchy_base.js.html | 58 ++++++++ license_library/tests/test_views.py | 2 +- .../includes/owner_hierarchy.js.html | 15 +- .../templates/organization/owner_details.html | 2 +- .../includes/product_hierarchy.js.html | 69 +++------ .../product_portfolio/product_details.html | 2 +- product_portfolio/tests/test_views.py | 6 +- product_portfolio/views.py | 3 + 14 files changed, 197 insertions(+), 157 deletions(-) create mode 100644 dje/templates/hierarchy_base.js.html diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2be142b..173519d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,10 @@ Release notes ### Version 5.1.1-dev +- Add visual indicator in hierarchy views, when an object on the far left or far right + also belong or have a hierarchy (relathionship tree). + https://github.com/nexB/dejacode/issues/70 + ### Version 5.1.0 - Upgrade Python version to 3.12 and Django to 5.0.x diff --git a/component_catalog/templates/component_catalog/component_details.html b/component_catalog/templates/component_catalog/component_details.html index 092b918..9464026 100644 --- a/component_catalog/templates/component_catalog/component_details.html +++ b/component_catalog/templates/component_catalog/component_details.html @@ -58,7 +58,7 @@ {% block javascripts %} {{ block.super }} - + {% include 'component_catalog/includes/component_hierarchy.js.html' with related_parents=tabsets.Hierarchy.fields.0.1.related_parents related_children=tabsets.Hierarchy.fields.0.1.related_children productcomponents=tabsets.Hierarchy.fields.0.1.productcomponents %} {% if tabsets.Owner.extra %} {% include 'organization/includes/owner_hierarchy.js.html' with current_owner=object.owner parents=tabsets.Owner.extra.context.owner_parents children=tabsets.Owner.extra.context.owner_children tab_name="tab_owner" %} diff --git a/component_catalog/templates/component_catalog/includes/component_hierarchy.js.html b/component_catalog/templates/component_catalog/includes/component_hierarchy.js.html index 4947825..c37e010 100644 --- a/component_catalog/templates/component_catalog/includes/component_hierarchy.js.html +++ b/component_catalog/templates/component_catalog/includes/component_hierarchy.js.html @@ -1,84 +1,66 @@ - \ No newline at end of file + {% if related_child.child_count > 0 %} + var linkUrl = '{{ related_child.child.get_absolute_url }}#hierarchy'; + addEndpointWithLink(jsPlumbHierarchy, source_id, 'RightMiddle', linkUrl); + {% endif %} + {% endfor %} +{% endblock %} \ No newline at end of file diff --git a/component_catalog/templates/component_catalog/tabs/tab_subcomponents.html b/component_catalog/templates/component_catalog/tabs/tab_subcomponents.html index dc97a86..d98f485 100644 --- a/component_catalog/templates/component_catalog/tabs/tab_subcomponents.html +++ b/component_catalog/templates/component_catalog/tabs/tab_subcomponents.html @@ -34,7 +34,7 @@ {% endif %} {{ data.child.version }} - {{ data.child.owner }} + {{ data.child.owner|default_if_none:"" }} {{ data.subcomponent.purpose }} {% if data.subcomponent.license_expression %} @@ -50,7 +50,7 @@ {{ data.subcomponent.is_modified|as_icon }} {% if component.is_active %} -