chore: remove deprecated
This commit is contained in:
parent
d9cf920bb9
commit
e96e863c58
|
|
@ -5,7 +5,6 @@ pub struct Config {
|
|||
pub redis_url: String,
|
||||
pub gotrue_url: String,
|
||||
pub appflowy_cloud_url: String,
|
||||
pub appflowy_cloud_gateway_url: String,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
|
|
@ -17,11 +16,6 @@ impl Config {
|
|||
"ADMIN_FRONTEND_APPFLOWY_CLOUD_URL",
|
||||
"http://localhost:8000",
|
||||
),
|
||||
|
||||
appflowy_cloud_gateway_url: get_or_default(
|
||||
"ADMIN_FRONTEND_APPFLOWY_CLOUD_GATEWAY_URL",
|
||||
"http://localhost:8100",
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use super::{
|
|||
check_response,
|
||||
entities::{
|
||||
UserProfile, UserUsageLimit, WorkspaceBlobUsage, WorkspaceDocUsage, WorkspaceMember,
|
||||
WorkspaceUsageLimit, WorkspaceUsageLimits,
|
||||
WorkspaceUsageLimits,
|
||||
},
|
||||
error::Error,
|
||||
from_json_response,
|
||||
|
|
@ -55,7 +55,6 @@ pub async fn get_user_workspace_limit(
|
|||
pub async fn get_user_workspace_usages(
|
||||
access_token: &str,
|
||||
appflowy_cloud_base_url: &str,
|
||||
appflowy_cloud_gateway_base_url: &str,
|
||||
) -> Result<Vec<WorkspaceUsageLimits>, Error> {
|
||||
let user_workspaces = get_user_owned_workspaces(access_token, appflowy_cloud_base_url).await?;
|
||||
|
||||
|
|
@ -82,26 +81,11 @@ pub async fn get_user_workspace_usages(
|
|||
})
|
||||
};
|
||||
|
||||
let workspace_limits =
|
||||
get_user_workspace_limits(&workspace_id, access_token, appflowy_cloud_gateway_base_url).await;
|
||||
let (member_limit, total_blob_limit) = match workspace_limits {
|
||||
Ok(limit) => (
|
||||
limit.member_count.to_string(),
|
||||
human_bytes::human_bytes(limit.total_blob_size as f64),
|
||||
),
|
||||
Err(e) => {
|
||||
tracing::warn!("Error getting user workspace limits: {:?}", e);
|
||||
("N/A".to_string(), "N/A".to_string())
|
||||
},
|
||||
};
|
||||
|
||||
workspace_usages.push(WorkspaceUsageLimits {
|
||||
name: user_workspace.workspace_name,
|
||||
member_count: members.len(),
|
||||
member_limit,
|
||||
total_doc_size,
|
||||
total_blob_size,
|
||||
total_blob_limit,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -160,24 +144,6 @@ pub async fn get_accepted_workspace_invitations(
|
|||
from_json_response(resp).await
|
||||
}
|
||||
|
||||
async fn get_user_workspace_limits(
|
||||
workspace_id: &str,
|
||||
access_token: &str,
|
||||
appflowy_cloud_gateway_base_url: &str,
|
||||
) -> Result<WorkspaceUsageLimit, Error> {
|
||||
let http_client = reqwest::Client::new();
|
||||
let resp = http_client
|
||||
.get(format!(
|
||||
"{}/api/workspace/{}/limit",
|
||||
appflowy_cloud_gateway_base_url, workspace_id
|
||||
))
|
||||
.header("Authorization", format!("Bearer {}", access_token))
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
from_json_response(resp).await
|
||||
}
|
||||
|
||||
async fn get_user_workspace_blob_usage(
|
||||
workspace_id: &str,
|
||||
access_token: &str,
|
||||
|
|
|
|||
|
|
@ -16,10 +16,8 @@ pub struct UserUsageLimit {
|
|||
pub struct WorkspaceUsageLimits {
|
||||
pub name: String,
|
||||
pub member_count: usize,
|
||||
pub member_limit: String,
|
||||
pub total_doc_size: String,
|
||||
pub total_blob_size: String,
|
||||
pub total_blob_limit: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ async fn main() {
|
|||
|
||||
let state = AppState {
|
||||
appflowy_cloud_url: config.appflowy_cloud_url,
|
||||
appflowy_cloud_gateway_url: config.appflowy_cloud_gateway_url,
|
||||
gotrue_client,
|
||||
session_store,
|
||||
};
|
||||
|
|
@ -78,7 +77,6 @@ async fn main() {
|
|||
#[derive(Clone)]
|
||||
pub struct AppState {
|
||||
pub appflowy_cloud_url: String,
|
||||
pub appflowy_cloud_gateway_url: String,
|
||||
pub gotrue_client: gotrue::api::Client,
|
||||
pub session_store: session::SessionStorage,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -308,16 +308,14 @@ async fn user_usage_handler(
|
|||
0
|
||||
});
|
||||
|
||||
let workspace_limit = get_user_workspace_limit(
|
||||
&session.token.access_token,
|
||||
&state.appflowy_cloud_gateway_url,
|
||||
)
|
||||
.await
|
||||
.map(|limit| limit.workspace_count.to_string())
|
||||
.unwrap_or_else(|err| {
|
||||
tracing::warn!("unable to get user workspace limit: {:?}", err);
|
||||
"N/A".to_owned()
|
||||
});
|
||||
let workspace_limit =
|
||||
get_user_workspace_limit(&session.token.access_token, &state.appflowy_cloud_url)
|
||||
.await
|
||||
.map(|limit| limit.workspace_count.to_string())
|
||||
.unwrap_or_else(|err| {
|
||||
tracing::warn!("unable to get user workspace limit: {:?}", err);
|
||||
"N/A".to_owned()
|
||||
});
|
||||
|
||||
render_template(templates::UserUsage {
|
||||
workspace_count,
|
||||
|
|
@ -329,12 +327,8 @@ async fn workspace_usage_handler(
|
|||
State(app_state): State<AppState>,
|
||||
session: UserSession,
|
||||
) -> Result<Html<String>, WebAppError> {
|
||||
let workspace_usages = get_user_workspace_usages(
|
||||
&session.token.access_token,
|
||||
&app_state.appflowy_cloud_url,
|
||||
&app_state.appflowy_cloud_gateway_url,
|
||||
)
|
||||
.await?;
|
||||
let workspace_usages =
|
||||
get_user_workspace_usages(&session.token.access_token, &app_state.appflowy_cloud_url).await?;
|
||||
render_template(templates::WorkspaceUsageList { workspace_usages })
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,8 @@
|
|||
<tr>
|
||||
<th>Workspace Name</th>
|
||||
<th>Members</th>
|
||||
<th>Members Limit</th>
|
||||
<th>Document Storage</th>
|
||||
<th>Object Storage</th>
|
||||
<th>Object Storage Limit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
|
@ -15,12 +13,8 @@
|
|||
<tr>
|
||||
<td> {{ workspace_usage.name|escape }} </td>
|
||||
<td> {{ workspace_usage.member_count|escape }} </td>
|
||||
<td> {{ workspace_usage.member_limit|escape }} </td>
|
||||
<td> {{ workspace_usage.total_doc_size|escape }} </td>
|
||||
<td> {{ workspace_usage.total_blob_size|escape }} </td>
|
||||
<td> {{ workspace_usage.total_blob_limit|escape }} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
|
||||
<br />
|
||||
<span>   </span>
|
||||
<div style="max-width: 256px; display: flex; align-items: center">
|
||||
<img src="https://cdn.prod.website-files.com/5c14e387dab576fe667689cf/61e1116779fc0a9bd5bdbcc7_Frame%206.png" alt="kofi" width="32" height="32">
|
||||
<i>
|
||||
|
|
@ -114,10 +114,10 @@
|
|||
</i>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<span>   </span>
|
||||
<div style="max-width: 256px">
|
||||
<small style="color: #888; text-align: center;"><i>
|
||||
 
|
||||
By clicking logging in or signing up, you confirm that you have read, understood, and agreed to AppFlowy's
|
||||
<a href="https://appflowy.io/terms">Terms</a> and
|
||||
<a href="https://appflowy.io/privacy">Privacy Policy</a>.
|
||||
|
|
|
|||
Loading…
Reference in New Issue