-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73ff5c7
commit ce7abe6
Showing
8 changed files
with
64 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from inspect import isawaitable | ||
from jupyterhub.handlers.base import BaseHandler | ||
from jupyterhub.utils import admin_only | ||
from tornado import web | ||
|
||
from .docker import list_containers, list_images | ||
|
||
|
||
class ServersHandler(BaseHandler): | ||
""" | ||
Handler to show the list of servers available | ||
""" | ||
|
||
@web.authenticated | ||
async def get(self): | ||
images = await list_images() | ||
user = self.current_user | ||
if user.running: | ||
# trigger poll_and_notify event in case of a server that died | ||
await user.spawner.poll_and_notify() | ||
auth_state = await user.get_auth_state() | ||
print('########', auth_state) | ||
|
||
result = self.render_template( | ||
"servers.html", | ||
images=images, | ||
allow_named_servers=self.allow_named_servers, | ||
named_server_limit_per_user=await self.get_current_user_named_server_limit(), | ||
spawners=user.orm_user._orm_spawners, | ||
default_server=user.spawner, | ||
auth_state=auth_state | ||
) | ||
|
||
if isawaitable(result): | ||
self.write(await result) | ||
else: | ||
self.write(result) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% extends "page.html" %} {% block main %} | ||
<div id="servers-root"> | ||
<script id="tljh-page-data" type="application/json"> | ||
{ | ||
"images": {{ images | tojson }}, | ||
"allow_named_servers": {{allow_named_servers}}, | ||
"named_server_limit_per_user": {{named_server_limit_per_user}}, | ||
"spawners": {{spawners}}, | ||
"default_server": {{default_server}} | ||
} | ||
</script> | ||
</div> | ||
{% endblock %} |