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

consolidate add-edit-duplicate modals #1732

Merged
merged 16 commits into from
Jul 22, 2024

Conversation

danoswaltCL
Copy link
Collaborator

Opening as draft, is dependent on the backend updates Ben has made, but otherwise should be good for review.

This consolidates the ADD, EDIT, and DUPLICATE modals into a common template modal UpsertFeatureFlagModal, as they are nearly identical except for a couple of straightforward params.

This adds the DUPLICATE modal to the FF details menu. The only actual difference between ADD and DUPLICATE is the title and we add _COPY_CHANGE_ME to the name and key.

image image image

@danoswaltCL danoswaltCL requested review from bcb37, KD1712 and zackcl July 3, 2024 22:18
@Yagnik56 Yagnik56 self-requested a review July 4, 2024 02:51
Yagnik56
Yagnik56 previously approved these changes Jul 8, 2024
Copy link
Collaborator

@Yagnik56 Yagnik56 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me, some questions and suggestions but nothing seems to be a blocker to not merge this PR.

@Yagnik56 Yagnik56 self-requested a review July 12, 2024 08:39
@danoswaltCL danoswaltCL marked this pull request as ready for review July 18, 2024 14:30
@danoswaltCL danoswaltCL requested a review from Yagnik56 July 18, 2024 14:30
@danoswaltCL
Copy link
Collaborator Author

This one is merged with backend changes and works like a charm now for Add - Edit - Duplicate, ready for review @zackcl @Yagnik56 @Yagnik56

frontend/projects/upgrade/src/assets/i18n/en.json Outdated Show resolved Hide resolved
return { name, key, description, appContext, tags };
}

deriveName(sourceFlag: FeatureFlag, action: string): string {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why derive values separately for every property?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's your suggested code improvement?

Copy link
Collaborator

@Yagnik56 Yagnik56 Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can u try this?

deriveInitialFormValues(sourceFlag: FeatureFlag, action: string) {
  return {
    name: action === UPSERT_FEATURE_FLAG_ACTION.EDIT ? sourceFlag?.name : '',
    key: action === UPSERT_FEATURE_FLAG_ACTION.EDIT ? sourceFlag?.key : '',
    description: sourceFlag?.description || '',
    appContext: sourceFlag?.context?.[0] || '',
    tags: sourceFlag?.tags || [],
  };
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's exactly what I'd like to avoid doing, what's the benefit in jamming all that in there?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll ask in the dev mtg, I'm curious what others say, I guess I have a very different coding style than the rest of the team in general, I want to do what is comfortable for everyone.

}
}

createRequest(action: UPSERT_FEATURE_FLAG_ACTION, sourceFlag?: FeatureFlag): void {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of createRequest, something like sendRequest?

frontend/projects/upgrade/src/assets/i18n/en.json Outdated Show resolved Hide resolved
}

a {
text-decoration: none;
Copy link
Collaborator

@Yagnik56 Yagnik56 Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this removed? @zackcl The design show link shouldn't be underlined.


.learn-more-link {
color: var(--blue);
text-decoration: underline;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in figma we don't have underlines in learn more redirect links, can you confirm @zackcl ?

<mat-icon>file_upload</mat-icon>
<p class="ft-14-600 drag-text">Drag & drop or</p>
<button mat-flat-button color="primary" (click)="fileInput.click()">
<span class="material-symbols-outlined">upload</span>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how are you able to get the upload icon here without mat-icon @zackcl just curious.

@danoswaltCL
Copy link
Collaborator Author

If this is good other than some styling can we merge? would be easier to complete the story i'm currently working on. @zackcl @Yagnik56

@Yagnik56
Copy link
Collaborator

Yagnik56 commented Jul 22, 2024

If this is good other than some styling can we merge? would be easier to complete the story i'm currently working on. @zackcl @Yagnik56

can u resolve that deriveInitialFormValues function comment if possible, I can approve if you think it's fine this way?

@Yagnik56 Yagnik56 self-requested a review July 22, 2024 12:50
Yagnik56
Yagnik56 previously approved these changes Jul 22, 2024
@Yagnik56 Yagnik56 self-requested a review July 22, 2024 14:29
@danoswaltCL danoswaltCL merged commit 7c3f819 into dev Jul 22, 2024
8 checks passed
@danoswaltCL danoswaltCL deleted the feature/upsert-flag-common-modal-template branch July 22, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants