Skip to content

Commit

Permalink
update templates and ui tests (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Jun 14, 2023
1 parent 520da3f commit 87a3d73
Show file tree
Hide file tree
Showing 4 changed files with 233 additions and 135 deletions.
25 changes: 14 additions & 11 deletions samplesheets/templates/samplesheets/irods_access_tickets.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ <h3>iRODS Access Tickets</h3>
<i class="iconify" data-icon="mdi:arrow-left-circle"></i> Project Sheets
</a>
<a href="{% url 'samplesheets:irods_ticket_create' project=project.sodar_uuid %}"
class="btn btn-primary"
role="button">
class="btn btn-primary" role="button">
<i class="iconify" data-icon="mdi:plus-thick"></i> Create Ticket
</a>
</div>
Expand All @@ -101,9 +100,11 @@ <h3>iRODS Access Tickets</h3>
</thead>
<tbody>
{% for ticket in object_list %}
<tr>
<td class="nowrap">
<a href="{{ ticket.get_webdav_link }}" target="_blank">
<tr class="sodar-ss-ticket-item">
<td class="nowrap sodar-ss-ticket-item-title">
<a href="{{ ticket.get_webdav_link }}"
target="_blank"
class="{% if not ticket.is_active %}text-strikethrough{% endif %}">
{{ ticket.get_display_name }}
</a>
<button
Expand All @@ -115,7 +116,9 @@ <h3>iRODS Access Tickets</h3>
<i class="iconify" data-icon="mdi:clipboard-text-multiple"></i>
</button>
</td>
<td class="nowrap"><code>{{ ticket.ticket }}</code></td>
<td class="nowrap {% if not ticket.is_active %}text-strikethrough{% endif %} sodar-ss-ticket-item-str">
<code>{{ ticket.ticket }}</code>
</td>
{% if ticket.user %}
<td>
{% get_user_html ticket.user as user_html %}{{ user_html | safe }}
Expand All @@ -124,8 +127,10 @@ <h3>iRODS Access Tickets</h3>
<td class="text-muted">N/A</td>
{% endif %}
<td class="nowrap">{{ ticket.get_date_created }}</td>
<td class="nowrap {% if not ticket.date_expires %}text-muted{% endif %}">
{% if ticket.date_expires %}
<td class="nowrap {% if not ticket.date_expires %}text-muted{% elif not ticket.is_active %}text-danger{% endif %} sodar-ss-ticket-item-expiry">
{% if not ticket.is_active %}
Expired
{% elif ticket.date_expires %}
{{ ticket.get_date_expires }}
{% else %}
Never
Expand Down Expand Up @@ -157,7 +162,7 @@ <h3>iRODS Access Tickets</h3>
{% include 'projectroles/_pagination.html' with pg_small=False %}
{% endif %}
{% else %}
<div class="alert alert-info" id="sodar-ss-version-alert">
<div class="alert alert-info" id="sodar-ss-ticket-alert-empty">
No iRODS access tickets available for this project.
</div>
{% endif %}
Expand All @@ -167,11 +172,9 @@ <h3>iRODS Access Tickets</h3>

{% block javascript %}
{{ block.super }}

{# Tour content #}
<script type="text/javascript">
tourEnabled = false;
// TODO: Tour
</script>

{% endblock javascript %}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h3>{% if object.pk %}Update{% else %}Create{% endif %} iRODS Access Ticket</h3>

<div class="container-fluid sodar-page-container">
{% if not object.pk %}
<div class="alert alert-warning" id="sodar-ss-alert-ticket">
<div class="alert alert-warning" id="sodar-ss-alert-ticket-create">
Anyone with an iRODS ticket will gain read access to the associated
collection and its subcollections. They are also able to pass on the
ticket link and grant access to others. Enabling iRODS tickets to
Expand Down
35 changes: 35 additions & 0 deletions samplesheets/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
GenericMaterial,
ISATab,
IrodsAccessTicket,
IrodsDataRequest,
NOT_AVAILABLE_STR,
CONFIG_LABEL_CREATE,
ISA_META_ASSAY_PLUGIN,
Expand Down Expand Up @@ -416,6 +417,37 @@ def make_irods_ticket(
return obj


class IrodsDataRequestMixin:
"""Helpers for IrodsDataRequest model creation"""

@classmethod
def make_irods_data_request(
cls,
project,
action,
path,
status,
target_path='',
status_info='',
description='',
user=None,
):
"""Create an iRODS data request object in the database"""
values = {
'project': project,
'action': action,
'path': path,
'status': status,
'target_path': target_path,
'status_info': status_info,
'user': user,
'description': description,
}
obj = IrodsDataRequest(**values)
obj.save()
return obj


# Test classes -----------------------------------------------------------------


Expand Down Expand Up @@ -1516,3 +1548,6 @@ def test_get_date_expires(self):
self.ticket.get_date_expires(),
localtime(self.ticket.date_expires).strftime('%Y-%m-%d'),
)


# TODO: Add IrodsDataRequest tests

0 comments on commit 87a3d73

Please sign in to comment.