mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(api): fixed minor issue with error message when trying to create duplicate datasource, fixes #6164
This commit is contained in:
@@ -60,6 +60,14 @@ func DeleteDataSource(cmd *m.DeleteDataSourceCommand) error {
|
||||
func AddDataSource(cmd *m.AddDataSourceCommand) error {
|
||||
|
||||
return inTransaction(func(sess *xorm.Session) error {
|
||||
|
||||
existing := m.DataSource{OrgId: cmd.OrgId, Name: cmd.Name}
|
||||
has, _ := x.Get(&existing)
|
||||
|
||||
if has {
|
||||
return m.ErrDataSourceNameExists
|
||||
}
|
||||
|
||||
ds := &m.DataSource{
|
||||
OrgId: cmd.OrgId,
|
||||
Name: cmd.Name,
|
||||
|
||||
Reference in New Issue
Block a user