summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-10-08 19:07:12 +0200
committerWojtek Kosior <koszko@koszko.org>2022-10-08 19:08:39 +0200
commitb2055032cb914fd160270971dd1da46f8c7c838d (patch)
treebd1a67b9a708af1eae704e208bd50849e4b7f1f7 /src
parent4f016d740e3c15e72b944aa0d6f82ca863d1ae67 (diff)
downloadhaketilo-hydrilla-b2055032cb914fd160270971dd1da46f8c7c838d.tar.gz
haketilo-hydrilla-b2055032cb914fd160270971dd1da46f8c7c838d.zip
[proxy] remove TODOs from library and package pages and make package page display enable/disable/forget buttons
Diffstat (limited to 'src')
-rw-r--r--src/hydrilla/locales/en_US/LC_MESSAGES/messages.po125
-rw-r--r--src/hydrilla/proxy/state_impl/items.py3
-rw-r--r--src/hydrilla/proxy/web_ui/items.py78
-rw-r--r--src/hydrilla/proxy/web_ui/templates/items/item_view.html.jinja14
-rw-r--r--src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja16
-rw-r--r--src/hydrilla/proxy/web_ui/templates/items/library_view.html.jinja4
-rw-r--r--src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja87
-rw-r--r--src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja6
8 files changed, 265 insertions, 68 deletions
diff --git a/src/hydrilla/locales/en_US/LC_MESSAGES/messages.po b/src/hydrilla/locales/en_US/LC_MESSAGES/messages.po
index 55cf02a..aeff285 100644
--- a/src/hydrilla/locales/en_US/LC_MESSAGES/messages.po
+++ b/src/hydrilla/locales/en_US/LC_MESSAGES/messages.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: hydrilla 2.0\n"
"Report-Msgid-Bugs-To: koszko@koszko.org\n"
-"POT-Creation-Date: 2022-10-07 15:39+0200\n"
+"POT-Creation-Date: 2022-10-08 17:33+0200\n"
"PO-Revision-Date: 2022-02-12 00:00+0000\n"
"Last-Translator: Wojtek Kosior <koszko@koszko.org>\n"
"Language: en_US\n"
@@ -455,79 +455,79 @@ msgstr ""
msgid "web_ui.home.prune_orphans_button"
msgstr "Prune orphans"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:69
+#: src/hydrilla/proxy/web_ui/templates/items/item_view.html.jinja:44
#: src/hydrilla/proxy/web_ui/templates/prompts/package_suggestion.html.jinja:30
#: src/hydrilla/proxy/web_ui/templates/repos/show_single.html.jinja:35
msgid "web_ui.err.file_installation_error"
msgstr "Failed to install needed items from repository."
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:73
-msgid "web_ui.err.uninstall_disallowed"
-msgstr "This item is required and cannot be uninstalled."
+#: src/hydrilla/proxy/web_ui/templates/items/item_view.html.jinja:48
+msgid "web_ui.err.impossible_situation_error"
+msgstr "Item constraints prevent the action from succeeding."
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:77
+#: src/hydrilla/proxy/web_ui/templates/items/item_view.html.jinja:52
#: src/hydrilla/proxy/web_ui/templates/prompts/package_suggestion.html.jinja:34
#: src/hydrilla/proxy/web_ui/templates/repos/show_single.html.jinja:39
msgid "web_ui.err.repo_communication_error"
msgstr "Couldn't communicate with repository."
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:81
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:69
msgid "web_ui.err.item_not_compatible"
msgstr "This item is not compatible with current Haketilo version."
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:86
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:76
msgid "web_ui.items.single_version.identifier_label"
msgstr "Identifier"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:94
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:84
msgid "web_ui.items.single_version.version_label"
msgstr "Version"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:103
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:93
msgid "web_ui.items.single_version.uuid_label"
msgstr "UUID"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:113
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:103
msgid "web_ui.items.single_version.description_label"
msgstr "Description"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:122
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:112
msgid "web_ui.items.single_version.licenses_label"
msgstr "License and copyright files"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:128
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:118
msgid "web_ui.items.single_version.no_license_files"
msgstr "There are no designated files with legal information."
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:135
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:125
msgid "web_ui.items.single_version.required_mappings_label"
msgstr "Required packages"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:155
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:145
msgid "web_ui.items.single_version.min_haketilo_ver_label"
msgstr "Minimum compatible Haketilo version"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:165
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:155
msgid "web_ui.items.single_version.max_haketilo_ver_label"
msgstr "Maximum compatible Haketilo version"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:182
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:172
msgid "web_ui.items.single_version.install_uninstall_label"
msgstr "Installation status"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:189
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:179
msgid "web_ui.items.single_version.retry_install_button"
msgstr "Retry installation"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:193
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:183
msgid "web_ui.items.single_version.leave_uninstalled_button"
msgstr "Leave uninstalled"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:197
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:187
msgid "web_ui.items.single_version.install_button"
msgstr "Install"
-#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:199
+#: src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja:189
msgid "web_ui.items.single_version.uninstall_button"
msgstr "Uninstall"
@@ -547,7 +547,7 @@ msgstr "Library view"
msgid "web_ui.items.single.library.heading.name_{}"
msgstr "Libraries named '{}'"
-#: src/hydrilla/proxy/web_ui/templates/items/library_view.html.jinja:41
+#: src/hydrilla/proxy/web_ui/templates/items/library_view.html.jinja:37
msgid "web_ui.items.single.library.version_list_heading"
msgstr "Available versions"
@@ -622,7 +622,74 @@ msgstr "Package view"
msgid "web_ui.items.single.package.heading.name_{}"
msgstr "Packages named '{}'"
-#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:41
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:40
+msgid "web_ui.items.single.package.enabled_label"
+msgstr "Usage status"
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:46
+#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:117
+msgid "web_ui.items.unenable_button"
+msgstr "Forget"
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:47
+#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:118
+msgid "web_ui.items.disable_button"
+msgstr "Disable"
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:48
+#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:119
+msgid "web_ui.items.enable_button"
+msgstr "Enable"
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:53
+msgid "web_ui.items.single.package.item_not_enabled"
+msgstr "The package has not been explicitly configured by the user."
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:56
+msgid "web_ui.items.single.package.item_disabled"
+msgstr "The package has been explicitly disabled by the user."
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:60
+msgid "web_ui.items.single.package.item_enabled"
+msgstr "The package has been enabled by the user."
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:75
+msgid "web_ui.items.single.package.pinning_label"
+msgstr "Enabled package pinning"
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:81
+msgid "web_ui.items.single.package.unpin_button"
+msgstr "Unpin"
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:86
+msgid "web_ui.items.single.package.pin_local_repo_button"
+msgstr "Pin to local packages"
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:89
+msgid "web_ui.items.single.package.pin_repo_button"
+msgstr "Pin to repository"
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:92
+msgid "web_ui.items.single.package.pin_ver_button"
+msgstr "Pin to current version"
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:97
+msgid "web_ui.items.single.package.not_pinned"
+msgstr "The package is not pinned to any version."
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:101
+msgid "web_ui.items.single.package.pinned_repo_local"
+msgstr "The package is pinned to only use locally installed versions."
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:104
+msgid "web_ui.items.single.package.pinned_repo_{}"
+msgstr "The package is pinned to only use versions from repository '{}'."
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:110
+msgid "web_ui.items.single.package.pinned_ver"
+msgstr "The package is pinned to a specific version."
+
+#: src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja:125
msgid "web_ui.items.single.package.version_list_heading"
msgstr "Available versions"
@@ -666,18 +733,6 @@ msgstr "This package has no payloads."
msgid "web_ui.items.single_version.package.enabled_label"
msgstr "Usage status"
-#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:117
-msgid "web_ui.items.single_version.unenable_button"
-msgstr "Forget"
-
-#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:118
-msgid "web_ui.items.single_version.disable_button"
-msgstr "Disable"
-
-#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:119
-msgid "web_ui.items.single_version.enable_button"
-msgstr "Enable"
-
#: src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja:128
msgid "web_ui.items.single_version.package.item_not_activated"
msgstr "This package is not enabled. This version won't be used."
diff --git a/src/hydrilla/proxy/state_impl/items.py b/src/hydrilla/proxy/state_impl/items.py
index 010b8ca..6a41300 100644
--- a/src/hydrilla/proxy/state_impl/items.py
+++ b/src/hydrilla/proxy/state_impl/items.py
@@ -290,7 +290,8 @@ class ConcreteMappingRef(st.MappingRef):
if version_id_to_activate is not None:
new_active_version_id = version_id_to_activate
- elif enabled == st.EnabledStatus.ENABLED:
+ elif enabled == st.EnabledStatus.ENABLED and \
+ old_active_version_id is not None:
new_active_version_id = str(old_active_version_id)
else:
new_active_version_id = None
diff --git a/src/hydrilla/proxy/web_ui/items.py b/src/hydrilla/proxy/web_ui/items.py
index 467be2f..01b201d 100644
--- a/src/hydrilla/proxy/web_ui/items.py
+++ b/src/hydrilla/proxy/web_ui/items.py
@@ -73,15 +73,19 @@ def item_store(state: st.HaketiloState, item_type: item_infos.ItemType) \
else:
return state.mapping_store()
-def show_item(item_id: str, item_type: item_infos.ItemType) \
- -> werkzeug.Response:
+def show_item(
+ item_id: str,
+ item_type: item_infos.ItemType,
+ errors: t.Mapping[str, bool] = {}
+) -> werkzeug.Response:
try:
store = item_store(_app.get_haketilo_state(), item_type)
display_info = store.get(str(item_id)).get_display_info()
html = flask.render_template(
f'items/{item_type.alt_name}_view.html.jinja',
- display_info = display_info
+ display_info = display_info,
+ **errors
)
return flask.make_response(html, 200)
except st.MissingItemError:
@@ -96,6 +100,64 @@ def show_library(item_id: str) -> werkzeug.Response:
def show_package(item_id: str) -> werkzeug.Response:
return show_item(item_id, item_infos.ItemType.MAPPING)
+def alter_item(item_id: str, item_type: item_infos.ItemType) \
+ -> werkzeug.Response:
+ form_data = flask.request.form
+ action = form_data['action']
+
+ try:
+ store = item_store(_app.get_haketilo_state(), item_type)
+ item_ref = store.get(item_id)
+
+ if action == 'disable_item':
+ assert isinstance(item_ref, st.MappingRef)
+ item_ref.update_status(st.EnabledStatus.DISABLED)
+ elif action == 'unenable_item':
+ assert isinstance(item_ref, st.MappingRef)
+ item_ref.update_status(st.EnabledStatus.NO_MARK)
+ elif action in ('enable_item', 'unfreeze_item'):
+ assert isinstance(item_ref, st.MappingRef)
+ item_ref.update_status(
+ enabled = st.EnabledStatus.ENABLED,
+ frozen = st.FrozenStatus.NOT_FROZEN,
+ )
+ elif action == 'freeze_to_repo':
+ assert isinstance(item_ref, st.MappingRef)
+ item_ref.update_status(
+ enabled = st.EnabledStatus.ENABLED,
+ frozen = st.FrozenStatus.REPOSITORY,
+ )
+ elif action == 'freeze_to_version':
+ assert isinstance(item_ref, st.MappingRef)
+ item_ref.update_status(
+ enabled = st.EnabledStatus.ENABLED,
+ frozen = st.FrozenStatus.EXACT_VERSION,
+ )
+ else:
+ raise ValueError()
+ except st.RepoCommunicationError:
+ return show_item(item_id, item_type, {'repo_communication_error': True})
+ except st.FileInstallationError:
+ return show_item(item_id, item_type, {'file_installation_error': True})
+ except st.ImpossibleSituation:
+ errors = {'impossible_situation_error': True}
+ return show_item(item_id, item_type, errors)
+ except st.MissingItemError:
+ flask.abort(404)
+
+ return flask.redirect(
+ flask.url_for(f'.show_{item_type.alt_name}', item_id=item_id)
+ )
+
+@bp.route('/libraries/view/<string:item_id>', methods=['POST'])
+def alter_library(item_id: str) -> werkzeug.Response:
+ return alter_item(item_id, item_infos.ItemType.RESOURCE)
+
+@bp.route('/packages/view/<string:item_id>', methods=['POST'])
+def alter_package(item_id: str) -> werkzeug.Response:
+ return alter_item(item_id, item_infos.ItemType.MAPPING)
+
+
ItemVersionDisplayInfo = t.Union[
st.MappingVersionDisplayInfo,
st.ResourceVersionDisplayInfo
@@ -163,7 +225,7 @@ def alter_item_version(item_version_id: str, item_type: item_infos.ItemType) \
elif action == 'unenable_item':
assert isinstance(item_version_ref, st.MappingVersionRef)
item_version_ref.update_mapping_status(st.EnabledStatus.NO_MARK)
- elif action == 'enable_item_version':
+ elif action in ('enable_item_version', 'freeze_to_version'):
assert isinstance(item_version_ref, st.MappingVersionRef)
item_version_ref.update_mapping_status(
enabled = st.EnabledStatus.ENABLED,
@@ -181,12 +243,6 @@ def alter_item_version(item_version_id: str, item_type: item_infos.ItemType) \
enabled = st.EnabledStatus.ENABLED,
frozen = st.FrozenStatus.REPOSITORY,
)
- elif action == 'freeze_to_version':
- assert isinstance(item_version_ref, st.MappingVersionRef)
- item_version_ref.update_mapping_status(
- enabled = st.EnabledStatus.ENABLED,
- frozen = st.FrozenStatus.EXACT_VERSION,
- )
elif action == 'install_item_version':
item_version_ref.install()
elif action == 'uninstall_item_version':
@@ -214,7 +270,7 @@ def alter_item_version(item_version_id: str, item_type: item_infos.ItemType) \
return show_item_version(
item_version_id = item_version_id,
item_type = item_type,
- errors = {'uninstall_disallowed': True}
+ errors = {'impossible_situation_error': True}
)
except st.MissingItemError:
flask.abort(404)
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 5f8b102..e517f3b 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
@@ -39,6 +39,20 @@ code in a proprietary work, I am not going to enforce this in court.
{% endblock %}
{% block main %}
+ {% block top_errors %}
+ {% if file_installation_error is defined %}
+ {{ error_note(_('web_ui.err.file_installation_error')) }}
+ {% endif %}
+
+ {% if impossible_situation_error is defined %}
+ {{ error_note(_('web_ui.err.impossible_situation_error')) }}
+ {% endif %}
+
+ {% if repo_communication_error is defined %}
+ {{ error_note(_('web_ui.err.repo_communication_error')) }}
+ {% endif %}
+ {% endblock top_errors %}
+
{% block main_info %}
<h3>{% block heading required %}{% endblock %}</h3>
{% endblock %}
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 0d2ed57..3d1a2cb 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
@@ -64,23 +64,13 @@ code in a proprietary work, I am not going to enforce this in court.
}
{% endblock %}
-{% block main_info %}
- {% if file_installation_error is defined %}
- {{ error_note(_('web_ui.err.file_installation_error')) }}
- {% endif %}
-
- {% if uninstall_disallowed is defined %}
- {{ error_note(_('web_ui.err.uninstall_disallowed')) }}
- {% endif %}
-
- {% if repo_communication_error is defined %}
- {{ error_note(_('web_ui.err.repo_communication_error')) }}
- {% endif %}
-
+{% block top_errors %}
{% if not version_display_info.info.compatible %}
{{ error_note(_('web_ui.err.item_not_compatible')) }}
{% endif %}
+{% endblock %}
+{% block main_info %}
{{ super() }}
{{ label(_('web_ui.items.single_version.identifier_label')) }}
diff --git a/src/hydrilla/proxy/web_ui/templates/items/library_view.html.jinja b/src/hydrilla/proxy/web_ui/templates/items/library_view.html.jinja
index 76f63f3..f33b5b7 100644
--- a/src/hydrilla/proxy/web_ui/templates/items/library_view.html.jinja
+++ b/src/hydrilla/proxy/web_ui/templates/items/library_view.html.jinja
@@ -31,10 +31,6 @@ code in a proprietary work, I am not going to enforce this in court.
{% block main_info %}
{{ super() }}
-
- <p>
- TODO: add more info...
- </p>
{% endblock %}
{% block version_list_heading %}
diff --git a/src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja b/src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja
index d0bc1c8..d5ba2a0 100644
--- a/src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja
+++ b/src/hydrilla/proxy/web_ui/templates/items/package_view.html.jinja
@@ -32,9 +32,94 @@ code in a proprietary work, I am not going to enforce this in court.
{% block main_info %}
{{ super() }}
+ {#
+ The labels and buttons below are similar to those in single package versions
+ view but not similar enough for us to be able to refactor common code.
+ #}
+
+ {{ label(_('web_ui.items.single.package.enabled_label')) }}
+
+ {% set enable_but_classes = ['blue-button'] %}
+ {% set unenable_but_classes = ['green-button'] %}
+ {% set disable_but_classes = ['red-button'] %}
+
+ {% set unenable_text = _('web_ui.items.unenable_button') %}
+ {% set disable_text = _('web_ui.items.disable_button') %}
+ {% set enable_text = _('web_ui.items.enable_button') %}
+
<p>
- TODO: add more info...
+ {% if display_info.enabled == EnabledStatus.NO_MARK %}
+ {% do unenable_but_classes.append('disabled-button') %}
+ {{ _('web_ui.items.single.package.item_not_enabled') }}
+ {% elif display_info.enabled == EnabledStatus.DISABLED %}
+ {% do disable_but_classes.append('disabled-button') %}
+ {{ _('web_ui.items.single.package.item_disabled') }}
+ {% else %}
+ {# display_info.enabled == EnabledStatus.ENABLED #}
+ {% do enable_but_classes.append('disabled-button') %}
+ {{ _('web_ui.items.single.package.item_enabled') }}
+ {% endif %}
</p>
+
+ {{
+ button_row([
+ (disable_but_classes, disable_text, {'action': 'disable_item'}),
+ (unenable_but_classes, unenable_text, {'action': 'unenable_item'}),
+ (enable_but_classes, enable_text, {'action': 'enable_item'})
+ ])
+ }}
+
+ {% if display_info.enabled == EnabledStatus.ENABLED %}
+ <div class="horizontal-separator"></div>
+
+ {{ label(_('web_ui.items.single.package.pinning_label')) }}
+
+ {% set unpin_but_classes = ['green-button'] %}
+ {% set pin_repo_but_classes = ['green-button'] %}
+ {% set pin_ver_but_classes = ['green-button'] %}
+
+ {% set unpin_text = _('web_ui.items.single.package.unpin_button') %}
+
+ {% if display_info.active_version.is_local %}
+ {%
+ set pin_repo_text =
+ _('web_ui.items.single.package.pin_local_repo_button')
+ %}
+ {% else %}
+ {% set pin_repo_text = _('web_ui.items.single.package.pin_repo_button') %}
+ {% endif %}
+
+ {% set pin_ver_text = _('web_ui.items.single.package.pin_ver_button') %}
+
+ <p>
+ {% if display_info.frozen == FrozenStatus.NOT_FROZEN %}
+ {% do unpin_but_classes.append('disabled-button') %}
+ {{ _('web_ui.items.single.package.not_pinned') }}
+ {% elif display_info.frozen == FrozenStatus.REPOSITORY %}
+ {% do pin_repo_but_classes.append('disabled-button') %}
+ {% if display_info.active_version.is_local %}
+ {{ _('web_ui.items.single.package.pinned_repo_local') }}
+ {% else %}
+ {{
+ _('web_ui.items.single.package.pinned_repo_{}')
+ .format(display_info.active_version.info.repo)
+ }}
+ {% endif %}
+ {% else %}
+ {# display_info.frozen == FrozenStatus.EXACT_VERSION #}
+ {% do pin_ver_but_classes.append('disabled-button') %}
+ {{ _('web_ui.items.single.package.pinned_ver') }}
+ {% endif %}
+ </p>
+
+ {{
+ button_row([
+ (unpin_but_classes, unpin_text, {'action': 'unfreeze_item'}),
+ (pin_repo_but_classes, pin_repo_text, {'action': 'freeze_to_repo'}),
+ (pin_ver_but_classes, pin_ver_text, {'action': 'freeze_to_version'})
+ ])
+ }}
+ {% endif %}{# display_info.enabled == EnabledStatus.ENABLED #}
{% endblock %}
{% block version_list_heading %}
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 fa7c954..fe816ab 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
@@ -114,9 +114,9 @@ code in a proprietary work, I am not going to enforce this in court.
{% 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') %}
+ {% set unenable_text = _('web_ui.items.unenable_button') %}
+ {% set disable_text = _('web_ui.items.disable_button') %}
+ {% set enable_text = _('web_ui.items.enable_button') %}
<p>
{% if display_info.enabled == EnabledStatus.NO_MARK %}