Continue separation of state and value
This commit is contained in:
parent
584389e205
commit
16e4c28516
@ -28,8 +28,9 @@ class BrickMetadataList(BrickRecordList[T]):
|
||||
# Queries
|
||||
select_query: str
|
||||
|
||||
# Set state endpoint
|
||||
# Set endpoints
|
||||
set_state_endpoint: str
|
||||
set_value_endpoint: str
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -149,3 +150,11 @@ class BrickMetadataList(BrickRecordList[T]):
|
||||
cls.set_state_endpoint,
|
||||
id=id,
|
||||
)
|
||||
|
||||
# URL to change the selected value of this metadata item for a set
|
||||
@classmethod
|
||||
def url_for_set_value(cls, id: str, /) -> str:
|
||||
return url_for(
|
||||
cls.set_value_endpoint,
|
||||
id=id,
|
||||
)
|
||||
|
@ -17,8 +17,8 @@ class BrickSetStorageList(BrickMetadataList[BrickSetStorage]):
|
||||
select_query = 'set/metadata/storage/list'
|
||||
all_query = 'set/metadata/storage/all'
|
||||
|
||||
# Set state endpoint
|
||||
set_state_endpoint: str = 'set.update_storage'
|
||||
# Set value endpoint
|
||||
set_value_endpoint: str = 'set.update_storage'
|
||||
|
||||
# Load all storages
|
||||
@classmethod
|
||||
|
@ -66,7 +66,7 @@ def update_status(*, id: str, metadata_id: str) -> Response:
|
||||
return jsonify({'value': state})
|
||||
|
||||
|
||||
# Change the state of a storage
|
||||
# Change the value of storage
|
||||
@set_page.route('/<id>/storage', methods=['POST'])
|
||||
@login_required
|
||||
@exception_handler(__file__, json=True)
|
||||
|
@ -48,7 +48,7 @@
|
||||
{% if icon %}<span class="input-group-text"><i class="ri-{{ icon }}"></i></span>{% endif %}
|
||||
<select id="{{ prefix }}-{{ item.fields.id }}" class="form-select"
|
||||
{% if not delete %}
|
||||
data-changer-id="{{ item.fields.id }}" data-changer-prefix="{{ prefix }}" data-changer-url="{{ metadata_list.url_for_set_state(item.fields.id) }}"
|
||||
data-changer-id="{{ item.fields.id }}" data-changer-prefix="{{ prefix }}" data-changer-url="{{ metadata_list.url_for_set_value(item.fields.id) }}"
|
||||
{% else %}
|
||||
disabled
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user