Skip to content

Commit

Permalink
Updating EC templates (#146)
Browse files Browse the repository at this point in the history
* Updating EC templates

* Updating current templates with newest Jupyterhub 5 template updates
  from https://github.com/jupyterhub/jupyterhub/tree/a8500a31a9bc77a9829e903693462a7da38fee52/share/jupyterhub/templates

* Fixing broken template

* Fixing template content alignment

* Fix linting

---------

Co-authored-by: gonimoro <>
  • Loading branch information
gonimoro authored Nov 21, 2024
1 parent 700fb34 commit 6edf89c
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 12 deletions.
55 changes: 55 additions & 0 deletions ec-templates/accept-share.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!-- htmlhint doctype-first:false,id-class-value:false -->
{# Copyright (c) Jupyter Development Team. #}
{# Distributed under the terms of the Modified BSD License. #}
{% extends "page.html" %}
{% block login_widget %}
{% endblock login_widget %}
{% block main %}
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<h1 class="text-center">Accept sharing invitation</h1>
<p class="lead">
You ({{ user.name }}) have been invited to access {{ owner.name }}'s server
{%- if spawner.name %}({{ spawner.name }}){%- endif %} at <a href="{{ spawner_url | safe }}">{{ spawner_url }}</a>
</p>
{% if not spawner_ready %}
<p class="alert alert-danger">
The server at {{ spawner_url }} is not currently running.
After accepting permission, you may need to ask {{ owner.name }}
to start the server before you can access it.
</p>
{% endif %}
<form method="post" action="">
<div class="card">
<div class="card-header">
By accepting the invitation, you will be granted the following permissions,
restricted to this particular server:
</div>
<div class="card-body">
{# these are the 'real' inputs to the form -#}
<input type="hidden" name="_xsrf" value="{{ xsrf }}" />
<input type="hidden" name="code" value="{{ code }}" />
{% for scope_info in scope_descriptions -%}
<div class="form-check input-group">
<label>
<span>
{{ scope_info['description'] }}
{% if scope_info['filter'] %}Applies to {{ scope_info['filter'] }}.{% endif %}
</span>
</label>
</div>
{% endfor -%}
</div>
<div class="card-footer">
<button type="submit" class="form-control ecl-button ecl-button--primary">Accept invitation</button>
<p class="small">
After accepting the invitation, you will be redirected to <a href="{{ next_url | safe }}">{{ next_url }}</a>.
</p>
</div>
</div>
</form>
</div>
</div>
</div>
{% endblock main %}
20 changes: 12 additions & 8 deletions ec-templates/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
{% endblock login_widget %}
{% block main %}
<div class="ecl-container ecl-u-mv-xl container-fix">
{% block h1_error %}
<h1>{{ status_code }} : {{ status_message }}</h1>
{% endblock h1_error %}
{% block error_detail %}
{% if message %}<p>{{ message }}</p>{% endif %}
{% if message_html %}<p>{{ message_html | safe }}</p>{% endif %}
{% if extra_error_html %}<p>{{ extra_error_html | safe }}</p>{% endif %}
{% endblock error_detail %}
<div class="ecl-u-d-flex justify-content-center">
<div>
{% block h1_error %}
<h1>{{ status_code }} : {{ status_message }}</h1>
{% endblock h1_error %}
{% block error_detail %}
{% if message %}<p>{{ message }}</p>{% endif %}
{% if message_html %}<p>{{ message_html | safe }}</p>{% endif %}
{% if extra_error_html %}<p>{{ extra_error_html | safe }}</p>{% endif %}
{% endblock error_detail %}
</div>
</div>
</div>
{% endblock main %}
{% block script %}
Expand Down
2 changes: 1 addition & 1 deletion ec-templates/oauth.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ <h1 class="text-center">Authorize access</h1>
</div>
</div>
</div>
{% endblock main %
{% endblock main %}
17 changes: 14 additions & 3 deletions ec-templates/token.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

{% block main %}
<div class="ecl-container ecl-u-mv-xl container-fix">
<div class="row justify-content-center">
<h1 class="sr-only">Manage JupyterHub Tokens</h1>
<div class="row">
<form id="request-token-form" class="col-md-offset-3 col-md-6">
<div class="text-center">
<button type="submit" class="ecl-button ecl-button--primary">
Expand All @@ -15,7 +15,7 @@ <h1 class="sr-only">Manage JupyterHub Tokens</h1>
<label for="token-note">Note</label>
<input
id="token-note"
class="form-control"
class="ecl-text-input ecl-u-width-100"
placeholder="note to identify your new token"
/>
<small id="note-note" class="form-text text-muted">
Expand All @@ -24,7 +24,7 @@ <h1 class="sr-only">Manage JupyterHub Tokens</h1>
<br /><br />
<label for="token-expiration-seconds">Token expires in</label>
{% block expiration_options %}
<select id="token-expiration-seconds" class="form-control">
<select id="token-expiration-seconds" class="ecl-text-input ecl-u-width-100">
<!-- unit used for each value is `seconds` -->
<option value="3600">1 Hour</option>
<option value="86400">1 Day</option>
Expand All @@ -35,6 +35,17 @@ <h1 class="sr-only">Manage JupyterHub Tokens</h1>
<small id="note-expires-at" class="form-text text-muted">
You can configure when your token will expire.
</small>
<br /><br />
{# Adapted from https://github.com/jupyterhub/jupyterhub/blob/a8500a31a9bc77a9829e903693462a7da38fee52/share/jupyterhub/templates/token.html #}
<label for="token-scopes" class="form-label">Permissions</label>
<input id="token-scopes"
class="ecl-text-input ecl-u-width-100"
placeholder="list of scopes for the token to have, separated by space">
<small id="note-token-scopes" class="form-text">
You can limit the permissions of the token so it can only do what you want it to.
If none are specified, the token will have permission to do everything you can do.
See the <a href="https://jupyterhub.readthedocs.io/en/stable/rbac/scopes.html#available-scopes">JupyterHub documentation for a list of available scopes</a>.
</small>
</div>
</form>
</div>
Expand Down

0 comments on commit 6edf89c

Please sign in to comment.