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

#4209: add 'add to draft' button for segments. #4400

Merged
merged 5 commits into from
Aug 3, 2023

Conversation

thomasheartman
Copy link
Contributor

@thomasheartman thomasheartman commented Aug 3, 2023

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.

@sonatype-lift
Copy link

sonatype-lift bot commented Aug 3, 2023

Sonatype Lift is retiring

Sonatype 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.
We are extremely grateful and thank you for your support over the years.

📖 Read about the impacts and timeline

@vercel
Copy link

vercel bot commented Aug 3, 2023

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

Name Status Preview Comments Updated (UTC)
unleash-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 3, 2023 0:18am
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 3, 2023 0:18am

Comment on lines +5 to 12
export const UpdateButton = ({
children = 'Save',
...rest
}: IPermissionButtonProps) => {
return (
<PermissionButton type="submit" {...rest}>
Save
{children}
</PermissionButton>
Copy link
Contributor Author

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?

Comment on lines +91 to +101
await updateSegment(segment.id, getSegmentPayload());
refetchSegments();
if (projectId) {
navigate(`/projects/${projectId}/settings/segments/`);
} else {
navigate('/segments/');
}
setToastData({
title: 'Segment updated',
type: 'success',
});
Copy link
Contributor Author

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',
Copy link
Contributor

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

Copy link
Contributor Author

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 ☺️

@thomasheartman thomasheartman merged commit 7cab19d into main Aug 3, 2023
18 checks passed
@thomasheartman thomasheartman deleted the #4209/segment-drafts branch August 3, 2023 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants