aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/web_ui/templates/items
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-09-02 13:51:25 +0200
committerWojtek Kosior <koszko@koszko.org>2022-09-28 12:54:55 +0200
commit5cdb4c29ea9e736ea5a52483c2e62009c4c7d27e (patch)
tree0ccdec4cff3fb7b507a085a81322d2cfce1288d8 /src/hydrilla/proxy/web_ui/templates/items
parentb533fa5c5bdd88fa1ea4980ff0c1828d692e5319 (diff)
downloadhaketilo-hydrilla-5cdb4c29ea9e736ea5a52483c2e62009c4c7d27e.tar.gz
haketilo-hydrilla-5cdb4c29ea9e736ea5a52483c2e62009c4c7d27e.zip
[proxy] allow packages to be frozen and unfrozen in the web UI
This commit also makes some minor changes and fixes in other parts of the web UI.
Diffstat (limited to 'src/hydrilla/proxy/web_ui/templates/items')
-rw-r--r--src/hydrilla/proxy/web_ui/templates/items/item_view.html.jinja60
-rw-r--r--src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja18
-rw-r--r--src/hydrilla/proxy/web_ui/templates/items/library_viewversion.html.jinja15
-rw-r--r--src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja119
4 files changed, 151 insertions, 61 deletions
diff --git a/src/hydrilla/proxy/web_ui/templates/items/item_view.html.jinja b/src/hydrilla/proxy/web_ui/templates/items/item_view.html.jinja
index 861d5ef..1ad8df3 100644
--- a/src/hydrilla/proxy/web_ui/templates/items/item_view.html.jinja
+++ b/src/hydrilla/proxy/web_ui/templates/items/item_view.html.jinja
@@ -19,6 +19,15 @@ file's licenses. Although I request that you do not make use this code
in a proprietary work, I am not going to enforce this in court.
#}
{% extends "base.html.jinja" %}
+
+{% macro versioned_identifier_with_repo(info) %}
+ {{ info.info.versioned_identifier }}
+ {% if not info.is_local %}
+ @
+ {{ info.info.repo }}
+ {% endif %}
+{% endmacro %}
+
{% block style %}
{{ super() }}
@@ -28,38 +37,37 @@ in a proprietary work, I am not going to enforce this in court.
{% block main_info %}
<h3>{% block heading required %}{% endblock %}</h3>
{% endblock %}
- {% if version_display_infos|length > 0 %}
+ {% if display_info.all_versions|length > 0 %}
<h4>
{% block version_list_heading required %}
{% endblock %}
</h4>
<ul id="item_list">
- {% for info in version_display_infos %}
- {% set entry_classes = [] %}
- {% if info.is_local %}
- {% do entry_classes.append('version-entry-local') %}
- {% endif %}
- {% if info.is_orphan %}
- {% do entry_classes.append('version-entry-orphan') %}
+ {% for info in display_info.all_versions %}
+ {%
+ if version_display_info is not defined or
+ version_display_info.ref != info.ref
+ %}
+ {% set entry_classes = [] %}
+ {% if info.is_local %}
+ {% do entry_classes.append('version-entry-local') %}
+ {% endif %}
+ {% if info.is_orphan %}
+ {% do entry_classes.append('version-entry-orphan') %}
+ {% endif %}
+ <li class="{{ entry_classes|join(' ') }}">
+ {%
+ set href = url_for(
+ '.show_{}_version'.format(info.type.alt_name),
+ item_version_id = info.ref.id
+ )
+ %}
+ <a href="{{ href }}">
+ <div> {{ versioned_identifier_with_repo(info) }} </div>
+ </a>
+ </li>
{% endif %}
- <li class="{{ entry_classes|join(' ') }}">
- {%
- set href = url_for(
- '.show_{}_version'.format(info.type.alt_name),
- item_version_id = info.ref.id
- )
- %}
- <a href="{{ href }}">
- <div>
- {{ info.info.version_string }}
- {% if not info.is_local %}
- @
- {{ info.info.repo }}
- {% endif %}
- </div>
- </a>
- </li>
{% endfor %}
</ul>
- {% endif %}{# version_display_infos|length > 0 #}
+ {% endif %}{# display_info.all_versions|length > 0 #}
{% endblock main %}
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 54cb3cf..de62330 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
@@ -39,25 +39,25 @@ in a proprietary work, I am not going to enforce this in court.
{{ super() }}
<div class="item-identifier">
- {{ display_info.info.versioned_identifier }}
+ {{ versioned_identifier_with_repo(version_display_info) }}
</div>
{% block main_info_bulk %}
TODO: add more info...
{% endblock %}
- {% if display_info.active == ActiveStatus.REQUIRED %}
+ {% if version_display_info.active == ActiveStatus.REQUIRED %}
<div>{% block item_required_msg required %}{% endblock %}</div>
- {% elif display_info.active == ActiveStatus.AUTO %}
+ {% elif version_display_info.active == ActiveStatus.AUTO %}
<div>{% block item_auto_activated_msg required %}{% endblock %}</div>
{% else %}
- {# display_info.active == ActiveStatus.NOT_ACTIVE #}
+ {# version_display_info.active == ActiveStatus.NOT_ACTIVE #}
<div>{% block item_not_activated_msg required %}{% endblock %}</div>
{% endif %}
{% set install_but_classes = ['green-button', 'button-bordering-left'] %}
{% set uninstall_but_classes = ['green-button', 'button-bordering-right'] %}
- {% if display_info.installed == InstalledStatus.FAILED_TO_INSTALL %}
+ {% if version_display_info.installed == InstalledStatus.FAILED_TO_INSTALL %}
{%
set install_text =
_('web_ui.items.single_version.retry_install_button')
@@ -70,19 +70,19 @@ in a proprietary work, I am not going to enforce this in court.
{% else %}
{% set install_text = _('web_ui.items.single_version.install_button') %}
{% set uninstall_text = _('web_ui.items.single_version.uninstall_button') %}
- {% if display_info.installed == InstalledStatus.INSTALLED %}
+ {% if version_display_info.installed == InstalledStatus.INSTALLED %}
{% do install_but_classes.append('disabled-button') %}
{%
if uninstall_disallowed is defined or
- display_info.active == ActiveStatus.REQUIRED
+ version_display_info.active == ActiveStatus.REQUIRED
%}
{% do uninstall_but_classes.append('disabled-button') %}
{% endif %}
{% else %}
- {# display_info.installed == InstalledStatus.NOT_INSTALLED #}
+ {# version_display_info.installed == InstalledStatus.NOT_INSTALLED #}
{% do uninstall_but_classes.append('disabled-button') %}
{% endif %}
- {% endif %}{# else/ display_info.installed == InstalledStatus.FAILED_TO_I...#}
+ {% endif %}{# else/ version_display_info.installed == InstalledStatus.FA... #}
{{
button_row([
(uninstall_but_classes, uninstall_text, 'uninstall_item_version'),
diff --git a/src/hydrilla/proxy/web_ui/templates/items/library_viewversion.html.jinja b/src/hydrilla/proxy/web_ui/templates/items/library_viewversion.html.jinja
index 30e084d..9e0a32e 100644
--- a/src/hydrilla/proxy/web_ui/templates/items/library_viewversion.html.jinja
+++ b/src/hydrilla/proxy/web_ui/templates/items/library_viewversion.html.jinja
@@ -25,10 +25,17 @@ in a proprietary work, I am not going to enforce this in court.
{% endblock %}
{% block heading %}
- {{
- _('web_ui.items.single_version.library.heading.name_{}')
- .format(display_info.info.long_name)
- }}
+ {% if version_display_info.is_local %}
+ {{
+ _('web_ui.items.single_version.library_local.heading.name_{}')
+ .format(version_display_info.info.long_name)
+ }}
+ {% else %}
+ {{
+ _('web_ui.items.single_version.library.heading.name_{}')
+ .format(version_display_info.info.long_name)
+ }}
+ {% endif %}
{% endblock %}
{% block item_required_msg %}
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 a532b5f..ea8b7d3 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
@@ -25,10 +25,17 @@ in a proprietary work, I am not going to enforce this in court.
{% endblock %}
{% block heading %}
- {{
- _('web_ui.items.single_version.package.heading.name_{}')
- .format(display_info.info.long_name)
- }}
+ {% if version_display_info.is_local %}
+ {{
+ _('web_ui.items.single_version.package_local.heading.name_{}')
+ .format(version_display_info.info.long_name)
+ }}
+ {% else %}
+ {{
+ _('web_ui.items.single_version.package.heading.name_{}')
+ .format(version_display_info.info.long_name)
+ }}
+ {% endif %}
{% endblock %}
{% block item_required_msg %}
@@ -66,28 +73,18 @@ in a proprietary work, I am not going to enforce this in court.
{% set unenable_text = _('web_ui.items.single_version.unenable_button') %}
{% set disable_text = _('web_ui.items.single_version.disable_button') %}
- {%
- if display_info.mapping_enabled == EnabledStatus.ENABLED and
- display_info.active == ActiveStatus.NOT_ACTIVE
- %}
- {%
- set enable_text =
- _('web_ui.items.single_version.freeze_to_this_button')
- %}
- {% else %}
- {% set enable_text = _('web_ui.items.single_version.enable_button') %}
- {% endif %}
+ {% set enable_text = _('web_ui.items.single_version.enable_button') %}
- {% if display_info.mapping_enabled == EnabledStatus.NO_MARK %}
+ {% if display_info.enabled == EnabledStatus.NO_MARK %}
{% do unenable_but_classes.append('disabled-button') %}
- {% elif display_info.mapping_enabled == EnabledStatus.DISABLED %}
+ <div> {{ _('web_ui.items.single_version.item_not_marked') }} </div>
+ {% elif display_info.enabled == EnabledStatus.DISABLED %}
{% do disable_but_classes.append('disabled-button') %}
+ <div> {{ _('web_ui.items.single_version.item_disabled') }} </div>
{% else %}
- {% if display_info.active == ActiveStatus.REQUIRED %}
- {% do enable_but_classes.append('disabled-button') %}
- {% else %}
- <div> {{ _('web_ui.items.single_version.other_version_enabled') }} </div>
- {% endif %}
+ {# display_info.enabled == EnabledStatus.ENABLED #}
+ {% do enable_but_classes.append('disabled-button') %}
+ <div> {{ _('web_ui.items.single_version.item_enabled') }} </div>
{% endif %}
{{
@@ -97,4 +94,82 @@ in a proprietary work, I am not going to enforce this in court.
(enable_but_classes, enable_text, 'enable_item_version')
])
}}
+
+ {% if display_info.enabled == EnabledStatus.ENABLED %}
+ {% set unpin_but_classes = ['green-button', 'button-bordering-right'] %}
+ {%
+ set pin_repo_but_classes = [
+ 'green-button',
+ 'button-bordering-right',
+ 'button-bordering-left'
+ ]
+ %}
+ {% set pin_ver_but_classes = ['green-button', 'button-bordering-left'] %}
+
+ {% set unpin_text = _('web_ui.items.single_version.unpin_button') %}
+
+ {% if display_info.frozen == FrozenStatus.NOT_FROZEN %}
+ {% do unpin_but_classes.append('disabled-button') %}
+ <div> {{ _('web_ui.items.single_version.not_pinned') }} </div>
+ {% endif %}
+
+ {% if display_info.frozen == FrozenStatus.REPOSITORY %}
+ {% if display_info.active_version.is_local %}
+ <div> {{ _('web_ui.items.single_version.pinned_repo_local') }} </div>
+ {% else %}
+ <div>
+ {{
+ _('web_ui.items.single_version.pinned_repo_{}')
+ .format(display_info.active_version.info.repo)
+ }}
+ </div>
+ {% endif %}
+ {%
+ if display_info.active_version.info.repo ==
+ version_display_info.info.repo
+ %}
+ {% if version_display_info.is_local %}
+ {%
+ set pin_repo_text =
+ _('web_ui.items.single_version.pin_local_repo_button')
+ %}
+ {% else %}
+ {%
+ set pin_repo_text = _('web_ui.items.single_version.pin_repo_button')
+ %}
+ {% endif %}
+ {% do pin_repo_but_classes.append('disabled-button') %}
+ {% else %}
+ {%
+ set pin_repo_text =
+ _('web_ui.items.single_version.repin_repo_button')
+ %}
+ {% endif %}
+ {% else %}{# display_info.frozen == FrozenStatus.REPOSITORY #}
+ {% set pin_repo_text = _('web_ui.items.single_version.pin_repo_button') %}
+ {% endif %}{# else/ display_info.frozen == FrozenStatus.REPOSITORY #}
+
+ {% if display_info.frozen == FrozenStatus.EXACT_VERSION %}
+ {% if display_info.active_version.ref == version_display_info.ref %}
+ {% set pin_ver_text = _('web_ui.items.single_version.pin_ver_button') %}
+ {% do pin_ver_but_classes.append('disabled-button') %}
+ <div> {{ _('web_ui.items.single_version.pinned_ver') }} </div>
+ {% else %}
+ {%
+ set pin_ver_text = _('web_ui.items.single_version.repin_ver_button')
+ %}
+ <div> {{ _('web_ui.items.single_version.pinned_other_ver') }} </div>
+ {% endif %}
+ {% else %}
+ {% set pin_ver_text = _('web_ui.items.single_version.pin_ver_button') %}
+ {% endif %}{# else/ display_info.frozen == FrozenStatus.EXACT_VERSION #}
+
+ {{
+ button_row([
+ (unpin_but_classes, unpin_text, 'unfreeze_item'),
+ (pin_repo_but_classes, pin_repo_text, 'freeze_to_repo'),
+ (pin_ver_but_classes, pin_ver_text, 'freeze_to_version')
+ ])
+ }}
+ {% endif %}{# display_info.enabled == EnabledStatus.ENABLED #}
{% endblock main_info_bulk %}