File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -886,6 +886,7 @@ pub struct AlertsInfo {
886
886
low : u64 ,
887
887
medium : u64 ,
888
888
high : u64 ,
889
+ critical : u64 ,
889
890
}
890
891
891
892
// TODO: add RBAC
@@ -898,6 +899,7 @@ pub async fn get_alerts_info() -> Result<AlertsInfo, AlertError> {
898
899
let mut low = 0 ;
899
900
let mut medium = 0 ;
900
901
let mut high = 0 ;
902
+ let mut critical = 0 ;
901
903
902
904
for ( _, alert) in alerts. iter ( ) {
903
905
total += 1 ;
@@ -911,7 +913,7 @@ pub async fn get_alerts_info() -> Result<AlertsInfo, AlertError> {
911
913
Severity :: Low => low += 1 ,
912
914
Severity :: Medium => medium += 1 ,
913
915
Severity :: High => high += 1 ,
914
- _ => { }
916
+ Severity :: Critical => critical += 1 ,
915
917
}
916
918
}
917
919
@@ -923,5 +925,6 @@ pub async fn get_alerts_info() -> Result<AlertsInfo, AlertError> {
923
925
low,
924
926
medium,
925
927
high,
928
+ critical,
926
929
} )
927
930
}
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ pub async fn generate_home_response(key: &SessionKey) -> Result<HomeResponse, Pr
149
149
let alerts_info = get_alerts_info ( ) . await ?;
150
150
151
151
// generate dates for date-wise stats
152
- let dates = ( 0 ..7 )
152
+ let mut dates = ( 0 ..7 )
153
153
. map ( |i| {
154
154
Utc :: now ( )
155
155
. checked_sub_signed ( chrono:: Duration :: days ( i) )
@@ -158,6 +158,7 @@ pub async fn generate_home_response(key: &SessionKey) -> Result<HomeResponse, Pr
158
158
} )
159
159
. map ( |date| date. format ( "%Y-%m-%d" ) . to_string ( ) )
160
160
. collect_vec ( ) ;
161
+ dates. reverse ( ) ;
161
162
162
163
let mut stream_details = Vec :: new ( ) ;
163
164
You can’t perform that action at this time.
0 commit comments