aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/web_ui
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-10-07 14:00:15 +0200
committerWojtek Kosior <koszko@koszko.org>2022-10-08 19:08:39 +0200
commit4f016d740e3c15e72b944aa0d6f82ca863d1ae67 (patch)
treea7f8b2dd322a9c35122ce9c4ad3922f4ad3bd9c1 /src/hydrilla/proxy/web_ui
parent168b8d76d9b84a4d6b78100bee080cc9a14f5ff6 (diff)
downloadhaketilo-hydrilla-4f016d740e3c15e72b944aa0d6f82ca863d1ae67.tar.gz
haketilo-hydrilla-4f016d740e3c15e72b944aa0d6f82ca863d1ae67.zip
[proxy] honor min/max haketilo version constraints in packages/libraries
Diffstat (limited to 'src/hydrilla/proxy/web_ui')
-rw-r--r--src/hydrilla/proxy/web_ui/root.py2
-rw-r--r--src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja24
-rw-r--r--src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja10
3 files changed, 36 insertions, 0 deletions
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.
<div class="horizontal-separator"></div>
{% endif %}
+ {% if version_display_info.info.min_haketilo_ver != versions.int_ver_min %}
+ {{ label(_('web_ui.items.single_version.min_haketilo_ver_label')) }}
+
+ <p>
+ {{ versions.version_string(version_display_info.info.min_haketilo_ver) }}
+ </p>
+
+ <div class="horizontal-separator"></div>
+ {% endif %}
+
+ {% if version_display_info.info.max_haketilo_ver != versions.int_ver_max %}
+ {{ label(_('web_ui.items.single_version.max_haketilo_ver_label')) }}
+
+ <p>
+ {{ versions.version_string(version_display_info.info.max_haketilo_ver) }}
+ </p>
+
+ <div class="horizontal-separator"></div>
+ {% 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') %}
<p>