1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-18 01:18:23 +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', path: '/admin/api',
title: 'API access', title: 'API access',
flag: 'frontendNavigationUpdate',
menu: { adminSettings: true }, menu: { adminSettings: true },
group: 'access', group: 'access',
}, },

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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