Skip to content

Commit

Permalink
Remove: OBJ and Managed Feature Flags (#5785)
Browse files Browse the repository at this point in the history
* removes obj and managed feature flags

* removes obj and managed feature flags
  • Loading branch information
martinmckenna committed Nov 19, 2019
1 parent cb5773a commit 6753a8d
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 138 deletions.
12 changes: 3 additions & 9 deletions packages/manager/src/MainContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ const MainContent: React.FC<CombinedProps> = props => {
{getObjectStorageRoute(
props.accountLoading,
props.accountCapabilities,
props.accountError,
Boolean(props.flags.objectStorage)
props.accountError
)}
{isKubernetesEnabled && (
<Route path="/kubernetes" component={Kubernetes} />
Expand Down Expand Up @@ -385,15 +384,10 @@ const MainContent: React.FC<CombinedProps> = props => {
const getObjectStorageRoute = (
accountLoading: boolean,
accountCapabilities: AccountCapability[],
accountError?: Error | APIError[],
featureFlag?: boolean
accountError?: Error | APIError[]
) => {
let component;
// If the feature flag is on, we want to see Object Storage regardless of
// the state of account.
if (featureFlag) {
component = ObjectStorage;
} else if (accountLoading) {
if (accountLoading) {
component = () => <LandingLoading delayInMS={1000} />;
} else if (accountError) {
component = () => (
Expand Down
4 changes: 1 addition & 3 deletions packages/manager/src/components/PrimaryNav/PrimaryNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ export class PrimaryNav extends React.Component<CombinedProps, State> {

return [
{
conditionToAdd: () =>
isObjectStorageEnabled(accountCapabilities) ||
Boolean(flags.objectStorage),
conditionToAdd: () => isObjectStorageEnabled(accountCapabilities),
insertAfter: 'Volumes',
link: {
display: 'Object Storage',
Expand Down
4 changes: 0 additions & 4 deletions packages/manager/src/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ interface TaxBanner {
type OneClickApp = Record<string, string>;

interface Flags {
managed: boolean;
objectStorage: boolean;
promos: boolean;
vatBanner: TaxBanner;
oneClickLocation: 'sidenav' | 'createmenu';
lkeHideButtons: boolean;
firewalls: boolean;
oneClickApps: OneClickApp;
longview: boolean;
objectStorageBilling: boolean;
objectStorageCancel: boolean;
}

/**
Expand Down
6 changes: 0 additions & 6 deletions packages/manager/src/features/Account/EnableManaged.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import SupportLink from 'src/components/SupportLink';
import withLinodes, {
DispatchProps
} from 'src/containers/withLinodes.container';
import useFlags from 'src/hooks/useFlags';
import { pluralize } from 'src/utilities/pluralize';

interface Props {
Expand Down Expand Up @@ -70,7 +69,6 @@ export const ManagedContent: React.FC<ContentProps> = props => {

export const EnableManaged: React.FC<CombinedProps> = props => {
const { isManaged, linodeCount, push, update } = props;
const flags = useFlags();
const [isOpen, setOpen] = React.useState<boolean>(false);
const [error, setError] = React.useState<string | undefined>();
const [isLoading, setLoading] = React.useState<boolean>(false);
Expand Down Expand Up @@ -113,10 +111,6 @@ export const EnableManaged: React.FC<CombinedProps> = props => {
</ActionsPanel>
);

if (!flags.managed) {
return null;
}

return (
<>
<ExpansionPanel heading="Linode Managed" defaultExpanded={true}>
Expand Down
20 changes: 6 additions & 14 deletions packages/manager/src/features/Account/GlobalSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import { AnyAction } from 'redux';
import { ThunkDispatch } from 'redux-thunk';
import CircleProgress from 'src/components/CircleProgress';
import ErrorState from 'src/components/ErrorState';
import withFeatureFlags, {
FeatureFlagConsumerProps
} from 'src/containers/withFeatureFlagConsumer.container';
import TagImportDrawer from 'src/features/TagImport';
import { ApplicationState } from 'src/store';
import { updateSettingsInStore } from 'src/store/accountSettings/accountSettings.actions';
Expand Down Expand Up @@ -62,8 +59,7 @@ interface DispatchProps {
type CombinedProps = StateProps &
DispatchProps &
WithSnackbarProps &
RouteComponentProps<{}> &
FeatureFlagConsumerProps;
RouteComponentProps<{}>;

class GlobalSettings extends React.Component<CombinedProps, {}> {
toggleAutomaticBackups = () => {
Expand Down Expand Up @@ -111,7 +107,6 @@ class GlobalSettings extends React.Component<CombinedProps, {}> {
backups_enabled,
networkHelperEnabled,
error,
flags,
loading,
linodesWithoutBackups,
entitiesWithGroupsToImport,
Expand Down Expand Up @@ -143,12 +138,10 @@ class GlobalSettings extends React.Component<CombinedProps, {}> {
onChange={this.toggleNetworkHelper}
networkHelperEnabled={networkHelperEnabled}
/>
{flags.objectStorageCancel && (
<EnableObjectStorage
object_storage={object_storage}
update={this.props.actions.updateAccountSettingsInStore}
/>
)}
<EnableObjectStorage
object_storage={object_storage}
update={this.props.actions.updateAccountSettingsInStore}
/>
<EnableManaged
isManaged={isManaged}
update={this.props.actions.updateAccountSettingsInStore}
Expand Down Expand Up @@ -220,8 +213,7 @@ const connected = connect(

const enhanced = compose<CombinedProps, {}>(
connected,
withSnackbar,
withFeatureFlags
withSnackbar
)(GlobalSettings);

export default enhanced;
2 changes: 1 addition & 1 deletion packages/manager/src/features/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const Dashboard: React.StatelessComponent<CombinedProps> = props => {
Dashboard
</Typography>
</Grid>
{flags.managed && managed && (
{managed && (
<Grid item xs={12}>
<ManagedDashboardCard />
</Grid>
Expand Down
8 changes: 0 additions & 8 deletions packages/manager/src/features/Managed/ManagedLanding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { RouteComponentProps } from 'react-router-dom';
import { compose } from 'recompose';
import setDocs from 'src/components/DocsSidebar/setDocs';
import { DocumentTitleSegment } from 'src/components/DocumentTitle';
import useFlags from 'src/hooks/useFlags';
import ManagedLandingContent from './ManagedLandingContent';
import ManagedPlaceholder from './ManagedPlaceholder';

export type CombinedProps = RouteComponentProps<{}>;

Expand All @@ -18,12 +16,6 @@ const docs: Linode.Doc[] = [
];

export const ManagedLanding: React.FunctionComponent<CombinedProps> = props => {
const flags = useFlags();

if (!flags.managed) {
return <ManagedPlaceholder />;
}

return (
<React.Fragment>
<DocumentTitleSegment segment="Managed" />
Expand Down
24 changes: 0 additions & 24 deletions packages/manager/src/features/Managed/ManagedPlaceholder.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { shallow } from 'enzyme';
import { AccountSettings } from 'linode-js-sdk/lib/account';
import * as React from 'react';
import { AccessKeyDrawer, Props } from './AccessKeyDrawer';
import { MODES } from './AccessKeyLanding';
import { AccessKeyDrawer, MODES, Props } from './AccessKeyDrawer';

describe('AccessKeyDrawer', () => {
const props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import Typography from 'src/components/core/Typography';
import Drawer from 'src/components/Drawer';
import Notice from 'src/components/Notice';
import TextField from 'src/components/TextField';
import useFlags from 'src/hooks/useFlags';
import { ApplicationState } from 'src/store';
import EnableObjectStorageModal from '../EnableObjectStorageModal';
import { confirmObjectStorage } from '../utilities';
import { MODES } from './AccessKeyLanding';

export type MODES = 'creating' | 'editing';

export interface Props {
open: boolean;
Expand Down Expand Up @@ -52,8 +52,6 @@ export const AccessKeyDrawer: React.StatelessComponent<
objectStorageKey
} = props;

const flags = useFlags();

const [dialogOpen, setDialogOpen] = React.useState<boolean>(false);

const title =
Expand Down Expand Up @@ -89,8 +87,7 @@ export const AccessKeyDrawer: React.StatelessComponent<
confirmObjectStorage<FormState>(
props.object_storage,
formikProps,
() => setDialogOpen(true),
flags.objectStorageBilling
() => setDialogOpen(true)
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ import {
sendRevokeAccessKeyEvent
} from 'src/utilities/ga';
import AccessKeyDisplayDialog from './AccessKeyDisplayDialog';
import AccessKeyDrawer from './AccessKeyDrawer';
import { MODES } from './AccessKeyLanding';
import AccessKeyDrawer, { MODES } from './AccessKeyDrawer';
import AccessKeyTable from './AccessKeyTable';
import RevokeAccessKeyDialog from './RevokeAccessKeyDialog';

Expand Down Expand Up @@ -71,8 +70,6 @@ type CombinedProps = Props &
ReduxStateProps &
DispatchProps;

export type MODES = 'creating' | 'editing';

export const AccessKeyLanding: React.StatelessComponent<
CombinedProps
> = props => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import bucketRequestsContainer, {
} from 'src/containers/bucketRequests.container';
// @todo: Extract ActionPanel out of Volumes
import BucketsActionPanel from 'src/features/Volumes/VolumeDrawer/VolumesActionsPanel';
import useFlags from 'src/hooks/useFlags';
import { ApplicationState } from 'src/store';
import { requestAccountSettings } from 'src/store/accountSettings/accountSettings.requests';
import {
Expand Down Expand Up @@ -79,8 +78,6 @@ export const CreateBucketForm: React.StatelessComponent<
bucketsData
} = props;

const flags = useFlags();

const [dialogOpen, setDialogOpen] = React.useState<boolean>(false);

return (
Expand Down Expand Up @@ -165,8 +162,7 @@ export const CreateBucketForm: React.StatelessComponent<
confirmObjectStorage<FormState>(
props.object_storage,
formikProps,
() => setDialogOpen(true),
flags.objectStorageBilling
() => setDialogOpen(true)
);
};

Expand Down
17 changes: 2 additions & 15 deletions packages/manager/src/features/ObjectStorage/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,23 +211,11 @@ describe('Object Storage utilities', () => {
handleSubmit
} as any;

it("doesn't call the confirmation handler if the feature flag is off", async () => {
await confirmObjectStorage(
'disabled',
mockFormikProps,
openConfirmationDialog,
false
);
expect(openConfirmationDialog).toHaveBeenCalledTimes(0);
expect(handleSubmit).toHaveBeenCalledTimes(1);
});

it("doesn't call the confirmation handler if OBJ is active", async () => {
await confirmObjectStorage(
'active',
mockFormikProps,
openConfirmationDialog,
true
openConfirmationDialog
);
expect(openConfirmationDialog).toHaveBeenCalledTimes(0);
expect(handleSubmit).toHaveBeenCalledTimes(1);
Expand All @@ -236,8 +224,7 @@ describe('Object Storage utilities', () => {
await confirmObjectStorage(
'disabled',
mockFormikProps,
openConfirmationDialog,
true
openConfirmationDialog
);
expect(openConfirmationDialog).toHaveBeenCalledTimes(1);
expect(handleSubmit).toHaveBeenCalledTimes(0);
Expand Down
5 changes: 2 additions & 3 deletions packages/manager/src/features/ObjectStorage/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,11 @@ export const firstSubfolder = (path: string) => path.split('/')[0];
export const confirmObjectStorage = <T extends {}>(
object_storage: AccountSettings['object_storage'],
formikProps: FormikProps<T>,
openConfirmationDialog: () => void,
featureFlag = false
openConfirmationDialog: () => void
) => {
// If the user doesn't already have Object Storage enabled, we show
// a confirmation modal before letting them create their first bucket.
if (featureFlag && object_storage === 'disabled') {
if (object_storage === 'disabled') {
// But first, manually validate the form.
formikProps.validateForm().then(validationErrors => {
if (Object.keys(validationErrors).length > 0) {
Expand Down
Loading

0 comments on commit 6753a8d

Please sign in to comment.