Skip to content

Commit 128e456

Browse files
committed
Simplify the /files documentation
Remove most of the documentation in favor of a link to a new page on rsp.lsst.io. Display the WebDAV file server timeout in a more human-readable form.
1 parent 4f7849f commit 128e456

File tree

4 files changed

+71
-131
lines changed

4 files changed

+71
-131
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
### Bug fixes
2+
3+
- Display the timeout in the `/files` documentation in a more human-readable format.
4+
5+
### Other changes
6+
7+
- Remove most of the `/files` documentation in favor of a link to [rsp.lsst.io](https://rsp.lsst.io/guides/notebooks/extfileaccess/webdav/).

controller/src/controller/templates.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,28 @@ def _format_timedelta(delta: timedelta) -> str:
3333
Returns
3434
-------
3535
str
36-
Human-readable equivalent using ``d`` for days, ``h`` for hours, ``m``
37-
for minutes, and ``s`` for seconds. Daylight saving time transitions
38-
are not taken into account.
36+
Human-readable equivalent. Daylight saving time transitions are not
37+
taken into account.
3938
"""
4039
seconds = int(delta.total_seconds())
4140
days, seconds = divmod(seconds, 86400)
4241
hours, seconds = divmod(seconds, 3600)
4342
minutes, seconds = divmod(seconds, 60)
4443
string = ""
4544
if days:
46-
string = f"{days}d"
45+
string = f"{days} " + ("day" if days == 1 else "days")
4746
if hours:
48-
string += f"{hours}h"
47+
if string:
48+
string += " "
49+
string += f"{hours} " + ("hour" if hours == 1 else "hours")
4950
if minutes:
50-
string += f"{minutes}m"
51+
if string:
52+
string += " "
53+
string += f"{minutes} " + ("minute" if minutes == 1 else "minutes")
5154
if seconds:
52-
string += f"{seconds}s"
55+
if string:
56+
string += " "
57+
string += f"{seconds} " + ("second" if seconds == 1 else "seconds")
5358
return string
5459

5560

Original file line numberDiff line numberDiff line change
@@ -1,64 +1,28 @@
11
<html>
2-
<head>
3-
<title>
4-
User Fileserver Created
5-
</title>
6-
</head>
7-
</body>
8-
<h1>
9-
Your fileserver is ready.
10-
<h1>
11-
12-
<h2>
13-
Access Token
14-
</h2>
15-
16-
<p> If you do not have an access token, go to <a
17-
href="{{ base_url }}/auth/tokens">the Gafaelfawr tokens page</a> and press
18-
the "Create Token" button. </p>
19-
20-
<p>
21-
Give that token a name, such as "fileserver", the "exec:notebook" scope,
22-
and a reasonable expiration duration, such as 1 month.
23-
</p>
24-
25-
<p>
26-
Press "Create".
27-
</p>
28-
29-
<p>
30-
Your token will be displayed. Copy this token and save it somewhere
31-
safe; you will never be able to view it from the tokens page again.
32-
</p>
33-
34-
<h2>
35-
Using the Fileserver
36-
</h2>
37-
38-
<p>
39-
To use the fileserver, you will need a WebDAV client of your choice.
40-
Mac and Windows have built-in WebDAV clients (this is "Connect to
41-
Server..." or "Map Network Drive..."), as do Gnome Nautilus and
42-
Konqueror for Linux. The open-source command-line client
43-
<a href="https://github.com/notroj/cadaver">cadaver</a> should build on
44-
almost any Unix-like system and will work.
45-
</p>
46-
47-
<p>
48-
Connect to
49-
<a href="{{ base_url }}{{ path_prefix }}/{{ username }}">{{ base_url }}{{ path_prefix }}/{{ username }}</a>
50-
with your WebDAV client (for Konqueror, use "webdav" or "webdavs" rather
51-
than "http" or "https" as the protocol). Use the token you acquired
52-
earlier as the password. You can use any string for your username
53-
(since the token belongs to you, it identifies you), but "{{ username }}"
54-
would be both accurate and traditional.
55-
</p>
56-
57-
<p>
58-
If you make no requests in {{ timeout | format_timedelta }}, the fileserver will shut
59-
down. If that occurs, simply go back to
60-
<a href="{{ base_url }}{{ path_prefix }}">{{ base_url }}{{ path_prefix }}</a>
61-
and a new fileserver will be created for you.
62-
</p>
63-
</body>
2+
<head>
3+
<title>File server is running</title>
4+
</head>
5+
<body>
6+
<h1>File server is running</h1>
7+
8+
<p>
9+
Your WebDAV file server for username {{ username }} is running. The
10+
URL to enter into a WebDAV client is:
11+
</p>
12+
13+
<pre>{{ base_url }}{{ path_prefix }}/{{ username }}</pre>
14+
15+
<p>
16+
For instructions on how to use the file server, see
17+
<a href="https://rsp.lsst.io/guides/notebooks/extfileaccess/webdav/">the
18+
rsp.lsst.io documentation</a>.
19+
</p>
20+
21+
<p>
22+
If you make no requests for {{ timeout | format_timedelta }}, the
23+
file server will shut down and you will need to return to
24+
<a href="{{ base_url }}{{ path_prefix }}">this page</a> to start it
25+
again.
26+
</p>
27+
</body>
6428
</html>
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,28 @@
11
<html>
2-
<head>
3-
<title>
4-
User Fileserver Created
5-
</title>
6-
</head>
7-
</body>
8-
<h1>
9-
Your fileserver is ready.
10-
<h1>
11-
12-
<h2>
13-
Access Token
14-
</h2>
15-
16-
<p> If you do not have an access token, go to <a
17-
href="http://127.0.0.1:8080/auth/tokens">the Gafaelfawr tokens page</a> and press
18-
the "Create Token" button. </p>
19-
20-
<p>
21-
Give that token a name, such as "fileserver", the "exec:notebook" scope,
22-
and a reasonable expiration duration, such as 1 month.
23-
</p>
24-
25-
<p>
26-
Press "Create".
27-
</p>
28-
29-
<p>
30-
Your token will be displayed. Copy this token and save it somewhere
31-
safe; you will never be able to view it from the tokens page again.
32-
</p>
33-
34-
<h2>
35-
Using the Fileserver
36-
</h2>
37-
38-
<p>
39-
To use the fileserver, you will need a WebDAV client of your choice.
40-
Mac and Windows have built-in WebDAV clients (this is "Connect to
41-
Server..." or "Map Network Drive..."), as do Gnome Nautilus and
42-
Konqueror for Linux. The open-source command-line client
43-
<a href="https://github.com/notroj/cadaver">cadaver</a> should build on
44-
almost any Unix-like system and will work.
45-
</p>
46-
47-
<p>
48-
Connect to
49-
<a href="http://127.0.0.1:8080/files/rachel">http://127.0.0.1:8080/files/rachel</a>
50-
with your WebDAV client (for Konqueror, use "webdav" or "webdavs" rather
51-
than "http" or "https" as the protocol). Use the token you acquired
52-
earlier as the password. You can use any string for your username
53-
(since the token belongs to you, it identifies you), but "rachel"
54-
would be both accurate and traditional.
55-
</p>
56-
57-
<p>
58-
If you make no requests in 1h, the fileserver will shut
59-
down. If that occurs, simply go back to
60-
<a href="http://127.0.0.1:8080/files">http://127.0.0.1:8080/files</a>
61-
and a new fileserver will be created for you.
62-
</p>
63-
</body>
2+
<head>
3+
<title>File server is running</title>
4+
</head>
5+
<body>
6+
<h1>File server is running</h1>
7+
8+
<p>
9+
Your WebDAV file server for username rachel is running. The
10+
URL to enter into a WebDAV client is:
11+
</p>
12+
13+
<pre>http://127.0.0.1:8080/files/rachel</pre>
14+
15+
<p>
16+
For instructions on how to use the file server, see
17+
<a href="https://rsp.lsst.io/guides/notebooks/extfileaccess/webdav/">the
18+
rsp.lsst.io documentation</a>.
19+
</p>
20+
21+
<p>
22+
If you make no requests for 1 hour, the
23+
file server will shut down and you will need to return to
24+
<a href="http://127.0.0.1:8080/files">this page</a> to start it
25+
again.
26+
</p>
27+
</body>
6428
</html>

0 commit comments

Comments
 (0)