Skip to content

Commit

Permalink
feat: Harvest grafana import should support nested Grafana folders
Browse files Browse the repository at this point in the history
Thanks to @IvanZenger for reporting

Fixes: #3412
  • Loading branch information
cgrinds committed Jan 9, 2025
1 parent 4832f74 commit 51b2dbf
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmd/tools/grafana/grafana.go
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,13 @@ func checkVersion(inputVersion string) bool {

func checkFolder(folder *Folder) error {

result, status, code, err := sendRequestArray(opts, "GET", "/api/folders?limit=1000", nil)
q := "/api/folders?limit=1000"

if folder.parentUID != "" {
q += "&parentUid=" + folder.parentUID
}

result, status, code, err := sendRequestArray(opts, "GET", q, nil)

if err != nil {
return err
Expand Down Expand Up @@ -1227,11 +1233,11 @@ func createServerFolders(folder *Folder) error {
if err := createServerFolder(curFolder); err != nil {
return err
}
folder.name = f
folder.id = curFolder.id
}

parentUID = curFolder.uid
folder.name = f
folder.id = curFolder.id
}

return nil
Expand Down

0 comments on commit 51b2dbf

Please sign in to comment.