-
Notifications
You must be signed in to change notification settings - Fork 15
add-edit-duplicate segment modal functionality #2320
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
Conversation
|
@zackcl yes, i disabled it on purpose because I think we need to talk about what the expected behavior is, I edited my comment above to be more clear |
|
@zackcl I added in a backend change to do a duplicate name check on submit and error if yes. Also shows error in the form that makes the form invalid until changed. The error will persist and keep getting checked while the name or context changes, removing the error if changed, putting it back if the name and context again match. I put this in WIP still, I haven't added in the duplicate modal changes requested. |
|
Ok, this now adds full duplicate modal functionality also, which does include just copying the lists directly from the source segment, it works just like add since it's upsert, so as far as I can tell this is creating faithful duplications, with the understanding that currently this must keep same context as target. |
|
@danoswaltCL Shouldn't we disable the "App Context" dropdown on the"Duplicate Segment" modal? I thought that was our decision. Currently, I'm able to change the "App Context" on your branch. |
| message: `Segment name ${name} already exists in context ${context}`, | ||
| }); | ||
|
|
||
| // const error = new ErrorWithType(); |
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.
We can probably remove these comments
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.
One small thing
oops, yes |
|
|
||
| public upsertSegment(segment: SegmentInputValidator, logger: UpgradeLogger): Promise<Segment> { | ||
| public async upsertSegment(segment: SegmentInputValidator, logger: UpgradeLogger): Promise<Segment> { | ||
| await this.checkIsDuplicateSegmentName(segment.name, segment.context, logger); |
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 method is also used when editing - so now editing always fails unless you're changing the name.
Maybe only perform the check if there isn't an id on 'segment'.
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 found one more thing.
Also, when you edit a new-style segment, it deletes all the lists (see code comment below)
| context: appContext, | ||
| userIds: [], | ||
| groups: [], | ||
| subSegmentIds: [], |
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.
We need subSegmentIds from the segment here (same as with duplicate)
|
@bcb37 updated, ready for re-re-review |




This PR resolves #2245
I have added all the necessary code for add, edit and duplicate segment modal. Currently this PR needs the segmenr table list component for a listener to close the modal after add/edit/duplicate segment. Also, tags and listType are not getting stored in the backend as of now, that also needs to be handled in a separate PR. We will need to test this PR once all these missing parts are in the dev branch. Rest all seems to work fine as expected.
EDIT DAN: