Commit c67bec54 by Marcus Efraimsson Committed by GitHub

Merge pull request #12834 from grafana/11270_secret_fields

Fix issue with secret fields after updating datasource
parents 77b561cf eb1b9405
...@@ -158,12 +158,26 @@ func UpdateDataSource(c *m.ReqContext, cmd m.UpdateDataSourceCommand) Response { ...@@ -158,12 +158,26 @@ func UpdateDataSource(c *m.ReqContext, cmd m.UpdateDataSourceCommand) Response {
} }
return Error(500, "Failed to update datasource", err) return Error(500, "Failed to update datasource", err)
} }
ds := convertModelToDtos(cmd.Result)
query := m.GetDataSourceByIdQuery{
Id: cmd.Id,
OrgId: c.OrgId,
}
if err := bus.Dispatch(&query); err != nil {
if err == m.ErrDataSourceNotFound {
return Error(404, "Data source not found", nil)
}
return Error(500, "Failed to query datasources", err)
}
dtos := convertModelToDtos(query.Result)
return JSON(200, util.DynMap{ return JSON(200, util.DynMap{
"message": "Datasource updated", "message": "Datasource updated",
"id": cmd.Id, "id": cmd.Id,
"name": cmd.Name, "name": cmd.Name,
"datasource": ds, "datasource": dtos,
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment