File tree Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change @@ -1482,22 +1482,11 @@ impl AlertManagerTrait for Alerts {
1482
1482
Ok ( alerts)
1483
1483
}
1484
1484
1485
- /// Returns a sigle alert that the user has access to (based on query auth)
1485
+ /// Returns a single alert that the user has access to (based on query auth)
1486
1486
async fn get_alert_by_id ( & self , id : Ulid ) -> Result < Box < dyn AlertTrait > , AlertError > {
1487
1487
let read_access = self . alerts . read ( ) . await ;
1488
1488
if let Some ( alert) = read_access. get ( & id) {
1489
- let alert: Box < dyn AlertTrait > = match & alert. get_alert_type ( ) {
1490
- AlertType :: Threshold => {
1491
- Box :: new ( ThresholdAlert :: from ( alert. to_alert_config ( ) ) ) as Box < dyn AlertTrait >
1492
- }
1493
- AlertType :: Anomaly => {
1494
- return Err ( AlertError :: NotPresentInOSS ( "anomaly" . into ( ) ) ) ;
1495
- }
1496
- AlertType :: Forecast => {
1497
- return Err ( AlertError :: NotPresentInOSS ( "forecast" . into ( ) ) ) ;
1498
- }
1499
- } ;
1500
- Ok ( alert)
1489
+ Ok ( alert. clone_box ( ) )
1501
1490
} else {
1502
1491
Err ( AlertError :: CustomError ( format ! (
1503
1492
"No alert found for the given ID- {id}"
You can’t perform that action at this time.
0 commit comments