1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-10 01:16:39 +02:00

Remove frontendNavigationUpdate flag (#4547)

https://linear.app/unleash/issue/1-1275/remove-frontendnavigationupdate-feature-flag

Shipping new navigation by default to everyone
This commit is contained in:
Tymoteusz Czech 2023-08-23 11:42:20 +02:00 committed by GitHub
parent 65e62c64b8
commit 31e2260c46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 36 additions and 108 deletions

View File

@ -45,7 +45,6 @@ export const adminRoutes: INavigationMenuItem[] = [
{
path: '/admin/api',
title: 'API access',
flag: 'frontendNavigationUpdate',
menu: { adminSettings: true },
group: 'access',
},

View File

@ -6,8 +6,7 @@ export const filterAdminRoutes = (
pro,
enterprise,
billing,
}: { pro?: boolean; enterprise?: boolean; billing?: boolean },
showEnterpriseOptionsInPro = true
}: { pro?: boolean; enterprise?: boolean; billing?: boolean }
): boolean => {
const mode = menu?.mode;
if (menu?.billing && !billing) return false;
@ -21,7 +20,7 @@ export const filterAdminRoutes = (
return true;
}
if (showEnterpriseOptionsInPro && mode.includes('enterprise')) {
if (mode.includes('enterprise')) {
return true;
}
}

View File

@ -26,9 +26,6 @@ export const AdminTabsMenu: VFC = () => {
const activeTab = pathname.split('/')[2];
const showEnterpriseFeaturesInPro =
uiConfig?.flags?.frontendNavigationUpdate;
const adminRoutes = useAdminRoutes();
const group = adminRoutes.find(route =>
pathname.includes(route.path)
@ -65,8 +62,7 @@ export const AdminTabsMenu: VFC = () => {
condition={Boolean(
tab.menu.mode?.includes('enterprise') &&
!tab.menu.mode?.includes('pro') &&
isPro() &&
showEnterpriseFeaturesInPro
isPro()
)}
show={
<StyledBadgeContainer>

View File

@ -7,9 +7,6 @@ import { filterByConfig, mapRouteLink } from 'component/common/util';
export const useAdminRoutes = () => {
const { uiConfig, isPro, isEnterprise } = useUiConfig();
const { isBilling } = useInstanceStatus();
const showEnterpriseOptionsInPro = Boolean(
uiConfig?.flags?.frontendNavigationUpdate
);
const routes = [...adminRoutes];
if (uiConfig.flags.UNLEASH_CLOUD) {
@ -25,15 +22,11 @@ export const useAdminRoutes = () => {
return routes
.filter(filterByConfig(uiConfig))
.filter(route =>
filterAdminRoutes(
route?.menu,
{
enterprise: isEnterprise(),
pro: isPro(),
billing: isBilling,
},
showEnterpriseOptionsInPro
)
filterAdminRoutes(route?.menu, {
enterprise: isEnterprise(),
pro: isPro(),
billing: isBilling,
})
)
.map(mapRouteLink);
};

View File

@ -114,8 +114,6 @@ const Header: VFC = () => {
const { uiConfig, isOss } = useUiConfig();
const smallScreen = useMediaQuery(theme.breakpoints.down('md'));
const [openDrawer, setOpenDrawer] = useState(false);
const showApiAccessInConfigure = !uiConfig?.flags?.frontendNavigationUpdate;
const toggleDrawer = () => setOpenDrawer(prev => !prev);
const onAdminClose = () => setAdminRef(null);
const onConfigureClose = () => setConfigRef(null);
@ -125,31 +123,9 @@ const Header: VFC = () => {
const filteredMainRoutes = {
mainNavRoutes: getCondensedRoutes(routes.mainNavRoutes)
.concat(
showApiAccessInConfigure
? [
{
path: '/admin/api',
title: 'API access',
menu: {},
},
]
: []
)
.filter(filterByConfig(uiConfig))
.map(mapRouteLink),
mobileRoutes: getCondensedRoutes(routes.mobileRoutes)
.concat(
showApiAccessInConfigure
? [
{
path: '/admin/api',
title: 'API access',
menu: {},
},
]
: []
)
.filter(filterByConfig(uiConfig))
.map(mapRouteLink),
adminRoutes,

View File

@ -54,10 +54,10 @@ const NavigationLink = ({
handleClose,
...props
}: INavigationLinkProps) => {
const { uiConfig, isPro } = useUiConfig();
const { isPro } = useUiConfig();
const showEnterpriseBadgeToPro = Boolean(
uiConfig?.flags?.frontendNavigationUpdate &&
isPro() &&
isPro() &&
!props.mode?.includes('pro') &&
props.mode?.includes('enterprise')
);

View File

@ -50,23 +50,21 @@ export const NavigationMenu = ({
anchorEl,
style,
}: INavigationMenuProps) => {
const { uiConfig, isPro, isOss } = useUiConfig();
const showUpdatedMenu = uiConfig?.flags?.frontendNavigationUpdate;
const { isPro, isOss } = useUiConfig();
const showBadge = useCallback(
(mode?: INavigationMenuItem['menu']['mode']) => {
if (
isPro() &&
!mode?.includes('pro') &&
mode?.includes('enterprise') &&
showUpdatedMenu
mode?.includes('enterprise')
) {
return true;
}
return false;
},
[isPro, showUpdatedMenu]
[isPro]
);
return (
@ -81,7 +79,6 @@ export const NavigationMenu = ({
.map((option, i) => {
const previousGroup = options[i - 1]?.group;
const addDivider =
showUpdatedMenu &&
previousGroup &&
previousGroup !== option.group &&
(!isOss() || option.group === 'log');

View File

@ -42,8 +42,6 @@ import { ImportModal } from './Import/ImportModal';
import { IMPORT_BUTTON } from 'utils/testIds';
import { EnterpriseBadge } from 'component/common/EnterpriseBadge/EnterpriseBadge';
const NAVIGATE_TO_EDIT_PROJECT = 'NAVIGATE_TO_EDIT_PROJECT';
export const Project = () => {
const projectId = useRequiredPathParam('projectId');
const params = useQueryParams();
@ -60,8 +58,6 @@ export const Project = () => {
const [showDelDialog, setShowDelDialog] = useState(false);
const updatedNavigation = uiConfig?.flags?.frontendNavigationUpdate;
const tabs = [
{
title: 'Overview',
@ -84,32 +80,17 @@ export const Project = () => {
name: 'change-request',
isEnterprise: true,
},
...(updatedNavigation
? [
{
title: 'Event log',
path: `${basePath}/logs`,
name: 'logs',
},
{
title: 'Project settings',
path: `${basePath}/settings`,
name: 'settings',
},
]
: [
{
title: 'Project settings',
path: `${basePath}/settings`,
name: 'settings',
},
{
title: 'Event log',
path: `${basePath}/logs`,
name: 'logs',
},
]),
].filter(tab => !updatedNavigation || !(isOss() && tab.isEnterprise));
{
title: 'Event log',
path: `${basePath}/logs`,
name: 'logs',
},
{
title: 'Project settings',
path: `${basePath}/settings`,
name: 'settings',
},
].filter(tab => !(isOss() && tab.isEnterprise));
const activeTab = [...tabs]
.reverse()
@ -218,11 +199,10 @@ export const Project = () => {
tab.isEnterprise ? 'end' : undefined
}
icon={
tab.isEnterprise &&
isPro() &&
updatedNavigation
? enterpriseIcon
: undefined
(tab.isEnterprise &&
isPro() &&
enterpriseIcon) ||
undefined
}
/>
))}

View File

@ -19,11 +19,9 @@ import { Box } from '@mui/material';
export const ProjectSettings = () => {
const location = useLocation();
const { uiConfig, isPro, isEnterprise } = useUiConfig();
const { isPro, isEnterprise } = useUiConfig();
const navigate = useNavigate();
const updatedNavigation = uiConfig.flags?.frontendNavigationUpdate;
const tabs: ITab[] = [
{
id: '',
@ -33,7 +31,7 @@ export const ProjectSettings = () => {
id: 'environments',
label: 'Environments',
},
...(!updatedNavigation || isPro() || isEnterprise()
...(isPro() || isEnterprise()
? [
{
id: 'access',
@ -46,12 +44,11 @@ export const ProjectSettings = () => {
{
id: 'change-requests',
label: 'Change request configuration',
icon:
isPro() && updatedNavigation ? (
<Box sx={{ marginLeft: 'auto' }}>
<EnterpriseBadge />
</Box>
) : undefined,
icon: isPro() ? (
<Box sx={{ marginLeft: 'auto' }}>
<EnterpriseBadge />
</Box>
) : undefined,
},
]
: []),

View File

@ -53,7 +53,6 @@ export interface IFlags {
customRootRolesKillSwitch?: boolean;
strategyVariant?: boolean;
configurableFeatureTypeLifetimes?: boolean;
frontendNavigationUpdate?: boolean;
segmentChangeRequests?: boolean;
changeRequestReject?: boolean;
lastSeenByEnvironment?: boolean;

View File

@ -80,7 +80,6 @@ exports[`should create default config 1`] = `
"embedProxyFrontend": true,
"featuresExportImport": true,
"filterInvalidClientMetrics": false,
"frontendNavigationUpdate": false,
"googleAuthEnabled": false,
"integrationsRework": false,
"lastSeenByEnvironment": false,
@ -117,7 +116,6 @@ exports[`should create default config 1`] = `
"embedProxyFrontend": true,
"featuresExportImport": true,
"filterInvalidClientMetrics": false,
"frontendNavigationUpdate": false,
"googleAuthEnabled": false,
"integrationsRework": false,
"lastSeenByEnvironment": false,

View File

@ -24,7 +24,6 @@ export type IFlagKey =
| 'slackAppAddon'
| 'configurableFeatureTypeLifetimes'
| 'filterInvalidClientMetrics'
| 'frontendNavigationUpdate'
| 'lastSeenByEnvironment'
| 'segmentChangeRequests'
| 'changeRequestReject'
@ -114,10 +113,6 @@ const flags: IFlags = {
process.env.FILTER_INVALID_CLIENT_METRICS,
false,
),
frontendNavigationUpdate: parseEnvVarBoolean(
process.env.UNLEASH_NAVIGATION_UPDATE,
false,
),
lastSeenByEnvironment: parseEnvVarBoolean(
process.env.LAST_SEEN_BY_ENVIRONMENT,
false,

View File

@ -40,7 +40,6 @@ process.nextTick(async () => {
strategyVariant: true,
slackAppAddon: true,
configurableFeatureTypeLifetimes: true,
frontendNavigationUpdate: true,
lastSeenByEnvironment: true,
segmentChangeRequests: true,
newApplicationList: true,