Skip to content

Secret changes dialog added #274 #318

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

Merged
merged 14 commits into from
Aug 31, 2024

Conversation

harshith-1008
Copy link
Contributor

🔍 Overview

💡 Proposed Changes

  • Used GenericDialog component to show the changes made by user
  • Added info button which onClick shows dialog
  • Created type SecretChange for the secret changes
  • Created a component DisplayChanges which returns changes of a particular secret
  • Also limited key value to 50 characters so that it does overflow out of the dialogue

🖼️ Screenshots or Demo

Before
Screenshot 2024-07-31 at 6 53 37 PM

After
Screenshot 2024-07-31 at 7 34 42 PM
Screenshot 2024-07-31 at 7 34 55 PM

📝 Release Notes

User now can see the changes made to the environment secrets

❓ Open Questions

Is there anyway I can enhance the UI more?

🧪 Testing

  • Add a secret
  • Change an attribute of a pre-existing secret
  • Remove a tag from the secret and add other tags

🎯 Reviewer Focus

You can just make any desired changes and click on the info button to view the changes

➕ Additional Context

issue #274

✨ How to Test the Changes Locally

  • Pull the branch
  • log in to your phase console account
  • head over to an environment of any app and start testing

💚 Did You...

  • Ensure linting passes (code style checks)?
  • Update dependencies and lockfiles (if required)
  • Regenerate graphql schema and types (if required)
  • Verify the app builds locally?
  • Manually test the changes on different browsers/devices?

@harshith-1008
Copy link
Contributor Author

@rohan-chaturvedi
If possible, could you please look into this pr?

@rohan-chaturvedi
Copy link
Member

@rohan-chaturvedi If possible, could you please look into this pr?

Sure @harshith-1008 , will take a look as soon as I can!

@rohan-chaturvedi rohan-chaturvedi self-requested a review August 1, 2024 07:57
@rohan-chaturvedi
Copy link
Member

@harshith-1008 Could you fix the filename please?
image

@harshith-1008
Copy link
Contributor Author

@harshith-1008 Could you fix the filename please? image

Screenshot 2024-08-11 at 8 10 21 PM

@rohan-chaturvedi for some reason vscode isnt allowing me to keep this license file because folder name license already exists, can you please guide me to restore it?

@rohan-chaturvedi
Copy link
Member

@harshith-1008 Could you fix the filename please? image

Screenshot 2024-08-11 at 8 10 21 PM @rohan-chaturvedi for some reason vscode isnt allowing me to keep this license file because folder name license already exists, can you please guide me to restore it?

Thanks a lot for the screenshot! Now I understand why this was a problem 😅

I'll raise a PR to rename the license folder in a bit, that should resolve it.

@harshith-1008
Copy link
Contributor Author

@rohan-chaturvedi I have managed to rename the file through GitHub as I wasnt Able to do in Vscode. The file is renamed now.

@rohan-chaturvedi
Copy link
Member

rohan-chaturvedi commented Aug 12, 2024

Hey @harshith-1008 , a couple of updates:

  1. We've updated the UX for deleting secrets. Secrets can now be "staged" for delete, and are only deleted when clicking on "Deploy". See the PR for a full demo: refactor: misc optimizations and ux improvements to secrets editing #340
    This means we need to add Deleted secrets to the changed secrets dialog

  2. I was working on a cleaner design for this dialog for a while. I've made a Figma mock here.

Here's a screenshot as well:
Undeployed changes

You can grab the colors from Figma. The tailwind colors are:

  • Dialog title: text-zinc-900 dark:text-zinc-900
  • Dialog subtitle: text-zinc-500
  • Created: text-emerald-400 (Backgrounds: bg-emerald-400/20 dark:bg-emerald-400/10)
  • Updated: text-amber-400 (Backgrounds: bg-amber-400/20 dark:bg-amber-400/10)
  • Deleted: text-red-400 (Backgrounds: bg-red-400/20 dark:bg-red-400/10)

Sorry for the constant design updates! Lmk if you have any questions, we can hop on a slack huddle and discuss it as well.

@harshith-1008
Copy link
Contributor Author

Screenshot 2024-08-15 at 4 29 31 PM

@rohan-chaturvedi I tried changing the UI, Can you guide me how to override text-color of tags? In Tag component the styling is (text-zinc-700 dark:text-zinc-200).

Screenshot 2024-08-15 at 4 31 44 PM

I tried this method but it isn't working. and should I decrease the height and width of tags?

@rohan-chaturvedi
Copy link
Member

Screenshot 2024-08-15 at 4 29 31 PM

@rohan-chaturvedi I tried changing the UI, Can you guide me how to override text-color of tags? In Tag component the styling is (text-zinc-700 dark:text-zinc-200).
Screenshot 2024-08-15 at 4 31 44 PM

I tried this method but it isn't working. and should I decrease the height and width of tags?

@harshith-1008 You could add a variant prop to the Tag component that takes a string of type: 'normal' | 'deleted' | 'created'. Apply the styles based on the value of this prop. Check out the Button component to see how a variant can be added. Make the 'normal' default value of the prop, so that you won't have to add this prop wherever the Tag is currently used.

Lets keep the height and width of the tags for now.

@harshith-1008
Copy link
Contributor Author

@rohan-chaturvedi can you look into these changes? I have kept the tags width and height same.

Screenshot 2024-08-16 at 10 41 51 AM

@rohan-chaturvedi
Copy link
Member

@rohan-chaturvedi can you look into these changes? I have kept the tags width and height same.

Screenshot 2024-08-16 at 10 41 51 AM

Looking good! Only issue I can see is that monospace font isn't used in the right places. Could you take a look at that?

@harshith-1008
Copy link
Contributor Author

Screenshot 2024-08-16 at 3 45 32 PM

@rohan-chaturvedi changed font irregularities.

@rohan-chaturvedi
Copy link
Member

Screenshot 2024-08-16 at 3 45 32 PM

@rohan-chaturvedi changed font irregularities.

  • Use normal font for the change type ("Created", "Updated" etc)
  • Use monospace for everything else (field names and values)

@harshith-1008
Copy link
Contributor Author

harshith-1008 commented Aug 16, 2024

Screenshot 2024-08-16 at 3 45 32 PM @rohan-chaturvedi changed font irregularities.
  • Use normal font for the change type ("Created", "Updated" etc)
  • Use monospace for everything else (field names and values)
Screenshot 2024-08-16 at 4 20 23 PM

@rohan-chaturvedi Except change type, all other texts changed to font-mono.

@rohan-chaturvedi
Copy link
Member

@harshith-1008 Nice! Lmk when the code changes are pushed, will take a look. Lets get this merged!

@harshith-1008
Copy link
Contributor Author

@rohan-chaturvedi I have pushed changes.

Copy link
Member

@rohan-chaturvedi rohan-chaturvedi left a comment

Choose a reason for hiding this comment

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

@harshith-1008 Awesome work! This is working perfectly 👌

Just a few code changes and minor fixes required. Also, could you please create a separate component for this? Call is "DeployPreview" or something and put it in components/environments/secrets

{secretsToDelete?.map(secretId => {
const deletedSecret = serverSecrets.find(secret => secret.id === secretId);
return (
<div className="flex items-center space-x-2 mb-6">
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<div className="flex items-center space-x-2 mb-6">
<div key={secretId} className="flex items-center space-x-2 mb-6">

Add a key for elements rendered in a list

Comment on lines 848 to 854
const removedTags = change.tags?.old?.filter(tag =>
!change.tags?.new?.some(newTag => newTag.id === tag.id)
) || [];

const addedTags = change.tags?.new?.filter(tag =>
!change.tags?.old?.some(oldTag => oldTag.id === tag.id)
) || [];
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const removedTags = change.tags?.old?.filter(tag =>
!change.tags?.new?.some(newTag => newTag.id === tag.id)
) || [];
const addedTags = change.tags?.new?.filter(tag =>
!change.tags?.old?.some(oldTag => oldTag.id === tag.id)
) || [];
const removedTags =
change.tags?.old?.filter(
(tag: SecretTagType) =>
!change.tags?.new?.some((newTag: SecretTagType) => newTag.id === tag.id)
) || []
const addedTags =
change.tags?.new?.filter(
(tag: SecretTagType) =>
!change.tags?.old?.some((oldTag: SecretTagType) => oldTag.id === tag.id)
) || []

Add the SecretTagType annotation here

onClose={() => setIsChangesModalOpen(false)}
buttonContent={<FaInfoCircle />}
>
<div className="flex flex-col space-y-2">
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<div className="flex flex-col space-y-2">
<div className="flex flex-col space-y-2 max-h-[85vh] overflow-auto">

Add a max height to handle overflow where there are a large number of changes

@harshith-1008
Copy link
Contributor Author

@rohan-chaturvedi I have pushed new changes. Can you look into it ?

@rohan-chaturvedi rohan-chaturvedi self-requested a review August 31, 2024 08:06
@rohan-chaturvedi
Copy link
Member

rohan-chaturvedi commented Aug 31, 2024

Great work! Sorry for the lengthy review 😅

@rohan-chaturvedi rohan-chaturvedi merged commit 4389320 into phasehq:main Aug 31, 2024
2 of 3 checks passed
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