mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Rename Id to ID in alerting models (#62777)
* Chore: Rename Id to ID in alerting models * Add xorm tags for datasource * Add xorm tag for uid
This commit is contained in:
@@ -74,11 +74,11 @@ type Service struct {
|
||||
|
||||
func DataSourceModel(orgId int64) *datasources.DataSource {
|
||||
return &datasources.DataSource{
|
||||
Id: DatasourceID,
|
||||
Uid: DatasourceUID,
|
||||
ID: DatasourceID,
|
||||
UID: DatasourceUID,
|
||||
Name: DatasourceName,
|
||||
Type: "grafana",
|
||||
OrgId: orgId,
|
||||
OrgID: orgId,
|
||||
JsonData: simplejson.New(),
|
||||
SecureJsonData: make(map[string][]byte),
|
||||
}
|
||||
|
||||
@@ -79,9 +79,9 @@ func generateRequest(ctx context.Context, ds *datasources.DataSource, decryptedJ
|
||||
}
|
||||
|
||||
instanceSettings := &backend.DataSourceInstanceSettings{
|
||||
ID: ds.Id,
|
||||
ID: ds.ID,
|
||||
Name: ds.Name,
|
||||
URL: ds.Url,
|
||||
URL: ds.URL,
|
||||
Database: ds.Database,
|
||||
User: ds.User,
|
||||
BasicAuthEnabled: ds.BasicAuth,
|
||||
@@ -89,7 +89,7 @@ func generateRequest(ctx context.Context, ds *datasources.DataSource, decryptedJ
|
||||
JSONData: jsonDataBytes,
|
||||
DecryptedSecureJSONData: decryptedJsonData,
|
||||
Updated: ds.Updated,
|
||||
UID: ds.Uid,
|
||||
UID: ds.UID,
|
||||
}
|
||||
|
||||
if query.Headers == nil {
|
||||
@@ -98,7 +98,7 @@ func generateRequest(ctx context.Context, ds *datasources.DataSource, decryptedJ
|
||||
|
||||
req := &backend.QueryDataRequest{
|
||||
PluginContext: backend.PluginContext{
|
||||
OrgID: ds.OrgId,
|
||||
OrgID: ds.OrgID,
|
||||
PluginID: ds.Type,
|
||||
User: adapters.BackendUserFromSignedInUser(query.User),
|
||||
DataSourceInstanceSettings: instanceSettings,
|
||||
|
||||
@@ -40,12 +40,12 @@ func TestHandleRequest(t *testing.T) {
|
||||
|
||||
s := ProvideService(client, nil, dsService)
|
||||
|
||||
ds := &datasources.DataSource{Id: 12, Type: "unregisteredType", JsonData: simplejson.New()}
|
||||
ds := &datasources.DataSource{ID: 12, Type: "unregisteredType", JsonData: simplejson.New()}
|
||||
req := legacydata.DataQuery{
|
||||
TimeRange: &legacydata.DataTimeRange{},
|
||||
Queries: []legacydata.DataSubQuery{
|
||||
{RefID: "A", DataSource: &datasources.DataSource{Id: 1, Type: "test"}, Model: simplejson.New()},
|
||||
{RefID: "B", DataSource: &datasources.DataSource{Id: 1, Type: "test"}, Model: simplejson.New()},
|
||||
{RefID: "A", DataSource: &datasources.DataSource{ID: 1, Type: "test"}, Model: simplejson.New()},
|
||||
{RefID: "B", DataSource: &datasources.DataSource{ID: 1, Type: "test"}, Model: simplejson.New()},
|
||||
},
|
||||
}
|
||||
res, err := s.HandleRequest(context.Background(), ds, req)
|
||||
|
||||
Reference in New Issue
Block a user