From 4f016d740e3c15e72b944aa0d6f82ca863d1ae67 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Fri, 7 Oct 2022 14:00:15 +0200 Subject: [proxy] honor min/max haketilo version constraints in packages/libraries --- src/hydrilla/proxy/web_ui/root.py | 2 ++ .../templates/items/item_viewversion.html.jinja | 24 ++++++++++++++++++++++ .../templates/items/package_viewversion.html.jinja | 10 +++++++++ 3 files changed, 36 insertions(+) (limited to 'src/hydrilla/proxy/web_ui') diff --git a/src/hydrilla/proxy/web_ui/root.py b/src/hydrilla/proxy/web_ui/root.py index 402c5ae..3676307 100644 --- a/src/hydrilla/proxy/web_ui/root.py +++ b/src/hydrilla/proxy/web_ui/root.py @@ -42,6 +42,7 @@ import flask import werkzeug from ...translations import translation as make_translation +from ... import versions from ... import item_infos from .. import state as st from .. import http_messages @@ -97,6 +98,7 @@ class WebUIAppImpl(_app.WebUIApp): self.jinja_env.globals['ActiveStatus'] = st.ActiveStatus self.jinja_env.globals['ItemType'] = item_infos.ItemType self.jinja_env.globals['MappingUseMode'] = st.MappingUseMode + self.jinja_env.globals['versions'] = versions self.before_request(authenticate_by_referrer) diff --git a/src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja b/src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja index fe5f335..0d2ed57 100644 --- a/src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja @@ -77,6 +77,10 @@ code in a proprietary work, I am not going to enforce this in court. {{ error_note(_('web_ui.err.repo_communication_error')) }} {% endif %} + {% if not version_display_info.info.compatible %} + {{ error_note(_('web_ui.err.item_not_compatible')) }} + {% endif %} + {{ super() }} {{ label(_('web_ui.items.single_version.identifier_label')) }} @@ -147,6 +151,26 @@ code in a proprietary work, I am not going to enforce this in court.
{% endif %} + {% if version_display_info.info.min_haketilo_ver != versions.int_ver_min %} + {{ label(_('web_ui.items.single_version.min_haketilo_ver_label')) }} + +

+ {{ versions.version_string(version_display_info.info.min_haketilo_ver) }} +

+ +
+ {% endif %} + + {% if version_display_info.info.max_haketilo_ver != versions.int_ver_max %} + {{ label(_('web_ui.items.single_version.max_haketilo_ver_label')) }} + +

+ {{ versions.version_string(version_display_info.info.max_haketilo_ver) }} +

+ +
+ {% endif %} + {% block main_info_rest required %}{% endblock %} {% diff --git a/src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja b/src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja index 230168a..fa7c954 100644 --- a/src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja @@ -110,6 +110,10 @@ code in a proprietary work, I am not going to enforce this in court. {% set unenable_but_classes = ['green-button'] %} {% set disable_but_classes = ['red-button'] %} + {% if not version_display_info.info.compatible %} + {% do enable_but_classes.append('disabled-button') %} + {% endif %} + {% set unenable_text = _('web_ui.items.single_version.unenable_button') %} {% set disable_text = _('web_ui.items.single_version.disable_button') %} {% set enable_text = _('web_ui.items.single_version.enable_button') %} @@ -155,6 +159,12 @@ code in a proprietary work, I am not going to enforce this in court. {% set pin_repo_but_classes = ['green-button'] %} {% set pin_ver_but_classes = ['green-button'] %} + {% if not version_display_info.info.compatible %} + {% do unpin_but_classes.append('disabled-button') %} + {% do pin_repo_but_classes.append('disabled-button') %} + {% do pin_ver_but_classes.append('disabled-button') %} + {% endif %} + {% set unpin_text = _('web_ui.items.single_version.unpin_button') %}

-- cgit v1.2.3