forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request grafana#9594 from bergquist/datasources_optimistic…
…_concurrency datasources: change to optimistic concurrency
- Loading branch information
Showing
8 changed files
with
200 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package dtos | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/grafana/grafana/pkg/components/simplejson" | ||
m "github.com/grafana/grafana/pkg/models" | ||
) | ||
|
||
type DataSource struct { | ||
Id int64 `json:"id"` | ||
OrgId int64 `json:"orgId"` | ||
Name string `json:"name"` | ||
Type string `json:"type"` | ||
TypeLogoUrl string `json:"typeLogoUrl"` | ||
Access m.DsAccess `json:"access"` | ||
Url string `json:"url"` | ||
Password string `json:"password"` | ||
User string `json:"user"` | ||
Database string `json:"database"` | ||
BasicAuth bool `json:"basicAuth"` | ||
BasicAuthUser string `json:"basicAuthUser"` | ||
BasicAuthPassword string `json:"basicAuthPassword"` | ||
WithCredentials bool `json:"withCredentials"` | ||
IsDefault bool `json:"isDefault"` | ||
JsonData *simplejson.Json `json:"jsonData,omitempty"` | ||
SecureJsonFields map[string]bool `json:"secureJsonFields"` | ||
Version int `json:"version"` | ||
} | ||
|
||
type DataSourceListItemDTO struct { | ||
Id int64 `json:"id"` | ||
OrgId int64 `json:"orgId"` | ||
Name string `json:"name"` | ||
Type string `json:"type"` | ||
TypeLogoUrl string `json:"typeLogoUrl"` | ||
Access m.DsAccess `json:"access"` | ||
Url string `json:"url"` | ||
Password string `json:"password"` | ||
User string `json:"user"` | ||
Database string `json:"database"` | ||
BasicAuth bool `json:"basicAuth"` | ||
IsDefault bool `json:"isDefault"` | ||
JsonData *simplejson.Json `json:"jsonData,omitempty"` | ||
} | ||
|
||
type DataSourceList []DataSourceListItemDTO | ||
|
||
func (slice DataSourceList) Len() int { | ||
return len(slice) | ||
} | ||
|
||
func (slice DataSourceList) Less(i, j int) bool { | ||
return strings.ToLower(slice[i].Name) < strings.ToLower(slice[j].Name) | ||
} | ||
|
||
func (slice DataSourceList) Swap(i, j int) { | ||
slice[i], slice[j] = slice[j], slice[i] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.