fix API specification for #4194
Signed-off-by: zhu733756 <talonzhu@yunify.com>
This commit is contained in:
@@ -328,7 +328,9 @@ func (h handler) handleGrafanaDashboardImport(req *restful.Request, resp *restfu
|
||||
return
|
||||
}
|
||||
|
||||
if entity.GrafanaDashboardName == "" {
|
||||
grafanaDashboardName := req.PathParameter("grafanaDashboardName")
|
||||
|
||||
if grafanaDashboardName == "" {
|
||||
err := errors.New("the requested parameter grafanaDashboardName cannot be empty")
|
||||
api.HandleBadRequest(resp, nil, err)
|
||||
return
|
||||
@@ -375,7 +377,7 @@ func (h handler) handleGrafanaDashboardImport(req *restful.Request, resp *restfu
|
||||
}
|
||||
|
||||
c := converter.NewConverter()
|
||||
convertedDashboard, err := c.ConvertToDashboard(grafanaDashboardContent, true, "", entity.GrafanaDashboardName)
|
||||
convertedDashboard, err := c.ConvertToDashboard(grafanaDashboardContent, true, "", grafanaDashboardName)
|
||||
if err != nil {
|
||||
api.HandleBadRequest(resp, nil, err)
|
||||
return
|
||||
@@ -406,7 +408,7 @@ func (h handler) handleGrafanaDashboardImport(req *restful.Request, resp *restfu
|
||||
DoRaw(ctx)
|
||||
|
||||
if err == nil {
|
||||
api.HandleBadRequest(resp, nil, errors.New("a dashboard with the same name already exists!"))
|
||||
api.HandleBadRequest(resp, nil, errors.New("a dashboard with the same name already exists."))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user