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:
idafurjes
2023-02-02 17:22:43 +01:00
committed by GitHub
parent 48a374f50b
commit 23c27cffb3
88 changed files with 698 additions and 698 deletions
+2 -2
View File
@@ -131,7 +131,7 @@ func (s *Service) buildGraph(req *Request) (*simple.DirectedGraph, error) {
dp := simple.NewDirectedGraph()
for _, query := range req.Queries {
if query.DataSource == nil || query.DataSource.Uid == "" {
if query.DataSource == nil || query.DataSource.UID == "" {
return nil, fmt.Errorf("missing datasource uid in query with refId %v", query.RefID)
}
@@ -157,7 +157,7 @@ func (s *Service) buildGraph(req *Request) (*simple.DirectedGraph, error) {
var node Node
if IsDataSource(rn.DataSource.Uid) {
if IsDataSource(rn.DataSource.UID) {
node, err = buildCMDNode(dp, rn)
} else {
node, err = s.buildDSNode(dp, rn, req)
+4 -4
View File
@@ -32,7 +32,7 @@ func TestServicebuildPipeLine(t *testing.T) {
{
RefID: "B",
DataSource: &datasources.DataSource{
Uid: "Fake",
UID: "Fake",
},
TimeRange: AbsoluteTimeRange{},
},
@@ -143,7 +143,7 @@ func TestServicebuildPipeLine(t *testing.T) {
{
RefID: "C",
DataSource: &datasources.DataSource{
Uid: "Fake",
UID: "Fake",
},
TimeRange: AbsoluteTimeRange{},
},
@@ -198,7 +198,7 @@ func TestServicebuildPipeLine(t *testing.T) {
{
RefID: "C",
DataSource: &datasources.DataSource{
Uid: "Fake",
UID: "Fake",
},
TimeRange: AbsoluteTimeRange{},
},
@@ -222,7 +222,7 @@ func TestServicebuildPipeLine(t *testing.T) {
{
RefID: "B",
DataSource: &datasources.DataSource{
Uid: "Fake",
UID: "Fake",
},
TimeRange: AbsoluteTimeRange{},
},
+1 -1
View File
@@ -201,7 +201,7 @@ func (s *Service) buildDSNode(dp *simple.DirectedGraph, rn *rawNode, req *Reques
// other nodes they must have already been executed and their results must
// already by in vars.
func (dn *DSNode) Execute(ctx context.Context, now time.Time, _ mathexp.Vars, s *Service) (r mathexp.Results, e error) {
logger := logger.FromContext(ctx).New("datasourceType", dn.datasource.Type, "queryRefId", dn.refID, "datasourceUid", dn.datasource.Uid, "datasourceVersion", dn.datasource.Version)
logger := logger.FromContext(ctx).New("datasourceType", dn.datasource.Type, "queryRefId", dn.refID, "datasourceUid", dn.datasource.UID, "datasourceVersion", dn.datasource.Version)
dsInstanceSettings, err := adapters.ModelToInstanceSettings(dn.datasource, s.decryptSecureJsonDataFn(ctx))
if err != nil {
return mathexp.Results{}, fmt.Errorf("%v: %w", "failed to convert datasource instance settings", err)
+2 -2
View File
@@ -79,8 +79,8 @@ func (s *Service) ExecutePipeline(ctx context.Context, now time.Time, pipeline D
func DataSourceModel() *datasources.DataSource {
return &datasources.DataSource{
Id: DatasourceID,
Uid: DatasourceUID,
ID: DatasourceID,
UID: DatasourceUID,
Name: DatasourceUID,
Type: DatasourceType,
JsonData: simplejson.New(),
+2 -2
View File
@@ -38,8 +38,8 @@ func TestService(t *testing.T) {
{
RefID: "A",
DataSource: &datasources.DataSource{
OrgId: 1,
Uid: "test",
OrgID: 1,
UID: "test",
Type: "test",
},
JSON: json.RawMessage(`{ "datasource": { "uid": "1" }, "intervalMs": 1000, "maxDataPoints": 1000 }`),