Provisioning: Include ref field in DELETE endpoint response for branch operations (#113615)
Fix: Include ref field in DELETE endpoint response for branch operations When deleting a dashboard file via DELETE endpoint with a ref query parameter (for branch operations), the response was missing the ref field. This caused the frontend branch workflow success handler to fail silently. The issue was an inverted boolean condition in the Delete method. The code was setting file.Ref = opts.Ref when shouldUpdateGrafanaDB returned true (main branch operations), but it should have been setting it when false (branch operations), since we read the file with an empty ref. Fixed by inverting the condition from: if r.shouldUpdateGrafanaDB(opts, nil) to: if !r.shouldUpdateGrafanaDB(opts, nil) This ensures the ref field is properly included in the ResourceWrapper response for branch operations.
This commit is contained in:
@@ -100,7 +100,7 @@ func (r *DualReadWriter) Delete(ctx context.Context, opts DualWriteOptions) (*Pa
|
||||
}
|
||||
|
||||
// HACK: manual set to the provided branch so that the parser can possible read the file
|
||||
if r.shouldUpdateGrafanaDB(opts, nil) {
|
||||
if !r.shouldUpdateGrafanaDB(opts, nil) {
|
||||
file.Ref = opts.Ref
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user