ezidam: apps: don't include ezidam

This commit is contained in:
Philippe Loctaux 2023-03-30 23:57:06 +02:00
parent 23f69e8377
commit 14bff68cbf
2 changed files with 33 additions and 25 deletions

View file

@ -4,10 +4,13 @@ use rocket::get;
#[get("/admin/apps")] #[get("/admin/apps")]
pub async fn admin_apps(mut db: Connection<Database>, admin: JwtAdmin) -> Result<Page> { pub async fn admin_apps(mut db: Connection<Database>, admin: JwtAdmin) -> Result<Page> {
let list = App::get_all(&mut *db, None).await?; let mut apps = App::get_all(&mut *db, None).await?;
// Remove ezidam from list
apps.retain(|app| *app.id() != AppID("ezidam".into()));
Ok(Page::AdminApps(super::content::AdminApps { Ok(Page::AdminApps(super::content::AdminApps {
user: admin.0, user: admin.0,
apps: list, apps,
})) }))
} }

View file

@ -1,9 +1,12 @@
{% extends "shell" %} {% extends "shell" %}
{% block content %} {% block content %}
{% set new_app_label = "New application" %}
{% set new_app_link = "./new" %}
<div class="page-header d-print-none"> <div class="page-header d-print-none">
<div class="container-xl"> <div class="container-xl">
<div class="row align-items-center"> <div class="row align-items-center">
{% if apps | length != 0 %}
<div class="col"> <div class="col">
<div class="page-pretitle"> <div class="page-pretitle">
Admin dashboard Admin dashboard
@ -14,38 +17,24 @@
</div> </div>
<div class="col-auto ms-auto"> <div class="col-auto ms-auto">
<div class="btn-list"> <div class="btn-list">
{% set primary_action = "New application" %} <a href="{{ new_app_link }}" class="btn btn-primary d-none d-sm-inline-block">
<a href="#" class="btn btn-primary d-none d-sm-inline-block" data-bs-toggle="modal" {% include "icons/plus" %}
data-bs-target="#modal-report"> {{ new_app_label }}
<!-- Download SVG icon from http://tabler-icons.io/i/plus -->
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24"
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M12 5l0 14"/>
<path d="M5 12l14 0"/>
</svg>
{{ primary_action }}
</a> </a>
<a href="#" class="btn btn-primary d-sm-none btn-icon" data-bs-toggle="modal" <a href="{{ new_app_link }}" class="btn btn-primary d-sm-none btn-icon"
data-bs-target="#modal-report" aria-label="{{ primary_action }}"> aria-label="{{ new_app_label }}">
<!-- Download SVG icon from http://tabler-icons.io/i/plus --> {% include "icons/plus" %}
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24"
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M12 5l0 14"/>
<path d="M5 12l14 0"/>
</svg>
</a> </a>
</div> </div>
</div> </div>
{% endif %}
</div> </div>
</div> </div>
</div> </div>
<!-- Page body --> <!-- Page body -->
<div class="page-body"> <div class="page-body">
<div class="container-xl"> <div class="container-xl">
{% if apps | length != 0 %}
<div class="card"> <div class="card">
<div id="table-default" class="table-responsive"> <div id="table-default" class="table-responsive">
<table class="table table-hover"> <table class="table table-hover">
@ -91,7 +80,7 @@
<td class="sort-id">{{ app.id }}</td> <td class="sort-id">{{ app.id }}</td>
<td class="sort-redirect-uri">{{ app.redirect_uri }}</td> <td class="sort-redirect-uri">{{ app.redirect_uri }}</td>
<td> <td>
<a class="btn btn-sm btn-outline-secondary" href="#">Details</a> <a href="#">Details</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -100,6 +89,22 @@
</table> </table>
</div> </div>
</div> </div>
{% else %}
<div class="d-flex flex-column justify-content-center">
<div class="empty">
<p class="empty-title">No registered applications</p>
<p class="empty-subtitle text-muted">
Register an application to allow users access it with ezidam.
</p>
<div class="empty-action">
<a href="{{ new_app_link }}" class="btn btn-primary">
{% include "icons/plus" %}
{{ new_app_label }}
</a>
</div>
</div>
</div>
{% endif %}
</div> </div>
</div> </div>
{% endblock content %} {% endblock content %}