forked from enviPath/enviPy
[Feature] Modern UI roll out (#236)
This PR moves all the collection pages into the new UI in a rough push. I did not put the same amount of care into these as into search, index, and predict. ## Major changes - All modals are now migrated to a state based alpine.js implementation. - jQuery is no longer present in the base layout; ajax is replace by native fetch api - most of the pps.js is now obsolte (as I understand it; the code is not referenced any more @jebus please double check) - in-memory pagination for large result lists (set to 50; we can make that configurable later; performance degrades at around 1k) stukk a bit rough tracked in #235 ## Minor things - Sarch and index also use alpine now - The loading spinner is now CSS animated (not sure if it currently gets correctly called) ## Not done - Ihave not even cheked the admin pages. Not sure If these need migrations - The temporary migration pages still use the old template. Not sure what is supposed to happen with those? @jebus ## What I did to test - opend all pages in browse, and user ; plus all pages reachable from there. - Interacted and tested the functionality of each modal superfically with exception of the API key modal (no functional test). --- This PR is massive sorry for that; just did not want to push half-brokenn state. @jebus @liambrydon I would be glad if you could click around and try to break it :) Finally closes #133 Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#236 Co-authored-by: Tobias O <tobias.olenyi@envipath.com> Co-committed-by: Tobias O <tobias.olenyi@envipath.com>
This commit is contained in:
@ -1,151 +1,150 @@
|
||||
{% load static %}
|
||||
<!-- Edit Package Permission -->
|
||||
<div id="edit_group_member_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Add or Remove Group Member</h5>
|
||||
<button
|
||||
type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Close"
|
||||
>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
To add member (either User or entire Groups) to this group select the
|
||||
entity you want to add below and click the check mark.
|
||||
<br />
|
||||
To remove member simply click the <code>X</code> next to the member.
|
||||
</p>
|
||||
<!-- Edit Group Member -->
|
||||
<dialog
|
||||
id="edit_group_member_modal"
|
||||
class="modal"
|
||||
x-data="{
|
||||
isSubmitting: false,
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-8">
|
||||
<legend>User or Group</legend>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<legend>Add/Remove</legend>
|
||||
</div>
|
||||
</div>
|
||||
reset() {
|
||||
this.isSubmitting = false;
|
||||
},
|
||||
|
||||
<div class="row">
|
||||
<form
|
||||
id="modal-form-group-member"
|
||||
class="form-inline"
|
||||
role="form"
|
||||
accept-charset="UTF-8"
|
||||
action=""
|
||||
data-remote="true"
|
||||
method="post"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<div class="col-xs-8">
|
||||
<select
|
||||
id="select_member"
|
||||
name="member"
|
||||
data-actions-box="true"
|
||||
class="selPackages"
|
||||
data-width="100%"
|
||||
>
|
||||
<option disabled selected>User</option>
|
||||
submitForm(form) {
|
||||
if (form && form.checkValidity()) {
|
||||
form.submit();
|
||||
} else if (form) {
|
||||
form.reportValidity();
|
||||
}
|
||||
}
|
||||
}"
|
||||
@close="reset()"
|
||||
>
|
||||
<div class="modal-box">
|
||||
<!-- Header -->
|
||||
<h3 class="text-lg font-bold">Add or Remove Group Member</h3>
|
||||
|
||||
<!-- Close button (X) -->
|
||||
<form method="dialog">
|
||||
<button
|
||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
||||
:disabled="isSubmitting"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<!-- Body -->
|
||||
<div class="py-4">
|
||||
<p class="mb-4">
|
||||
To add member (either User or entire Groups) to this group select the
|
||||
entity you want to add below and click the check mark.
|
||||
<br />
|
||||
To remove member simply click the X button next to the member.
|
||||
</p>
|
||||
|
||||
<!-- Add Member Form -->
|
||||
<form
|
||||
id="modal-form-group-member"
|
||||
accept-charset="UTF-8"
|
||||
action=""
|
||||
method="post"
|
||||
class="mb-4"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<div class="flex gap-2 items-end">
|
||||
<div class="form-control flex-1">
|
||||
<label class="label">
|
||||
<span class="label-text">User or Group</span>
|
||||
</label>
|
||||
<select
|
||||
id="select_member"
|
||||
name="member"
|
||||
class="select select-bordered w-full"
|
||||
required
|
||||
>
|
||||
<optgroup label="Users">
|
||||
{% for u in users %}
|
||||
<option value="{{ u.url }}">{{ u.username }}</option>
|
||||
{% endfor %}
|
||||
<option disabled>Groups</option>
|
||||
</optgroup>
|
||||
<optgroup label="Groups">
|
||||
{% for g in groups %}
|
||||
<option value="{{ g.url }}">{{ g.name|safe }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input type="hidden" name="action" value="add" />
|
||||
</div>
|
||||
<div class="col-xs-2"></div>
|
||||
<div class="col-xs-2">
|
||||
<button type="submit" style="width:60%;" class="btn col-xs-2">
|
||||
<span class="glyphicon glyphicon-ok"></span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</optgroup>
|
||||
</select>
|
||||
<input type="hidden" name="action" value="add" />
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Add</button>
|
||||
</div>
|
||||
<p></p>
|
||||
{% for u in group.user_member.all %}
|
||||
<div class="row">
|
||||
</form>
|
||||
|
||||
<!-- User Members -->
|
||||
{% if group.user_member.all %}
|
||||
<div class="divider">User Members</div>
|
||||
<div class="space-y-2">
|
||||
{% for u in group.user_member.all %}
|
||||
<form
|
||||
id="modal-form-group-member_{{ u.uuid }}"
|
||||
class="form-inline"
|
||||
role="form"
|
||||
accept-charset="UTF-8"
|
||||
action=""
|
||||
data-remote="true"
|
||||
method="post"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<div class="col-xs-8">
|
||||
{{ u.username }}
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="flex-1">{{ u.username }}</span>
|
||||
<input type="hidden" name="member" value="{{ u.url }}" />
|
||||
<input type="hidden" name="action" value="remove" />
|
||||
</div>
|
||||
<div class="col-xs-2"></div>
|
||||
<div class="col-xs-2">
|
||||
<button type="submit" style="width:60%;" class="btn col-xs-2">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
<button type="submit" class="btn btn-error btn-sm">
|
||||
Remove
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<p></p>
|
||||
{% for g in group.group_member.all %}
|
||||
<div class="row">
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Group Members -->
|
||||
{% if group.group_member.all %}
|
||||
<div class="divider">Group Members</div>
|
||||
<div class="space-y-2">
|
||||
{% for g in group.group_member.all %}
|
||||
<form
|
||||
id="modal-form-group-member_{{ g.uuid }}"
|
||||
class="form-inline"
|
||||
role="form"
|
||||
accept-charset="UTF-8"
|
||||
action=""
|
||||
data-remote="true"
|
||||
method="post"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<div class="col-xs-8">
|
||||
{{ g.name|safe }}
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="flex-1">{{ g.name|safe }}</span>
|
||||
<input type="hidden" name="member" value="{{ g.url }}" />
|
||||
<input type="hidden" name="action" value="remove" />
|
||||
</div>
|
||||
<div class="col-xs-2"></div>
|
||||
<div class="col-xs-2">
|
||||
<button type="submit" style="width:60%;" class="btn col-xs-2">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
<button type="submit" class="btn btn-error btn-sm">
|
||||
Remove
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">
|
||||
Close
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
id="edit-package-modal-submit"
|
||||
>
|
||||
Update
|
||||
</button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="modal-action">
|
||||
<button
|
||||
type="button"
|
||||
class="btn"
|
||||
onclick="this.closest('dialog').close()"
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$("#edit-package-modal-submit").click(function (e) {
|
||||
e.preventDefault();
|
||||
$("#edit-package-modal-form").submit();
|
||||
});
|
||||
|
||||
$("#select_member").selectpicker();
|
||||
});
|
||||
</script>
|
||||
<!-- Backdrop -->
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>close</button>
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
Reference in New Issue
Block a user