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

feat: condition domain certificate field #267

Merged

Conversation

lorenzomigliorero
Copy link
Contributor

@lorenzomigliorero lorenzomigliorero commented Jul 24, 2024

Steps taken

Merge add-domain and update-domain in one component

There were a lot of duplications before, and the only difference between the files was the create vs update mutation. One file is easier to manage, and we're sure they share now the same validation rules (before they weren't).

Add a condition to show certificate field when HTTPS is true

Close modal on either success or fail

I see a PR for it, but I'm starting adding the fix here

Summary by CodeRabbit

  • New Features

    • Enhanced domain management functionality, allowing users to create or update domains within the same component.
    • Improved validation for domain fields, ensuring proper input formats and mandatory values.
  • UI Improvements

    • Updated icons for domain actions, enhancing visual clarity.
    • Refined user interface for the "Add Domain" button, increasing interactivity.
  • Bug Fixes

    • Adjusted conditional rendering for certificate selection based on user input, improving usability.
  • Chores

    • Updated database schema to enforce required values for critical domain attributes, enhancing data integrity.

coderabbitai[bot]

This comment was marked as spam.

@lorenzomigliorero
Copy link
Contributor Author

lorenzomigliorero commented Jul 24, 2024

@Siumauricio, what is this extension doing exactly? It never shows relevant information, and I found it quite confusing. Should we maybe add an issue template instead? What do you think?

coderabbitai[bot]

This comment was marked as abuse.

server/db/schema/domain.ts Outdated Show resolved Hide resolved
@Siumauricio
Copy link
Contributor

@lorenzomigliorero in theory it should give some suggestions about the code and better practices, but is more the unnecesary comments

@Dokploy Dokploy deleted a comment from coderabbitai bot Jul 25, 2024
@lorenzomigliorero
Copy link
Contributor Author

Yeah, I found it very confusing. Eventually, we can make the biome rules more strict and add a PR template.
I don't think this extension is necessary.

@lorenzomigliorero lorenzomigliorero marked this pull request as draft July 25, 2024 07:20
@lorenzomigliorero
Copy link
Contributor Author

lorenzomigliorero commented Jul 25, 2024

Hey @Siumauricio, I worked a bit on this form, and I made several improvements.

  • Now the same validation rules are shared for both API and form
  • The certificate is required only on HTTPS
  • I removed unnecessary required modifier from the APIs, because fields were already required
  • APIs inputs were all required, but this is not necessary. They should respect the validation rules
  • The form reset only when a new domain is added

This is a big improvement because it avoids many duplications, and it should be the standard for all APIs/forms.
We can schedule a refactor later.

@lorenzomigliorero lorenzomigliorero marked this pull request as ready for review July 25, 2024 09:10
@Siumauricio
Copy link
Contributor

All looks good @lorenzomigliorero thank you so much for this refactor

I just remove the flushsync due to this suggestion of react docs Ref

The form reset wasn't working because we wasn't reset the form properly since the recommend way to reset a form is inside a useEffect Ref and also added the refetch only when we have a domainId specified

@Siumauricio Siumauricio merged commit f02f75e into Dokploy:canary Jul 26, 2024
1 check passed
@lorenzomigliorero lorenzomigliorero deleted the feat/condition-certificate branch October 3, 2024 13:30
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.

2 participants