-
Notifications
You must be signed in to change notification settings - Fork 429
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Uffizzi Preview |
|
|
|
|
|
}) | ||
.catch((e) => { | ||
e.json().then((result) => { | ||
toast(result.metadata[0], 'danger') |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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'}
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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': { |
There was a problem hiding this comment.
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]) { |
There was a problem hiding this comment.
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])
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
frontend/common/utils/utils.tsx
Outdated
@@ -396,6 +400,8 @@ const Utils = Object.assign({}, require('./base/_utils'), { | |||
: null | |||
: AccountStore.getPlans() | |||
|
|||
console.log('DEBUG: plans:', plans) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
As discussed, raised an overall issue here. For now there's a few things to tidy up + default custom fields to expanded |
So much better |
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingdocs/
if required so people know about the feature!Changes
How did you test this code?