mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
skip readonly check when provisioning correlations
This commit is contained in:
parent
83814af498
commit
1f3307637e
@ -246,8 +246,6 @@ datasources:
|
||||
type: loki
|
||||
access: proxy
|
||||
url: http://localhost:3100
|
||||
editable: true
|
||||
version: 10
|
||||
correlations:
|
||||
- targetUid: gdev-jaeger
|
||||
label: "Jaeger traces"
|
||||
|
@ -29,7 +29,7 @@ func (s CorrelationsService) createCorrelation(ctx context.Context, cmd CreateCo
|
||||
return ErrSourceDataSourceDoesNotExists
|
||||
}
|
||||
|
||||
if query.Result.ReadOnly {
|
||||
if !cmd.SkipReadOnlyCheck && query.Result.ReadOnly {
|
||||
return ErrSourceDataSourceReadOnly
|
||||
}
|
||||
|
||||
|
@ -40,11 +40,12 @@ type CreateCorrelationResponse struct {
|
||||
type CreateCorrelationCommand struct {
|
||||
// UID of the data source for which correlation is created.
|
||||
// example: PE1C5CBDA0504A6A3
|
||||
SourceUID string
|
||||
OrgId int64
|
||||
TargetUID string `json:"targetUid" binding:"Required"`
|
||||
Label string `json:"label"`
|
||||
Description string `json:"description"`
|
||||
SourceUID string
|
||||
OrgId int64
|
||||
TargetUID string `json:"targetUid" binding:"Required"`
|
||||
Label string `json:"label"`
|
||||
Description string `json:"description"`
|
||||
SkipReadOnlyCheck bool
|
||||
}
|
||||
|
||||
type DeleteCorrelationsBySourceUIDCommand struct {
|
||||
|
@ -77,11 +77,12 @@ func (dc *DatasourceProvisioner) apply(ctx context.Context, cfg *configs) error
|
||||
for _, correlation := range ds.Correlations {
|
||||
if field, ok := correlation.(map[string]interface{}); ok {
|
||||
correlationsToInsert = append(correlationsToInsert, correlations.CreateCorrelationCommand{
|
||||
SourceUID: insertCmd.Result.Uid,
|
||||
TargetUID: field["targetUid"].(string),
|
||||
Label: field["label"].(string),
|
||||
Description: field["description"].(string),
|
||||
OrgId: insertCmd.OrgId,
|
||||
SourceUID: insertCmd.Result.Uid,
|
||||
TargetUID: field["targetUid"].(string),
|
||||
Label: field["label"].(string),
|
||||
Description: field["description"].(string),
|
||||
OrgId: insertCmd.OrgId,
|
||||
SkipReadOnlyCheck: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -102,11 +103,12 @@ func (dc *DatasourceProvisioner) apply(ctx context.Context, cfg *configs) error
|
||||
for _, correlation := range ds.Correlations {
|
||||
if field, ok := correlation.(map[string]interface{}); ok {
|
||||
correlationsToInsert = append(correlationsToInsert, correlations.CreateCorrelationCommand{
|
||||
SourceUID: cmd.Result.Uid,
|
||||
TargetUID: field["targetUid"].(string),
|
||||
Label: field["label"].(string),
|
||||
Description: field["description"].(string),
|
||||
OrgId: updateCmd.OrgId,
|
||||
SourceUID: cmd.Result.Uid,
|
||||
TargetUID: field["targetUid"].(string),
|
||||
Label: field["label"].(string),
|
||||
Description: field["description"].(string),
|
||||
OrgId: updateCmd.OrgId,
|
||||
SkipReadOnlyCheck: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user