-
-
Notifications
You must be signed in to change notification settings - Fork 729
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: create and edit release plan template milestones #8768
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files |
frontend/src/component/releases/ReleasePlanTemplate/CreateReleasePlanTemplate.tsx
Outdated
Show resolved
Hide resolved
frontend/src/component/releases/ReleasePlanTemplate/CreateReleasePlanTemplate.tsx
Outdated
Show resolved
Hide resolved
frontend/src/component/releases/ReleasePlanTemplate/CreateReleasePlanTemplate.tsx
Outdated
Show resolved
Hide resolved
frontend/src/component/releases/ReleasePlanTemplate/CreateReleasePlanTemplate.tsx
Outdated
Show resolved
Hide resolved
frontend/src/component/releases/ReleasePlanTemplate/CreateReleasePlanTemplate.tsx
Outdated
Show resolved
Hide resolved
frontend/src/component/releases/ReleasePlanTemplate/EditReleasePlanTemplate.tsx
Outdated
Show resolved
Hide resolved
frontend/src/component/releases/ReleasePlanTemplate/MilestoneCard.tsx
Outdated
Show resolved
Hide resolved
frontend/src/component/releases/ReleasePlanTemplate/MilestoneCard.tsx
Outdated
Show resolved
Hide resolved
)} | ||
{!editMode && ( | ||
<StyledEditIcon onClick={editMilestoneNameClick} /> | ||
)} |
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.
Why isn't this a part of the above block, since the condition is the same?
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.
Argh, I moved things around and forgot to remove the duplicate condition 🙄
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 think you could have added the onClick handler on the parent component, catching any click in the children, instead of duplicating it.
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.
Parent is the same for this and the other section which is only shown during edit mode, and would have a weird effect if you click inside. I'll have a think if I can introduce a parent just for these two while doing add strategies
|
||
return ( | ||
<> | ||
{milestones.map((milestone, index) => ( |
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.
Try not to rely on the index here. It's going to be especially troublesome if we decide to allow the user to sort / change the order of the milestones.
Ideally you would have unique ids you could use for each milestone, however those are generated only in the backend. My suggestion is creating temporary uuids in the frontend for state management and omitting them from the final payload.
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 still think relying on indexes here will bite you down the line, but if you're willing to accept that then feel free to proceed for now.
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 going to have a look at that together with adding strategies!
frontend/src/component/releases/ReleasePlanTemplate/ReleasePlanTemplateAddStrategyForm.tsx
Outdated
Show resolved
Hide resolved
frontend/src/component/releases/ReleasePlanTemplate/TemplateForm.tsx
Outdated
Show resolved
Hide resolved
frontend/src/component/releases/ReleasePlanTemplate/CreateReleasePlanTemplate.tsx
Outdated
Show resolved
Hide resolved
@@ -24,5 +24,17 @@ export interface IReleasePlanTemplatePayload { | |||
id?: string; | |||
name: string; | |||
description: string; | |||
milestones?: IReleasePlanMilestone[]; | |||
milestones?: IReleasePlanMilestonePayload[]; |
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.
Why is this a payload instead of just IReleasePlanMilestone
?
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'll have a look at the types when doing add strategies :)
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 believe we should take another look at some of these points before merging:
- Duplicated code between
CreateReleasePlanTemplate
andEditReleasePlanTemplate
- State management
- Relying on index for milestone management
…asePlanTemplate.tsx Co-authored-by: Nuno Góis <[email protected]>
Cancel | ||
</StyledCancelButton> | ||
</StyledButtonContainer> | ||
</TemplateForm> |
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 still think you could have potentially merged the edit and create components into a single one, with a simple const isEdit = Boolean(templateId)
, but this is probably fine for now, and has much less duplicated code than before, so good job 👍
errors, | ||
clearErrors, | ||
}: IMilestoneList) => { | ||
const [currentMilestone, setCurrentMilestone] = useState(-1); |
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.
Why not use IReleasePlanMilestonePayload | undefined
here? Should be more explicit than -1
and indexes.
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 one is for adding strategies to the milestone. Current milestone (should probably be named ...index) gets passed to the add strategy form. If we're adding something to that object (like we do with names) it should be bubbled up no?
frontend/src/component/releases/ReleasePlanTemplate/MilestoneList.tsx
Outdated
Show resolved
Hide resolved
frontend/src/component/releases/ReleasePlanTemplate/MilestoneCard.tsx
Outdated
Show resolved
Hide resolved
frontend/src/component/releases/ReleasePlanTemplate/TemplateForm.tsx
Outdated
Show resolved
Hide resolved
frontend/src/component/releases/ReleasePlanTemplate/TemplateForm.tsx
Outdated
Show resolved
Hide resolved
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 definitely better now, especially the create / edit component part.
We already discussed the points I'm worried about, so I'll leave you a non-blocking approval and leave the decision up to you. Some of the issues I'm concerned about you'll eventually be forced to tackle, even if it's later down the line.
…ist.tsx Co-authored-by: Nuno Góis <[email protected]>
…rm.tsx Co-authored-by: Nuno Góis <[email protected]>
…ard.tsx Co-authored-by: Nuno Góis <[email protected]>
Adding and editing milestones and their names