diff --git a/uhepp_org/uhepp_org/settings.py b/uhepp_org/uhepp_org/settings.py index ca69151470b2ba67de630cb740c5fe936fc6823c..ac8e75db1322eccb78915b7f0b6156385d1e3433 100644 --- a/uhepp_org/uhepp_org/settings.py +++ b/uhepp_org/uhepp_org/settings.py @@ -198,3 +198,5 @@ USE_TZ = True # https://docs.djangoproject.com/en/3.0/howto/static-files/ STATIC_URL = '/static/' + +DATETIME_INPUT_FORMATS = '%Y-%m-%d %H:%M' diff --git a/uhepp_org/uhepp_vault/templates/registration/login.html b/uhepp_org/uhepp_vault/templates/registration/login.html index db67857f04aaac5dd5c881d28a5ec88172213e10..ce44275f8677109feb42a7f2c0e3fff6a9b35ab9 100644 --- a/uhepp_org/uhepp_vault/templates/registration/login.html +++ b/uhepp_org/uhepp_vault/templates/registration/login.html @@ -3,6 +3,13 @@ {% block content %} +<nav aria-label="breadcrumb" class="d-none d-sm-block"> + <ol class="breadcrumb my-2"> + <li class="breadcrumb-item"><a href="/">Home</a></li> + <li class="breadcrumb-item active"><a href="/login">Login</a></li> + </ol> +</nav> + <h1>Login</h1> <div class="row"> diff --git a/uhepp_org/uhepp_vault/templates/uhepp_vault/collection_confirm_delete.html b/uhepp_org/uhepp_vault/templates/uhepp_vault/collection_confirm_delete.html index 1a6fb89efe9fdcc11783ae7999e99a6ba6981c5a..f61bea56ec569e01b8ce6d3f0c5a082e278cefcd 100644 --- a/uhepp_org/uhepp_vault/templates/uhepp_vault/collection_confirm_delete.html +++ b/uhepp_org/uhepp_vault/templates/uhepp_vault/collection_confirm_delete.html @@ -1,13 +1,21 @@ {% extends 'uhepp_vault/base.html' %} {% block content %} -<h2>Delete collection</h2> +<nav aria-label="breadcrumb" class="d-none d-sm-block"> + <ol class="breadcrumb my-2"> + <li class="breadcrumb-item"><a href="/">Home</a></li> + <li class="breadcrumb-item"><a href="{% url 'uhepp_vault:user-detail' collection.owner.username %}">{{ collection.owner }}</a></li> + <li class="breadcrumb-item active"><a href="{% url 'uhepp_vault:collection-detail' collection.id %}">{{ collection.title }}</a></li> + </ol> +</nav> -<a href="{% url 'uhepp_vault:user-detail' request.user.username %}">Back to profile</a> +<h1>Delete collection</h1> <form method="post">{% csrf_token %} - <p>Are you sure you want to delete collection "{{ collection.title }}"?</p> - <input type="submit" value="Delete"> + <p>Are you sure you want to delete collection <b>{{ collection.title }}</b>? + Deleting the collection will also delete <span class="badge badge-primary + badge-pill">{{ collection.plots.count }}</span> plots.</p> + <button type="submit" class="btn btn-outline-danger">Delete</button> </form> {% endblock %} diff --git a/uhepp_org/uhepp_vault/templates/uhepp_vault/collection_list.html b/uhepp_org/uhepp_vault/templates/uhepp_vault/collection_list.html index 77d2ccec8c57265cf37570a2bb09b87a69ddf7d3..fad959e48a3c6fab59548488101b989b323048f2 100644 --- a/uhepp_org/uhepp_vault/templates/uhepp_vault/collection_list.html +++ b/uhepp_org/uhepp_vault/templates/uhepp_vault/collection_list.html @@ -4,7 +4,6 @@ <nav aria-label="breadcrumb"> <ol class="breadcrumb my-2"> <li class="breadcrumb-item"><a href="/">Home</a></li> - <li class="breadcrumb-item">Explore</li> <li class="breadcrumb-item active"><a class="active" href="{% url 'uhepp_vault:collection-list' %}">Collections</a></li> </ol> </nav> diff --git a/uhepp_org/uhepp_vault/templates/uhepp_vault/logout.html b/uhepp_org/uhepp_vault/templates/uhepp_vault/logout.html index 226c6beba11cb7da29fd86550c075a55d2bbab45..d2cd33c250add5e6df923cb347de98748fd234c8 100644 --- a/uhepp_org/uhepp_vault/templates/uhepp_vault/logout.html +++ b/uhepp_org/uhepp_vault/templates/uhepp_vault/logout.html @@ -2,8 +2,21 @@ {% load pygmentify_tags %} {% block content %} -<h1>Logout</h2> +<nav aria-label="breadcrumb" class="d-none d-sm-block"> + <ol class="breadcrumb my-2"> + <li class="breadcrumb-item"><a href="/">Home</a></li> + <li class="breadcrumb-item active"><a href="{% url 'uhepp_vault:logout' %}">Logout</a></li> + </ol> +</nav> + +<h1>Logout</h1> + <form action="{% url 'oidc_logout' %}" method="post"> {% csrf_token %} - <input type="submit" value="logout"> + <p>Do you really want to log out?</p> + <button class="btn btn-primary" type="submit">Log out</button> + <p class="text-muted"><small>Please note, this will only end your session + on uhepp.org. Your + access tokens or sessions on other CERN services will remain + active.</small></p> </form> {% endblock %} diff --git a/uhepp_org/uhepp_vault/templates/uhepp_vault/plot_list.html b/uhepp_org/uhepp_vault/templates/uhepp_vault/plot_list.html index d11a8fba3f20325674d1f76134cdf6e4c8fe26a9..4b05942c5bdd24444a5624424c449a8cf0443493 100644 --- a/uhepp_org/uhepp_vault/templates/uhepp_vault/plot_list.html +++ b/uhepp_org/uhepp_vault/templates/uhepp_vault/plot_list.html @@ -4,7 +4,6 @@ <nav aria-label="breadcrumb"> <ol class="breadcrumb my-2"> <li class="breadcrumb-item"><a href="/">Home</a></li> - <li class="breadcrumb-item">Explore</li> <li class="breadcrumb-item active"><a class="active" href="{% url 'uhepp_vault:plot-list' %}">Plots</a></li> </ol> </nav> diff --git a/uhepp_org/uhepp_vault/templates/uhepp_vault/profile_list.html b/uhepp_org/uhepp_vault/templates/uhepp_vault/profile_list.html index 802463177096dfba85d544e888eb44b697b6565f..0c51013dcb70e725235a1d2253a797caf82a7f66 100644 --- a/uhepp_org/uhepp_vault/templates/uhepp_vault/profile_list.html +++ b/uhepp_org/uhepp_vault/templates/uhepp_vault/profile_list.html @@ -4,7 +4,6 @@ <nav aria-label="breadcrumb"> <ol class="breadcrumb my-2"> <li class="breadcrumb-item"><a href="/">Home</a></li> - <li class="breadcrumb-item">Explore</li> <li class="breadcrumb-item active"><a class="active" href="{% url 'uhepp_vault:user-list' %}">Users</a></li> </ol> </nav> diff --git a/uhepp_org/uhepp_vault/templates/uhepp_vault/token_confirm_delete.html b/uhepp_org/uhepp_vault/templates/uhepp_vault/token_confirm_delete.html index eac72cb41e3435291478d6dc71bf0c0a06ecfe92..5bc8fe1ec44c17f9cabfec5444a3875ed1a2f018 100644 --- a/uhepp_org/uhepp_vault/templates/uhepp_vault/token_confirm_delete.html +++ b/uhepp_org/uhepp_vault/templates/uhepp_vault/token_confirm_delete.html @@ -1,13 +1,18 @@ {% extends 'uhepp_vault/base.html' %} {% block content %} -<h2>API access tokens</h2> - -<a href="{% url 'uhepp_vault:token-list' %}">Back to token list</a> +<nav aria-label="breadcrumb" class="d-none d-sm-block"> + <ol class="breadcrumb my-2"> + <li class="breadcrumb-item"><a href="/">Home</a></li> + <li class="breadcrumb-item"><a href="{% url 'uhepp_vault:token-list' %}">API access tokens</a></li> + </ol> +</nav> +<h1>API access tokens</h1> <form method="post">{% csrf_token %} - <p>Are you sure you want to delete token "{{ token.description }}"?</p> - <input type="submit" value="Delete"> + <p>Are you sure you want to delete token <b>{{ token.description }}</b>? + Access to the API won't be possible with this token.</p> + <button class="btn btn-outline-danger" type="submit">Yes, delete the token</button> </form> {% endblock %} diff --git a/uhepp_org/uhepp_vault/templates/uhepp_vault/token_form.html b/uhepp_org/uhepp_vault/templates/uhepp_vault/token_form.html index 32eeea7c536930396cbb12e66863415c291ad053..c28317405a5183e2b44a1649d1a64442fefa0132 100644 --- a/uhepp_org/uhepp_vault/templates/uhepp_vault/token_form.html +++ b/uhepp_org/uhepp_vault/templates/uhepp_vault/token_form.html @@ -1,13 +1,22 @@ {% extends 'uhepp_vault/base.html' %} {% load pygmentify_tags %} +{% load crispy_forms_tags %} {% block content %} -<h2>API access tokens</h2> +<nav aria-label="breadcrumb" class="d-none d-sm-block"> + <ol class="breadcrumb my-2"> + <li class="breadcrumb-item"><a href="/">Home</a></li> + <li class="breadcrumb-item"><a href="{% url 'uhepp_vault:token-list' %}">API access tokens</a></li> + </ol> +</nav> -<a href="{% url 'uhepp_vault:token-list' %}">Back to token list</a> +<h1>API access tokens</h1> {% if token %} -<p>New token is: {{ token.key }}</p> +<div class="alert alert-success"> + <p>Your brand new token is: <code class="text-dark">{{ token.key }}</code></p> + <p>Keep the token secure and don't share it with anyone.</p> +</div> <p>In order to use the token to access the API, add the following code to your environment.</p> @@ -20,8 +29,8 @@ export UHEPP_TOKEN={{ token.key }} {% else %} <form method="post">{% csrf_token %} - {{ form }} - <input type="submit" value="Save"> + {{ form|crispy }} + <button type="submit" class="btn btn-primary">Save</button> </form> {% endif %} {% endblock %} diff --git a/uhepp_org/uhepp_vault/templates/uhepp_vault/token_list.html b/uhepp_org/uhepp_vault/templates/uhepp_vault/token_list.html index c1aba8b0f9aa9a4414c4cf36f16269ccdecf5532..bc6adf4f374b0843f2a03ea1d6a30dc3eb2b0e8c 100644 --- a/uhepp_org/uhepp_vault/templates/uhepp_vault/token_list.html +++ b/uhepp_org/uhepp_vault/templates/uhepp_vault/token_list.html @@ -1,27 +1,54 @@ {% extends 'uhepp_vault/base.html' %} {% block content %} -<h2>API access tokens</h2> +<nav aria-label="breadcrumb" class="d-none d-sm-block"> + <ol class="breadcrumb my-2"> + <li class="breadcrumb-item"><a href="/">Home</a></li> + <li class="breadcrumb-item"><a href="{% url 'uhepp_vault:token-list' %}">API access tokens</a></li> + </ol> +</nav> -<a href="{% url 'uhepp_vault:token-create' %}">Create a new token</a> +<h1 class="controls-head"> + <span>API access tokens</span> + <span> + <a class="btn btn-outline-primary" href="{% url 'uhepp_vault:token-create' %}"> + <i class="fas fa-plus"></i> + </a> + </span> +</h1> + + +<p>API tokens let you access uhepp hub from Python or the command-line. The +token is used to authenticate you. This way, you don't need to expose your CERN +password in environment variables.</p> {% if token_list %} - <ul> +<table class="table table-bordered table-striped"> + <thead class="thead-light"> + <tr> + <th scope="col">Comment</th> + <th scope="col">Created</th> + <th scope="col">Expires</th> + <th scope="col"></th> + </tr> + </thead> {% for token in token_list %} - <li> - <b>{{ token.description }}</b><br /> - Created: {{ token.created }}<br /> - {% if token.expires %} - {% if token.expired %} - <b>Expired</b>: {{ token.expires }}<br /> - {% else %} - Expires: {{ token.expires }}<br /> - {% endif %} - {% endif %} - <a href="{% url 'uhepp_vault:token-delete' token.pk %}">Delete</a> - </li> + <tr> + <th scope="row">{{ token.description }}</th> + <td>{{ token.created|date:"Y-m-d H:i" }}</td> + <td> + {{ token.expires|default_if_none:"never" }} + {% if token.expired %} + <small class="text-danger">(Expired)</small> + {% endif %} + </td> + <td> + <a class="text-danger" href="{% url 'uhepp_vault:token-delete' token.pk %}"><i class="fas fa-trash"></i></a> + </td> + </tr> {% endfor %} - </ul> + </tbody> +</table> {% else %} <p>You don't have any tokens.</p> {% endif %}