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

Folders: Fix creating/updating a folder whose title has leading and trailing spaces #80909

Merged
merged 6 commits into from
Jan 22, 2024

Conversation

papagian
Copy link
Contributor

What is this feature?

Temporarily folders are store in both dashboard and folder table. This fixes an inconsistency in two tables that used to occur if the folder title used to contain leading and trailing spaces because if the folder table was stored as is, while in the dashboard table was store trimmed.

Why do we need this feature?

[Add a description of the problem the feature is trying to solve.]

Who is this feature for?

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

Which issue(s) does this PR fix?:

Fixes #

Special notes for your reviewer:

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 papagian added type/bug add to changelog backport v10.3.x Mark PR for automatic backport to v10.3.x labels Jan 19, 2024
@papagian papagian requested a review from a team as a code owner January 19, 2024 16:04
@papagian papagian requested review from zserge, mildwonkey and idafurjes and removed request for a team January 19, 2024 16:04
@grafana-delivery-bot grafana-delivery-bot bot added this to the 10.4.x milestone Jan 19, 2024
@yuri-tceretian
Copy link
Contributor

Since this is already in the wild, I think we need a migration too.


db := sqlstore.InitTestDB(t)
cfg := setting.NewCfg()
features := featuremgmt.WithFeatures()
Copy link
Contributor

Choose a reason for hiding this comment

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

[question] [non-blocker] Do we need ProvideStore to receive an empty *FeatureManagement or could we create features like this and reuse it when creating Service?

Suggested change
features := featuremgmt.WithFeatures()
features := featuremgmt.WithFeatures(featuremgmt.FlagNestedFolders)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually features is redundant (is not used inside the nested folder store) so I have removed it
but to answer your question: yes, we can create the features like this and pass the same to the service.

@diegommm diegommm self-requested a review January 19, 2024 19:26
@papagian
Copy link
Contributor Author

Since this is already in the wild, I think we need a migration too.

this will be addressed by #80972

@papagian papagian merged commit 4243079 into main Jan 22, 2024
11 checks passed
@papagian papagian deleted the papagian/fix-folder-title-with-leading-space branch January 22, 2024 16:03
Copy link
Contributor

The backport to v10.3.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-80909-to-v10.3.x origin/v10.3.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 4243079cb52de57ba816e4c2a4eddcd7c11bb133

When the conflicts are resolved, stage and commit the changes:

git add . && git cherry-pick --continue

If you have the GitHub CLI installed:

# Push the branch to GitHub:
git push --set-upstream origin backport-80909-to-v10.3.x
# Create the PR body template
PR_BODY=$(gh pr view 80909 --json body --template 'Backport 4243079cb52de57ba816e4c2a4eddcd7c11bb133 from #80909{{ "\n\n---\n\n" }}{{ index . "body" }}')
# Create the PR on GitHub
echo "${PR_BODY}" | gh pr create --title "[v10.3.x] Folders: Fix creating/updating a folder whose title has leading and trailing spaces" --body-file - --label "type/bug" --label "area/backend" --label "add to changelog" --label "backport" --base v10.3.x --milestone 10.3.x --web

Or, if you don't have the GitHub CLI installed (we recommend you install it!):

# Push the branch to GitHub:
git push --set-upstream origin backport-80909-to-v10.3.x

# Create a pull request where the `base` branch is `v10.3.x` and the `compare`/`head` branch is `backport-80909-to-v10.3.x`.

# Remove the local backport branch
git switch main
git branch -D backport-80909-to-v10.3.x

@grafana-delivery-bot grafana-delivery-bot bot added the backport-failed Failed to generate backport PR. Please resolve conflicts and create one manually. label Jan 22, 2024
papagian added a commit that referenced this pull request Jan 22, 2024
…railing spaces (#80909)

* Add tests

* Folders: Fix creating folder whose title has leading and trailing spaces

* Fix folder update

* Remove redundant argument

* Fix test

(cherry picked from commit 4243079)
papagian added a commit that referenced this pull request Jan 22, 2024
…ding and trailing spaces (#81006)

Folders: Fix creating/updating a folder whose title has leading and trailing spaces (#80909)

* Add tests

* Folders: Fix creating folder whose title has leading and trailing spaces

* Fix folder update

* Remove redundant argument

* Fix test

(cherry picked from commit 4243079)
Ukochka pushed a commit that referenced this pull request Feb 14, 2024
…railing spaces (#80909)

* Add tests

* Folders: Fix creating folder whose title has leading and trailing spaces

* Fix folder update

* Remove redundant argument

* Fix test
@aangelisc aangelisc modified the milestones: 10.4.x, 10.4.0 Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/backend backport v10.3.x Mark PR for automatic backport to v10.3.x backport-failed Failed to generate backport PR. Please resolve conflicts and create one manually. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants