-
Notifications
You must be signed in to change notification settings - Fork 361
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-8279] - Conditionally disable regions based on the selected image #10607
upcoming: [M3-8279] - Conditionally disable regions based on the selected image #10607
Conversation
b49b73d
to
0aeb0bd
Compare
0aeb0bd
to
68bfd23
Compare
Coverage Report: ✅ |
…image on Linode Create
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified all functionality in create v1 and v2:
✅ Edge sites are disabled when selecting a core image
✅ Edge sites are enabled when selecting a distributed image
✅ Switching from a distributed image to a core image clears regions field if a core region is selected
Approved pending some minor feedback and one failing unit test. (CI test failures appear to be flake).
selection: string | undefined, | ||
image: Image | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selection
is just the image label right? If so, can we just provide the image
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Selection is the image id.
I chose to just pass the whole image as the second parameter to minimize having to touch tons of other files.
ImageSelect should be removed soon in favor of ImageSelect2, which addresses this, so I think this is okay for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep in mind that <ImageSelect />
won't be deprecated by switching over to the Linode Create v2 flow alone (it's also used in Rebuild flows) so we may live with this for a while. We should at least have a code comment about this here and below for the non-null assertion
const supportedDistributedRegionTypes = [ | ||
'Distributions', | ||
'StackScripts', | ||
'Images', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a top-level constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will let @hana-linode handle that with Gecko
packages/manager/src/features/Linodes/LinodeCreatev2/Region.test.tsx
Outdated
Show resolved
Hide resolved
selectedImageID: | ||
this.params.imageID ?? this.params.type !== 'Images' | ||
? DEFAULT_IMAGE | ||
: undefined, | ||
// @todo: Abstract and test. UPDATE 5/21/20: lol what does this mean. UPDATE 3/16/23 lol what |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't wait to switch to create v2 so we can finally remove this comment 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic looks good and confirmed the region select is behaving properly according to the image selection ✅
selection: string | undefined, | ||
image: Image | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep in mind that <ImageSelect />
won't be deprecated by switching over to the Linode Create v2 flow alone (it's also used in Rebuild flows) so we may live with this for a while. We should at least have a code comment about this here and below for the non-null assertion
return disabledRegions; | ||
}, | ||
{} | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am starting to get worried about seeing a lot of of various logic bits for checking against distributed regions. Not something this PR should necessarily address but it would be nice to start seeing those checks in utils and unit tested in isolation (glad to see it's still tested below! tho there seems to be a failure). This same duplicated is Region.tsx
which I assume is intentional?
CC @hana-linode
if ( | ||
image && | ||
!image.capabilities.includes('distributed-images') && | ||
selectedRegion?.site_type === 'distributed' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar comment here - tho this one isn't unit tested
packages/manager/src/components/SelectRegionPanel/SelectRegionPanel.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 I just pulled latest and confirmed:
Create Flow v1:
- When a distributed compatible image is selected any region can be selected
- When a non-distributed capable image is selected, only core regions can be selected
- If the user changes the Image, the region field is cleared if there is an incompatibility
Create Flow v2:
- When a distributed compatible image is selected any region can be selected
- When a non-distributed capable image is selected, only core regions can be selected
- If the user changes the Image, the region field is cleared if there is an incompatibility
Description 📝
capabilities
🌐Preview 📷
How to test 🧪
Prerequisites
Verification steps
Warning
Test with both Linode Create and Linode Create v2
As an Author I have considered 🤔