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

feat: Announcement per page FF accept params #4275

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

novakzaballa
Copy link
Contributor

@novakzaballa novakzaballa commented Jul 2, 2024

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

  • The feature flag Announcement_per_page can have a projectId, and the UI validates that it matches the one from the dashboard to display the announcement.

How did you test this code?

  • Add a key params to the value of your feature flag Announcement_per_page, and set the value to the IDs of the project, environment, or organisation, where you want the announcement to be displayed.

The params key can have the following values: projectId, environmentId, and organisationId.(They are not mandatory)

This is an example of how the flag's value should appear with the params key.

{ 
"id":"announcement-per-page-3",
"title":"This is a custom announcement for some pages",
"description":"Announcement Page 1",
"buttonText":"Go your page",
"isClosable": true,
"url":"https://app.flagsmith.com/",
"pages":["users","segments","integrations","features"],
"params":{"projectId": 1}
}

@novakzaballa novakzaballa requested a review from a team as a code owner July 2, 2024 17:26
@novakzaballa novakzaballa requested review from kyle-ssg and removed request for a team July 2, 2024 17:26
Copy link

vercel bot commented Jul 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 8:45pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 8:45pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview Jul 2, 2024 8:45pm

@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard feature New feature or request labels Jul 2, 2024
Copy link
Contributor

github-actions bot commented Jul 2, 2024

Uffizzi Preview deployment-53744 was deleted.

exact: false,
path: routes[page],
strict: false,
})
if (match) {
if (
parseInt(get(match, 'params.projectId')!) !==
Copy link
Member

Choose a reason for hiding this comment

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

I think this could be more generic

  • Put projectId under a params object
  • Check if announcementPerPageValue.params
  • If there are params match all params
  • String both sides rather than assuming the params are int

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I think I understood you, done.

@novakzaballa novakzaballa requested a review from kyle-ssg July 2, 2024 19:08
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Jul 2, 2024
@novakzaballa novakzaballa changed the title feat: Announcement per page FF accept the projectId feat: Announcement per page FF accept the params Jul 2, 2024

if (match) {
const annParams =
convertObjectValuesToStrings(announcementPerPageValue?.params) || {}
Copy link
Member

Choose a reason for hiding this comment

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

Is any of the convert objects to strings necessary? Can't you just adjust line 67 to

   return Object.keys(obj1).every((key) => {
            return `${obj1[key]}` === `${obj2[key]}`
          })

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, done

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Jul 2, 2024
@novakzaballa novakzaballa requested a review from kyle-ssg July 2, 2024 20:44
@novakzaballa novakzaballa changed the title feat: Announcement per page FF accept the params feat: Announcement per page FF accept params Jul 2, 2024
@novakzaballa novakzaballa added this pull request to the merge queue Jul 3, 2024
Merged via the queue into main with commit 078bf1e Jul 3, 2024
24 checks passed
@novakzaballa novakzaballa deleted the feat/announcement-per-page-accept-project-id branch July 3, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request front-end Issue related to the React Front End Dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants