mirror of
https://github.com/grafana/grafana.git
synced 2026-08-18 09:05:04 -05:00
Provisioning: Look up provisioned folders by UID when possible (#87465)
look up provisioned folders by uid when possible
This commit is contained in:
@@ -339,10 +339,16 @@ func (fr *FileReader) getOrCreateFolder(ctx context.Context, cfg *config, servic
|
|||||||
|
|
||||||
metrics.MFolderIDsServiceCount.WithLabelValues(metrics.Provisioning).Inc()
|
metrics.MFolderIDsServiceCount.WithLabelValues(metrics.Provisioning).Inc()
|
||||||
cmd := &dashboards.GetDashboardQuery{
|
cmd := &dashboards.GetDashboardQuery{
|
||||||
Title: &folderName,
|
|
||||||
FolderID: util.Pointer(int64(0)), // nolint:staticcheck
|
FolderID: util.Pointer(int64(0)), // nolint:staticcheck
|
||||||
OrgID: cfg.OrgID,
|
OrgID: cfg.OrgID,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.FolderUID != "" {
|
||||||
|
cmd.UID = cfg.FolderUID
|
||||||
|
} else {
|
||||||
|
cmd.Title = &folderName
|
||||||
|
}
|
||||||
|
|
||||||
result, err := fr.dashboardStore.GetDashboard(ctx, cmd)
|
result, err := fr.dashboardStore.GetDashboard(ctx, cmd)
|
||||||
|
|
||||||
if err != nil && !errors.Is(err, dashboards.ErrDashboardNotFound) {
|
if err != nil && !errors.Is(err, dashboards.ErrDashboardNotFound) {
|
||||||
|
|||||||
Reference in New Issue
Block a user