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: [M3-7345] – Unrecommended Linode configuration indicators on VPC Detail page #9914

Conversation

dwiley-akamai
Copy link
Contributor

@dwiley-akamai dwiley-akamai commented Nov 16, 2023

Description πŸ“

Assigning a linode to a VPC but not having the VPC interface be primary results in situations where network connectivity issues can arise (see ticket for more details). This PR adds warning indicators on the VPC Detail page when such configurations exist: a warning icon at the SubnetLinodeRow level

Changes πŸ”„

  • Interactive tooltip w/ warning icon added to SubnetLinodeRow when a linode has an unrecommended configuration
  • hasUnrecommendedConfiguration utility function
  • Test updates

Preview πŸ“·

Warning icon

Screenshot 2023-11-21 at 4 04 26 PM

How to test πŸ§ͺ

Prerequisites

  • An account with proper VPC tags
  • A VPC with:
    • a subnet within it
    • at least one linode assigned to it, with the linode having:
      • a public interface in eth0, designated as the primary interface (you can do this in the Linode Edit Config dialog)
      • a VPC interface in eth1

Verification steps

With the prereqs described above, observe:

  • The warning icon being present for the linode with an unrecommended configuration

If you go to the linode with an unrecommended configuration and adjust it by making the VPC interface (eth1) the primary interface, returning to the VPC Detail page should show that the warning icon is no longer present for that linode.

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

…mended configuration notice displayed (unconditionally for now) on VPC Detail page; fix visual defect in Storybook for Notices > Usage
@dwiley-akamai dwiley-akamai added the VPC Relating to VPC project label Nov 16, 2023
@dwiley-akamai dwiley-akamai self-assigned this Nov 16, 2023
@dwiley-akamai dwiley-akamai requested a review from a team as a code owner November 16, 2023 21:23
@dwiley-akamai dwiley-akamai requested review from hana-akamai and coliu-akamai and removed request for a team November 16, 2023 21:23
@@ -79,7 +79,7 @@ export interface NoticeProps extends Grid2Props {
- Appear within the page or modal
- Might be triggered by user action
- Typically used to alert the user to a new service, limited availability, or a potential consequence of the action being taken
- Consider using a [Dismissible Banner](/docs/components-notifications-dismissible-banners--beta-banner) if it’s not critical information
- Consider using a [Dismissible Banner](/docs/components-notifications-dismissible-banners--beta-banner) if it’s not critical information
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes this issue at design.linode.com:

Screenshot 2023-11-15 at 9 16 44 PM

const [
unrecommendedConfigurationPresent,
setUnrecommendedConfigurationPresent,
] = React.useState(false);
Copy link
Contributor Author

@dwiley-akamai dwiley-akamai Nov 16, 2023

Choose a reason for hiding this comment

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

Grabbing all the configs in this component could get expensive and messy, so this gets passed down and is used to decide whether the dismissible banner gets displayed or not. (configs get grabbed at the SubnetLinodeRow level)

@coliu-akamai
Copy link
Contributor

coliu-akamai commented Nov 17, 2023

Should the warning icon and dismissible banner show up for all linode statuses, including when the linode is inactive, or just when it's booting/online? My linode was originally offline so that I could set up the unrecommended configs, and then when I navigated back its vpc, the icon/banner didn't show up. After powering on the Linode the banner and icon show up then (*after reloading, see below)

When I switch the linode from a good config profile one to an unrecommended one, I need to reload the page in order to get the icon and banner to show up (when the linode is booting/active. If the linode's inactive, then the banner/icon don't show up after a page reload) -- see video:

Screen going white/loading is me reloading the page. (also deleting this linode now)

hmm.mov

@dwiley-akamai
Copy link
Contributor Author

Should the warning icon and dismissible banner show up for all linode statuses, including when the linode is inactive, or just when it's booting/online?

Confirmed with UX last Friday that we don't want these indicators displayed when the linode is inactive πŸ‘

When I switch the linode from a good config profile one to an unrecommended one, I need to reload the page in order to get the icon and banner to show up (when the linode is booting/active. If the linode's inactive, then the banner/icon don't show up after a page reload) -- see video:

What was happening here is: the linode is off in order to change the config --> config is changed, query gets refetched and active shows as false for the interfaces because the linode is off --> turn the linode back on, query doesn't get refetched. This should be fixed now

Copy link
Contributor

@hana-akamai hana-akamai left a comment

Choose a reason for hiding this comment

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

It seems a bit odd to me for the warning text to be separate (i.e. in a notice) from the warning icon. What about removing the notice and adding the text as a tooltip using the TooltipIcon component?

https://design.linode.com/?path=/docs/components-tooltip-tooltip-icon--documentation

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

autoformatting from the linter

@coliu-akamai
Copy link
Contributor

thanks for confirming @dwiley-akamai! Still getting the warning indicator to show up for inactive linodes. This happens if the linode had the warning indicator while online -- it stays after the linode is shut down. Might need to invalidate config queries as the linode is shutting down as well then?
image

Copy link
Contributor

@coliu-akamai coliu-akamai left a comment

Choose a reason for hiding this comment

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

βœ… SubnetLinodeRow.test.tsx tests pass
βœ… Warning icon + tooltip show up as expected when Linode is online - see comment above for offline linode

Regarding the warning icon status, how does it work for linodes with multiple configurations? Is it a similar situation to the Reboot Needed status, where it might get super confusing for linodes w multiple configs? πŸ‘€

@dwiley-akamai
Copy link
Contributor Author

Regarding the warning icon status, how does it work for linodes with multiple configurations? Is it a similar situation to the Reboot Needed status, where it might get super confusing for linodes w multiple configs? πŸ‘€

It's a similar situation unfortunately: I created a linode with an unrecommended config profile and a recommended config profile, assigning the former to one subnet and the latter to another subnet. I booted it with the unrecommended config profile and the icon displays for both of the linode's appearances in the table:

Screenshot 2023-11-21 at 5 48 46 PM

@coliu-akamai
Copy link
Contributor

@dwiley-akamai thanks for confirming! Is UX good with this behavior? Otherwise maybe you could pass the subnet ID into the hasUnrecommendedConfiguration method and then use that to determine that whether or not the warning indicator should be displayed?

@dwiley-akamai
Copy link
Contributor Author

@dwiley-akamai thanks for confirming! Is UX good with this behavior? Otherwise maybe you could pass the subnet ID into the hasUnrecommendedConfiguration method and then use that to determine that whether or not the warning indicator should be displayed?

What did you have in mind with the subnet ID? I'm not sure just the subnet ID is enough on its own. I wrote this out and the logic seems to work:

Revised hasUnrecommendedConfiguration() and new helper function
export const hasUnrecommendedConfiguration = (
  configs: Config[],
  subnet: Subnet | undefined
) => {
  const subnetAssignedLinodeData = subnet?.linodes;

  for (const config of configs) {
    const configInterfaces = config.interfaces;

    /*
     If there is a VPC interface marked as active but not primary, we want to display a
     message re: it not being a recommended configuration.

     Rationale: when the VPC interface is not the primary interface, it can communicate
     to other VMs within the same subnet, but not to VMs in a different subnet
     within the same VPC.
    */

    return configInterfaces.some(
      (_interface) =>
        _interface.active &&
        _interface.purpose === 'vpc' &&
        !_interface.primary &&
        interfaceInSubnet(_interface.id, subnetAssignedLinodeData)
    );
  }

  return false;
};

export const interfaceInSubnet = (
  interfaceId: number,
  subnetAssignedLinodeData: SubnetAssignedLinodeData[] | undefined
) => {
  return subnetAssignedLinodeData?.some((subnetAssignedLinodeDatum) => {
    const assignedInterfaces = subnetAssignedLinodeDatum.interfaces;
    return assignedInterfaces.some(
      (assignedInterface) =>
        assignedInterface.id === interfaceId && assignedInterface.active
    );
  });
};

In the scenario I described in my previous comment, this logic has the warning displayed in the subnet for the linode whose VPC interface has the unrecommended config, and not in the other subnet (same linode but whose VPC interface has the recommended config).

@coliu-akamai
Copy link
Contributor

@dwiley-akamai I wasn't clear, apologies. I meant pass in the subnet_id **in addition to the configs you were already passing in, which would allow you do do what you wrote above ^, to check if an interface was associated with the subnet_id you passed in. Glad to hear that works ^!

@coliu-akamai
Copy link
Contributor

coliu-akamai commented Nov 27, 2023

@dwiley-akamai Wednesday before Thanksgiving shenanigans πŸ˜… - I just looked over what you wrote above again, and realized you had a different approach. I had more in mind that you could compare the interface.subnet_id to the passed in subnet_id, since interfaces should also have a subnet_id field if they're assigned to a vpc. You might not need the helper function interfaceInSubnet if so - you could compare directly in at line 53 if _interface.subnet_id === subnet_id

Will be re-reviewing this shortly!

@dwiley-akamai
Copy link
Contributor Author

@coliu-akamai Thanks for the thorough testing and review -- with the most recent changes I think the expected indicators should be displayed

Copy link
Contributor

@coliu-akamai coliu-akamai left a comment

Choose a reason for hiding this comment

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

Tested βœ…

  • 1 config linode unrecommended config
  • 1 config linode recommended config
  • 2 configs linode βœ…
    • first one in use and unrecommended, second one recommended but not in use (warning indicator for first)
    • first one not in use and unrecommended, second one in use and recommended (no warning indicators)
    • first one in use and recommended, second one unrecommended but not in use (no warning indicators)
    • first one not in use and recommended, second on in use and unrecommended (warning indicator for second)
    • both unrecommended and first one in use (warning indicator for first)
    • both unrecommended and second one in use (warning indicator for second)
    • both recommended, first one in use (no warning indicator)
    • both recommended, second one in use (no warning indicator)

The indicators worked as expected -- thanks Dajahi! πŸš€

@coliu-akamai coliu-akamai added the Add'tl Approval Needed Waiting on another approval! label Nov 28, 2023
@coliu-akamai
Copy link
Contributor

Ah - one small thing I was thinking about in terms of accessibility for the warning indicator: is there a way to use the keyboard to click on the Configuration Profiles link that appears in the tooltip? I'm able to use the keyboard to get the tooltip to show up and have the contents be read in the voiceover, but couldn't figure out how to click on the link

Copy link
Contributor

@hana-akamai hana-akamai left a comment

Choose a reason for hiding this comment

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

Confirmed that the warning icon is visible in the table for Linodes with an unrecommended configuration πŸ‘

Should we also add a warning notice to the Linode's details page about the unrecommended configuration?

@dwiley-akamai
Copy link
Contributor Author

Should we also add a warning notice to the Linode's details page about the unrecommended configuration?

Between #9916 and how we configure things for the user via the initial assignment payloads, I think we should be covered (users would have to go into the Add/Edit Config dialog to change to unrecommended configurations, so they would see the warnings).

Ah - one small thing I was thinking about in terms of accessibility for the warning indicator: is there a way to use the keyboard to click on the Configuration Profiles link that appears in the tooltip? I'm able to use the keyboard to get the tooltip to show up and have the contents be read in the voiceover, but couldn't figure out how to click on the link

This seems to be a limitation of MUI's Tooltip component currently. We do have this pattern elsewhere in the app so perhaps a separate ticket could be created to investigate workarounds

@hana-akamai hana-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Nov 28, 2023
@dwiley-akamai
Copy link
Contributor Author

Created M3-7486 for investigating the accessibility question

@dwiley-akamai dwiley-akamai merged commit 9f1f4dd into linode:develop Nov 28, 2023
@dwiley-akamai dwiley-akamai deleted the M3-7345-vpc-linode-config-not-recommended branch November 28, 2023 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! VPC Relating to VPC project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants