forked from enviPath/enviPy
[Feature] Prediction settings list on User page (#276)
Some checks failed
Build CI Docker Image / build-and-push (push) Failing after 23s
Some checks failed
Build CI Docker Image / build-and-push (push) Failing after 23s
I have added a list of other prediction settings to the User page and a way to change a setting to the default.
<img width="500" alt="{4EFA1273-E53A-4333-948B-8AE3597821A8}.png" src="attachments/048fdc83-1c3e-41d2-a59b-44b0337a05bf">
Co-authored-by: Tim Lorsbach <tim@lorsba.ch>
Reviewed-on: enviPath/enviPy#276
Reviewed-by: jebus <lorsbach@envipath.com>
Co-authored-by: Liam Brydon <lbry121@aucklanduni.ac.nz>
Co-committed-by: Liam Brydon <lbry121@aucklanduni.ac.nz>
This commit is contained in:
@ -2664,6 +2664,14 @@ def user(request, user_uuid):
|
|||||||
|
|
||||||
return redirect(current_user.url)
|
return redirect(current_user.url)
|
||||||
|
|
||||||
|
if "change_default" in request.POST:
|
||||||
|
new_default_uuid = request.POST["change_default"]
|
||||||
|
current_user.default_setting = SettingManager.get_setting_by_id(
|
||||||
|
current_user, new_default_uuid
|
||||||
|
)
|
||||||
|
current_user.save()
|
||||||
|
return redirect(current_user.url)
|
||||||
|
|
||||||
return HttpResponseBadRequest()
|
return HttpResponseBadRequest()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -388,81 +388,9 @@
|
|||||||
<input type="checkbox" />
|
<input type="checkbox" />
|
||||||
<div class="collapse-title text-xl font-medium">Setting</div>
|
<div class="collapse-title text-xl font-medium">Setting</div>
|
||||||
<div class="collapse-content">
|
<div class="collapse-content">
|
||||||
<div class="overflow-x-auto">
|
{% with setting_to_render=pathway.setting can_be_default=False %}
|
||||||
<table class="table-zebra table">
|
{% include "objects/setting_template.html" %}
|
||||||
<thead>
|
{% endwith %}
|
||||||
<tr>
|
|
||||||
<th>Parameter</th>
|
|
||||||
<th>Value</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% if pathway.setting.model %}
|
|
||||||
<tr>
|
|
||||||
<td>Model</td>
|
|
||||||
<td>
|
|
||||||
<div class="space-y-2">
|
|
||||||
<div>
|
|
||||||
<a
|
|
||||||
href="{{ pathway.setting.model.url }}"
|
|
||||||
class="link link-primary"
|
|
||||||
>
|
|
||||||
{{ pathway.setting.model.name }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="overflow-x-auto">
|
|
||||||
<table class="table-xs table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Model Parameter</th>
|
|
||||||
<th>Parameter Value</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>Threshold</td>
|
|
||||||
<td>
|
|
||||||
{{ pathway.setting_with_overrides.model_threshold }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
{% if pathway.setting.rule_packages.all %}
|
|
||||||
<tr>
|
|
||||||
<td>Rule Packages</td>
|
|
||||||
<td>
|
|
||||||
<ul class="menu bg-base-100 rounded-box">
|
|
||||||
{% for p in pathway.setting.rule_packages.all %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ p.url }}" class="hover:bg-base-200"
|
|
||||||
>{{ p.name }}</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
<tr>
|
|
||||||
<td>Max Nodes</td>
|
|
||||||
<td>{{ pathway.setting_with_overrides.max_nodes }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Max Depth</td>
|
|
||||||
<td>{{ pathway.setting_with_overrides.max_depth }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Expansion Scheme</td>
|
|
||||||
<td>{{ user.default_setting.expansion_scheme }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
92
templates/objects/setting_template.html
Normal file
92
templates/objects/setting_template.html
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
<div class="overflow-x-auto rounded-box shadow-md bg-base-100">
|
||||||
|
<table class="table table-fixed w-full">
|
||||||
|
<thead class="text-base">
|
||||||
|
<tr>
|
||||||
|
<th class="w-1/5">Parameter</th>
|
||||||
|
<th>Value</th>
|
||||||
|
{% if can_be_default %}
|
||||||
|
<th class="text-right">
|
||||||
|
<form method="post" action="{% url 'user' user.uuid %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input
|
||||||
|
type="hidden"
|
||||||
|
name="change_default"
|
||||||
|
value="{{ setting_to_render.uuid }}"
|
||||||
|
/>
|
||||||
|
<button type="submit" class="btn">Make Default</button>
|
||||||
|
</form>
|
||||||
|
</th>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Setting Name</td>
|
||||||
|
<td>{{ setting_to_render.name }}</td>
|
||||||
|
</tr>
|
||||||
|
{% if setting_to_render.description %}
|
||||||
|
<tr>
|
||||||
|
<td>Setting Description</td>
|
||||||
|
<td>{{ setting_to_render.description }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% if setting_to_render.model %}
|
||||||
|
<tr>
|
||||||
|
<td>Model</td>
|
||||||
|
<td>
|
||||||
|
<div class="space-y-2">
|
||||||
|
<a
|
||||||
|
href="{{ setting_to_render.model.url }}"
|
||||||
|
class="link link-primary"
|
||||||
|
>
|
||||||
|
{{ setting_to_render.model.name }}
|
||||||
|
</a>
|
||||||
|
<table class="table-xs table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Model Parameter</th>
|
||||||
|
<th>Parameter Value</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Threshold</td>
|
||||||
|
<td>{{ setting_to_render.model_threshold }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% if setting_to_render.rule_packages.all %}
|
||||||
|
<tr>
|
||||||
|
<td>Rule Packages</td>
|
||||||
|
<td>
|
||||||
|
<ul class="menu bg-base-200 rounded-box">
|
||||||
|
{% for p in setting_to_render.rule_packages.all %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ p.url }}" class="hover:bg-base-300"
|
||||||
|
>{{ p.name }}</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
<tr>
|
||||||
|
<td>Max Nodes</td>
|
||||||
|
<td>{{ setting_to_render.max_nodes }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Max Depth</td>
|
||||||
|
<td>{{ setting_to_render.max_depth }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Expansion Scheme</td>
|
||||||
|
<td>{{ setting_to_render.expansion_scheme }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
@ -88,75 +88,26 @@
|
|||||||
Current Prediction Setting
|
Current Prediction Setting
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse-content">
|
<div class="collapse-content">
|
||||||
<div class="overflow-x-auto">
|
{% with setting_to_render=user.default_setting can_be_default=False %}
|
||||||
<table class="table-zebra table">
|
{% include "objects/setting_template.html" %}
|
||||||
<thead>
|
{% endwith %}
|
||||||
<tr>
|
</div>
|
||||||
<th>Parameter</th>
|
</div>
|
||||||
<th>Value</th>
|
|
||||||
</tr>
|
<!-- Other Prediction Settings -->
|
||||||
</thead>
|
<div class="collapse-arrow bg-base-200 collapse">
|
||||||
<tbody>
|
<input type="checkbox" />
|
||||||
{% if user.default_setting.model %}
|
<div class="collapse-title text-xl font-medium">
|
||||||
<tr>
|
Other Prediction Settings
|
||||||
<td>Model</td>
|
</div>
|
||||||
<td>
|
<div class="collapse-content space-y-3">
|
||||||
<div class="space-y-2">
|
{% for setting in meta.available_settings %}
|
||||||
<a
|
{% if setting != user.default_setting %}
|
||||||
href="{{ user.default_setting.model.url }}"
|
{% with setting_to_render=setting can_be_default=True %}
|
||||||
class="link link-primary"
|
{% include "objects/setting_template.html" %}
|
||||||
>
|
{% endwith %}
|
||||||
{{ user.default_setting.model.name }}
|
{% endif %}
|
||||||
</a>
|
{% endfor %}
|
||||||
<table class="table-xs table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Model Parameter</th>
|
|
||||||
<th>Parameter Value</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>Threshold</td>
|
|
||||||
<td>{{ user.default_setting.model_threshold }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
{% if user.default_setting.rule_packages.all %}
|
|
||||||
<tr>
|
|
||||||
<td>Rule Packages</td>
|
|
||||||
<td>
|
|
||||||
<ul class="menu bg-base-200 rounded-box">
|
|
||||||
{% for p in user.default_setting.rule_packages.all %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ p.url }}" class="hover:bg-base-300"
|
|
||||||
>{{ p.name }}</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
<tr>
|
|
||||||
<td>Max Nodes</td>
|
|
||||||
<td>{{ user.default_setting.max_nodes }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Max Depth</td>
|
|
||||||
<td>{{ user.default_setting.max_depth }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Expansion Scheme</td>
|
|
||||||
<td>{{ user.default_setting.expansion_scheme }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user