feat: add reload button
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
cellarspoon 2022-01-10 16:31:09 +01:00
parent 24f2aff90a
commit 2032816eaa
No known key found for this signature in database
GPG Key ID: 03789458B3D0C410
3 changed files with 33 additions and 2 deletions

View File

@ -21,7 +21,14 @@ from members_lumbung_space.keycloak import init_keycloak
from members_lumbung_space.nextcloud import init_resource_map
from members_lumbung_space.oidc import init_oidc
from members_lumbung_space.redis import Redis, init_redis
from members_lumbung_space.routes import health, invite, oidc, register, root
from members_lumbung_space.routes import (
health,
invite,
oidc,
register,
resource,
root,
)
log = logging.getLogger("uvicorn")
log.setLevel(APP_LOG_LEVEL)
@ -73,3 +80,4 @@ app.include_router(oidc.router)
app.include_router(register.router)
app.include_router(root.router)
app.include_router(health.router)
app.include_router(resource.router)

View File

@ -0,0 +1,16 @@
"""Resource map routes."""
from fastapi import APIRouter, Depends, Request
from fastapi.responses import RedirectResponse
from members_lumbung_space.dependencies import logged_in
router = APIRouter()
@router.get("/resource/generate", dependencies=[Depends(logged_in)])
async def generate_resource_map(request: Request):
from members_lumbung_space.nextcloud import init_resource_map
await init_resource_map(request.app)
return RedirectResponse(request.url_for("home"))

View File

@ -48,8 +48,15 @@
<div>
<h2>Resource map</h2>
<p>(i have no idea how to render this)<p>
<p>
<a href="{{ url_for('generate_resource_map') }}">Regenerate</a>
</p>
<p>(PS. i have no idea how to render this)<p>
<div>{{ resource_map }}</div>
</div>
{% endblock %}