lots of UI tweaks

pull/280/head
Ryan Barrett 2022-11-12 23:19:09 -08:00
rodzic 4f3dc03a3e
commit 3cc1be5493
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
8 zmienionych plików z 49 dodań i 37 usunięć

Wyświetl plik

@ -28,6 +28,9 @@ handlers:
- url: /oauth_dropins_static
static_dir: oauth_dropins_static
- url: /fonts
static_dir: oauth_dropins_fonts
- url: /favicon.ico
static_files: static/favicon.ico
upload: static/favicon.ico

Wyświetl plik

@ -0,0 +1 @@
../oauth-dropins/oauth_dropins/fonts

Wyświetl plik

@ -9,6 +9,7 @@ from flask import render_template, request
from google.cloud.ndb.stats import KindStat
from oauth_dropins.webutil import flask_util, logs, util
from oauth_dropins.webutil.flask_util import error
from oauth_dropins.webutil.util import json_dumps, json_loads
from app import app, cache
import common
@ -47,6 +48,7 @@ def user(domain):
return render_template(
'user.html',
logs=logs,
util=util,
**locals(),
)
@ -66,12 +68,12 @@ def followers(domain):
).order(-Follower.updated)
followers, before, after = fetch_page(query, Follower)
follower_links = [
util.pretty_link(
f.src,
text=re.sub(r'^https?://(.+)/(users/|@)(.+)$', r'@\3@\1', f.src),
) for f in followers
]
for f in followers:
f.url = f.src
f.handle = re.sub(r'^https?://(.+)/(users/|@)(.+)$', r'@\3@\1', f.src)
if f.last_follow:
last_follow = json_loads(f.last_follow)
f.picture = last_follow.get('actor', {}).get('icon', {}).get('url')
return render_template(
'followers.html',
@ -91,12 +93,9 @@ def following(domain):
).order(-Follower.updated)
followers, before, after = fetch_page(query, Follower)
follower_links = [
util.pretty_link(
f.src,
text=re.sub(r'^https?://(.+)/(users/|@)(.+)$', r'@\3@\1', f.dest),
) for f in followers
]
for f in followers:
f.url = f.dest
f.handle = re.sub(r'^https?://(.+)/(users/|@)(.+)$', r'@\3@\1', f.dest)
return render_template(
'following.html',
@ -112,9 +111,10 @@ def recent():
query = Activity.query(Activity.status.IN(('new', 'complete', 'error')))
activities, before, after = fetch_page(query, Activity)
return render_template(
'recent.html',
util=util,
**locals(),
'recent.html',
logs=logs,
util=util,
**locals(),
)
@ -160,11 +160,6 @@ def fetch_page(query, model_class):
query_iter = query.iter()
results = sorted(islice(query_iter, 0, 20), key=lambda r: r.updated, reverse=True)
for r in results:
r.log_url_path = '/log?' + urllib.parse.urlencode({
'key': r.key.id(),
'start_time': calendar.timegm(r.updated.timetuple()),
})
# calculate new paging param(s)
has_next = results and query_iter.probably_has_next()

Wyświetl plik

@ -164,3 +164,16 @@ td, th {
padding-top: .2em;
padding-bottom: .2em;
}
.follower {
text-align: left;
margin-top: .5em;
}
/* .glyphicon-warning-sign { color: gold; } */
.glyphicon-ok-sign { color: green; }
.glyphicon-exclamation-sign { color: gold; }
.glyphicon-pause { color: gold; }
.glyphicon-refresh { color: blue; }
.glyphicon-remove { color: red !important; }
.glyphicon-transfer { color: blue; }

Wyświetl plik

@ -1,10 +1,13 @@
<br>
<div class="row">
{% for link in follower_links %}
<div class="col-sm-4">{{ link|safe }}</div>
{% for f in followers %}
<a class="follower col-xs-6 col-sm-4" href="{{ f.url }}" title="{{ f.handle }}">
<img class="profile u-photo" src="{{ f.picture }}" width="48px">
{{ util.ellipsize(f.handle, chars=25) }}
</a>
{% else %}
<div class="col-sm-4">None</div>
None
{% endfor %}
</div>

Wyświetl plik

@ -1,23 +1,20 @@
<!-- <table> -->
<!-- <tr><th>Source</th> <th>Target</th> <th>Protocol</th> <th>Status</th> <th>Time (click for log)</th></tr> -->
<br>
{% for a in activities %}
<div class="row">
<div class="col-sm-3">{{ util.pretty_link(a.source())|safe }}</div>
<div class="col-sm-3">{{ util.pretty_link(a.target())|safe }}</div>
<div class="col-sm-2">{{ a.protocol }}</div>
<div class="col-sm-2">{{ a.status }}</div>
<div class="col-sm-2">
{% if a.log_url_path %}<a href="{{ a.log_url_path }}">{% endif %}
{{ a.updated.replace(microsecond=0) }}
{% if a.log_url_path %}</a>{% endif %}
<div class="col-sm-5">{{ util.pretty_link(a.source())|safe }}</div>
<div class="col-sm-4">{{ util.pretty_link(a.target())|safe }}</div>
<div class="col-sm-3">
{% if a.status == 'error' %}
<span title="Error" class="glyphicon glyphicon-exclamation-sign"></span>
{% else %}{% if a.status == 'new' %}
<span title="Processing" class="glyphicon glyphicon-transfer"></span>
{% endif %}{% endif %}
{{ logs.maybe_link(a.updated, a.key)|safe }}
</div>
</div>
{% else %}
<div class="row">None</div>
{% endfor %}
<!-- </table> -->
{% include "paging.html" %}

Wyświetl plik

@ -5,7 +5,7 @@
{% block content %}
<h2 class="row">
<a href="https://{{ domain }}/">🌐 {{ domain }}</a>'s followers:
<a href="/user/{{ domain }}">🌐 {{ domain }}</a>'s followers:
</h2>
{% include "_followers.html" %}

Wyświetl plik

@ -5,7 +5,7 @@
{% block content %}
<h2 class="row">
<a href="https://{{ domain }}/">🌐 {{ domain }}</a> is following:
<a href="/user/{{ domain }}">🌐 {{ domain }}</a> is following:
</h2>
{% include "_followers.html" %}