Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Iridias
Copy link
Contributor

@Iridias Iridias commented Aug 23, 2024

Our use-case:
We use gdg only as a backup-tool (no restore).

The issue:
A while ago, Grafana introduced the feature of nested sub-folders for dashboards.
So far gdg would download those folders, but all on the same level. This has (at least) two major problems:

  • the connection to the original folder (and in our case "team") is lost
  • dashboards could overwrite each other, if they as well as the folder they're in, have the same name as those from another folder/team.

What changed:

  • determine the full path of a dashboard (not just use its parent folder) and use that for the download
  • in order to be able to do that: also fetch folders (type dash-folder) in the ListDashboards-search
    • limit this behavior to the DownloadDashboards functionality (if enabled at all)
  • added a new config-option in the filter_overrides to enable this feature/behavior
  • added a unit-test, to ensure the download-path is calculated correctly

Known Issues:

  • currently only supported in DownloadDashboards
  • might interfere with other features like UploadDashboards if used in combination (as those currently don't support nested folders - and explicitly so)

searchParams.Limit = tools.PtrOf(limit)
searchParams.Page = tools.PtrOf(page)
searchParams.Type = tools.PtrOf(searchTypeDashboard)
if allTypes == false {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, but if !allTypes {}

}
validUid = filterReq.GetFilter(filters.DashFilter) == "" || link.Slug == filterReq.GetFilter(filters.DashFilter)
if link.FolderID == 0 {
if link.FolderID == 0 && link.Type == "dash-db" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

common.go has a constant for dash-db, use the const searchTypeDashboard

@@ -0,0 +1,71 @@
package service
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently, all the integration tests are under test, unless you have some package level see if you can just add this to the current test. dashboard_integration_test.go

@safaci2000
Copy link
Contributor

First of all, thank you for the PR, that's always appreciated. I have looked at nested folder when they first were released as a beta feature and it felt very broken still at the time, and ended up closing that out till someone asked for the feature. (Which I suppose you're asking.)

A few questions.

  1. I know this is a toggle, but this is now an officially supported feature right? out of beta?
  2. I'm happy to try to add support for nested folders but I'd like to do this fully, ie. GDG should have a setting to use/not use internal folders, and have the ability to download, upload, list and restore doing the full CRUD operations.

Let me take a closer look at the MR, and see how it works a bit closer. I'll try to suggest something that should work for all use cases.

@safaci2000
Copy link
Contributor

Please link: #171 to your PR as well.

@safaci2000
Copy link
Contributor

There's a few things I'd like to add to this, I'm going to pick up on your changes and take it the last hurdle so it lines up a bit better. I also wanted to get integration tests written for the cloud and basic CRUD that uses nested folders. Once I have this cleaned up, I'll ping you on a final pass if you wanted to double check it satisfies your use case.

From what I can tell you mainly wanted the ability to fetch nested folders and respect those deeper paths.

@Iridias
Copy link
Contributor Author

Iridias commented Sep 10, 2024

Sorry for the late response - was on vacation.

I'm going to pick up on your changes and take it the last hurdle so it lines up a bit better.

Cool. Thanks for the effort :-)

From what I can tell you mainly wanted the ability to fetch nested folders and respect those deeper paths.

Yes, that's right.

@safaci2000
Copy link
Contributor

@Iridias somewhat. Once you enable that flag it affects the inherent behavior of Dashboard CRUD, Folder CRUD and Folder Permissions as well. So it's a bigger change to introduce it. It's still a WIP but I have the rough Impl done just need some clean up and testing and likely removing some duplicate logic that can be consolidated.

@safaci2000
Copy link
Contributor

@Iridias I'm going to close this patch. Please see #291 for this feature change.

@safaci2000 safaci2000 closed this Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants