feat(sidebar): add nested virtual table groups with drag and batch move
This commit is contained in:
1 parent
0db9756a57
commit
1f43d184aa
31 files changed
+1714
-20
No files matched your search
@@ -1112,6 +1112,14 @@ async fn main() {
|
||||
.route("/changelog", get(routes::update::fetch_changelog))
|
||||
// Layout
|
||||
.route("/layout/sidebar", post(routes::layout::save_sidebar_layout).get(routes::layout::load_sidebar_layout))
|
||||
.route(
|
||||
"/layout/table-vgroups",
|
||||
post(routes::layout::save_table_vgroups).get(routes::layout::load_table_vgroups),
|
||||
)
|
||||
.route(
|
||||
"/layout/table-vgroups/connection/{connection_id}",
|
||||
delete(routes::layout::delete_table_vgroups_for_connection),
|
||||
)
|
||||
// App settings
|
||||
.route(
|
||||
"/app-settings/pinned-tree-node-ids",
|
||||
|
||||
@@ -25,3 +25,31 @@ pub async fn load_sidebar_layout(State(state): State<Arc<WebState>>) -> Result<J
|
||||
let layout = state.app.storage.load_sidebar_layout().await.map_err(AppError::from)?;
|
||||
Ok(Json(layout.unwrap_or(serde_json::json!(null))))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SaveTableVGroupsRequest {
|
||||
pub scope_key: String,
|
||||
pub layout: serde_json::Value,
|
||||
}
|
||||
|
||||
pub async fn save_table_vgroups(
|
||||
State(state): State<Arc<WebState>>,
|
||||
Json(body): Json<SaveTableVGroupsRequest>,
|
||||
) -> Result<Json<()>, AppError> {
|
||||
state.app.storage.save_table_vgroups(&body.scope_key, &body.layout).await.map_err(AppError::from)?;
|
||||
Ok(Json(()))
|
||||
}
|
||||
|
||||
pub async fn load_table_vgroups(State(state): State<Arc<WebState>>) -> Result<Json<serde_json::Value>, AppError> {
|
||||
let layouts = state.app.storage.load_table_vgroups().await.map_err(AppError::from)?;
|
||||
Ok(Json(layouts))
|
||||
}
|
||||
|
||||
pub async fn delete_table_vgroups_for_connection(
|
||||
State(state): State<Arc<WebState>>,
|
||||
axum::extract::Path(connection_id): axum::extract::Path<String>,
|
||||
) -> Result<Json<()>, AppError> {
|
||||
state.app.storage.delete_table_vgroups_for_connection(&connection_id).await.map_err(AppError::from)?;
|
||||
Ok(Json(()))
|
||||
}
|
||||
Reference in new issue
Block a user