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

fix: Metadata UI improvements #4327

Merged
merged 10 commits into from
Jul 30, 2024
Merged

fix: Metadata UI improvements #4327

merged 10 commits into from
Jul 30, 2024

Conversation

novakzaballa
Copy link
Contributor

@novakzaballa novakzaballa commented Jul 11, 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

  • Add error messages and validations in the features and environments settings.
  • Improve multiline type metadata.
  • Change URL validation type.
  • Only enterprise Orgs can use custom fields/metadata

How did you test this code?

  • Use an enterprise organization to be able to use custom fields/metadata.
  • Changes were applied to multiline metadata in the feature settings.
  • Try to cause an error to see error toasts. For example, enter an incorrect metadata value and try to save.

Copy link

vercel bot commented Jul 11, 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 29, 2024 3:37pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 29, 2024 3:37pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2024 3:37pm

Copy link
Contributor

github-actions bot commented Jul 11, 2024

Uffizzi Preview deployment-54106 was deleted.

@novakzaballa novakzaballa marked this pull request as ready for review July 11, 2024 18:39
@novakzaballa novakzaballa requested a review from a team as a code owner July 11, 2024 18:39
@novakzaballa novakzaballa requested review from kyle-ssg and removed request for a team July 11, 2024 18:39
@github-actions github-actions bot added the fix label Jul 11, 2024
Copy link
Contributor

github-actions bot commented Jul 11, 2024

flagsmith-frontend image build and security scan finished ✨

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-frontend:pr-4327 Finished ✅ Results

Copy link
Contributor

github-actions bot commented Jul 11, 2024

flagsmith-api image build and security scan finished ✨

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api:pr-4327 Finished ✅ Results

Copy link
Contributor

github-actions bot commented Jul 11, 2024

flagsmith-private-cloud image build and security scan finished ✨

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-private-cloud:pr-4327 Finished ✅ Results

Copy link
Contributor

github-actions bot commented Jul 11, 2024

flagsmith image build and security scan finished ✨

Image Build Status Security report
ghcr.io/flagsmith/flagsmith:pr-4327 Finished ✅ Results

Copy link
Contributor

github-actions bot commented Jul 11, 2024

flagsmith-e2e image build finished ✨

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-4327 Finished ✅ Skipped

})
.catch((e) => {
e.json().then((result) => {
toast(result.metadata[0], 'danger')
Copy link
Member

@kyle-ssg kyle-ssg Jul 12, 2024

Choose a reason for hiding this comment

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

This assumes result.metadata isn't undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected

) : metadata?.type === 'multiline_str' ? (
<Flex className='flex-row' style={{ minWidth: '300px' }}>
<InputGroup
textarea
Copy link
Member

@kyle-ssg kyle-ssg Jul 12, 2024

Choose a reason for hiding this comment

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

The component under this is the exact same except it has a textarea prop, why not just do the following?

textarea={metadata?.type === 'multiline_str'}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

}`,
)
({ changeRequest, createdFlag, error, isCreate } = {}) => {
if (error?.data?.metadata) {
Copy link
Member

@kyle-ssg kyle-ssg Jul 12, 2024

Choose a reason for hiding this comment

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

error could be defined but not error?.data?.metadata. With this code any other error will show a success message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@@ -382,6 +382,10 @@ const Utils = Object.assign({}, require('./base/_utils'), {
valid = isEnterprise
break
}
case 'METADATA': {
Copy link
Member

Choose a reason for hiding this comment

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

Note to self: this affects #4281

.catch((e) => {
e.json()
.then((result) => {
if (result.metadata && result.metadata[0]) {
Copy link
Member

@kyle-ssg kyle-ssg Jul 16, 2024

Choose a reason for hiding this comment

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

This is better syntax and also checks that result.metadata isn't null (maybe not necessary but still good)

(result: Environment) => { // Types Environment
   if(result?.metadata?.[0])
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -396,6 +400,8 @@ const Utils = Object.assign({}, require('./base/_utils'), {
: null
: AccountStore.getPlans()

console.log('DEBUG: plans:', plans)
Copy link
Member

Choose a reason for hiding this comment

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

can remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@kyle-ssg
Copy link
Member

As discussed, raised an overall issue here. For now there's a few things to tidy up + default custom fields to expanded

@novakzaballa
Copy link
Contributor Author

As discussed, raised an overall issue here. For now there's a few things to tidy up + default custom fields to expanded

@kyle-ssg, I adjusted the Vertical alignment, removed the placeholder, and custom fields expanded by default.
I added a screenshot with the UI changes bellow.

Screenshot 2024-07-29 at 11 34 43 AM

@kyle-ssg
Copy link
Member

So much better

@novakzaballa novakzaballa added this pull request to the merge queue Jul 30, 2024
Merged via the queue into main with commit d4006c0 Jul 30, 2024
30 checks passed
@novakzaballa novakzaballa deleted the fix/metadata-ui-improvements branch July 30, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix front-end Issue related to the React Front End Dashboard
Projects
None yet
2 participants