Skip to content

Commit fd57ad5

Browse files
committed
Add project-scoped filtering and expand mock data
- Add project selector in header with Zustand persistence - Filter all resources (VMs, Pods, Storage, Network, Logs) by project - Remove Databases view (not needed) - Expand mock data to 2-5 objects per type per project - Rename mock projects to neonwave, pixelforge, cloudharbor - Move Cluster nav item to admin section at bottom of sidebar
1 parent 9cb2ba6 commit fd57ad5

45 files changed

Lines changed: 1523 additions & 1420 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

mvirt-ui/mock-server/src/main.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ async fn main() {
2020
.allow_headers(Any);
2121

2222
let app = Router::new()
23+
// Project routes
24+
.route("/api/v1/projects", get(routes::project::list_projects))
25+
.route("/api/v1/projects/:id", get(routes::project::get_project))
2326
// VM routes
2427
.route(
2528
"/api/v1/vms",
@@ -45,23 +48,6 @@ async fn main() {
4548
)
4649
.route("/api/v1/pods/:id/start", post(routes::pod::start_pod))
4750
.route("/api/v1/pods/:id/stop", post(routes::pod::stop_pod))
48-
// Database routes
49-
.route(
50-
"/api/v1/databases",
51-
get(routes::database::list_databases).post(routes::database::create_database),
52-
)
53-
.route(
54-
"/api/v1/databases/:id",
55-
get(routes::database::get_database).delete(routes::database::delete_database),
56-
)
57-
.route(
58-
"/api/v1/databases/:id/start",
59-
post(routes::database::start_database),
60-
)
61-
.route(
62-
"/api/v1/databases/:id/stop",
63-
post(routes::database::stop_database),
64-
)
6551
// Storage routes
6652
.route(
6753
"/api/v1/storage/volumes",

mvirt-ui/mock-server/src/routes/database.rs

Lines changed: 0 additions & 224 deletions
This file was deleted.

mvirt-ui/mock-server/src/routes/log.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ use crate::state::{AppState, LogEntry, LogLevel};
1414
#[derive(Deserialize)]
1515
#[serde(rename_all = "camelCase")]
1616
pub struct LogQueryParams {
17+
#[serde(alias = "projectId")]
18+
project_id: Option<String>,
1719
object_id: Option<String>,
1820
level: Option<String>,
1921
component: Option<String>,
2022
limit: Option<usize>,
23+
#[allow(dead_code)]
2124
before_id: Option<String>,
2225
}
2326

@@ -37,6 +40,13 @@ pub async fn query_logs(
3740
.logs
3841
.iter()
3942
.filter(|log| {
43+
// Filter by project_id
44+
if let Some(ref pid) = params.project_id {
45+
if &log.project_id != pid {
46+
return false;
47+
}
48+
}
49+
4050
// Filter by object_id
4151
if let Some(ref obj_id) = params.object_id {
4252
if !log.related_object_ids.contains(obj_id) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
pub mod cluster;
2-
pub mod database;
32
pub mod log;
43
pub mod network;
54
pub mod notification;
65
pub mod pod;
6+
pub mod project;
77
pub mod storage;
88
pub mod system;
99
pub mod vm;

0 commit comments

Comments
 (0)