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

upcoming: [M3-7599] - Update AGLB Configuration Ports Copy #10079

Merged

Conversation

bnussman-akamai
Copy link
Contributor

@bnussman-akamai bnussman-akamai commented Jan 18, 2024

Description 📝

  • Updates AGLB Configuration Ports Copy
  • Tweaks form error handling so that it matches the behavior of other dynamic forms
  • Updates the port dynamically if you choose HTTP or HTTPS when you haven't provided a custom port

Preview 📷

Before After
Screenshot 2024-01-18 at 4 59 31 PM Screenshot 2024-01-18 at 4 59 20 PM

How to test 🧪

Prerequisites

  • Use the dev-test-aglb account
  • Use the dev environment

Verification steps

As an Author I have considered 🤔

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@bnussman-akamai bnussman-akamai added Ready for Review ACLB Relating to the Akamai Cloud Load Balancer labels Jan 18, 2024
@bnussman-akamai bnussman-akamai self-assigned this Jan 18, 2024
@bnussman-akamai bnussman-akamai marked this pull request as ready for review January 18, 2024 22:03
@bnussman-akamai bnussman-akamai requested a review from a team as a code owner January 18, 2024 22:03
@bnussman-akamai bnussman-akamai requested review from carrillo-erik and hkhalil-akamai and removed request for a team January 18, 2024 22:03
@@ -65,6 +66,8 @@ export const ConfigurationForm = (props: CreateProps | EditProps) => {
const [isAddRouteDrawerOpen, setIsAddRouteDrawerOpen] = useState(false);
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);

const [hasChangedPort, setHasChangedPort] = useState(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a better way to handle this?

Copy link
Contributor

Choose a reason for hiding this comment

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

You'll need to define some defaults first, but then you could do:

const defaultPort = {
    http: 80,
    https: 443,
    tcp: 80,
  };

  const handleProtocolChange = (protocol: Protocol) => {
    const { values, setFormikState } = formik;
    const { protocol: currentProtocol, port } = values;

    // Calculate the default port directly
    const newPort = port === defaultPort[currentProtocol] ? defaultPort[protocol] : port;

    setFormikState((prev) => ({
      ...prev,
      values: {
        ...values,
        port: newPort,
        protocol,
      },
    }));
  };

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That looks clean! I was mainly asking about having to maintain extra state (hasChangedPort). I don't think I can derive that with formik, but I'm not 100% sure

Copy link
Contributor

Choose a reason for hiding this comment

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

Well that's what this does, no?

Copy link

github-actions bot commented Jan 18, 2024

Coverage Report:
Base Coverage: 79.95%
Current Coverage: 79.95%

@carrillo-erik
Copy link
Contributor

I was able to verify the update to the AGLB Configuration Ports Copy.
Screenshot 2024-01-19 at 8 41 33 AM

@bnussman-akamai bnussman-akamai added the Add'tl Approval Needed Waiting on another approval! label Jan 19, 2024
Copy link
Contributor

@jaalah-akamai jaalah-akamai left a comment

Choose a reason for hiding this comment

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

This looks good regardless

@bnussman-akamai bnussman-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Jan 19, 2024
@bnussman-akamai bnussman-akamai merged commit 155e43c into linode:develop Jan 22, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ACLB Relating to the Akamai Cloud Load Balancer Approved Multiple approvals and ready to merge! Ready for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants