Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search: Fix empty folder details for nested folder items #76504

Merged
merged 34 commits into from
Oct 24, 2023

Conversation

papagian
Copy link
Contributor

@papagian papagian commented Oct 13, 2023

What is this feature?
For nested folders we have to refer to the folder table for getting the parent folder details instead of the dashboard table
that knows only of flat folders. However, in the search query we used to join with the latter on folder_id column. As a result parent folder details were missing for a subfolder.

The sequential IDs for a folder differ in folder and dashboard table: but their UIDs are the same.

This fix:

  • Introduces a schema migration for adding a folder_uid column in dashboard table
  • Introduces a data migration for setting folder_uid into the existing dashboard and folder rows in the dashboard table. (this can take several minutes for large setups > 1M dashboards)
  • Stores folder_uid when saving a dashboard or folder
  • Modifies the search query to refer to the folder table if the nested folders are enabled
  • Adds tests for searching by folder and title with nested folders on/off

Why do we need this feature?

This is introduced for fixing search results for the nested folders feature but we need it in general because in the future we want to exclusively use the folder table for storing folders and without this migration this is not possible.

Who is this feature for?

[Add information on what kind of user the feature is for.]

Which issue(s) does this PR fix?:

Fixes #74433

Special notes for your reviewer:
To reproduce the issue:

  • enable nested folders in main
  • create a folder hierarchy like:
Screenshot 2023-10-18 at 8 33 06 AM
  • the folder details are missing from api/search?query=New response
  • the folder details are missing from api/search?query=child response
  • switch to this branch and try the above request: make sure that the folder details are not missing

Try also moving a subfolder under another folder and to the root and make sure that search response is correct.

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

@papagian
Copy link
Contributor Author

/deploy-to-hg

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes.
  • Check the GitHub actions tab to follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with papagian/nf-fix-search-74433 oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot
Copy link

@papagian
Copy link
Contributor Author

/deploy-to-hg

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes.
  • Check the GitHub actions tab to follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with papagian/nf-fix-search-74433 oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot

This comment was marked as resolved.

@papagian
Copy link
Contributor Author

/deploy-to-hg

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes.
  • Check the GitHub actions tab to follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with papagian/nf-fix-search-74433 oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot
Copy link

@papagian
Copy link
Contributor Author

/deploy-to-hg

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes.
  • Check the GitHub actions tab to follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with papagian/nf-fix-search-74433 oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot

This comment was marked as resolved.

Ignore cyclomatic complexity of func
`(*DashboardServiceImpl).BuildSaveDashboardCommand
@papagian papagian marked this pull request as ready for review October 18, 2023 06:27
zserge
zserge previously approved these changes Oct 18, 2023
@papagian papagian requested a review from zserge October 20, 2023 07:36
@papagian
Copy link
Contributor Author

/deploy-to-hg

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes.
  • Check the GitHub actions tab to follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with papagian/nf-fix-search-74433 oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot
Copy link

@papagian
Copy link
Contributor Author

/deploy-to-hg

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes.
  • Check the GitHub actions tab to follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with papagian/nf-fix-search-74433 oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot
Copy link

@papagian papagian merged commit 03a626f into main Oct 24, 2023
17 of 18 checks passed
@papagian papagian deleted the papagian/nf-fix-search-74433 branch October 24, 2023 07:04
@grafana-delivery-bot grafana-delivery-bot bot added this to the 10.3.x milestone Oct 24, 2023
@papagian papagian added add to changelog and removed no-changelog Skip including change in changelog/release notes labels Nov 22, 2023
@aangelisc aangelisc modified the milestones: 10.3.x, 10.2.3 Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nested folders: Empty folder details from search handler response for folder items
3 participants