Skip to content

Commit 419c5e2

Browse files
committed
cleanup rough edges
1 parent ec843ca commit 419c5e2

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

server/src/handlers/http/users/dashboards.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use crate::{
2424
};
2525
use actix_web::{http::header::ContentType, web, HttpRequest, HttpResponse, Responder};
2626
use bytes::Bytes;
27+
2728
use http::StatusCode;
2829
use serde_json::{Error as SerdeError, Value as JsonValue};
2930

server/src/users/dashboards.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,26 @@ pub struct Pannel {
3535
chart_type: String,
3636
columns: Vec<String>,
3737
headers: Vec<String>,
38-
dimensions: (u64, u64),
38+
dimensions: Vec<u64>,
3939
}
4040

4141
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
4242
pub struct Dashboard {
4343
version: String,
44-
name: String,
45-
id: String,
44+
dashboard_name: String,
45+
dashboard_id: String,
4646
time_filter: TimeFilter,
4747
refresh_interval: u64,
4848
pannels: Vec<Pannel>,
4949
}
5050

5151
impl Dashboard {
5252
pub fn dashboard_id(&self) -> &str {
53-
&self.id
53+
&self.dashboard_id
5454
}
5555
}
5656

57-
#[derive(Default)]
57+
#[derive(Default, Debug)]
5858
pub struct Dashboards(RwLock<Vec<Dashboard>>);
5959

6060
impl Dashboards {
@@ -64,7 +64,8 @@ impl Dashboards {
6464
let store = CONFIG.storage().get_object_store();
6565
let objs = store
6666
.get_objects(Some(&path), Box::new(|path| path.ends_with(".json")))
67-
.await?;
67+
.await
68+
.unwrap_or_default();
6869

6970
for obj in objs {
7071
if let Ok(filter) = serde_json::from_slice::<Dashboard>(&obj) {

server/src/users/filters.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616
*
1717
*/
1818

19-
use std::sync::RwLock;
20-
2119
use once_cell::sync::Lazy;
2220
use relative_path::RelativePathBuf;
2321
use serde::{Deserialize, Serialize};
22+
use std::sync::RwLock;
2423

2524
use super::TimeFilter;
2625
use crate::{handlers::http::users::USERS_ROOT_DIR, metadata::LOCK_EXPECT, option::CONFIG};
@@ -51,9 +50,11 @@ impl Filters {
5150
let mut this = vec![];
5251
let path = RelativePathBuf::from(USERS_ROOT_DIR);
5352
let store = CONFIG.storage().get_object_store();
53+
5454
let objs = store
5555
.get_objects(Some(&path), Box::new(|path| path.ends_with(".json")))
56-
.await?;
56+
.await
57+
.unwrap_or_default();
5758

5859
for obj in objs {
5960
if let Ok(filter) = serde_json::from_slice::<Filter>(&obj) {

0 commit comments

Comments
 (0)