Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions crates/nexus/src/http/ui/handlers/databases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub async fn delete_database(
("warehouseId" = Uuid, description = "Warehouse ID"),
("databaseName" = String, description = "Database Name"),
),
operation_id = "webDatabaseDashboard",
operation_id = "webGetDatabase",
responses(
(status = 200, description = "Successful Response", body = Database),
(status = 404, description = "Database not found", body = AppError),
Expand All @@ -117,17 +117,13 @@ pub async fn get_database(
Path((warehouse_id, database_name)): Path<(Uuid, String)>,
) -> Result<Json<Database>, AppError> {
let mut warehouse = state.get_warehouse_by_id(warehouse_id).await?;
let profile = state
.get_profile_by_id(warehouse.storage_profile_id.unwrap())
.await?;
let ident = DatabaseIdent {
warehouse: WarehouseIdent::new(warehouse.id),
namespace: NamespaceIdent::new(database_name),
};
let mut database = state.get_database(&ident).await?;
let tables = state.list_tables(&ident).await?;

warehouse.with_details(Option::from(profile), None);
database.with_details(Option::from(tables));
Ok(Json(database))
}
18 changes: 6 additions & 12 deletions crates/nexus/src/http/ui/handlers/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct ApiDoc;
#[utoipa::path(
get,
path = "/ui/warehouses/{warehouseId}/databases/{databaseName}/tables/{tableName}",
operation_id = "webTableDashboard",
operation_id = "webGetTable",
params(
("warehouseId" = Uuid, description = "Warehouse ID"),
("databaseName" = String, description = "Database Name"),
Expand All @@ -53,20 +53,14 @@ pub async fn get_table(
Path((warehouse_id, database_name, table_name)): Path<(Uuid, String, String)>,
) -> Result<Json<Table>, AppError> {
let mut warehouse = state.get_warehouse_by_id(warehouse_id).await?;
let profile = state
.get_profile_by_id(warehouse.storage_profile_id.unwrap())
.await?;
let ident = DatabaseIdent {
warehouse: WarehouseIdent::new(warehouse.id),
namespace: NamespaceIdent::new(database_name),
};
let mut database = state.get_database(&ident).await?;
let table_ident = TableIdent {
database: ident,
database: DatabaseIdent {
warehouse: WarehouseIdent::new(warehouse.id),
namespace: NamespaceIdent::new(database_name),
},
table: table_name,
};
warehouse.with_details(Option::from(profile), None);
let mut table = state.get_table(&table_ident).await?;
let table = state.get_table(&table_ident).await?;
Ok(Json(table))
}

Expand Down
4 changes: 2 additions & 2 deletions crates/nexus/src/http/ui/handlers/warehouses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub async fn list_warehouses(
#[utoipa::path(
get,
path = "/ui/warehouses/{warehouseId}",
operation_id = "webWarehouseDashboard",
operation_id = "webGetWarehouse",
params(
("warehouseId" = Uuid, Path, description = "Warehouse ID")
),
Expand Down Expand Up @@ -139,7 +139,7 @@ pub async fn create_warehouse(
#[utoipa::path(
delete,
path = "/ui/warehouses/{warehouseId}",
operation_id = "webCreateWarehouse",
operation_id = "webDeleteWarehouse",
params(
("warehouseId" = Uuid, Path, description = "Warehouse ID")
),
Expand Down
8 changes: 0 additions & 8 deletions crates/nexus/src/http/ui/models/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ pub struct Table {
pub updated_at: Option<chrono::DateTime<chrono::Utc>>,
}

// impl Table {
// pub fn with_details(&mut self, database: Option<Database>) {
// if database.is_some() {
// self.database = database;
// }
// }
// }

impl From<catalog::models::Table> for Table {
fn from(table: catalog::models::Table) -> Self {
Self {
Expand Down

This file was deleted.

This file was deleted.