-
-
Notifications
You must be signed in to change notification settings - Fork 658
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
#4209: add 'add to draft' button for segments. #4400
Conversation
Sonatype Lift is retiringSonatype Lift will be retiring on Sep 12, 2023, with its analysis stopping on Aug 12, 2023. We understand that this news may come as a disappointment, and Sonatype is committed to helping you transition off it seamlessly. If you’d like to retain your data, please export your issues from the web console. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
export const UpdateButton = ({ | ||
children = 'Save', | ||
...rest | ||
}: IPermissionButtonProps) => { | ||
return ( | ||
<PermissionButton type="submit" {...rest}> | ||
Save | ||
{children} | ||
</PermissionButton> |
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.
Allow the update button to be used with arbitrary content. Felt like an easy way to change it, but there may be better ways to sort it out?
await updateSegment(segment.id, getSegmentPayload()); | ||
refetchSegments(); | ||
if (projectId) { | ||
navigate(`/projects/${projectId}/settings/segments/`); | ||
} else { | ||
navigate('/segments/'); | ||
} | ||
setToastData({ | ||
title: 'Segment updated', | ||
type: 'success', | ||
}); |
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 has just been moved into the else block.
@@ -2,10 +2,13 @@ import PermissionButton, { | |||
IPermissionButtonProps, | |||
} from 'component/common/PermissionButton/PermissionButton'; | |||
|
|||
export const UpdateButton = ({ ...rest }: IPermissionButtonProps) => { | |||
export const UpdateButton = ({ | |||
children = 'Save', |
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.
I'm wondering if we need a default children. I've never seen this pattern before with default children
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.
Good point. The reason I put it there was that we previously hardcoded the text "save" and I didn't want the button to be empty in the other places where it's used. Happy to use a different approach if you have one in mind
Note: it doesn't work yet! It just throws an error.
This PR adds some logic to conditionally display "Add to draft" button for segments if the segment is part of a project that has change requests enabled and the flag is enabled.
Also adds a flag (
segmentChangeRequests
) to the frontend.Holding off on actually adding the change to a draft until the API/orval has been updated with the most recent changes.