feat: layout for workspace usage
This commit is contained in:
parent
f7a8cdcd65
commit
13ce89d27e
|
|
@ -325,6 +325,7 @@ dependencies = [
|
|||
"dotenvy",
|
||||
"gotrue",
|
||||
"gotrue-entity",
|
||||
"human_bytes",
|
||||
"jwt",
|
||||
"redis 0.24.0",
|
||||
"reqwest",
|
||||
|
|
@ -2556,6 +2557,12 @@ version = "1.0.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||
|
||||
[[package]]
|
||||
name = "human_bytes"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91f255a4535024abf7640cb288260811fc14794f62b063652ed349f9a6c2348e"
|
||||
|
||||
[[package]]
|
||||
name = "humansize"
|
||||
version = "2.1.3"
|
||||
|
|
|
|||
|
|
@ -28,3 +28,4 @@ tower = "0.4"
|
|||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
|
||||
jwt = "0.16"
|
||||
human_bytes = "0.4.3"
|
||||
|
|
|
|||
|
|
@ -8,15 +8,16 @@ pub struct UserUsage {
|
|||
pub workspace_limit: u32,
|
||||
}
|
||||
|
||||
// #[derive(Template)]
|
||||
// #[template(path = "components/workspace_usage.html")]
|
||||
// pub struct WorkspaceUsage {
|
||||
// pub name: String,
|
||||
// pub member_count: u32,
|
||||
// pub member_limit: u32,
|
||||
// pub total_object_size: u64,
|
||||
// pub total_object_limit: u64,
|
||||
// }
|
||||
#[derive(Template)]
|
||||
#[template(path = "components/workspace_usage.html")]
|
||||
pub struct WorkspaceUsage<'a> {
|
||||
pub name: &'a str,
|
||||
pub member_count: u32,
|
||||
pub member_limit: u32,
|
||||
pub total_doc_size: &'a str,
|
||||
pub total_blob_size: &'a str,
|
||||
pub total_blob_limit: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "components/admin_sso_detail.html")]
|
||||
|
|
@ -45,10 +46,6 @@ pub struct Login<'a> {
|
|||
pub oauth_providers: Vec<&'a str>,
|
||||
}
|
||||
|
||||
// #[derive(Template)]
|
||||
// #[template(path = "login.html")]
|
||||
// pub struct Login;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "pages/home.html")]
|
||||
pub struct Home<'a> {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use axum::extract::{Path, State};
|
|||
use axum::response::Result;
|
||||
use axum::{response::Html, routing::get, Router};
|
||||
use gotrue_entity::dto::User;
|
||||
use human_bytes::human_bytes;
|
||||
|
||||
use crate::{templates, AppState};
|
||||
|
||||
|
|
@ -122,7 +123,14 @@ pub async fn user_usage_handler(
|
|||
}
|
||||
|
||||
pub async fn workspace_usage_handler(session: UserSession) -> Result<Html<String>, WebAppError> {
|
||||
todo!()
|
||||
render_template(templates::WorkspaceUsage {
|
||||
name: "test",
|
||||
member_count: 6,
|
||||
member_limit: 7,
|
||||
total_doc_size: &human_bytes(987654),
|
||||
total_blob_size: &human_bytes(9876543),
|
||||
total_blob_limit: &human_bytes(98765432),
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn admin_users_create_handler() -> Result<Html<String>, WebAppError> {
|
||||
|
|
|
|||
|
|
@ -5,16 +5,18 @@
|
|||
<th>Workspace Name</th>
|
||||
<th>Members</th>
|
||||
<th>Members Limit</th>
|
||||
<th>Storage Space</th>
|
||||
<th>Storage Space Limit</th>
|
||||
<th>Document Storage</th>
|
||||
<th>Object Storage</th>
|
||||
<th>Object Storage Limit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td> {{ name|escape }} </td>
|
||||
<td> {{ member_count|escape }} </td>
|
||||
<td> {{ member_limit|escape }} </td>
|
||||
<td> {{ total_doc_size|escape }} </td>
|
||||
<td> {{ total_blob_size|escape }} </td>
|
||||
<td> {{ total_blob_size_limit|escape }} </td>
|
||||
<td> {{ total_blob_limit|escape }} </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue