Skip to content

Commit a9ed835

Browse files
committed
style: apply rustfmt across view and component files
Reformat long tuple literals, struct initialisers, and if-else expressions to stay within the default line width. No logic changes.
1 parent 91a2de0 commit a9ed835

13 files changed

Lines changed: 461 additions & 52 deletions

File tree

nodedb-studio/src/components/popovers/notification_popover.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ use crate::state::ui::Popover;
1313
fn target_route(target: NotificationTarget) -> Route {
1414
match target {
1515
NotificationTarget::Sync => Route::Sync {},
16-
NotificationTarget::StreamsTopics => Route::Streams { tab: "topics".to_string() },
17-
NotificationTarget::StreamsCron => Route::Streams { tab: "cron".to_string() },
18-
NotificationTarget::Admin => Route::Admin { tab: "cluster".to_string() },
16+
NotificationTarget::StreamsTopics => Route::Streams {
17+
tab: "topics".to_string(),
18+
},
19+
NotificationTarget::StreamsCron => Route::Streams {
20+
tab: "cron".to_string(),
21+
},
22+
NotificationTarget::Admin => Route::Admin {
23+
tab: "cluster".to_string(),
24+
},
1925
NotificationTarget::Query => Route::Query {},
2026
}
2127
}

nodedb-studio/src/components/topbar.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ use crate::state::ui::Popover;
1818

1919
/// Open `which`, or close it if it is already the open popover.
2020
fn toggled(current: Option<Popover>, which: Popover) -> Option<Popover> {
21-
if current == Some(which) { None } else { Some(which) }
21+
if current == Some(which) {
22+
None
23+
} else {
24+
Some(which)
25+
}
2226
}
2327

2428
#[component]
@@ -34,7 +38,11 @@ pub fn Topbar() -> Element {
3438
};
3539

3640
let badge = unread_count(&notifs.read()[..], &c.capabilities);
37-
let badge_class = if badge == 0 { "bell-badge zero" } else { "bell-badge" };
41+
let badge_class = if badge == 0 {
42+
"bell-badge zero"
43+
} else {
44+
"bell-badge"
45+
};
3846

3947
rsx! {
4048
header { class: "topbar",

nodedb-studio/src/views/admin/audit.rs

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,46 @@ use dioxus::prelude::*;
66
pub fn AuditView() -> Element {
77
// (when, actor, action, target, pill-css, result)
88
let rows = [
9-
("04:18:02", "hatta", "GRANT", "role:writer → aisha", "ok", "ok"),
10-
("03:42:14", "farhan", "CREATE TABLE", "analytics.cohorts", "ok", "ok"),
11-
("03:14:08", "backup-svc", "SNAPSHOT", "full · 2.4GB", "ok", "ok"),
12-
("02:51:22", "mkhairi", "ALTER POLICY", "orders_own_only", "ok", "ok"),
13-
("02:10:01", "hatta", "LOGIN FAIL", "—", "err", "denied · bad pw"),
9+
(
10+
"04:18:02",
11+
"hatta",
12+
"GRANT",
13+
"role:writer → aisha",
14+
"ok",
15+
"ok",
16+
),
17+
(
18+
"03:42:14",
19+
"farhan",
20+
"CREATE TABLE",
21+
"analytics.cohorts",
22+
"ok",
23+
"ok",
24+
),
25+
(
26+
"03:14:08",
27+
"backup-svc",
28+
"SNAPSHOT",
29+
"full · 2.4GB",
30+
"ok",
31+
"ok",
32+
),
33+
(
34+
"02:51:22",
35+
"mkhairi",
36+
"ALTER POLICY",
37+
"orders_own_only",
38+
"ok",
39+
"ok",
40+
),
41+
(
42+
"02:10:01",
43+
"hatta",
44+
"LOGIN FAIL",
45+
"—",
46+
"err",
47+
"denied · bad pw",
48+
),
1449
("01:08:55", "hatta", "LOGIN", "—", "ok", "ok"),
1550
];
1651
rsx! {

nodedb-studio/src/views/admin/nodes.rs

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,72 @@ struct Node {
1818
#[component]
1919
pub fn NodesView() -> Element {
2020
let nodes = [
21-
Node { name: "node-1 · leader", pill_css: "ok", pill_text: "ok", points: "0,60 40,55 80,50 120,45 160,40 200,42 240,30 280,32 320,28 360,18 400,22", stroke: "#185fa5", qps: "2.1k", p99: "18ms", p99_warn: false, cpu: "42%" },
22-
Node { name: "node-2", pill_css: "ok", pill_text: "ok", points: "0,50 40,52 80,48 120,55 160,45 200,40 240,38 280,42 320,32 360,28 400,30", stroke: "#3b6d11", qps: "1.8k", p99: "22ms", p99_warn: false, cpu: "38%" },
23-
Node { name: "node-3", pill_css: "ok", pill_text: "ok", points: "0,45 40,48 80,42 120,50 160,38 200,35 240,40 280,32 320,28 360,30 400,25", stroke: "#3b6d11", qps: "1.9k", p99: "19ms", p99_warn: false, cpu: "41%" },
24-
Node { name: "node-4", pill_css: "ok", pill_text: "ok", points: "0,55 40,48 80,52 120,42 160,45 200,38 240,35 280,40 320,30 360,32 400,28", stroke: "#3b6d11", qps: "1.6k", p99: "24ms", p99_warn: false, cpu: "36%" },
25-
Node { name: "node-5", pill_css: "warn", pill_text: "lag", points: "0,30 40,40 80,35 120,55 160,50 200,62 240,58 280,68 320,65 360,72 400,70", stroke: "#854f0b", qps: "980", p99: "182ms", p99_warn: true, cpu: "78%" },
26-
Node { name: "node-6", pill_css: "ok", pill_text: "ok", points: "0,50 40,45 80,48 120,40 160,42 200,35 240,38 280,30 320,32 360,25 400,28", stroke: "#3b6d11", qps: "1.7k", p99: "21ms", p99_warn: false, cpu: "39%" },
21+
Node {
22+
name: "node-1 · leader",
23+
pill_css: "ok",
24+
pill_text: "ok",
25+
points: "0,60 40,55 80,50 120,45 160,40 200,42 240,30 280,32 320,28 360,18 400,22",
26+
stroke: "#185fa5",
27+
qps: "2.1k",
28+
p99: "18ms",
29+
p99_warn: false,
30+
cpu: "42%",
31+
},
32+
Node {
33+
name: "node-2",
34+
pill_css: "ok",
35+
pill_text: "ok",
36+
points: "0,50 40,52 80,48 120,55 160,45 200,40 240,38 280,42 320,32 360,28 400,30",
37+
stroke: "#3b6d11",
38+
qps: "1.8k",
39+
p99: "22ms",
40+
p99_warn: false,
41+
cpu: "38%",
42+
},
43+
Node {
44+
name: "node-3",
45+
pill_css: "ok",
46+
pill_text: "ok",
47+
points: "0,45 40,48 80,42 120,50 160,38 200,35 240,40 280,32 320,28 360,30 400,25",
48+
stroke: "#3b6d11",
49+
qps: "1.9k",
50+
p99: "19ms",
51+
p99_warn: false,
52+
cpu: "41%",
53+
},
54+
Node {
55+
name: "node-4",
56+
pill_css: "ok",
57+
pill_text: "ok",
58+
points: "0,55 40,48 80,52 120,42 160,45 200,38 240,35 280,40 320,30 360,32 400,28",
59+
stroke: "#3b6d11",
60+
qps: "1.6k",
61+
p99: "24ms",
62+
p99_warn: false,
63+
cpu: "36%",
64+
},
65+
Node {
66+
name: "node-5",
67+
pill_css: "warn",
68+
pill_text: "lag",
69+
points: "0,30 40,40 80,35 120,55 160,50 200,62 240,58 280,68 320,65 360,72 400,70",
70+
stroke: "#854f0b",
71+
qps: "980",
72+
p99: "182ms",
73+
p99_warn: true,
74+
cpu: "78%",
75+
},
76+
Node {
77+
name: "node-6",
78+
pill_css: "ok",
79+
pill_text: "ok",
80+
points: "0,50 40,45 80,48 120,40 160,42 200,35 240,38 280,30 320,32 360,25 400,28",
81+
stroke: "#3b6d11",
82+
qps: "1.7k",
83+
p99: "21ms",
84+
p99_warn: false,
85+
cpu: "39%",
86+
},
2787
];
2888
rsx! {
2989
div { class: "subview active",

nodedb-studio/src/views/admin/rbac.rs

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,66 @@ fn dot(on: bool) -> &'static str {
2020
#[component]
2121
pub fn RbacView() -> Element {
2222
let rows = [
23-
Row { name: "hatta", email: "hatta@nodedb.io", service: false, analyst: true, writer: true, ops: true, admin: true, last_login: "2m ago" },
24-
Row { name: "farhan", email: "", service: false, analyst: true, writer: true, ops: true, admin: true, last_login: "14m ago" },
25-
Row { name: "aisha", email: "", service: false, analyst: true, writer: true, ops: false, admin: false, last_login: "1h ago" },
26-
Row { name: "mkhairi", email: "", service: false, analyst: true, writer: true, ops: true, admin: false, last_login: "22m ago" },
27-
Row { name: "read-only-bi", email: "", service: true, analyst: true, writer: false, ops: false, admin: false, last_login: "just now" },
28-
Row { name: "backup-svc", email: "", service: true, analyst: false, writer: false, ops: true, admin: false, last_login: "4m ago" },
23+
Row {
24+
name: "hatta",
25+
email: "hatta@nodedb.io",
26+
service: false,
27+
analyst: true,
28+
writer: true,
29+
ops: true,
30+
admin: true,
31+
last_login: "2m ago",
32+
},
33+
Row {
34+
name: "farhan",
35+
email: "",
36+
service: false,
37+
analyst: true,
38+
writer: true,
39+
ops: true,
40+
admin: true,
41+
last_login: "14m ago",
42+
},
43+
Row {
44+
name: "aisha",
45+
email: "",
46+
service: false,
47+
analyst: true,
48+
writer: true,
49+
ops: false,
50+
admin: false,
51+
last_login: "1h ago",
52+
},
53+
Row {
54+
name: "mkhairi",
55+
email: "",
56+
service: false,
57+
analyst: true,
58+
writer: true,
59+
ops: true,
60+
admin: false,
61+
last_login: "22m ago",
62+
},
63+
Row {
64+
name: "read-only-bi",
65+
email: "",
66+
service: true,
67+
analyst: true,
68+
writer: false,
69+
ops: false,
70+
admin: false,
71+
last_login: "just now",
72+
},
73+
Row {
74+
name: "backup-svc",
75+
email: "",
76+
service: true,
77+
analyst: false,
78+
writer: false,
79+
ops: true,
80+
admin: false,
81+
last_login: "4m ago",
82+
},
2983
];
3084
rsx! {
3185
div { class: "subview active",

nodedb-studio/src/views/admin/shards.rs

Lines changed: 72 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,78 @@ use dioxus::prelude::*;
66
pub fn ShardsView() -> Element {
77
// (shard, range, leader, replicas, size, pill-css, status)
88
let rows = [
9-
("s_001", "[0000, 1FFF]", "node-1", "node-2, node-3", "2.4 GB", "ok", "healthy"),
10-
("s_002", "[2000, 3FFF]", "node-2", "node-3, node-4", "2.1 GB", "ok", "healthy"),
11-
("s_003", "[4000, 5FFF]", "node-3", "node-4, node-5", "2.8 GB", "warn", "replica lag"),
12-
("s_004", "[6000, 7FFF]", "node-4", "node-5, node-6", "1.9 GB", "ok", "healthy"),
13-
("s_005", "[8000, 9FFF]", "node-5", "node-6, node-7", "2.2 GB", "ok", "healthy"),
14-
("s_006", "[A000, BFFF]", "node-6", "node-7, node-1", "2.0 GB", "ok", "healthy"),
15-
("s_007", "[C000, DFFF]", "node-7", "node-1, node-2", "2.3 GB", "ok", "healthy"),
16-
("s_008", "[E000, FFFF]", "node-1", "node-2, node-3", "2.5 GB", "ok", "healthy"),
9+
(
10+
"s_001",
11+
"[0000, 1FFF]",
12+
"node-1",
13+
"node-2, node-3",
14+
"2.4 GB",
15+
"ok",
16+
"healthy",
17+
),
18+
(
19+
"s_002",
20+
"[2000, 3FFF]",
21+
"node-2",
22+
"node-3, node-4",
23+
"2.1 GB",
24+
"ok",
25+
"healthy",
26+
),
27+
(
28+
"s_003",
29+
"[4000, 5FFF]",
30+
"node-3",
31+
"node-4, node-5",
32+
"2.8 GB",
33+
"warn",
34+
"replica lag",
35+
),
36+
(
37+
"s_004",
38+
"[6000, 7FFF]",
39+
"node-4",
40+
"node-5, node-6",
41+
"1.9 GB",
42+
"ok",
43+
"healthy",
44+
),
45+
(
46+
"s_005",
47+
"[8000, 9FFF]",
48+
"node-5",
49+
"node-6, node-7",
50+
"2.2 GB",
51+
"ok",
52+
"healthy",
53+
),
54+
(
55+
"s_006",
56+
"[A000, BFFF]",
57+
"node-6",
58+
"node-7, node-1",
59+
"2.0 GB",
60+
"ok",
61+
"healthy",
62+
),
63+
(
64+
"s_007",
65+
"[C000, DFFF]",
66+
"node-7",
67+
"node-1, node-2",
68+
"2.3 GB",
69+
"ok",
70+
"healthy",
71+
),
72+
(
73+
"s_008",
74+
"[E000, FFFF]",
75+
"node-1",
76+
"node-2, node-3",
77+
"2.5 GB",
78+
"ok",
79+
"healthy",
80+
),
1781
];
1882
rsx! {
1983
div { class: "subview active",

nodedb-studio/src/views/connection_manager.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ fn ConnectionCard(conn: SavedConnection, on_connect: EventHandler<String>) -> El
8484
ConnStatus::ReadOnly => ("pill warn", "read-only", ""),
8585
ConnStatus::Offline => ("pill", "offline", "background:var(--text-tertiary)"),
8686
};
87-
let dbs = conn.db_count.map(|n| n.to_string()).unwrap_or_else(|| "—".to_string());
87+
let dbs = conn
88+
.db_count
89+
.map(|n| n.to_string())
90+
.unwrap_or_else(|| "—".to_string());
8891
let ping = conn.ping.clone().unwrap_or_else(|| "—".to_string());
8992

9093
rsx! {

nodedb-studio/src/views/explorer/viewers/kv.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ pub fn KvViewer() -> Element {
77
let rows = [
88
("flag:graphrag_v2", "bool", "5 B", "—", "true"),
99
("flag:new_explorer_skin", "bool", "5 B", "—", "false"),
10-
("session:u_44182", "json", "2.1 KB", "14m", "{{ \"user\": \"u_44182\", \"since\": \"\", … }}"),
10+
(
11+
"session:u_44182",
12+
"json",
13+
"2.1 KB",
14+
"14m",
15+
"{{ \"user\": \"u_44182\", \"since\": \"\", … }}",
16+
),
1117
("rate:/api/search", "counter", "8 B", "1m", "491"),
1218
("cache:home_dashboard", "bytes", "18 KB", "2h", "(binary)"),
1319
];

0 commit comments

Comments
 (0)