Skip to content

Commit 64594d3

Browse files
committed
Add NodeList Page
1 parent cf2cb42 commit 64594d3

File tree

18 files changed

+1087
-58
lines changed

18 files changed

+1087
-58
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ Bob Management GUI changelog
1414
- Login Page, backend (#16)
1515
- Login Page, frontend (#17)
1616
- Home page, backend (#18)
17+
- Node list page, backend (#19)
1718
- Home page, frontend (#22)
19+
- Node list page, frontend (#23)

api/openapi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
openapi: 3.0.3
23
info:
34
title: bob-management
@@ -838,3 +839,6 @@ components:
838839
tags:
839840
- name: bob
840841
description: BOB management API
842+
=======
843+
844+
>>>>>>> 3a6bfd4 (Add NodeList Page)

backend/src/connector/dto.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ impl Ord for MetricsEntryModel {
409409
impl Eq for MetricsEntryModel {}
410410
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
411411
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
412+
#[cfg_attr(all(feature = "swagger", debug_assertions), derive(ToSchema))]
413+
#[cfg_attr(all(feature = "swagger", debug_assertions), schema(as = dto::Node))]
412414
pub struct Node {
413415
#[serde(rename = "name")]
414416
pub name: String,
@@ -418,6 +420,7 @@ pub struct Node {
418420

419421
#[serde(rename = "vdisks")]
420422
#[serde(skip_serializing_if = "Option::is_none")]
423+
#[cfg_attr(all(feature = "swagger", debug_assertions), schema(value_type = Option<Vec<dto::VDisk>>))]
421424
pub vdisks: Option<Vec<VDisk>>,
422425
}
423426

@@ -697,6 +700,8 @@ impl std::str::FromStr for Partition {
697700

698701
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
699702
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
703+
#[cfg_attr(all(feature = "swagger", debug_assertions), derive(ToSchema))]
704+
#[cfg_attr(all(feature = "swagger", debug_assertions), schema(as = dto::Replica))]
700705
pub struct Replica {
701706
#[serde(rename = "node")]
702707
pub node: String,
@@ -896,12 +901,15 @@ impl std::str::FromStr for StatusExt {
896901

897902
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
898903
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
904+
#[cfg_attr(all(feature = "swagger", debug_assertions), derive(ToSchema))]
905+
#[cfg_attr(all(feature = "swagger", debug_assertions), schema(as = dto::VDisk))]
899906
pub struct VDisk {
900907
#[serde(rename = "id")]
901908
pub id: i32,
902909

903910
#[serde(rename = "replicas")]
904911
#[serde(skip_serializing_if = "Option::is_none")]
912+
#[cfg_attr(all(feature = "swagger", debug_assertions), schema(value_type = Option<Vec<dto::Replica>>))]
905913
pub replicas: Option<Vec<Replica>>,
906914
}
907915

backend/src/connector/mod.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ mod prelude {
1010
headers::{authorization::Credentials, Authorization, HeaderMapExt},
1111
http::{HeaderName, HeaderValue},
1212
};
13-
pub use futures::StreamExt;
14-
pub use hyper::{service::Service, Response, Uri};
13+
pub use futures::{Stream, StreamExt};
14+
pub use hyper::{body::Bytes, service::Service, Response, Uri};
15+
pub use std::collections::BTreeMap;
1516
pub use std::{
1617
str::FromStr,
1718
sync::Arc,
@@ -105,7 +106,7 @@ pub struct BobClient<Context: Send + Sync, Client: ApiNoContext<Context> + Send
105106
main: Arc<Client>,
106107

107108
/// Clients for all known nodes
108-
cluster: HashMap<NodeName, Arc<Client>>,
109+
cluster: BTreeMap<NodeName, Arc<Client>>,
109110

110111
context_marker: PhantomData<fn(Context)>,
111112
}
@@ -168,7 +169,7 @@ impl<Context: Send + Sync, ApiInterface: ApiNoContext<Context> + Send + Sync>
168169
.attach_printable(format!("Hostname: {}", hostname.to_string()))?
169170
};
170171

171-
let cluster: HashMap<NodeName, Arc<_>> = nodes
172+
let cluster: BTreeMap<NodeName, Arc<_>> = nodes
172173
.iter()
173174
.filter_map(|node| HttpClient::from_node(node, &bob_data.hostname, context.clone()))
174175
.collect();
@@ -177,6 +178,7 @@ impl<Context: Send + Sync, ApiInterface: ApiNoContext<Context> + Send + Sync>
177178
id: Uuid::new_v4(),
178179
hostname: bob_data.hostname,
179180
main: Arc::new(client.with_context(context)),
181+
// main: Arc::new(client),
180182
cluster,
181183
context_marker: PhantomData,
182184
})
@@ -275,7 +277,7 @@ impl<Context: Send + Sync, ApiInterface: ApiNoContext<Context> + Send + Sync>
275277
}
276278

277279
#[must_use]
278-
pub const fn cluster_with_addr(&self) -> &HashMap<NodeName, Arc<ApiInterface>> {
280+
pub const fn cluster_with_addr(&self) -> &BTreeMap<NodeName, Arc<ApiInterface>> {
279281
&self.cluster
280282
}
281283

backend/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,36 @@ impl Modify for SecurityAddon {
4141
services::api::get_nodes_count,
4242
services::api::get_rps,
4343
services::api::get_space,
44+
services::api::raw_metrics_by_node,
45+
services::api::raw_configuration_by_node,
46+
services::api::get_node_info,
47+
services::api::get_nodes_list,
4448
),
4549
components(
4650
schemas(models::shared::Credentials, models::shared::Hostname, models::shared::BobConnectionData,
51+
models::api::Disk,
4752
models::api::DiskProblem,
4853
models::api::DiskStatus,
4954
models::api::DiskStatusName,
5055
models::api::DiskCount,
56+
models::api::NodeInfo,
5157
models::api::NodeProblem,
5258
models::api::NodeStatus,
5359
models::api::NodeStatusName,
5460
models::api::NodeCount,
61+
models::api::Replica,
5562
models::api::ReplicaProblem,
5663
models::api::ReplicaStatus,
5764
models::api::SpaceInfo,
65+
models::api::VDisk,
5866
models::api::VDiskStatus,
5967
models::api::Operation,
6068
models::api::RPS,
6169
models::api::RawMetricEntry,
6270
models::api::TypedMetrics,
71+
connector::dto::Node,
72+
connector::dto::VDisk,
73+
connector::dto::Replica,
6374
connector::dto::MetricsEntryModel,
6475
connector::dto::MetricsSnapshotModel,
6576
connector::dto::NodeConfiguration

0 commit comments

Comments
 (0)