[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2021-12-16 14:50:37 +00:00
parent 25b0133979
commit e59e7f534c
14 changed files with 14022 additions and 483 deletions

View File

@@ -21,7 +21,6 @@ def upgrade():
tables = sa.inspect(engine).get_table_names()
if 'groups' in tables:
op.add_column('groups', sa.Column('properties', JSONDict))
def downgrade():

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,3 @@
{% extends "error.html" %}
{% block error_detail %}
{% extends "error.html" %} {% block error_detail %}
<p>Jupyter has lots of moons, but this is not one...</p>
{% endblock %}

View File

@@ -1,40 +1,27 @@
{% extends "page.html" %}
{% macro th(label, key='', colspan=1) %}
<th data-sort="{{key}}" colspan="{{colspan}}">{{label}}
{% if key %}
<a href="#"><i class="fa {% if sort.get(key) == 'asc' -%}
fa-sort-asc
{%- elif sort.get(key) == 'desc' -%}
fa-sort-desc
{%- else -%}
fa-sort
{%- endif %} sort-icon">
</i></a>
{% extends "page.html" %} {% macro th(label, key='', colspan=1) %}
<th data-sort="{{key}}" colspan="{{colspan}}">
{{label}} {% if key %}
<a href="#"
><i
class="fa {% if sort.get(key) == 'asc' -%} fa-sort-asc {%- elif sort.get(key) == 'desc' -%} fa-sort-desc {%- else -%} fa-sort {%- endif %} sort-icon"
>
</i
></a>
{% endif %}
</th>
{% endmacro %}
{% block main %}
{% endmacro %} {% block main %}
<div id="react-admin-hook">
<script id="jupyterhub-admin-config">
window.api_page_limit = parseInt("{{ api_page_limit|safe }}")
window.api_page_limit = parseInt("{{ api_page_limit|safe }}");
</script>
<script src="static/js/admin-react.js"></script>
</div>
{% endblock %}
{% block footer %}
{% endblock %} {% block footer %}
<div class="container-fluid navbar-default small version_footer">
<div class="navbar-text">
JupyterHub {{ server_version }}
</div>
<div class="navbar-text">JupyterHub {{ server_version }}</div>
</div>
{% endblock %}
{% block script %}
{{ super() }}
{% endblock %} {% block script %} {{ super() }}
<script type="text/javascript">
require(["admin"]);
require(["admin"]);
</script>
{% endblock %}

View File

@@ -1,64 +1,45 @@
{% extends "page.html" %}
{% block login_widget %}
{% endblock %}
{% block main %}
{% extends "page.html" %} {% block login_widget %} {% endblock %} {% block main
%}
<div class="error">
{% 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 %}
<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>
{% endblock %}
{% endblock %} {% block script %} {{super()}}
{% block script %}
{{super()}}
<script type="text/javascript">
function _remove_redirects_from_url() {
if (window.location.search.length <= 1) {
<script type="text/javascript">
function _remove_redirects_from_url() {
if (window.location.search.length <= 1) {
return;
}
var search_parameters = window.location.search.slice(1).split("&");
for (var i = 0; i < search_parameters.length; i++) {
if (search_parameters[i].split("=")[0] === "redirects") {
// remote redirects from search parameters
search_parameters.splice(i, 1);
var new_search = "";
if (search_parameters.length) {
new_search = "?" + search_parameters.join("&");
}
var new_url =
window.location.origin +
window.location.pathname +
new_search +
window.location.hash;
window.history.replaceState({}, "", new_url);
return;
}
var search_parameters = window.location.search.slice(1).split('&');
for (var i = 0; i < search_parameters.length; i++) {
if (search_parameters[i].split('=')[0] === 'redirects') {
// remote redirects from search parameters
search_parameters.splice(i, 1);
var new_search = '';
if (search_parameters.length) {
new_search = '?' + search_parameters.join('&');
}
var new_url = window.location.origin +
window.location.pathname +
new_search +
window.location.hash;
window.history.replaceState({}, "", new_url);
return;
}
}
}
}
_remove_redirects_from_url();
</script>
_remove_redirects_from_url();
</script>
{% endblock %}

View File

@@ -1,32 +1,31 @@
{% extends "page.html" %}
{% if announcement_home %}
{% set announcement = announcement_home %}
{% endif %}
{% block main %}
{% extends "page.html" %} {% if announcement_home %} {% set announcement =
announcement_home %} {% endif %} {% block main %}
<div class="container">
<div class="row">
<div class="text-center">
{% if default_server.active %}
<a id="stop" role="button" class="btn btn-lg btn-danger">
Stop My Server
</a>
<a id="stop" role="button" class="btn btn-lg btn-danger">
Stop My Server
</a>
{% endif %}
<a id="start" role="button" class="btn btn-lg btn-primary" href="{{ url }}">
{% if not default_server.active %}Start{% endif %}
My Server
<a
id="start"
role="button"
class="btn btn-lg btn-primary"
href="{{ url }}"
>
{% if not default_server.active %}Start{% endif %} My Server
</a>
</div>
</div>
{% if allow_named_servers %}
<h2>
Named Servers
</h2>
<h2>Named Servers</h2>
<p>
In addition to your default server,
you may have additional {% if named_server_limit_per_user > 0 %}{{ named_server_limit_per_user }} {% endif %}server(s) with names.
This allows you to have more than one server running at the same time.
In addition to your default server, you may have additional {% if
named_server_limit_per_user > 0 %}{{ named_server_limit_per_user }} {% endif
%}server(s) with names. This allows you to have more than one server running
at the same time.
</p>
{% set named_spawners = user.all_spawners(include_default=False)|list %}
@@ -43,8 +42,12 @@
<tbody>
<tr class="home-server-row add-server-row">
<td colspan="4">
<input class="new-server-name" placeholder="Name your server">
<a role="button" class="new-server-btn" class="add-server btn btn-xs btn-primary">
<input class="new-server-name" placeholder="Name your server" />
<a
role="button"
class="new-server-btn"
class="add-server btn btn-xs btn-primary"
>
Add New Server
</a>
</td>
@@ -55,27 +58,40 @@
<td>{{ spawner.name }}</td>
{# url #}
<td>
<a class="server-link {% if not spawner.ready %}hidden{% endif %}" href="{{ user.server_url(spawner.name) }}">
<a
class="server-link {% if not spawner.ready %}hidden{% endif %}"
href="{{ user.server_url(spawner.name) }}"
>
{{ user.server_url(spawner.name) }}
</a>
</td>
{# activity #}
<td class='time-col'>
{% if spawner.last_activity %}
{{ spawner.last_activity.isoformat() + 'Z' }}
{% else %}
Never
{% endif %}
<td class="time-col">
{% if spawner.last_activity %} {{ spawner.last_activity.isoformat() +
'Z' }} {% else %} Never {% endif %}
</td>
{# actions #}
<td>
<a role="button" class="stop-server btn btn-xs btn-danger{% if not spawner.active %} hidden{% endif %}" id="stop-{{ spawner.name }}">stop</a>
<a role="button" class="start-server btn btn-xs btn-primary {% if spawner.active %} hidden{% endif %}" id="start-{{ spawner.name }}"
href="{{ base_url }}spawn/{{ user.name }}/{{ spawner.name }}"
<a
role="button"
class="stop-server btn btn-xs btn-danger{% if not spawner.active %} hidden{% endif %}"
id="stop-{{ spawner.name }}"
>stop</a
>
<a
role="button"
class="start-server btn btn-xs btn-primary {% if spawner.active %} hidden{% endif %}"
id="start-{{ spawner.name }}"
href="{{ base_url }}spawn/{{ user.name }}/{{ spawner.name }}"
>
start
</a>
<a role="button" class="delete-server btn btn-xs btn-danger{% if spawner.active %} hidden{% endif %}" id="delete-{{ spawner.name }}">delete</a>
<a
role="button"
class="delete-server btn btn-xs btn-danger{% if spawner.active %} hidden{% endif %}"
id="delete-{{ spawner.name }}"
>delete</a
>
</td>
</tr>
{% endfor %}
@@ -83,11 +99,8 @@
</table>
{% endif %}
</div>
{% endblock main %}
{% block script %}
{{ super() }}
{% endblock main %} {% block script %} {{ super() }}
<script type="text/javascript">
require(["home"]);
require(["home"]);
</script>
{% endblock %}

View File

@@ -1,109 +1,95 @@
{% extends "page.html" %}
{% if announcement_login %}
{% set announcement = announcement_login %}
{% endif %}
{% block login_widget %}
{% endblock %}
{% block main %}
{% block login %}
{% extends "page.html" %} {% if announcement_login %} {% set announcement =
announcement_login %} {% endif %} {% block login_widget %} {% endblock %} {%
block main %} {% block login %}
<div id="login-main" class="container">
{% block login_container %}
{% if custom_html %}
{{ custom_html | safe }}
{% elif login_service %}
<div class="service-login">
<a role="button" class='btn btn-jupyter btn-lg' href='{{authenticator_login_url}}'>
Sign in with {{login_service}}
</a>
</div>
{% else %}
<form action="{{login_url}}?next={{next}}" method="post" role="form">
<div class="auth-form-header">
Sign in
{% block login_container %} {% if custom_html %} {{ custom_html | safe }} {%
elif login_service %}
<div class="service-login">
<a
role="button"
class="btn btn-jupyter btn-lg"
href="{{authenticator_login_url}}"
>
Sign in with {{login_service}}
</a>
</div>
<div class='auth-form-body'>
{% else %}
<form action="{{login_url}}?next={{next}}" method="post" role="form">
<div class="auth-form-header">Sign in</div>
<div class="auth-form-body">
<p id="insecure-login-warning" class="hidden">
Warning: JupyterHub seems to be served over an unsecured HTTP
connection. We strongly recommend enabling HTTPS for JupyterHub.
</p>
<p id='insecure-login-warning' class='hidden'>
Warning: JupyterHub seems to be served over an unsecured HTTP connection.
We strongly recommend enabling HTTPS for JupyterHub.
</p>
{% if login_error %}
<p class="login_error">
{{login_error}}
</p>
{% endif %}
<label for="username_input">Username:</label>
<input
id="username_input"
type="text"
autocapitalize="off"
autocorrect="off"
class="form-control"
name="username"
val="{{username}}"
tabindex="1"
autofocus="autofocus"
/>
<label for='password_input'>Password:</label>
<input
type="password"
class="form-control"
name="password"
id="password_input"
tabindex="2"
/>
<div class="feedback-container">
{% if login_error %}
<p class="login_error">{{login_error}}</p>
{% endif %}
<label for="username_input">Username:</label>
<input
id="login_submit"
type="submit"
class='btn btn-jupyter'
value='Sign in'
tabindex="3"
id="username_input"
type="text"
autocapitalize="off"
autocorrect="off"
class="form-control"
name="username"
val="{{username}}"
tabindex="1"
autofocus="autofocus"
/>
<label for="password_input">Password:</label>
<input
type="password"
class="form-control"
name="password"
id="password_input"
tabindex="2"
/>
<div class="feedback-container">
<input
id="login_submit"
type="submit"
class="btn btn-jupyter"
value="Sign in"
tabindex="3"
/>
<div class="feedback-widget hidden">
<i class="fa fa-spinner"></i>
<div class="feedback-widget hidden">
<i class="fa fa-spinner"></i>
</div>
</div>
</div>
{% block login_terms %}
{% if login_term_url %}
<div id="login_terms" class="login_terms">
<input type="checkbox" id="login_terms_checkbox" name="login_terms_checkbox" required />
{% block login_terms_text %} {# allow overriding the text #}
By logging into the platform you accept the <a href="{{ login_term_url }}">terms and conditions</a>.
{% endblock login_terms_text %}
{% block login_terms %} {% if login_term_url %}
<div id="login_terms" class="login_terms">
<input
type="checkbox"
id="login_terms_checkbox"
name="login_terms_checkbox"
required
/>
{% block login_terms_text %} {# allow overriding the text #} By logging
into the platform you accept the
<a href="{{ login_term_url }}">terms and conditions</a>. {% endblock
login_terms_text %}
</div>
{% endif %} {% endblock login_terms %}
</div>
{% endif %}
{% endblock login_terms %}
</div>
</form>
{% endif %}
{% endblock login_container %}
</form>
{% endif %} {% endblock login_container %}
</div>
{% endblock login %}
{% endblock %}
{% block script %}
{{ super() }}
{% endblock login %} {% endblock %} {% block script %} {{ super() }}
<script>
if (window.location.protocol === "http:") {
// unhide http warning
var warning = document.getElementById('insecure-login-warning');
warning.className = warning.className.replace(/\bhidden\b/, '');
}
// setup onSubmit feedback
$('form').submit((e) => {
var form = $(e.target);
form.find('.feedback-container>input').attr('disabled', true);
form.find('.feedback-container>*').toggleClass('hidden');
form.find('.feedback-widget>*').toggleClass('fa-pulse');
});
if (window.location.protocol === "http:") {
// unhide http warning
var warning = document.getElementById("insecure-login-warning");
warning.className = warning.className.replace(/\bhidden\b/, "");
}
// setup onSubmit feedback
$("form").submit((e) => {
var form = $(e.target);
form.find(".feedback-container>input").attr("disabled", true);
form.find(".feedback-container>*").toggleClass("hidden");
form.find(".feedback-widget>*").toggleClass("fa-pulse");
});
</script>
{% endblock %}

View File

@@ -1,14 +1,8 @@
{% extends "page.html" %}
{% if announcement_logout %}
{% set announcement = announcement_logout %}
{% endif %}
{% block main %}
{% extends "page.html" %} {% if announcement_logout %} {% set announcement =
announcement_logout %} {% endif %} {% block main %}
<div id="logout-main" class="container">
<p>
Successfully logged out.
</p>
<p>Successfully logged out.</p>
</div>
{% endblock %}

View File

@@ -1,57 +1,38 @@
{% extends "page.html" %}
{% block main %}
{% extends "page.html" %} {% block main %}
<div class="container">
<div class="row">
<div class="text-center">
{% block heading %}
<h1>
{% if failed %}
Spawn failed
{% else %}
Server not running
{% endif %}
{% if failed %} Spawn failed {% else %} Server not running {% endif %}
</h1>
{% endblock %}
{% block message %}
{% endblock %} {% block message %}
<p>
{% if failed %}
The latest attempt to start your server {{ server_name }} has failed.
{% if failed_message %}
{{ failed_message }}
{% endif %}
Would you like to retry starting it?
{% else %}
Your server {{ server_name }} is not running.
{% if implicit_spawn_seconds %}
It will be restarted automatically.
If you are not redirected in a few seconds,
click below to launch your server.
{% else %}
Would you like to start it?
{% endif %}
{% endif %}
{% if failed %} The latest attempt to start your server {{ server_name
}} has failed. {% if failed_message %} {{ failed_message }} {% endif %}
Would you like to retry starting it? {% else %} Your server {{
server_name }} is not running. {% if implicit_spawn_seconds %} It will
be restarted automatically. If you are not redirected in a few seconds,
click below to launch your server. {% else %} Would you like to start
it? {% endif %} {% endif %}
</p>
{% endblock %}
{% block start_button %}
<a id="start" role="button" class="btn btn-lg btn-primary" href="{{ spawn_url }}">
{% if failed %}
Relaunch
{% else %}
Launch
{% endif %}
Server {{ server_name }}
{% endblock %} {% block start_button %}
<a
id="start"
role="button"
class="btn btn-lg btn-primary"
href="{{ spawn_url }}"
>
{% if failed %} Relaunch {% else %} Launch {% endif %} Server {{
server_name }}
</a>
{% endblock %}
</div>
</div>
</div>
{% endblock %}
{% block script %}
{{ super () }}
{% if implicit_spawn_seconds %}
{% endblock %} {% block script %} {{ super () }} {% if implicit_spawn_seconds %}
<script type="text/javascript">
var spawn_url = "{{ spawn_url }}";
var implicit_spawn_seconds = {{ implicit_spawn_seconds }};
@@ -64,6 +45,6 @@
</script>
{% endif %}
<script type="text/javascript">
require(["not_running"]);
require(["not_running"]);
</script>
{% endblock script %}

View File

@@ -1,51 +1,41 @@
{% extends "page.html" %}
{% block login_widget %}
{% endblock %}
{% block main %}
{% extends "page.html" %} {% block login_widget %} {% endblock %} {% block main
%}
<div class="container col-md-6 col-md-offset-3">
<h1 class="text-center">Authorize access</h1>
<h1 class="text-center">Authorize access</h1>
<h2>
An application is requesting authorization to access data associated with your JupyterHub account
</h2>
<h2>
An application is requesting authorization to access data associated with
your JupyterHub account
</h2>
<p>
{{ oauth_client.description }} (oauth URL: {{ oauth_client.redirect_uri }})
would like permission to identify you.
{% if not role_names %}
It will not be able to take actions on
your behalf.
{% endif %}
</p>
<p>
{{ oauth_client.description }} (oauth URL: {{ oauth_client.redirect_uri }})
would like permission to identify you. {% if not role_names %} It will not
be able to take actions on your behalf. {% endif %}
</p>
<h3>This will grant the application permission to:</h3>
<div>
<form method="POST" action="">
{# these are the 'real' inputs to the form -#}
{% for role_name in role_names %}
<input type="hidden" name="scopes" value="{{ role_name }}"/>
{% endfor %}
{% for scope_info in scope_descriptions %}
<div class="checkbox input-group">
<label>
<input type="checkbox" name="raw-scopes" checked="true" title="This authorization is required"
disabled="disabled"
{# disabled because it's required #} />
<span>
{{ scope_info['description'] }}
{% if scope_info['filter'] %}
Applies to {{ scope_info['filter'] }}.
{% endif %}
<h3>This will grant the application permission to:</h3>
<div>
<form method="POST" action="">
{# these are the 'real' inputs to the form -#} {% for role_name in
role_names %}
<input type="hidden" name="scopes" value="{{ role_name }}" />
{% endfor %} {% for scope_info in scope_descriptions %}
<div class="checkbox input-group">
<label>
<input type="checkbox" name="raw-scopes" checked="true" title="This
authorization is required" disabled="disabled" {# disabled because
it's required #} />
<span>
{{ scope_info['description'] }} {% if scope_info['filter'] %}
Applies to {{ scope_info['filter'] }}. {% endif %}
</span>
</label>
</div>
{% endfor %}
<input type="submit" value="Authorize" class="form-control btn-jupyter"/>
</form>
</div>
</label>
</div>
{% endfor %}
<input type="submit" value="Authorize" class="form-control btn-jupyter" />
</form>
</div>
</div>
{% endblock %}

View File

@@ -1,9 +1,5 @@
{% extends "page.html" %}
{% if announcement_spawn %}
{% set announcement = announcement_spawn %}
{% endif %}
{% block main %}
{% extends "page.html" %} {% if announcement_spawn %} {% set announcement =
announcement_spawn %} {% endif %} {% block main %}
<div class="container">
{% block heading %}
@@ -13,18 +9,25 @@
{% endblock %}
<div class="row col-sm-offset-2 col-sm-8">
{% if for_user and user.name != for_user.name -%}
<p>Spawning server for {{ for_user.name }}</p>
{% endif -%}
{% if error_message -%}
<p class="spawn-error-msg text-danger">
Error: {{error_message}}
</p>
<p>Spawning server for {{ for_user.name }}</p>
{% endif -%} {% if error_message -%}
<p class="spawn-error-msg text-danger">Error: {{error_message}}</p>
{% endif %}
<form enctype="multipart/form-data" id="spawn_form" action="{{url}}" method="post" role="form">
<form
enctype="multipart/form-data"
id="spawn_form"
action="{{url}}"
method="post"
role="form"
>
{{spawner_options_form | safe}}
<br>
<br />
<div class="feedback-container">
<input type="submit" value="Start" class="btn btn-jupyter form-control">
<input
type="submit"
value="Start"
class="btn btn-jupyter form-control"
/>
<div class="feedback-widget hidden">
<i class="fa fa-spinner"></i>
</div>
@@ -33,17 +36,14 @@
</div>
</div>
{% endblock %}
{% block script %}
{{ super() }}
{% endblock %} {% block script %} {{ super() }}
<script>
// setup onSubmit feedback
$('form').submit((e) => {
var form = $(e.target);
form.find('.feedback-container>input').attr('disabled', true);
form.find('.feedback-container>*').toggleClass('hidden');
form.find('.feedback-widget>*').toggleClass('fa-pulse');
});
// setup onSubmit feedback
$("form").submit((e) => {
var form = $(e.target);
form.find(".feedback-container>input").attr("disabled", true);
form.find(".feedback-container>*").toggleClass("hidden");
form.find(".feedback-widget>*").toggleClass("fa-pulse");
});
</script>
{% endblock %}

View File

@@ -1,6 +1,4 @@
{% extends "page.html" %}
{% block main %}
{% extends "page.html" %} {% block main %}
<div class="container">
<div class="row">
@@ -10,7 +8,15 @@
<p>You will be redirected automatically when it's ready for you.</p>
{% endblock %}
<div class="progress">
<div id="progress-bar" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
<div
id="progress-bar"
class="progress-bar"
role="progressbar"
aria-valuenow="0"
aria-valuemin="0"
aria-valuemax="100"
style="width: 0%"
>
<span class="sr-only"><span id="sr-progress">0%</span> Complete</span>
</div>
</div>
@@ -27,66 +33,60 @@
</div>
</div>
{% endblock %}
{% block script %}
{{ super() }}
{% endblock %} {% block script %} {{ super() }}
<script type="text/javascript">
require(["jquery"], function ($) {
$("#refresh").click(function () {
window.location.reload();
});
// hook up event-stream for progress
var evtSource = new EventSource("{{ progress_url }}");
var progressMessage = $("#progress-message");
var progressBar = $("#progress-bar");
var srProgress = $("#sr-progress");
var progressLog = $("#progress-log");
evtSource.onmessage = function(e) {
var evt = JSON.parse(e.data);
console.log(evt);
if (evt.progress !== undefined) {
// update progress
var progText = evt.progress.toString();
progressBar.attr('aria-valuenow', progText);
srProgress.text(progText + '%');
progressBar.css('width', progText + '%');
}
// update message
var html_message;
if (evt.html_message !== undefined) {
progressMessage.html(evt.html_message);
html_message = evt.html_message;
} else if (evt.message !== undefined) {
progressMessage.text(evt.message);
html_message = progressMessage.html();
}
if (html_message) {
progressLog.append(
$("<div>")
.addClass('progress-log-event')
.html(html_message)
);
}
if (evt.ready) {
evtSource.close();
// reload the current page
// which should result in a redirect to the running server
require(["jquery"], function ($) {
$("#refresh").click(function () {
window.location.reload();
}
});
if (evt.failed) {
evtSource.close();
// turn progress bar red
progressBar.addClass('progress-bar-danger');
// open event log for debugging
$('#progress-details').prop('open', true);
}
};
// hook up event-stream for progress
var evtSource = new EventSource("{{ progress_url }}");
var progressMessage = $("#progress-message");
var progressBar = $("#progress-bar");
var srProgress = $("#sr-progress");
var progressLog = $("#progress-log");
});
evtSource.onmessage = function (e) {
var evt = JSON.parse(e.data);
console.log(evt);
if (evt.progress !== undefined) {
// update progress
var progText = evt.progress.toString();
progressBar.attr("aria-valuenow", progText);
srProgress.text(progText + "%");
progressBar.css("width", progText + "%");
}
// update message
var html_message;
if (evt.html_message !== undefined) {
progressMessage.html(evt.html_message);
html_message = evt.html_message;
} else if (evt.message !== undefined) {
progressMessage.text(evt.message);
html_message = progressMessage.html();
}
if (html_message) {
progressLog.append(
$("<div>").addClass("progress-log-event").html(html_message)
);
}
if (evt.ready) {
evtSource.close();
// reload the current page
// which should result in a redirect to the running server
window.location.reload();
}
if (evt.failed) {
evtSource.close();
// turn progress bar red
progressBar.addClass("progress-bar-danger");
// open event log for debugging
$("#progress-details").prop("open", true);
}
};
});
</script>
{% endblock %}

View File

@@ -1,32 +1,31 @@
{% extends "page.html" %}
{% block main %}
{% extends "page.html" %} {% block main %}
<div class="container">
<div class="row">
<div class="text-center">
{% block message %}
<p>Your server is stopping.</p>
<p>You will be able to start it again once it has finished stopping.</p>
<p>Your server is stopping.</p>
<p>You will be able to start it again once it has finished stopping.</p>
{% endblock message %}
<p><i class="fa fa-spinner fa-pulse fa-fw fa-3x" aria-hidden="true"></i></p>
<a role="button" id="refresh" class="btn btn-lg btn-primary" href="#">refresh</a>
<p>
<i class="fa fa-spinner fa-pulse fa-fw fa-3x" aria-hidden="true"></i>
</p>
<a role="button" id="refresh" class="btn btn-lg btn-primary" href="#"
>refresh</a
>
</div>
</div>
</div>
{% endblock %}
{% block script %}
{{ super() }}
{% endblock %} {% block script %} {{ super() }}
<script type="text/javascript">
require(["jquery"], function ($) {
$("#refresh").click(function () {
window.location.reload();
require(["jquery"], function ($) {
$("#refresh").click(function () {
window.location.reload();
});
setTimeout(function () {
window.location.reload();
}, 5000);
});
setTimeout(function () {
window.location.reload();
}, 5000);
});
</script>
{% endblock %}

View File

@@ -1,6 +1,4 @@
{% extends "page.html" %}
{% block main %}
{% extends "page.html" %} {% block main %}
<div class="container">
<div class="row">
@@ -15,15 +13,15 @@
<input
id="token-note"
class="form-control"
placeholder="note to identify your new token">
placeholder="note to identify your new token"
/>
<small id="note-note" class="form-text text-muted">
This note will help you keep track of what your tokens are for.
</small>
<br><br>
<br /><br />
<label for="token-expiration-seconds">Token expires</label>
{% block expiration_options %}
<select id="token-expiration-seconds"
class="form-control">
<select id="token-expiration-seconds" class="form-control">
<option value="3600">1 Day</option>
<option value="86400">1 Week</option>
<option value="604800">1 Month</option>
@@ -38,31 +36,29 @@
</div>
<div class="row">
<div id="token-area" class="col-md-6 col-md-offset-3" style="display: none;">
<div class="panel panel-default">
<div class="panel-heading">
Your new API Token
</div>
<div class="panel-body">
<p class="lead text-center">
<span id="token-result"></span>
</p>
<p>
Copy this token. You won't be able to see it again,
but you can always come back here to get a new one.
</p>
</div>
<div id="token-area" class="col-md-6 col-md-offset-3" style="display: none">
<div class="panel panel-default">
<div class="panel-heading">Your new API Token</div>
<div class="panel-body">
<p class="lead text-center">
<span id="token-result"></span>
</p>
<p>
Copy this token. You won't be able to see it again, but you can
always come back here to get a new one.
</p>
</div>
</div>
</div>
</div>
{% if api_tokens %}
<div class="row">
<h2>API Tokens</h2>
<p>
These are tokens with full access to the JupyterHub API.
Anything you can do with JupyterHub can be done with these tokens.
Revoking the API token for a running server will require restarting that server.
These are tokens with full access to the JupyterHub API. Anything you can
do with JupyterHub can be done with these tokens. Revoking the API token
for a running server will require restarting that server.
</p>
<table class="table table-striped">
<thead>
@@ -79,28 +75,21 @@
{% block token_row scoped %}
<td class="note-col col-sm-5">{{token.note}}</td>
<td class="time-col col-sm-3">
{%- if token.last_activity -%}
{{ token.last_activity.isoformat() + 'Z' }}
{%- else -%}
Never
{%- endif -%}
{%- if token.last_activity -%} {{ token.last_activity.isoformat() +
'Z' }} {%- else -%} Never {%- endif -%}
</td>
<td class="time-col col-sm-3">
{%- if token.created -%}
{{ token.created.isoformat() + 'Z' }}
{%- else -%}
N/A
{%- endif -%}
{%- if token.created -%} {{ token.created.isoformat() + 'Z' }} {%-
else -%} N/A {%- endif -%}
</td>
<td class="time-col col-sm-3">
{%- if token.expires_at -%}
{{ token.expires_at.isoformat() + 'Z' }}
{%- else -%}
Never
{%- endif -%}
{%- if token.expires_at -%} {{ token.expires_at.isoformat() + 'Z' }}
{%- else -%} Never {%- endif -%}
</td>
<td class="col-sm-1 text-center">
<button class="revoke-token-btn btn btn-xs btn-danger">revoke</button>
<button class="revoke-token-btn btn btn-xs btn-danger">
revoke
</button>
</td>
{% endblock token_row %}
</tr>
@@ -108,17 +97,13 @@
</tbody>
</table>
</div>
{% endif %}
{% if oauth_clients %}
{% endif %} {% if oauth_clients %}
<div class="row">
<h2>Authorized Applications</h2>
<p>
These are applications that use OAuth with JupyterHub
to identify users (mostly notebook servers).
OAuth tokens can generally only be used to identify you,
not take actions on your behalf.
These are applications that use OAuth with JupyterHub to identify users
(mostly notebook servers). OAuth tokens can generally only be used to
identify you, not take actions on your behalf.
</p>
<table class="table table-striped">
<thead>
@@ -130,39 +115,34 @@
</thead>
<tbody>
{% for client in oauth_clients %}
<tr class="token-row"
data-token-id="{{ client['token_id'] }}">
<tr class="token-row" data-token-id="{{ client['token_id'] }}">
{% block client_row scoped %}
<td class="note-col col-sm-5">{{ client['description'] }}</td>
<td class="time-col col-sm-3">
{%- if client['last_activity'] -%}
{{ client['last_activity'].isoformat() + 'Z' }}
{%- else -%}
Never
{%- endif -%}
{%- if client['last_activity'] -%} {{
client['last_activity'].isoformat() + 'Z' }} {%- else -%} Never {%-
endif -%}
</td>
<td class="time-col col-sm-3">
{%- if client['created'] -%}
{{ client['created'].isoformat() + 'Z' }}
{%- else -%}
N/A
{%- endif -%}
{%- if client['created'] -%} {{ client['created'].isoformat() + 'Z'
}} {%- else -%} N/A {%- endif -%}
</td>
<td class="col-sm-1 text-center">
<button class="revoke-token-btn btn btn-xs btn-danger">revoke</button>
{% endblock client_row %}
<button class="revoke-token-btn btn btn-xs btn-danger">
revoke
</button>
{% endblock client_row %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
{% endblock main %}
{% block script %}
{{ super() }}
{% endblock main %} {% block script %} {{ super() }}
<script type="text/javascript">
require(["token"]);
require(["token"]);
</script>
{% endblock script %}