mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Correlations: Return 200 instead of 404 for empt correlation lists (#55242)
* return 200 instead of 404 for empty correlations list * handle empty list response & improve consistency
This commit is contained in:
@@ -224,7 +224,7 @@ func (s *CorrelationsService) getCorrelationHandler(c *models.ReqContext) respon
|
||||
return response.Error(http.StatusNotFound, "Source data source not found", err)
|
||||
}
|
||||
|
||||
return response.Error(http.StatusInternalServerError, "Failed to update correlation", err)
|
||||
return response.Error(http.StatusInternalServerError, "Failed to get correlation", err)
|
||||
}
|
||||
|
||||
return response.JSON(http.StatusOK, correlation)
|
||||
@@ -270,7 +270,7 @@ func (s *CorrelationsService) getCorrelationsBySourceUIDHandler(c *models.ReqCon
|
||||
return response.Error(http.StatusNotFound, "Source data source not found", err)
|
||||
}
|
||||
|
||||
return response.Error(http.StatusInternalServerError, "Failed to update correlation", err)
|
||||
return response.Error(http.StatusInternalServerError, "Failed to get correlations", err)
|
||||
}
|
||||
|
||||
return response.JSON(http.StatusOK, correlations)
|
||||
@@ -309,7 +309,7 @@ func (s *CorrelationsService) getCorrelationsHandler(c *models.ReqContext) respo
|
||||
return response.Error(http.StatusNotFound, "No correlation found", err)
|
||||
}
|
||||
|
||||
return response.Error(http.StatusInternalServerError, "Failed to update correlation", err)
|
||||
return response.Error(http.StatusInternalServerError, "Failed to get correlations", err)
|
||||
}
|
||||
|
||||
return response.JSON(http.StatusOK, correlations)
|
||||
|
@@ -192,10 +192,6 @@ func (s CorrelationsService) getCorrelationsBySourceUID(ctx context.Context, cmd
|
||||
return []Correlation{}, err
|
||||
}
|
||||
|
||||
if len(correlations) == 0 {
|
||||
return []Correlation{}, ErrCorrelationNotFound
|
||||
}
|
||||
|
||||
return correlations, nil
|
||||
}
|
||||
|
||||
@@ -209,10 +205,6 @@ func (s CorrelationsService) getCorrelations(ctx context.Context, cmd GetCorrela
|
||||
return []Correlation{}, err
|
||||
}
|
||||
|
||||
if len(correlations) == 0 {
|
||||
return []Correlation{}, ErrCorrelationNotFound
|
||||
}
|
||||
|
||||
return correlations, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user