Skip to content

Commit

Permalink
Tech Story: [M3-7360] - DC Get Well - Cleanup/Remove feature flag log…
Browse files Browse the repository at this point in the history
…ic (linode#10146)

* Cleanup feature flag data

* Added changeset: DC Get Well - Cleanup/Remove feature flag logic
  • Loading branch information
abailly-akamai authored Feb 6, 2024
1 parent 460012d commit b847864
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tech Stories
---

DC Get Well - Cleanup/Remove feature flag logic ([#10146](https://github.com/linode/manager/pull/10146))
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useEffect, useMemo, useState } from 'react';

import { Autocomplete } from 'src/components/Autocomplete/Autocomplete';
import { StyledListItem } from 'src/components/Autocomplete/Autocomplete.styles';
import { useFlags } from 'src/hooks/useFlags';
import { useAccountAvailabilitiesQueryUnpaginated } from 'src/queries/accountAvailability';

import { RegionOption } from './RegionOption';
Expand Down Expand Up @@ -36,11 +35,10 @@ export const RegionMultiSelect = React.memo((props: RegionMultiSelectProps) => {
width,
} = props;

const flags = useFlags();
const {
data: accountAvailability,
isLoading: accountAvailabilityLoading,
} = useAccountAvailabilitiesQueryUnpaginated(flags.dcGetWell);
} = useAccountAvailabilitiesQueryUnpaginated();

const [selectedRegions, setSelectedRegions] = useState<RegionSelectOption[]>(
getSelectedRegionsByIds({
Expand Down Expand Up @@ -93,9 +91,6 @@ export const RegionMultiSelect = React.memo((props: RegionMultiSelectProps) => {
<>
<StyledAutocompleteContainer sx={{ width }}>
<Autocomplete
getOptionDisabled={(option: RegionSelectOption) =>
Boolean(flags.dcGetWell) && Boolean(option.unavailable)
}
groupBy={(option: RegionSelectOption) => {
return option?.data?.region;
}}
Expand Down Expand Up @@ -134,6 +129,7 @@ export const RegionMultiSelect = React.memo((props: RegionMultiSelectProps) => {
disableClearable={!isClearable}
disabled={disabled}
errorText={errorText}
getOptionDisabled={(option: RegionSelectOption) => option.unavailable}
label={label ?? 'Regions'}
loading={accountAvailabilityLoading}
multiple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Box } from 'src/components/Box';
import { Flag } from 'src/components/Flag';
import { Link } from 'src/components/Link';
import { Tooltip } from 'src/components/Tooltip';
import { useFlags } from 'src/hooks/useFlags';

import {
SelectedIcon,
Expand All @@ -23,9 +22,7 @@ type Props = {
};

export const RegionOption = ({ option, props, selected }: Props) => {
const flags = useFlags();
const isDisabledMenuItem =
Boolean(flags.dcGetWell) && Boolean(option.unavailable);
const isDisabledMenuItem = option.unavailable;

return (
<Tooltip
Expand Down
8 changes: 2 additions & 6 deletions packages/manager/src/components/RegionSelect/RegionSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';

import { Autocomplete } from 'src/components/Autocomplete/Autocomplete';
import { Flag } from 'src/components/Flag';
import { useFlags } from 'src/hooks/useFlags';
import { useAccountAvailabilitiesQueryUnpaginated } from 'src/queries/accountAvailability';

import { RegionOption } from './RegionOption';
Expand Down Expand Up @@ -39,11 +38,10 @@ export const RegionSelect = React.memo((props: RegionSelectProps) => {
width,
} = props;

const flags = useFlags();
const {
data: accountAvailability,
isLoading: accountAvailabilityLoading,
} = useAccountAvailabilitiesQueryUnpaginated(flags.dcGetWell);
} = useAccountAvailabilitiesQueryUnpaginated();

const regionFromSelectedId: RegionSelectOption | null =
getSelectedRegionById({
Expand Down Expand Up @@ -84,9 +82,6 @@ export const RegionSelect = React.memo((props: RegionSelectProps) => {
return (
<StyledAutocompleteContainer sx={{ width }}>
<Autocomplete
getOptionDisabled={(option: RegionSelectOption) =>
Boolean(flags.dcGetWell) && Boolean(option.unavailable)
}
isOptionEqualToValue={(
option: RegionSelectOption,
{ value }: RegionSelectOption
Expand Down Expand Up @@ -127,6 +122,7 @@ export const RegionSelect = React.memo((props: RegionSelectProps) => {
disableClearable={!isClearable}
disabled={disabled}
errorText={errorText}
getOptionDisabled={(option: RegionSelectOption) => option.unavailable}
groupBy={(option: RegionSelectOption) => option.data.region}
label={label ?? 'Region'}
loading={accountAvailabilityLoading}
Expand Down
1 change: 0 additions & 1 deletion packages/manager/src/dev-tools/FeatureFlagTool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const MOCK_FEATURE_FLAGS_STORAGE_KEY = 'devTools/mock-feature-flags';
const options: { flag: keyof Flags; label: string }[] = [
{ flag: 'aclb', label: 'ACLB' },
{ flag: 'aclbFullCreateFlow', label: 'ACLB Full Create Flow' },
{ flag: 'dcGetWell', label: 'DC Get Well' },
{ flag: 'linodeCloneUIChanges', label: 'Linode Clone UI Changes' },
{ flag: 'metadata', label: 'Metadata' },
{ flag: 'parentChildAccountAccess', label: 'Parent/Child Account' },
Expand Down
1 change: 0 additions & 1 deletion packages/manager/src/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export interface Flags {
databaseBeta: boolean;
databaseScaleUp: boolean;
databases: boolean;
dcGetWell: boolean;
firewallNodebalancer: boolean;
ipv6Sharing: boolean;
linodeCloneUIChanges: boolean;
Expand Down

0 comments on commit b847864

Please sign in to comment.