Skip to content

change: [M3-8000] - GPUv2 Plan Divider & PlanSelection cleanup #10407

Merged
abailly-akamai merged 16 commits intolinode:developfrom
abailly-akamai:M3-8000
May 3, 2024
Merged

change: [M3-8000] - GPUv2 Plan Divider & PlanSelection cleanup #10407
abailly-akamai merged 16 commits intolinode:developfrom
abailly-akamai:M3-8000

Conversation

@abailly-akamai
Copy link
Contributor

@abailly-akamai abailly-akamai commented Apr 25, 2024

Description 📝

This PR has two separate goals:

  • continue the consolidation of the Linode Create & K8 Create SelectionPlan components
  • implement the new plan divider for GPU plans

There may be more follow up as new features build on our Plan Selection interfaces, but this refactor will help much in reducing the barrier to doing so.

Changes 🔄

  • Improve PlansPanel (and children) APIs
    • props
    • naming conventions
    • reusability
  • Improve plans selection accessibility
  • Add new reusable logic to enable dividing plans into separate tables
  • Add new gpuv2 feature flag to control Divider for GPU plans
  • Improve ExtendedTypes to include props tied to plan disabled state
  • Consolidate Disabled Tooltip
    • New Component (we have two tooltips previously)
    • Copy (via util)
    • Placement (both tables and cards)
  • Update and increase selection-plan cypress test

Target release date 🗓️

5/13/2024

Preview 📷

The major visual change resulting from this PR is the Table divider feature shown below

Desktop Mobile
Screen Shot 2024-05-01 at 13 52 12 Screen Shot 2024-05-01 at 13 55 15

Another changes include the Card chip opacity (opacity for copy but not "Limited Development Availability" chip

Before After
Screen Shot 2024-05-01 at 10 55 25 Screen Shot 2024-05-01 at 10 54 58

How to test 🧪

Verification steps

ℹ️ Using ALPHA (the new "Ada" plans are only returned there at the moment)
ℹ️ The new gpuv2 flag is ON in development only and I didn't add it to the dev tools as it did not seem the switching feature was important here.

  • In the Linode create flow, select "Newark, NJ" region
    • Select the GPU tab and confirm display and functionality of the new split tables
    • Confirm other plan tabs are not affected
  • In the Kubernetes Create Flow, confirm no regression
  • In the Database Create & Resize flows, confirm no regression

As an Author I have considered 🤔

Check all that apply

  • 👀 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

@abailly-akamai abailly-akamai self-assigned this Apr 25, 2024
@abailly-akamai abailly-akamai force-pushed the M3-8000 branch 2 times, most recently from ffd352b to 0a71f39 Compare April 26, 2024 16:13
@abailly-akamai abailly-akamai changed the title M3-8000 change: [M3-8000] - GPUv2 Plan Divider & PlanSelection cleanup Apr 30, 2024
// Should have one disabled plan
// Should have tooltip for the disabled plan (more than half disabled plans in the panel, but only one plan)
fbtClick('High Memory');
cy.findByText('High Memory').click();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fbtClick is now marked as deprecated

<CardBaseHeading
className="cardSubheadingTitle"
data-qa-select-card-heading={heading}
>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These changes help with the styling of the disabled selection card, allowing non string items to not suffer fro the opacity change

<StyledPlansPanel
disableSmallerPlans={{
selectedDiskSize: currentPlanDisk,
}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reasons for nesting this property are:

  • being very explicit on what the prop achieves (before this change, selectedDiskSize was employed to disable smaller plans and it was not clear at all
  • Allowing more conditions to be passed as the logic needs some finesse (working with the dbaas team to sort them out - see M3-8057)

},
],
},
];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Main logic for declaring plan panel splitting. It was made to be dynamic to more items can be added to the array as we're gearing up towards more granularity in our selection plans in the next few weeks/months.

At the moment, without added API support, the only logic we split plans is to do string matching on the label, per plan type (including a way to turn this off via feature flag). Considering the slow rollout of such family plans, it has been the accepted hard coded solution on both the product and engineering side for the time being.

selectedId?: string;
selectedRegionId?: Region['id'];
showTransfer?: boolean;
type: PlanSelectionType;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

type was really ambiguous here, since planType usually refers to a plan "family". renamed to plan for code clarity since that's what it refers to. It has actually helped me with the refactor

text={tooltip}
tooltipPosition="right"
/>
)}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both tooltips consolidated in one - was kind of a mess

</TableBody>
</StyledTable>
);
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

new component to separate concern

@abailly-akamai abailly-akamai marked this pull request as ready for review May 1, 2024 16:11
@abailly-akamai abailly-akamai requested review from a team as code owners May 1, 2024 16:11
@abailly-akamai abailly-akamai requested review from carrillo-erik, dwiley-akamai and jdamore-linode and removed request for a team May 1, 2024 16:11
data-qa-plan-row={type.formattedLabel}
disabled={rowIsDisabled}
key={type.id}
onClick={() => (!rowIsDisabled ? onSelect(type.id) : undefined)}
Copy link
Contributor Author

@abailly-akamai abailly-akamai May 1, 2024

Choose a reason for hiding this comment

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

The reason for this change is to prevent applying aria-labels on non-interactive elements (more info documented in M3-8045, which will be a follow up PR) and have the interactive elements within the table row carrying that assistive information instead.

Some screen-readers don't even register aria-labels on non-interactive elements and in general are agreed to add more confusion than context. Cloud Manager in general needs work towards reducing this unwanted friction.

@github-actions
Copy link

github-actions bot commented May 1, 2024

Coverage Report:
Base Coverage: 81.82%
Current Coverage: 81.82%

}

interface gpuV2 {
planDivider: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Are other properties planned for the feature flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There will a string change there will be hence the payload. If not, it's quite ok to have it a JSON flag anyway?

Comment on lines +6 to +9
export const SMALLER_PLAN_DISABLED_COPY =
'Resizing to smaller plans is not supported';
export const PLAN_NOT_AVAILABLE_IN_REGION_COPY =
"This plan isn't available for the selected region";
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these end with periods to be consistent with the others?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed - done!

planBelongsToDisabledClass,
planHasLimitedAvailability,
planIsDisabled512Gb,
planIsTooSmall: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does disabling based on planIsTooSmall only apply to DBaaS? If so, might be worth commenting here to specify why we're setting this to 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.

done!

<TableBody role="radiogroup">
{shouldDisplayNoRegionSelectedMessage ? (
<TableRowEmpty
colSpan={9}
Copy link
Contributor

Choose a reason for hiding this comment

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

We can do tableCells.length instead of hardcoding the colSpan

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice - done!

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.

Checked these:
✅ Linode Plans
✅ Kubernetes Plans
✅ Database Plans

The only thing I noticed was NaN for Kubernetes Version
Screenshot 2024-05-02 at 3 34 12 PM

@abailly-akamai
Copy link
Contributor Author

@jaalah-akamai this NaN is only in alpha cause that Db does not return our default value

Copy link
Contributor

@dwiley-akamai dwiley-akamai left a comment

Choose a reason for hiding this comment

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

GPU tab changes with no regressions observed on other tabs or Kubernetes or DBaaS Create flows ✅

Tests pass ✅

Code review ✅

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