fisk/core/templates/partials/assetrule-list.html

77 lines
2.6 KiB
HTML
Raw Normal View History

2023-02-11 14:52:00 +00:00
{% load cache %}
2023-02-11 17:22:25 +00:00
{% load cachalot cache %}
{% get_last_invalidation 'core.AssetRule' as last %}
{% include 'mixins/partials/notify.html' %}
{% cache 600 objects_assetrules request.user.id object_list last %}
2023-02-11 14:52:00 +00:00
<table
class="table is-fullwidth is-hoverable"
hx-target="#{{ context_object_name }}-table"
id="{{ context_object_name }}-table"
hx-swap="outerHTML"
hx-trigger="{{ context_object_name_singular }}Event from:body"
hx-get="{{ list_url }}">
<thead>
<th>id</th>
<th>user</th>
<th>asset</th>
2023-02-11 14:52:00 +00:00
<th>group</th>
<th>aggregation</th>
<th>value</th>
<th>original status</th>
<th>status</th>
<th>trigger above</th>
<th>trigger below</th>
2023-02-11 14:52:00 +00:00
<th>actions</th>
</thead>
{% for item in object_list %}
<tr class="
{% if item.status == 2 %}has-background-success-light
{% elif item.status == 3 %}has-background-danger-light
{% elif item.status == 0 %}has-background-grey-light
{% endif %}">
2023-02-11 14:52:00 +00:00
<td>{{ item.id }}</td>
<td>{{ item.user }}</td>
<td>{{ item.asset }}</td>
2023-02-11 14:52:00 +00:00
<td>{{ item.group }}</td>
<td>{{ item.get_aggregation_display }}</td>
<td>{{ item.value }}</td>
<td>{{ item.get_original_status_display }}</td>
<td>{{ item.get_status_display }}</td>
<td>{{ item.trigger_above }}</td>
<td>{{ item.trigger_below }}</td>
2023-02-11 14:52:00 +00:00
<td>
<div class="buttons">
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'assetrule_update' type=type group=item.group.id pk=item.id %}"
2023-02-11 14:52:00 +00:00
hx-trigger="click"
hx-target="#{{ type }}s-here"
hx-swap="innerHTML"
class="button">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-pencil"></i>
</span>
2023-02-10 14:33:17 +00:00
</span>
2023-02-11 14:52:00 +00:00
</button>
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-delete="{% url 'assetrule_delete' type=type group=item.group.id pk=item.id %}"
2023-02-11 14:52:00 +00:00
hx-trigger="click"
hx-target="#modals-here"
hx-swap="innerHTML"
hx-confirm="Are you sure you wish to delete {{ item.name }}?"
class="button">
<span class="icon-text">
<span class="icon">
<i class="fa-solid fa-xmark"></i>
</span>
</span>
</button>
</div>
</td>
</tr>
{% endfor %}
2023-02-10 14:33:17 +00:00
2023-02-11 14:52:00 +00:00
</table>
{% endcache %}