aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/web_ui/packages.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/hydrilla/proxy/web_ui/packages.py')
-rw-r--r--src/hydrilla/proxy/web_ui/packages.py34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/hydrilla/proxy/web_ui/packages.py b/src/hydrilla/proxy/web_ui/packages.py
index ac8b480..e14c1fd 100644
--- a/src/hydrilla/proxy/web_ui/packages.py
+++ b/src/hydrilla/proxy/web_ui/packages.py
@@ -42,6 +42,7 @@ import werkzeug
from ...exceptions import HaketiloException
from ...translations import smart_gettext as _
+from ... import item_infos
from .. import state as st
from . import _app
@@ -109,17 +110,17 @@ def show_package(mapping_id: str) -> werkzeug.Response:
mapping_ref = store.get(str(mapping_id))
version_display_infos = mapping_ref.get_version_display_infos()
- active_list = [info for info in version_display_infos if info.is_active]
+ active_version: t.Optional[st.MappingVersionDisplayInfo] = None
- active_version_ref = None if active_list == [] else active_list[0].ref
- active_version_info = None if active_list == [] else active_list[0].info
+ for info in version_display_infos:
+ if info.active != st.ActiveStatus.NOT_ACTIVE:
+ active_version = info
display_info = st.MappingDisplayInfo(
- ref = mapping_ref,
- identifier = version_display_infos[0].info.identifier,
- enabled = version_display_infos[0].mapping_enabled,
- active_version_ref = active_version_ref,
- active_version_info = active_version_info
+ ref = mapping_ref,
+ identifier = version_display_infos[0].info.identifier,
+ enabled = version_display_infos[0].mapping_enabled,
+ active_version = active_version
)
html = flask.render_template(
@@ -138,11 +139,24 @@ def show_package_version(
) -> werkzeug.Response:
try:
store = _app.get_haketilo_state().mapping_version_store()
- display_info = store.get(mapping_version_id).get_display_info()
+ version_ref = store.get(mapping_version_id)
+ display_infos = version_ref.get_all_version_display_infos()
+
+ other_infos: list[st.MappingVersionDisplayInfo] = []
+ this_info: t.Optional[st.MappingVersionDisplayInfo] = None
+
+ for info in display_infos:
+ if info.ref == version_ref:
+ this_info = info
+ else:
+ other_infos.append(info)
+
+ assert this_info is not None
html = flask.render_template(
'packages/show_single_version.html.jinja',
- display_info = display_info,
+ display_info = this_info,
+ version_display_infos = other_infos,
**errors
)
return flask.make_response(html, 200)