mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-08 02:24:08 +00:00
address djlint lint
and autoformat js in templates
This commit is contained in:
@@ -42,6 +42,9 @@ repos:
|
|||||||
- id: djlint-reformat-jinja
|
- id: djlint-reformat-jinja
|
||||||
files: ".*templates/.*.html"
|
files: ".*templates/.*.html"
|
||||||
types_or: ["html"]
|
types_or: ["html"]
|
||||||
|
- id: djlint-jinja
|
||||||
|
files: ".*templates/.*.html"
|
||||||
|
types_or: ["html"]
|
||||||
|
|
||||||
# Autoformat and linting, misc. details
|
# Autoformat and linting, misc. details
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
@@ -19,14 +19,18 @@
|
|||||||
{%- block content %}
|
{%- block content %}
|
||||||
<redoc id="redoc-spec"></redoc>
|
<redoc id="redoc-spec"></redoc>
|
||||||
<script>
|
<script>
|
||||||
if (location.protocol === "file:") {
|
if (location.protocol === "file:") {
|
||||||
document.body.innerText = "Rendered API specification doesn't work with file: protocol. Use sphinx-autobuild to do local builds of the docs, served over HTTP."
|
document.body.innerText = "Rendered API specification doesn't work with file: protocol. Use sphinx-autobuild to do local builds of the docs, served over HTTP."
|
||||||
} else {
|
} else {
|
||||||
Redoc.init(
|
Redoc.init(
|
||||||
"{{ pathto('_static/rest-api.yml', 1) }}",
|
"{{ pathto('_static/rest-api.yml', 1) }}", {
|
||||||
{{ meta.redoc_options | default({}) }},
|
{
|
||||||
document.getElementById("redoc-spec"),
|
meta.redoc_options |
|
||||||
);
|
default ({})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
document.getElementById("redoc-spec"),
|
||||||
|
);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
{%- endblock content %}
|
{%- endblock content %}
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
{% extends "templates/page.html" %}
|
{% extends "templates/page.html" %}
|
||||||
{% block announcement %}<div class="container text-center announcement"></div>{% endblock %}
|
{% block announcement %}
|
||||||
|
<div class="container text-center announcement"></div>
|
||||||
|
{% endblock announcement %}
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script>
|
<script>
|
||||||
$.get("/services/announcement/", function (data) {
|
$.get("/services/announcement/", function(data) {
|
||||||
$(".announcement").html(data["announcement"]);
|
$(".announcement").html(data["announcement"]);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock script %}
|
||||||
|
@@ -17,38 +17,38 @@ It makes the following modifications:
|
|||||||
style="margin-right: 4px;
|
style="margin-right: 4px;
|
||||||
margin-left: 2px">Control Panel</a>
|
margin-left: 2px">Control Panel</a>
|
||||||
</span>
|
</span>
|
||||||
{% endblock %}
|
{% endblock header_buttons %}
|
||||||
{% block logo %}
|
{% block logo %}
|
||||||
<img src="{{ logo_url }}" alt="Jupyter Notebook" />
|
<img src="{{ logo_url }}" alt="Jupyter Notebook" />
|
||||||
{% endblock logo %}
|
{% endblock logo %}
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function _remove_redirects_param() {
|
function _remove_redirects_param() {
|
||||||
// remove ?redirects= param from URL so that
|
// remove ?redirects= param from URL so that
|
||||||
// successful page loads don't increment the redirect loop counter
|
// successful page loads don't increment the redirect loop counter
|
||||||
if (window.location.search.length <= 1) {
|
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 token 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;
|
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 token 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_param();
|
||||||
_remove_redirects_param();
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock script %}
|
{% endblock script %}
|
||||||
|
@@ -124,6 +124,18 @@ select = [
|
|||||||
# https://djlint.com/docs/configuration/
|
# https://djlint.com/docs/configuration/
|
||||||
[tool.djlint]
|
[tool.djlint]
|
||||||
indent = 2
|
indent = 2
|
||||||
|
# ignore often-incorrect lint
|
||||||
|
# H006: image height/width attributes
|
||||||
|
# ignore style lint that formatter doesn't catch
|
||||||
|
# H008: double-quotes
|
||||||
|
# H029: form method case
|
||||||
|
ignore = "H006,H008,H021,H029"
|
||||||
|
use_gitignore = true
|
||||||
|
|
||||||
|
format_js = true
|
||||||
|
|
||||||
|
[tool.djlint.js]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
# tbump is used to simplify and standardize the release process when updating
|
# tbump is used to simplify and standardize the release process when updating
|
||||||
# the version, making a git commit and tag, and pushing changes.
|
# the version, making a git commit and tag, and pushing changes.
|
||||||
|
@@ -1,2 +1,4 @@
|
|||||||
{% extends "error.html" %}
|
{% extends "error.html" %}
|
||||||
{% block error_detail %}<p>Jupyter has lots of moons, but this is not one...</p>{% endblock %}
|
{% block error_detail %}
|
||||||
|
<p>Jupyter has lots of moons, but this is not one...</p>
|
||||||
|
{% endblock error_detail %}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
{% extends "page.html" %}
|
{% extends "page.html" %}
|
||||||
{% block login_widget %}{% endblock %}
|
{% block login_widget %}
|
||||||
|
{% endblock login_widget %}
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
@@ -16,7 +17,7 @@
|
|||||||
to start the server before you can access it.
|
to start the server before you can access it.
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<form method="POST" action="">
|
<form method="post" action="">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
By accepting the invitation, you will be granted the following permissions,
|
By accepting the invitation, you will be granted the following permissions,
|
||||||
@@ -48,4 +49,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock main %}
|
||||||
|
@@ -2,12 +2,12 @@
|
|||||||
{% block main %}
|
{% block main %}
|
||||||
<div id="react-admin-hook">
|
<div id="react-admin-hook">
|
||||||
<script id="jupyterhub-admin-config">
|
<script id="jupyterhub-admin-config">
|
||||||
window.api_page_limit = parseInt("{{ api_page_limit|safe }}")
|
window.api_page_limit = parseInt("{{ api_page_limit|safe }}")
|
||||||
window.base_url = "{{ base_url|safe }}"
|
window.base_url = "{{ base_url|safe }}"
|
||||||
</script>
|
</script>
|
||||||
<script src={{ static_url("js/admin-react.js") }}></script>
|
<script src={{ static_url("js/admin-react.js") }}></script>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock main %}
|
||||||
{% block footer %}
|
{% block footer %}
|
||||||
<div class="py-2 px-4 bg-body-tertiary small version_footer">JupyterHub {{ server_version }}</div>
|
<div class="py-2 px-4 bg-body-tertiary small version_footer">JupyterHub {{ server_version }}</div>
|
||||||
{% endblock %}
|
{% endblock footer %}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
{% extends "page.html" %}
|
{% extends "page.html" %}
|
||||||
{% block login_widget %}{% endblock %}
|
{% block login_widget %}
|
||||||
|
{% endblock login_widget %}
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<div class="error">
|
<div class="error">
|
||||||
{% block h1_error %}
|
{% block h1_error %}
|
||||||
@@ -11,7 +12,7 @@
|
|||||||
{% if extra_error_html %}<p>{{ extra_error_html | safe }}</p>{% endif %}
|
{% if extra_error_html %}<p>{{ extra_error_html | safe }}</p>{% endif %}
|
||||||
{% endblock error_detail %}
|
{% endblock error_detail %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock main %}
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -29,9 +30,9 @@
|
|||||||
new_search = '?' + search_parameters.join('&');
|
new_search = '?' + search_parameters.join('&');
|
||||||
}
|
}
|
||||||
var new_url = window.location.origin +
|
var new_url = window.location.origin +
|
||||||
window.location.pathname +
|
window.location.pathname +
|
||||||
new_search +
|
new_search +
|
||||||
window.location.hash;
|
window.location.hash;
|
||||||
window.history.replaceState({}, "", new_url);
|
window.history.replaceState({}, "", new_url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -40,4 +41,4 @@
|
|||||||
|
|
||||||
_remove_redirects_from_url();
|
_remove_redirects_from_url();
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock script %}
|
||||||
|
@@ -86,5 +86,7 @@
|
|||||||
{% endblock main %}
|
{% endblock main %}
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script type="text/javascript">require(["home"]);</script>
|
<script type="text/javascript">
|
||||||
{% endblock %}
|
require(["home"]);
|
||||||
|
</script>
|
||||||
|
{% endblock script %}
|
||||||
|
@@ -2,7 +2,8 @@
|
|||||||
{% if announcement_login is string %}
|
{% if announcement_login is string %}
|
||||||
{% set announcement = announcement_login %}
|
{% set announcement = announcement_login %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% block login_widget %}{% endblock %}
|
{% block login_widget %}
|
||||||
|
{% endblock login_widget %}
|
||||||
{% block main %}
|
{% block main %}
|
||||||
{% block login %}
|
{% block login %}
|
||||||
<div id="login-main" class="container">
|
<div id="login-main" class="container">
|
||||||
@@ -86,21 +87,21 @@
|
|||||||
{% endblock login_container %}
|
{% endblock login_container %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock login %}
|
{% endblock login %}
|
||||||
{% endblock %}
|
{% endblock main %}
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script>
|
<script>
|
||||||
if (window.location.protocol === "http:") {
|
if (window.location.protocol === "http:") {
|
||||||
// unhide http warning
|
// unhide http warning
|
||||||
var warning = document.getElementById('insecure-login-warning');
|
var warning = document.getElementById('insecure-login-warning');
|
||||||
warning.className = warning.className.replace(/\bhidden\b/, '');
|
warning.className = warning.className.replace(/\bhidden\b/, '');
|
||||||
}
|
}
|
||||||
// setup onSubmit feedback
|
// setup onSubmit feedback
|
||||||
$('form').submit((e) => {
|
$('form').submit((e) => {
|
||||||
var form = $(e.target);
|
var form = $(e.target);
|
||||||
form.find('.feedback-container>input').attr('disabled', true);
|
form.find('.feedback-container>input').attr('disabled', true);
|
||||||
form.find('.feedback-container>*').toggleClass('hidden');
|
form.find('.feedback-container>*').toggleClass('hidden');
|
||||||
form.find('.feedback-widget>*').toggleClass('fa-pulse');
|
form.find('.feedback-widget>*').toggleClass('fa-pulse');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock script %}
|
||||||
|
@@ -6,4 +6,4 @@
|
|||||||
<div id="logout-main" class="container">
|
<div id="logout-main" class="container">
|
||||||
<p>Successfully logged out.</p>
|
<p>Successfully logged out.</p>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock main %}
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
Server not running
|
Server not running
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h1>
|
</h1>
|
||||||
{% endblock %}
|
{% endblock heading %}
|
||||||
{% block message %}
|
{% block message %}
|
||||||
<p>
|
<p>
|
||||||
{% if failed %}
|
{% if failed %}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
{% endblock %}
|
{% endblock message %}
|
||||||
{% block start_button %}
|
{% block start_button %}
|
||||||
<a id="start"
|
<a id="start"
|
||||||
role="button"
|
role="button"
|
||||||
@@ -48,24 +48,30 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
Server {{ server_name }}
|
Server {{ server_name }}
|
||||||
</a>
|
</a>
|
||||||
{% endblock %}
|
{% endblock start_button %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock main %}
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{{ super () }}
|
{{ super () }}
|
||||||
{% if implicit_spawn_seconds %}
|
{% if implicit_spawn_seconds %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var spawn_url = "{{ spawn_url }}";
|
var spawn_url = "{{ spawn_url }}";
|
||||||
var implicit_spawn_seconds = {{ implicit_spawn_seconds }};
|
var implicit_spawn_seconds = {
|
||||||
setTimeout(function () {
|
{
|
||||||
console.log("redirecting to spawn at", spawn_url);
|
implicit_spawn_seconds
|
||||||
window.location = spawn_url;
|
}
|
||||||
},
|
};
|
||||||
1000 * implicit_spawn_seconds
|
setTimeout(function() {
|
||||||
);
|
console.log("redirecting to spawn at", spawn_url);
|
||||||
|
window.location = spawn_url;
|
||||||
|
},
|
||||||
|
1000 * implicit_spawn_seconds
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<script type="text/javascript">require(["not_running"]);</script>
|
<script type="text/javascript">
|
||||||
|
require(["not_running"]);
|
||||||
|
</script>
|
||||||
{% endblock script %}
|
{% endblock script %}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
{% extends "page.html" %}
|
{% extends "page.html" %}
|
||||||
{% block login_widget %}{% endblock %}
|
{% block login_widget %}
|
||||||
|
{% endblock login_widget %}
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
@@ -14,7 +15,7 @@
|
|||||||
your behalf.
|
your behalf.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
<form method="POST" action="">
|
<form method="post" action="">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<p class="h5">This will grant the application permission to:</p>
|
<p class="h5">This will grant the application permission to:</p>
|
||||||
@@ -26,22 +27,26 @@
|
|||||||
{% for scope_info in scope_descriptions %}
|
{% for scope_info in scope_descriptions %}
|
||||||
<div class="checkbox input-group">
|
<div class="checkbox input-group">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="raw-scopes" checked="true" title="This authorization is required"
|
{# disabled because it's required #}
|
||||||
disabled="disabled"
|
<input type="checkbox"
|
||||||
{# disabled because it's required #} />
|
name="raw-scopes"
|
||||||
<span>
|
checked="true"
|
||||||
{{ scope_info['description'] }}
|
title="This authorization is required"
|
||||||
{% if scope_info['filter'] %}Applies to {{ scope_info['filter'] }}.{% endif %}
|
disabled="disabled" />
|
||||||
</span>
|
<span>
|
||||||
</label>
|
{{ scope_info['description'] }}
|
||||||
</div>
|
{% if scope_info['filter'] %}Applies to {{ scope_info['filter'] }}.{% endif %}
|
||||||
{% endfor %}
|
</span>
|
||||||
</div>
|
</label>
|
||||||
<div class="card-footer">
|
</div>
|
||||||
<button type="submit" class="form-control btn btn-jupyter mt-2">Authorize</button>
|
{% endfor %}
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
<div class="card-footer">
|
||||||
</div>
|
<button type="submit" class="form-control btn btn-jupyter mt-2">Authorize</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock main %}
|
||||||
|
@@ -10,9 +10,7 @@
|
|||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h2 class="modal-title" id="{{ key }}-label">
|
<h2 class="modal-title" id="{{ key }}-label">{{ title }}</h2>
|
||||||
{{ title }}
|
|
||||||
</h1>
|
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="btn-close"
|
class="btn-close"
|
||||||
data-bs-dismiss="modal"
|
data-bs-dismiss="modal"
|
||||||
@@ -34,40 +32,45 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>
|
<title>
|
||||||
{% block title %}JupyterHub{% endblock %}
|
{%- block title -%}
|
||||||
|
JupyterHub
|
||||||
|
{%- endblock title -%}
|
||||||
</title>
|
</title>
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
{% block stylesheet %}
|
{% block stylesheet %}
|
||||||
<link rel="stylesheet" href="{{ static_url("css/style.min.css") }}" type="text/css" />
|
<link rel="stylesheet" href="{{ static_url("css/style.min.css") }}" type="text/css" />
|
||||||
{% endblock %}
|
{% endblock stylesheet %}
|
||||||
{% block favicon %}<link rel="icon" href="{{ static_url("favicon.ico") }}" type="image/x-icon">{% endblock %}
|
{% block favicon %}
|
||||||
|
<link rel="icon" href="{{ static_url("favicon.ico") }}" type="image/x-icon">
|
||||||
|
{% endblock favicon %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{static_url("components/bootstrap/dist/js/bootstrap.bundle.min.js") }}" type="text/javascript" charset="utf-8"></script>
|
<script src="{{static_url("components/bootstrap/dist/js/bootstrap.bundle.min.js") }}" type="text/javascript" charset="utf-8"></script>
|
||||||
<script src="{{static_url("components/requirejs/require.js") }}" type="text/javascript" charset="utf-8"></script>
|
<script src="{{static_url("components/requirejs/require.js") }}" type="text/javascript" charset="utf-8"></script>
|
||||||
<script src="{{static_url("components/jquery/dist/jquery.min.js") }}" type="text/javascript" charset="utf-8"></script>
|
<script src="{{static_url("components/jquery/dist/jquery.min.js") }}" type="text/javascript" charset="utf-8"></script>
|
||||||
{% endblock %}
|
{% endblock scripts %}
|
||||||
<script>
|
{# djlint js formatting doesn't handle template blocks in js #}
|
||||||
require.config({
|
{# djlint: off #}
|
||||||
{% if version_hash %}urlArgs: "v={{version_hash}}",{% endif %}
|
|
||||||
baseUrl: '{{static_url("js", include_version=False)}}',
|
|
||||||
paths: {
|
|
||||||
components: '../components',
|
|
||||||
jquery: '../components/jquery/dist/jquery.min',
|
|
||||||
moment: "../components/moment/moment",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
require.config({
|
||||||
|
{% if version_hash %}
|
||||||
|
urlArgs: "v={{version_hash}}",
|
||||||
|
{% endif %}
|
||||||
|
baseUrl: '{{static_url("js", include_version=False)}}',
|
||||||
|
paths: {
|
||||||
|
components: '../components',
|
||||||
|
jquery: '../components/jquery/dist/jquery.min',
|
||||||
|
moment: "../components/moment/moment",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
window.jhdata = {
|
window.jhdata = {
|
||||||
base_url: "{{base_url}}",
|
base_url: "{{base_url}}",
|
||||||
prefix: "{{prefix}}",
|
prefix: "{{prefix}}",
|
||||||
{% if user %}
|
{% if user %}
|
||||||
{#
|
{#- Autoescaping in templates is turned on in JupyterHub, #}
|
||||||
Autoescaping in templates is turned on in JupyterHub,
|
{#- need `| safe` to prevent escaping #}
|
||||||
need `| safe` to prevent escaping
|
{#- `https://github.com/pallets/markupsafe/blob/2.1.4/src/markupsafe/_native.py#L6` #}
|
||||||
https://github.com/pallets/markupsafe/blob/2.1.4/src/markupsafe/_native.py#L6
|
|
||||||
#}
|
|
||||||
user: "{{ user.json_escaped_name | safe }}",
|
user: "{{ user.json_escaped_name | safe }}",
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if admin_access %}
|
{% if admin_access %}
|
||||||
@@ -81,97 +84,124 @@
|
|||||||
options_form: false,
|
options_form: false,
|
||||||
{% endif %}
|
{% endif %}
|
||||||
xsrf_token: "{{ xsrf_token }}",
|
xsrf_token: "{{ xsrf_token }}",
|
||||||
}
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{% block meta %}
|
{# djlint: on #}
|
||||||
{% endblock %}
|
{% block meta %}
|
||||||
</head>
|
<meta name="description" content="JupyterHub">
|
||||||
<body>
|
<meta name="keywords" content="Jupyter, JupyterHub">
|
||||||
<noscript>
|
{% endblock meta %}
|
||||||
<div id='noscript'>
|
</head>
|
||||||
JupyterHub requires JavaScript.
|
<body>
|
||||||
<br>
|
<noscript>
|
||||||
Please enable it to proceed.
|
<div id='noscript'>
|
||||||
</div>
|
JupyterHub requires JavaScript.
|
||||||
</noscript>
|
<br>
|
||||||
{% block nav_bar %}
|
Please enable it to proceed.
|
||||||
<nav class="navbar navbar-expand-sm bg-body-tertiary mb-4">
|
</div>
|
||||||
<div class="container-fluid">
|
</noscript>
|
||||||
{% block logo %}
|
{% block nav_bar %}
|
||||||
<span id="jupyterhub-logo" class="navbar-brand">
|
<nav class="navbar navbar-expand-sm bg-body-tertiary mb-4">
|
||||||
<a href="{{ logo_url or base_url }}">
|
<div class="container-fluid">
|
||||||
<img src='{{ base_url }}logo' alt='JupyterHub logo' class='jpy-logo' title='Home' />
|
{% block logo %}
|
||||||
</a>
|
<span id="jupyterhub-logo" class="navbar-brand">
|
||||||
</span>
|
<a href="{{ logo_url or base_url }}">
|
||||||
{% endblock %}
|
<img src='{{ base_url }}logo'
|
||||||
{% if user %}
|
alt='JupyterHub logo'
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#thenavbar" aria-controls="thenavbar" aria-expanded="false" aria-label="Toggle navigation">
|
class='jpy-logo'
|
||||||
<span class="navbar-toggler-icon"></span>
|
title='Home' />
|
||||||
</button>
|
</a>
|
||||||
{% endif %}
|
</span>
|
||||||
<div class="collapse navbar-collapse" id="thenavbar">
|
{% endblock logo %}
|
||||||
{% if user %}
|
{% if user %}
|
||||||
<ul class="navbar-nav me-auto mb-0">
|
<button class="navbar-toggler"
|
||||||
{% block nav_bar_left_items %}
|
type="button"
|
||||||
<li class="nav-item">
|
data-bs-toggle="collapse"
|
||||||
<a class="nav-link" href="{{ base_url }}home">Home</a>
|
data-bs-target="#thenavbar"
|
||||||
</li>
|
aria-controls="thenavbar"
|
||||||
<li class="nav-item">
|
aria-expanded="false"
|
||||||
<a class="nav-link" href="{{ base_url }}token">Token</a>
|
aria-label="Toggle navigation">
|
||||||
</li>
|
<span class="navbar-toggler-icon"></span>
|
||||||
{% if 'admin-ui' in parsed_scopes %}
|
</button>
|
||||||
<li class="nav-item">
|
{% endif %}
|
||||||
<a class="nav-link" href="{{ base_url }}admin">Admin</a>
|
<div class="collapse navbar-collapse" id="thenavbar">
|
||||||
</li>
|
{% if user %}
|
||||||
{% endif %}
|
<ul class="navbar-nav me-auto mb-0">
|
||||||
{% if services %}
|
{% block nav_bar_left_items %}
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item">
|
||||||
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false">Services</a>
|
<a class="nav-link" href="{{ base_url }}home">Home</a>
|
||||||
<ul class="dropdown-menu">
|
</li>
|
||||||
{% for service in services %}
|
<li class="nav-item">
|
||||||
{% block service scoped %}
|
<a class="nav-link" href="{{ base_url }}token">Token</a>
|
||||||
<li>
|
</li>
|
||||||
<a class="dropdown-item" href="{{ service.href }}">{{ service.name }}</a>
|
{% if 'admin-ui' in parsed_scopes %}
|
||||||
</li>
|
<li class="nav-item">
|
||||||
{% endblock %}
|
<a class="nav-link" href="{{ base_url }}admin">Admin</a>
|
||||||
{% endfor %}
|
</li>
|
||||||
</ul>
|
{% endif %}
|
||||||
</li>
|
{% if services %}
|
||||||
{% endif %}
|
<li class="nav-item dropdown">
|
||||||
{% endblock %}
|
<a href="#"
|
||||||
</ul>
|
class="nav-link dropdown-toggle"
|
||||||
{% endif %}
|
data-bs-toggle="dropdown"
|
||||||
<ul class="nav navbar-nav me-2">
|
role="button"
|
||||||
{% block nav_bar_right_items %}
|
aria-expanded="false">Services</a>
|
||||||
<li class="nav-item">
|
<ul class="dropdown-menu">
|
||||||
{% block login_widget %}
|
{% for service in services %}
|
||||||
<span id="login_widget">
|
{% block service scoped %}
|
||||||
{% if user %}
|
<li>
|
||||||
<span class="navbar-text">{{ user.name }}</span>
|
<a class="dropdown-item" href="{{ service.href }}">{{ service.name }}</a>
|
||||||
<a id="logout" role="button" class="btn btn-sm btn-outline-dark" href="{{ logout_url }}"> <i aria-hidden="true" class="fa fa-sign-out"></i> Logout</a>
|
</li>
|
||||||
{% else %}
|
{% endblock service %}
|
||||||
<a id="login" role="button" class="btn btn-sm btn-outline-dark" href="{{ login_url }}">Login</a>
|
{% endfor %}
|
||||||
{% endif %}
|
</ul>
|
||||||
</span>
|
</li>
|
||||||
{% endblock %}
|
{% endif %}
|
||||||
</li>
|
{% endblock nav_bar_left_items %}
|
||||||
{% endblock %}
|
</ul>
|
||||||
</ul>
|
{% endif %}
|
||||||
</div>
|
<ul class="nav navbar-nav me-2">
|
||||||
{% block header %}{% endblock %}
|
{% block nav_bar_right_items %}
|
||||||
</div>
|
<li class="nav-item">
|
||||||
</nav>
|
{% block login_widget %}
|
||||||
{% endblock %}
|
<span id="login_widget">
|
||||||
{% block announcement %}
|
{% if user %}
|
||||||
{% if announcement %}
|
<span class="navbar-text">{{ user.name }}</span>
|
||||||
<div class="container text-center announcement alert alert-warning">{{ announcement | safe }}</div>
|
<a id="logout"
|
||||||
{% endif %}
|
role="button"
|
||||||
{% endblock %}
|
class="btn btn-sm btn-outline-dark"
|
||||||
{% block main %}{% endblock %}
|
href="{{ logout_url }}"> <i aria-hidden="true" class="fa fa-sign-out"></i> Logout</a>
|
||||||
{% block footer %}{% endblock %}
|
{% else %}
|
||||||
{% call modal('Error', btn_label='OK') %}
|
<a id="login"
|
||||||
<div class="ajax-error alert-danger">The error</div>
|
role="button"
|
||||||
{% endcall %}
|
class="btn btn-sm btn-outline-dark"
|
||||||
{% block script %}{% endblock %}
|
href="{{ login_url }}">Login</a>
|
||||||
</body>
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
{% endblock login_widget %}
|
||||||
|
</li>
|
||||||
|
{% endblock nav_bar_right_items %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% block header %}
|
||||||
|
{% endblock header %}
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
{% endblock nav_bar %}
|
||||||
|
{% block announcement %}
|
||||||
|
{% if announcement %}
|
||||||
|
<div class="container text-center announcement alert alert-warning">{{ announcement | safe }}</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock announcement %}
|
||||||
|
{% block main %}
|
||||||
|
{% endblock main %}
|
||||||
|
{% block footer %}
|
||||||
|
{% endblock footer %}
|
||||||
|
{% call modal('Error', btn_label='OK') %}
|
||||||
|
<div class="ajax-error alert-danger">The error</div>
|
||||||
|
{% endcall %}
|
||||||
|
{% block script %}
|
||||||
|
{% endblock script %}
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<div class="row text-center">
|
<div class="row text-center">
|
||||||
<h1>Server Options</h1>
|
<h1>Server Options</h1>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock heading %}
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
{% if for_user and user.name != for_user.name -%}
|
{% if for_user and user.name != for_user.name -%}
|
||||||
@@ -31,16 +31,17 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
</div>
|
||||||
{% block script %}
|
{% endblock main %}
|
||||||
{{ super() }}
|
{% block script %}
|
||||||
<script>
|
{{ super() }}
|
||||||
// setup onSubmit feedback
|
<script>
|
||||||
$('form').submit((e) => {
|
// setup onSubmit feedback
|
||||||
var form = $(e.target);
|
$('form').submit((e) => {
|
||||||
form.find('.feedback-container>input').attr('disabled', true);
|
var form = $(e.target);
|
||||||
form.find('.feedback-container>*').toggleClass('hidden');
|
form.find('.feedback-container>input').attr('disabled', true);
|
||||||
form.find('.feedback-widget>*').toggleClass('fa-pulse');
|
form.find('.feedback-container>*').toggleClass('hidden');
|
||||||
});
|
form.find('.feedback-widget>*').toggleClass('fa-pulse');
|
||||||
</script>
|
});
|
||||||
{% endblock %}
|
</script>
|
||||||
|
{% endblock script %}
|
||||||
|
@@ -6,15 +6,14 @@
|
|||||||
{% block message %}
|
{% block message %}
|
||||||
<p>Your server is starting up.</p>
|
<p>Your server is starting up.</p>
|
||||||
<p>You will be redirected automatically when it's ready for you.</p>
|
<p>You will be redirected automatically when it's ready for you.</p>
|
||||||
{% endblock %}
|
{% endblock message %}
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div id="progress-bar"
|
<div id="progress-bar"
|
||||||
class="progress-bar"
|
class="progress-bar"
|
||||||
role="progressbar"
|
role="progressbar"
|
||||||
aria-valuenow="0"
|
aria-valuenow="0"
|
||||||
aria-valuemin="0"
|
aria-valuemin="0"
|
||||||
aria-valuemax="100"
|
aria-valuemax="100">
|
||||||
style="width: 0%">
|
|
||||||
<span class="sr-only"><span id="sr-progress">0%</span> Complete</span>
|
<span class="sr-only"><span id="sr-progress">0%</span> Complete</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -30,67 +29,67 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock main %}
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
require(["jquery"], function ($) {
|
require(["jquery"], function($) {
|
||||||
$("#refresh").click(function () {
|
$("#refresh").click(function() {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
// hook up event-stream for progress
|
// hook up event-stream for progress
|
||||||
var evtSource = new EventSource("{{ progress_url }}");
|
var evtSource = new EventSource("{{ progress_url }}");
|
||||||
var progressMessage = $("#progress-message");
|
var progressMessage = $("#progress-message");
|
||||||
var progressBar = $("#progress-bar");
|
var progressBar = $("#progress-bar");
|
||||||
var srProgress = $("#sr-progress");
|
var srProgress = $("#sr-progress");
|
||||||
var progressLog = $("#progress-log");
|
var progressLog = $("#progress-log");
|
||||||
|
|
||||||
evtSource.onmessage = function(e) {
|
evtSource.onmessage = function(e) {
|
||||||
var evt = JSON.parse(e.data);
|
var evt = JSON.parse(e.data);
|
||||||
console.log(evt);
|
console.log(evt);
|
||||||
if (evt.progress !== undefined) {
|
if (evt.progress !== undefined) {
|
||||||
// update progress
|
// update progress
|
||||||
var progText = evt.progress.toString();
|
var progText = evt.progress.toString();
|
||||||
progressBar.attr('aria-valuenow', progText);
|
progressBar.attr('aria-valuenow', progText);
|
||||||
srProgress.text(progText + '%');
|
srProgress.text(progText + '%');
|
||||||
progressBar.css('width', progText + '%');
|
progressBar.css('width', progText + '%');
|
||||||
}
|
}
|
||||||
// update message
|
// update message
|
||||||
var html_message;
|
var html_message;
|
||||||
if (evt.html_message !== undefined) {
|
if (evt.html_message !== undefined) {
|
||||||
progressMessage.html(evt.html_message);
|
progressMessage.html(evt.html_message);
|
||||||
html_message = evt.html_message;
|
html_message = evt.html_message;
|
||||||
} else if (evt.message !== undefined) {
|
} else if (evt.message !== undefined) {
|
||||||
progressMessage.text(evt.message);
|
progressMessage.text(evt.message);
|
||||||
html_message = progressMessage.html();
|
html_message = progressMessage.html();
|
||||||
}
|
}
|
||||||
if (html_message) {
|
if (html_message) {
|
||||||
progressLog.append(
|
progressLog.append(
|
||||||
$("<div>")
|
$("<div>")
|
||||||
.addClass('progress-log-event')
|
.addClass('progress-log-event')
|
||||||
.html(html_message)
|
.html(html_message)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evt.ready) {
|
if (evt.ready) {
|
||||||
evtSource.close();
|
evtSource.close();
|
||||||
// reload the current page
|
// reload the current page
|
||||||
// which should result in a redirect to the running server
|
// which should result in a redirect to the running server
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evt.failed) {
|
if (evt.failed) {
|
||||||
evtSource.close();
|
evtSource.close();
|
||||||
// turn progress bar red
|
// turn progress bar red
|
||||||
progressBar.addClass('progress-bar-danger');
|
progressBar.addClass('progress-bar-danger');
|
||||||
// open event log for debugging
|
// open event log for debugging
|
||||||
$('#progress-details').prop('open', true);
|
$('#progress-details').prop('open', true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// signal that page has finished loading (mostly for tests)
|
// signal that page has finished loading (mostly for tests)
|
||||||
window._jupyterhub_page_loaded = true;
|
window._jupyterhub_page_loaded = true;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock script %}
|
||||||
|
@@ -14,17 +14,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock main %}
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
require(["jquery"], function ($) {
|
require(["jquery"], function($) {
|
||||||
$("#refresh").click(function () {
|
$("#refresh").click(function() {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock script %}
|
||||||
|
@@ -166,16 +166,19 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="col-sm-1 text-center">
|
<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>
|
||||||
{% endblock client_row %}
|
</td>
|
||||||
</tr>
|
{% endblock client_row %}
|
||||||
{% endfor %}
|
</tr>
|
||||||
</tbody>
|
{% endfor %}
|
||||||
</table>
|
</tbody>
|
||||||
</div>
|
</table>
|
||||||
{% endif %}
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
{% endblock main %}
|
</div>
|
||||||
{% block script %}
|
{% endblock main %}
|
||||||
{{ super() }}
|
{% block script %}
|
||||||
<script type="text/javascript">require(["token"]);</script>
|
{{ super() }}
|
||||||
{% endblock script %}
|
<script type="text/javascript">
|
||||||
|
require(["token"]);
|
||||||
|
</script>
|
||||||
|
{% endblock script %}
|
||||||
|
Reference in New Issue
Block a user