Merge pull request #12834 from grafana/11270_secret_fields

Fix issue with secret fields after updating datasource
This commit is contained in:
Marcus Efraimsson 2018-08-08 09:11:07 +02:00 committed by GitHub
commit c67bec5487
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,
}) })
} }