Skip to content
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

chore: remove multiorg phase2 feat flag #6643

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cypress/e2e/cloud/about.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import {makeQuartzUseIDPEOrgID} from 'cypress/support/Utils'
import {Organization} from 'src/client'

const deleteOrgsFeatureFlags = {
createDeleteOrgs: true,
}

// This variable stores the current IDPE orgid and syncs it with the quartz-mock orgid.
let idpeOrgID: string

Expand Down Expand Up @@ -34,7 +30,6 @@ interface SetupParams {
const setupTest = (setupParams: SetupParams) => {
cy.flush().then(() =>
cy.signin().then(() => {
cy.setFeatureFlags(deleteOrgsFeatureFlags)
cy.request({
method: 'GET',
url: 'api/v2/orgs',
Expand Down
5 changes: 0 additions & 5 deletions cypress/e2e/cloud/createOrg.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import {makeQuartzUseIDPEOrgID} from 'cypress/support/Utils'

const createOrgsFeatureFlags = {
createDeleteOrgs: true,
}

const newOrgName = 'A New Org'

// This variable stores the current IDPE orgid and syncs it with the quartz-mock orgid.
Expand Down Expand Up @@ -113,7 +109,6 @@ interface SetupParams {
const setupTest = (setupParams: SetupParams) => {
cy.flush().then(() =>
cy.signin().then(() => {
cy.setFeatureFlags(createOrgsFeatureFlags)
cy.request({
method: 'GET',
url: 'api/v2/orgs',
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/cloud/deepLinks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ describe('Deep linking', () => {
beforeEach(() => {
cy.flush()
cy.signin()
cy.setFeatureFlags({createDeleteOrgs: true})
cy.request({
method: 'GET',
url: 'api/v2/orgs',
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/cloud/org-list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const setupTest = () => {
cy.flush().then(() =>
cy.signin().then(() => {
cy.get('@org').then(({id}) => {
cy.setFeatureFlags({createDeleteOrgs: true})
cy.visit(`/orgs/${id}/accounts/orglist`)
})
})
Expand Down
14 changes: 1 addition & 13 deletions src/accounts/AccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ import {
InputType,
Page,
} from '@influxdata/clockface'
import {LeaveOrgButton} from 'src/organizations/components/OrgProfileTab/LeaveOrg'

// Context
import {UsersContext, UsersProvider} from 'src/users/context/users'
import {UsersProvider} from 'src/users/context/users'
import {DeleteFreeAccountButton} from 'src/accounts/DeleteFreeAccount'
import {DeleteFreeAccountOverlay} from 'src/accounts/DeleteFreeAccountOverlay'

Expand All @@ -26,7 +25,6 @@ import {selectCurrentIdentity} from 'src/identity/selectors'
import {CLOUD} from 'src/shared/constants'

// Utils
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
import {pageTitleSuffixer} from 'src/shared/utils/pageTitles'
import {UserAccountContext} from 'src/accounts/context/userAccount'
import AccountTabContainer from 'src/accounts/AccountTabContainer'
Expand All @@ -48,7 +46,6 @@ const AccountAboutPage: FC = () => {
userAccounts,
} = useContext(UserAccountContext)

const {users} = useContext(UsersContext)
const activeAccount =
userAccounts && userAccounts.filter(acct => acct.isActive)[0]
const [activeAcctName, setActiveAcctName] = useState(activeAccount?.name)
Expand Down Expand Up @@ -76,9 +73,6 @@ const AccountAboutPage: FC = () => {
CLOUD && accountDetails?.isDeletable
)

const showLeaveOrgButton = !isFlagEnabled('createDeleteOrgs')
const allowSelfRemoval = users.length > 1

return (
<AccountTabContainer activeTab="settings">
<>
Expand All @@ -105,12 +99,6 @@ const AccountAboutPage: FC = () => {
text="Save"
/>
</FlexBox>
{allowSelfRemoval && showLeaveOrgButton && (
<>
<hr className="account-settings--divider" />
<LeaveOrgButton />
</>
)}
{shouldShowDeleteFreeAccountButton && <DeleteFreeAccountButton />}
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 "Leave Org" button was only here for backwards compatibility for situations where the feature flag was turned off. It now lives on the org settings page.

</>
</AccountTabContainer>
Expand Down
6 changes: 4 additions & 2 deletions src/accounts/AccountTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {ComponentSize, Orientation, Tabs} from '@influxdata/clockface'

// Utils
import {getOrg} from 'src/organizations/selectors'
import {isFlagEnabled} from 'src/shared/utils/featureFlag'

// Constants
import {CLOUD} from 'src/shared/constants'

interface Props {
activeTab: string
Expand All @@ -35,7 +37,7 @@ const AccountTabs: FC<Props> = ({activeTab}) => {
},
{
id: 'organizations',
enabled: isFlagEnabled('createDeleteOrgs'),
enabled: CLOUD,
link: `/orgs/${orgID}/accounts/orglist`,
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 organization tab cannot be accessed from OSS, where there is no multi-org or access to quartz APIs.

testID: 'accounts-orglist-tab',
text: 'Organizations',
Expand Down
6 changes: 3 additions & 3 deletions src/checkout/context/checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import {getQuartzIdentityThunk} from 'src/identity/actions/thunks'
import {selectCurrentIdentity} from 'src/identity/selectors'
import {shouldGetCredit250Experience} from 'src/me/selectors'

// Utils
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
// Constants
import {CLOUD} from 'src/shared/constants'

export type Props = {
children: JSX.Element
Expand Down Expand Up @@ -316,7 +316,7 @@ export const CheckoutProvider: FC<Props> = React.memo(({children}) => {
} finally {
setIsSubmitting(false)
// Refresh whether user is allowed to create new orgs after upgrading to PAYG.
if (isFlagEnabled('createDeleteOrgs')) {
if (CLOUD) {
dispatch(getOrgCreationAllowancesThunk())
}
}
Expand Down
45 changes: 18 additions & 27 deletions src/identity/components/GlobalHeader/AccountDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ import {
// Constants
import {CLOUD_URL} from 'src/shared/constants'

// Utils
import {isFlagEnabled} from 'src/shared/utils/featureFlag'

export const AccountDropdown: FC<Props> = ({
accountsList,
activeAccount,
Expand All @@ -47,31 +44,25 @@ export const AccountDropdown: FC<Props> = ({
name: activeAccount.name,
}

const isCreateDeleteFlagOn = isFlagEnabled('createDeleteOrgs')

const accountMainMenu = useMemo(
() =>
[
{
name: 'Settings',
iconFont: IconFont.CogSolid_New,
href: `/orgs/${activeOrg.id}/accounts/settings`,
enabled: true,
},
{
name: 'Organizations',
iconFont: IconFont.OrganizationChart,
href: `/orgs/${activeOrg.id}/accounts/orglist`,
enabled: isCreateDeleteFlagOn,
},
{
name: 'Billing',
iconFont: IconFont.Bill,
href: `/orgs/${activeOrg.id}/billing`,
enabled: true,
},
].filter(menuOption => menuOption.enabled),
[activeOrg.id, isCreateDeleteFlagOn]
() => [
{
name: 'Settings',
iconFont: IconFont.CogSolid_New,
href: `/orgs/${activeOrg.id}/accounts/settings`,
},
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's no need for the 'enabled' distinction here, as all of these tabs are accessible without condition. The global header only exists in cloud, so there's no need for a CLOUD guard either.

{
name: 'Organizations',
iconFont: IconFont.OrganizationChart,
href: `/orgs/${activeOrg.id}/accounts/orglist`,
},
{
name: 'Billing',
iconFont: IconFont.Bill,
href: `/orgs/${activeOrg.id}/billing`,
},
],
[activeOrg.id]
)

// Quartz handles switching accounts by having the user hit this URL.
Expand Down
13 changes: 3 additions & 10 deletions src/identity/components/GlobalHeader/OrgDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import {OrganizationSummaries} from 'src/client/unityRoutes'

// Constants
import {CLOUD_URL} from 'src/shared/constants'
import {CLOUD, CLOUD_URL} from 'src/shared/constants'

// Eventing
import {
Expand All @@ -28,9 +28,6 @@ import {event} from 'src/cloud/utils/reporting'
// Thunks
import {getOrgCreationAllowancesThunk} from 'src/identity/allowances/actions/thunks'

// Utils
import {isFlagEnabled} from 'src/shared/utils/featureFlag'

// Selectors
import {
selectCurrentAccount,
Expand Down Expand Up @@ -78,10 +75,7 @@ export const OrgDropdown: FC<Props> = ({activeOrg, orgsList}) => {
}

useEffect(() => {
if (
isFlagEnabled('createDeleteOrgs') &&
orgCreationAllowanceStatus === RemoteDataState.NotStarted
) {
if (CLOUD && orgCreationAllowanceStatus === RemoteDataState.NotStarted) {
dispatch(getOrgCreationAllowancesThunk())
}
}, [dispatch, orgCreationAllowanceStatus])
Expand Down Expand Up @@ -115,7 +109,6 @@ export const OrgDropdown: FC<Props> = ({activeOrg, orgsList}) => {
]

if (
isFlagEnabled('createDeleteOrgs') &&
!orgCreationAllowed &&
(availableUpgrade === 'pay_as_you_go' || availableUpgrade === 'contract')
) {
Expand All @@ -140,7 +133,7 @@ export const OrgDropdown: FC<Props> = ({activeOrg, orgsList}) => {
}

const additionalHeaderItems = []
if (isFlagEnabled('createDeleteOrgs') && orgCreationAllowed) {
if (orgCreationAllowed) {
additionalHeaderItems.push(
<CreateOrganizationMenuItem key="CreateOrgMenuItem" />
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {

// Constants
import {CLOUD} from 'src/shared/constants'
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
import {dismissOverlay, showOverlay} from 'src/overlays/actions/overlays'

// Notifications
Expand All @@ -48,8 +47,7 @@ export const DeletePanel: FC = () => {
const {user, account} = useSelector(selectCurrentIdentity)

const freeAccountWithOneOrg = account.type === 'free' && user.orgCount === 1
const shouldShowDeleteOrgButton =
CLOUD && isFlagEnabled('createDeleteOrgs') && !freeAccountWithOneOrg
const shouldShowDeleteOrgButton = CLOUD && !freeAccountWithOneOrg

return (
<PageSpinner loading={status}>
Expand Down
6 changes: 1 addition & 5 deletions src/organizations/components/OrgProfileTab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ import {RemoteDataState} from 'src/types'
// Constants
import {CLOUD} from 'src/shared/constants'

// Utils
import {isFlagEnabled} from 'src/shared/utils/featureFlag'

// Styles
import 'src/organizations/components/OrgProfileTab/style.scss'

Expand Down Expand Up @@ -81,7 +78,6 @@ const OrgProfileTab: FC = () => {
}, [dispatch, orgDetailsStatus, quartzOrg.id])

const allowSelfRemoval = users.length > 1
const showLeaveOrgButton = isFlagEnabled('createDeleteOrgs')
const hasFetchedOrgDetails = orgDetailsStatus === RemoteDataState.Done
const hasFetchedStorageType = Boolean(storageType)

Expand Down Expand Up @@ -175,7 +171,7 @@ const OrgProfileTab: FC = () => {
stretchToFitWidth={true}
>
<>
{allowSelfRemoval && showLeaveOrgButton && <LeaveOrgButton />}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is already subordinate to a CLOUD check, so we don't need another one.

{allowSelfRemoval && <LeaveOrgButton />}
<DeletePanel />
</>
</FlexBox>
Expand Down
2 changes: 1 addition & 1 deletion src/shared/containers/SetOrg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ const SetOrg: FC = () => {
/>
)}
{/* list of organizations in the user's current CLOUD account */}
{CLOUD && isFlagEnabled('createDeleteOrgs') && (
{CLOUD && (
<Route
path={`${orgPath}/accounts/orglist`}
component={OrganizationList}
Expand Down