Skip to content

Commit

Permalink
feat: [M3-7948] - Add Region filtering to Linodes landing table (#10639)
Browse files Browse the repository at this point in the history
## Description 📝
Add support for region filtering in the Linodes landing table for Gecko LA. Region filter is saved in local storage similar to the "Show X" dropdown.

## Changes  🔄
List any change relevant to the reviewer.
- Add `site_type` to the linode instance type
- Removed `edge` references where possible
- Add region filter dropdown to the Linodes landing table

## How to test 🧪
### Verification steps
- `All` should display all Linodes (core and distributed regions)
- `Core` should only display Linodes in `core` regions
- `Distributed` should only display Linodes in `distributed` regions
- Ensure sorting, summary, and tag view still work as normal
- Navigate to another page and go back to the Landing page, the region selection should stay the same
  • Loading branch information
hana-akamai authored Oct 7, 2024
1 parent f49d104 commit 5155c6a
Show file tree
Hide file tree
Showing 25 changed files with 388 additions and 206 deletions.
5 changes: 5 additions & 0 deletions packages/api-v4/.changeset/pr-10639-removed-1727977150621.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/api-v4": Removed
---

`edge` type reference in `LinodeTypeClass` and `RegionSite` ([#10639](https://github.com/linode/manager/pull/10639))
3 changes: 1 addition & 2 deletions packages/api-v4/src/linodes/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ export type LinodeTypeClass =
| 'gpu'
| 'metal'
| 'prodedicated'
| 'premium'
| 'edge';
| 'premium';

export interface IPAllocationRequest {
type: 'ipv4';
Expand Down
2 changes: 1 addition & 1 deletion packages/api-v4/src/regions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface DNSResolvers {

export type RegionStatus = 'ok' | 'outage';

export type RegionSite = 'core' | 'distributed' | 'edge';
export type RegionSite = 'core' | 'distributed';

export interface Region {
id: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Add Region filtering to Linodes landing table ([#10639](https://github.com/linode/manager/pull/10639))
12 changes: 6 additions & 6 deletions packages/manager/cypress/e2e/core/images/create-image.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const mockRegions: Region[] = [
}),
regionFactory.build({
capabilities: ['Linodes', 'Disk Encryption'],
id: 'us-den-edge-1',
label: 'Edge - Denver, CO',
site_type: 'edge',
id: 'us-den-1',
label: 'Distributed - Denver, CO',
site_type: 'distributed',
}),
];

Expand All @@ -34,7 +34,7 @@ const mockLinodes: Linode[] = [
region: mockRegions[0].id,
}),
linodeFactory.build({
label: 'edge-region-linode',
label: 'distributed-region-linode',
region: mockRegions[1].id,
}),
];
Expand Down Expand Up @@ -124,7 +124,7 @@ describe('create image (e2e)', () => {
});
});

it('displays notice informing user that Images are not encrypted, provided the LDE feature is enabled and the selected linode is not in an Edge region', () => {
it('displays notice informing user that Images are not encrypted, provided the LDE feature is enabled and the selected linode is not in a distributed region', () => {
// Mock feature flag -- @TODO LDE: Remove feature flag once LDE is fully rolled out
mockAppendFeatureFlags({
linodeDiskEncryption: true,
Expand Down Expand Up @@ -198,7 +198,7 @@ describe('create image (e2e)', () => {
cy.findByText(DISK_ENCRYPTION_IMAGES_CAVEAT_COPY).should('not.exist');
});

it('does not display a notice informing user that Images are not encrypted if the selected linode is in an Edge region', () => {
it('does not display a notice informing user that Images are not encrypted if the selected linode is in a distributed region', () => {
// Mock feature flag -- @TODO LDE: Remove feature flag once LDE is fully rolled out
mockAppendFeatureFlags({
linodeDiskEncryption: true,
Expand Down
36 changes: 18 additions & 18 deletions packages/manager/src/__data__/distributedRegionsData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const distributedRegions: Region[] = [
'Placement Group',
],
country: 'us',
id: 'us-den-edge-1',
label: 'Edge - Denver, CO',
id: 'us-den-1',
label: 'Distributed - Denver, CO',
placement_group_limits: {
maximum_linodes_per_pg: 5,
maximum_pgs_per_customer: null,
Expand All @@ -30,8 +30,8 @@ export const distributedRegions: Region[] = [
'Placement Group',
],
country: 'de',
id: 'de-ham-edge-1',
label: 'Edge - Hamburg, DE',
id: 'de-ham-1',
label: 'Distributed - Hamburg, DE',
placement_group_limits: {
maximum_linodes_per_pg: 5,
maximum_pgs_per_customer: null,
Expand All @@ -51,8 +51,8 @@ export const distributedRegions: Region[] = [
'Placement Group',
],
country: 'fr',
id: 'fr-mrs-edge-1',
label: 'Edge - Marseille, FR',
id: 'fr-mrs-1',
label: 'Distributed - Marseille, FR',
placement_group_limits: {
maximum_linodes_per_pg: 5,
maximum_pgs_per_customer: null,
Expand All @@ -72,8 +72,8 @@ export const distributedRegions: Region[] = [
'Placement Group',
],
country: 'za',
id: 'za-jnb-edge-1',
label: 'Edge - Johannesburg, ZA\t',
id: 'za-jnb-1',
label: 'Distributed - Johannesburg, ZA\t',
placement_group_limits: {
maximum_linodes_per_pg: 5,
maximum_pgs_per_customer: null,
Expand All @@ -93,8 +93,8 @@ export const distributedRegions: Region[] = [
'Placement Group',
],
country: 'my',
id: 'my-kul-edge-1',
label: 'Edge - Kuala Lumpur, MY',
id: 'my-kul-1',
label: 'Distributed - Kuala Lumpur, MY',
placement_group_limits: {
maximum_linodes_per_pg: 5,
maximum_pgs_per_customer: null,
Expand All @@ -114,8 +114,8 @@ export const distributedRegions: Region[] = [
'Placement Group',
],
country: 'co',
id: 'co-bog-edge-1',
label: 'Edge - Bogotá, CO',
id: 'co-bog-1',
label: 'Distributed - Bogotá, CO',
placement_group_limits: {
maximum_linodes_per_pg: 5,
maximum_pgs_per_customer: null,
Expand All @@ -135,8 +135,8 @@ export const distributedRegions: Region[] = [
'Placement Group',
],
country: 'mx',
id: 'mx-qro-edge-1',
label: 'Edge - Querétaro, MX',
id: 'mx-qro-1',
label: 'Distributed - Querétaro, MX',
placement_group_limits: {
maximum_linodes_per_pg: 5,
maximum_pgs_per_customer: null,
Expand All @@ -156,8 +156,8 @@ export const distributedRegions: Region[] = [
'Placement Group',
],
country: 'us',
id: 'us-hou-edge-1',
label: 'Edge - Houston, TX',
id: 'us-hou-1',
label: 'Distributed - Houston, TX',
placement_group_limits: {
maximum_linodes_per_pg: 5,
maximum_pgs_per_customer: null,
Expand All @@ -177,8 +177,8 @@ export const distributedRegions: Region[] = [
'Placement Group',
],
country: 'cl',
id: 'cl-scl-edge-1',
label: 'Edge - Santiago, CL',
id: 'cl-scl-1',
label: 'Distributed - Santiago, CL',
placement_group_limits: {
maximum_linodes_per_pg: 5,
maximum_pgs_per_customer: null,
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/__data__/regionsData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ export const regions: Region[] = [
status: 'ok',
},
{
capabilities: ['Linodes'],
capabilities: ['Linodes', 'Distributed Plans'],
country: 'us',
id: 'us-den-10',
label: 'Gecko Distributed Region Test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ export const getRegionOptions = ({
if (distributedContinentCode && distributedContinentCode !== 'ALL') {
const group = getRegionCountryGroup(region);
return (
region.site_type === 'edge' ||
(region.site_type === 'distributed' &&
CONTINENT_CODE_TO_CONTINENT[
distributedContinentCode as keyof typeof CONTINENT_CODE_TO_CONTINENT
] === group)
region.site_type === 'distributed' &&
CONTINENT_CODE_TO_CONTINENT[
distributedContinentCode as keyof typeof CONTINENT_CODE_TO_CONTINENT
] === group
);
}
return regionFilter.includes(region.site_type);
Expand Down Expand Up @@ -149,7 +148,7 @@ export const getIsDistributedRegion = (
const region = regionsData.find(
(region) => region.id === selectedRegion || region.label === selectedRegion
);
return region?.site_type === 'distributed' || region?.site_type === 'edge';
return region?.site_type === 'distributed';
};

export const getNewRegionLabel = (region: Region) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const KubernetesPlansPanel = (props: Props) => {
</>
);
},
title: planTabInfoContent[plan === 'edge' ? 'dedicated' : plan]?.title,
title: planTabInfoContent[plan]?.title,
};
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ export const Addons = () => {
);

const isDistributedRegionSelected =
selectedRegion?.site_type === 'distributed' ||
selectedRegion?.site_type === 'edge';
selectedRegion?.site_type === 'distributed';

return (
<Paper data-qa-add-ons>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ export const Backups = () => {
const isAccountBackupsEnabled = accountSettings?.backups_enabled ?? false;

const isDistributedRegionSelected =
selectedRegion?.site_type === 'distributed' ||
selectedRegion?.site_type === 'edge';
selectedRegion?.site_type === 'distributed';

const checked = getBackupsEnabledValue({
accountBackupsEnabled: isAccountBackupsEnabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ export const PrivateIP = () => {
);

const isDistributedRegionSelected =
selectedRegion?.site_type === 'distributed' ||
selectedRegion?.site_type === 'edge';
selectedRegion?.site_type === 'distributed';

return (
<FormControlLabel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,7 @@ export const Region = React.memo(() => {

const showDistributedRegionIconHelperText =
isGeckoBetaEnabled && !hideDistributedRegions;
regions?.some(
(region) =>
region.site_type === 'distributed' || region.site_type === 'edge'
);
regions?.some((region) => region.site_type === 'distributed');

const disabledRegions = getDisabledRegions({
regions: regions ?? [],
Expand Down
Loading

0 comments on commit 5155c6a

Please sign in to comment.