aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/web_ui/items.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-09-01 18:44:48 +0200
committerWojtek Kosior <koszko@koszko.org>2022-09-09 13:55:05 +0200
commit009ee56ccc8021e597c3fc5970a351b45a6d1ac7 (patch)
tree6cd46b7085263dc15bab2ad54990cefda24f3948 /src/hydrilla/proxy/web_ui/items.py
parentc163adccfe9db22bd1ba0888a3f60e1373c0a07a (diff)
downloadhaketilo-hydrilla-009ee56ccc8021e597c3fc5970a351b45a6d1ac7.tar.gz
haketilo-hydrilla-009ee56ccc8021e597c3fc5970a351b45a6d1ac7.zip
[proxy] make it possible to enable and disable mapping versions from web UI
Diffstat (limited to 'src/hydrilla/proxy/web_ui/items.py')
-rw-r--r--src/hydrilla/proxy/web_ui/items.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/hydrilla/proxy/web_ui/items.py b/src/hydrilla/proxy/web_ui/items.py
index 4bfae0a..01ae406 100644
--- a/src/hydrilla/proxy/web_ui/items.py
+++ b/src/hydrilla/proxy/web_ui/items.py
@@ -234,7 +234,19 @@ def alter_item_version(item_version_id: str, item_type: item_infos.ItemType) \
store = item_version_store(_app.get_haketilo_state(), item_type)
item_version_ref = store.get(item_version_id)
- if action == 'install_item_version':
+ if action == 'disable_item':
+ assert isinstance(item_version_ref, st.MappingVersionRef)
+ item_version_ref.update_mapping_status(st.EnabledStatus.DISABLED)
+ 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':
+ 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':
item_version_ref_after = item_version_ref.uninstall()