diff --git a/frontend/src/component/admin/Admin.tsx b/frontend/src/component/admin/Admin.tsx index 7820c14db9..00565df894 100644 --- a/frontend/src/component/admin/Admin.tsx +++ b/frontend/src/component/admin/Admin.tsx @@ -2,7 +2,6 @@ import { Routes, Route } from 'react-router-dom'; import { ApiTokenPage } from './apiToken/ApiTokenPage/ApiTokenPage'; import { CreateApiToken } from './apiToken/CreateApiToken/CreateApiToken'; import { AuthSettings } from './auth/AuthSettings'; -import { OldAuthSettings } from './auth/OldAuthSettings'; import { Billing } from './billing/Billing'; import FlaggedBillingRedirect from './billing/FlaggedBillingRedirect/FlaggedBillingRedirect'; import { CorsAdmin } from './cors'; @@ -17,23 +16,15 @@ import CreateUser from './users/CreateUser/CreateUser'; import { InviteLink } from './users/InviteLink/InviteLink'; import UsersAdmin from './users/UsersAdmin'; import NotFound from 'component/common/NotFound/NotFound'; -import { AdminIndex } from './AdminIndex'; import { Banners } from './banners/Banners'; import { License } from './license/License'; -import { useUiFlag } from 'hooks/useUiFlag'; import { AdminHome } from './AdminHome'; export const Admin = () => { - const newAdminUIEnabled = useUiFlag('adminNavUI'); - return ( <> - {newAdminUIEnabled ? ( - } /> - ) : ( - } /> - )} + } /> } /> } /> } /> @@ -48,11 +39,7 @@ export const Admin = () => { } /> } /> } /> - {newAdminUIEnabled ? ( - } /> - ) : ( - } /> - )} + } /> } diff --git a/frontend/src/component/admin/AdminIndex.tsx b/frontend/src/component/admin/AdminIndex.tsx deleted file mode 100644 index ac9b7b255f..0000000000 --- a/frontend/src/component/admin/AdminIndex.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { PageContent } from 'component/common/PageContent/PageContent'; -import { PageHeader } from 'component/common/PageHeader/PageHeader'; -import type { VFC } from 'react'; -import { adminGroups } from './oldAdminRoutes'; -import type { INavigationMenuItem } from 'interfaces/route'; -import { Box, Link, Typography } from '@mui/material'; -import { Link as RouterLink } from 'react-router-dom'; -import { useAdminRoutes } from './useAdminRoutes'; - -export const AdminIndex: VFC = () => { - const adminRoutes = useAdminRoutes(); - - const routeGroups = adminRoutes.reduce( - (acc, route) => { - const group = route.group || 'other'; - - const index = acc.findIndex((item) => item.name === group); - if (index === -1) { - acc.push({ - name: group, - description: adminGroups[group] || 'Other', - items: [route], - }); - - return acc; - } - - acc[index].items.push(route); - - return acc; - }, - [] as Array<{ - name: string; - description: string; - items: INavigationMenuItem[]; - }>, - ); - - return ( - }> - {routeGroups.map((group) => ( - ({ marginBottom: theme.spacing(2) })} - > - {group.description} -
    - {group.items.map((route) => ( -
  • - - {route.title} - -
  • - ))} -
-
- ))} -
- ); -}; diff --git a/frontend/src/component/admin/auth/OldAuthSettings.tsx b/frontend/src/component/admin/auth/OldAuthSettings.tsx deleted file mode 100644 index c309a33c17..0000000000 --- a/frontend/src/component/admin/auth/OldAuthSettings.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import { Tab, Tabs } from '@mui/material'; -import { PageContent } from 'component/common/PageContent/PageContent'; -import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; -import { OidcAuth } from './OidcAuth/OidcAuth'; -import { SamlAuth } from './SamlAuth/SamlAuth'; -import { ScimSettings } from './ScimSettings/ScimSettings'; -import { PasswordAuth } from './PasswordAuth/PasswordAuth'; -import { GoogleAuth } from './GoogleAuth/GoogleAuth'; -import { PermissionGuard } from 'component/common/PermissionGuard/PermissionGuard'; -import { ADMIN, UPDATE_AUTH_CONFIGURATION } from '@server/types/permissions'; -import { PremiumFeature } from 'component/common/PremiumFeature/PremiumFeature'; -import { useState } from 'react'; -import { TabPanel } from 'component/common/TabNav/TabPanel/TabPanel'; -import { usePageTitle } from 'hooks/usePageTitle'; - -export const OldAuthSettings = () => { - const { uiConfig, isEnterprise } = useUiConfig(); - - const tabs = [ - { - label: 'OpenID Connect', - component: , - }, - { - label: 'SAML 2.0', - component: , - }, - { - label: 'Password', - component: , - }, - { - label: 'Google', - component: , - }, - { - label: 'SCIM', - component: , - }, - ].filter( - (item) => uiConfig.flags?.googleAuthEnabled || item.label !== 'Google', - ); - - const [activeTab, setActiveTab] = useState(0); - usePageTitle(`Single sign-on: ${tabs[activeTab].label}`); - - if (!isEnterprise()) { - return ; - } - - return ( -
- - { - setActiveTab(tabId); - }} - indicatorColor='primary' - textColor='primary' - > - {tabs.map((tab, index) => ( - - ))} - - } - > -
- {tabs.map((tab, index) => ( - - {tab.component} - - ))} -
-
-
-
- ); -}; diff --git a/frontend/src/component/admin/oldAdminRoutes.ts b/frontend/src/component/admin/oldAdminRoutes.ts deleted file mode 100644 index 6ab6f00b24..0000000000 --- a/frontend/src/component/admin/oldAdminRoutes.ts +++ /dev/null @@ -1,122 +0,0 @@ -import type { INavigationMenuItem } from 'interfaces/route'; - -export const adminGroups: Record = { - users: 'User administration', - access: 'Access control', - instance: 'Instance configuration', - log: 'Logs', - other: 'Other', -}; - -export const adminRoutes: INavigationMenuItem[] = [ - { - path: '/admin/users', - title: 'Users', - menu: { adminSettings: true }, - group: 'users', - }, - { - path: '/admin/service-accounts', - title: 'Service accounts', - menu: { - adminSettings: true, - mode: ['enterprise'], - }, - group: 'users', - }, - { - path: '/admin/groups', - title: 'Groups', - menu: { - adminSettings: true, - mode: ['enterprise'], - }, - group: 'users', - }, - { - path: '/admin/roles/*', - title: 'Roles', - menu: { - adminSettings: true, - mode: ['enterprise'], - }, - group: 'users', - }, - { - path: '/admin/api', - title: 'API access', - menu: { adminSettings: true }, - group: 'access', - }, - { - path: '/admin/cors', - title: 'CORS origins', - flag: 'embedProxyFrontend', - menu: { adminSettings: true }, - group: 'access', - }, - { - path: '/admin/auth', - title: 'Single sign-on', - menu: { adminSettings: true, mode: ['enterprise'] }, - group: 'access', - }, - { - path: '/admin/network/*', - title: 'Network', - menu: { adminSettings: true, mode: ['pro', 'enterprise'] }, - group: 'instance', - }, - { - path: '/admin/maintenance', - title: 'Maintenance', - menu: { adminSettings: true }, - group: 'instance', - }, - { - path: '/admin/banners', - title: 'Banners', - menu: { adminSettings: true, mode: ['enterprise'] }, - group: 'instance', - }, - { - path: '/admin/instance', - title: 'Instance stats', - menu: { adminSettings: true }, - group: 'instance', - }, - { - path: '/admin/license', - title: 'License', - menu: { adminSettings: true, mode: ['enterprise'] }, - flag: 'enableLicense', - group: 'instance', - }, - { - path: '/admin/instance-privacy', - title: 'Instance privacy', - menu: { adminSettings: true }, - group: 'instance', - }, - { - path: '/admin/admin-invoices', - title: 'Billing & invoices', - menu: { adminSettings: true, billing: true }, - group: 'instance', - }, - { - path: '/admin/logins', - title: 'Login history', - menu: { - adminSettings: true, - mode: ['enterprise'], - }, - group: 'log', - }, - { - path: '/history', - title: 'Event log', - menu: { adminSettings: true }, - group: 'log', - }, -]; diff --git a/frontend/src/component/admin/useAdminRoutes.ts b/frontend/src/component/admin/useAdminRoutes.ts index 002a4482e5..cff3aa1a4c 100644 --- a/frontend/src/component/admin/useAdminRoutes.ts +++ b/frontend/src/component/admin/useAdminRoutes.ts @@ -1,16 +1,13 @@ import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; -import { adminRoutes as oldAdminRoutes } from './oldAdminRoutes'; import { adminRoutes } from './adminRoutes'; import { useInstanceStatus } from 'hooks/api/getters/useInstanceStatus/useInstanceStatus'; import { filterRoutesByPlanData } from './filterRoutesByPlanData'; import { filterByConfig, mapRouteLink } from 'component/common/util'; -import { useUiFlag } from 'hooks/useUiFlag'; export const useAdminRoutes = () => { - const newAdminUIEnabled = useUiFlag('adminNavUI'); const { uiConfig, isPro, isEnterprise } = useUiConfig(); const { isBilling } = useInstanceStatus(); - const routes = newAdminUIEnabled ? [...adminRoutes] : [...oldAdminRoutes]; + const routes = [...adminRoutes]; if (uiConfig.flags.UNLEASH_CLOUD) { const adminBillingMenuItem = routes.findIndex( diff --git a/frontend/src/component/commandBar/useCommandBarRoutes.ts b/frontend/src/component/commandBar/useCommandBarRoutes.ts index b60eafb311..3832003a22 100644 --- a/frontend/src/component/commandBar/useCommandBarRoutes.ts +++ b/frontend/src/component/commandBar/useCommandBarRoutes.ts @@ -1,6 +1,5 @@ import { adminGroups } from 'component/admin/adminRoutes'; import { useRoutes } from 'component/layout/MainLayout/NavigationSidebar/useRoutes'; -import { useUiFlag } from 'hooks/useUiFlag'; import type { INavigationMenuItem } from 'interfaces/route'; import { useMemo } from 'react'; @@ -12,7 +11,6 @@ interface IPageRouteInfo { } export const useCommandBarRoutes = () => { - const newAdminUIEnabled = useUiFlag('adminNavUI'); const { routes } = useRoutes(); const getSearchText = (route: INavigationMenuItem, title: string) => { if (route.group && adminGroups[route.group]) { @@ -41,15 +39,12 @@ export const useCommandBarRoutes = () => { path: route.path, route: route.route, title: title, - searchText: newAdminUIEnabled - ? getSearchText(route, title) - : title, + searchText: getSearchText(route, title), }; } return { allRoutes, - newAdminUIEnabled, }; }, [routes]); }; diff --git a/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationList.tsx b/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationList.tsx index 758d025d6a..47657da50b 100644 --- a/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationList.tsx +++ b/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationList.tsx @@ -2,7 +2,6 @@ import type React from 'react'; import type { FC } from 'react'; import type { INavigationMenuItem } from 'interfaces/route'; import type { NavigationMode } from './NavigationMode'; -import { ShowAdmin } from './ShowHide'; import { ExternalFullListItem, FullListItem, @@ -237,7 +236,7 @@ export const AdminSettingsNavigation: FC<{ activeItem, mode, }) => { - const { showOnlyAdminMenu, newAdminUIEnabled } = useNewAdminMenu(); + const { showOnlyAdminMenu } = useNewAdminMenu(); if (showOnlyAdminMenu) { return onClick('/admin')} />; } @@ -247,40 +246,7 @@ export const AdminSettingsNavigation: FC<{ onClick(activeItem); }; - if (newAdminUIEnabled) { - return ; - } - - return ( - <> - {mode === 'full' && ( - { - onExpandChange(expand); - }} - mode={mode} - title='Admin' - > - - - )} - - {mode === 'mini' && ( - { - onExpandChange(true); - onSetFullMode(); - }} - /> - )} - - ); + return ; }; export const AdminSettingsLink: FC<{ diff --git a/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationSidebar.test.tsx b/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationSidebar.test.tsx index 5e45729358..49ba7566ad 100644 --- a/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationSidebar.test.tsx +++ b/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationSidebar.test.tsx @@ -23,7 +23,6 @@ test('switch full mode and mini mode', () => { expect(screen.queryByText('Projects')).toBeInTheDocument(); expect(screen.queryByText('Applications')).toBeInTheDocument(); - expect(screen.queryByText('Users')).toBeInTheDocument(); const hide = screen.getByText('Hide (⌘ + B)'); @@ -31,14 +30,12 @@ test('switch full mode and mini mode', () => { expect(screen.queryByText('Projects')).not.toBeInTheDocument(); expect(screen.queryByText('Applications')).not.toBeInTheDocument(); - expect(screen.queryByText('Users')).not.toBeInTheDocument(); const expand = screen.getByTestId('expand-navigation'); fireEvent.click(expand); expect(screen.queryByText('Projects')).toBeInTheDocument(); expect(screen.queryByText('Applications')).toBeInTheDocument(); - expect(screen.queryByText('Users')).toBeInTheDocument(); }); test('persist navigation mode and expansion selection in storage', async () => { @@ -48,9 +45,6 @@ test('persist navigation mode and expansion selection in storage', async () => { const configure = screen.getByText('Configure'); configure.click(); // expand - configure.click(); // hide - const admin = screen.getByText('Admin'); - admin.click(); const hide = screen.getByText('Hide (⌘ + B)'); hide.click(); @@ -63,7 +57,7 @@ test('persist navigation mode and expansion selection in storage', async () => { 'navigation-expanded:v1', {}, ); - expect(expanded).toEqual(['admin']); + expect(expanded).toEqual(['configure']); }); }); @@ -122,13 +116,6 @@ describe('order of items in navigation', () => { await waitFor(() => expect(configureButton.getAttribute('aria-expanded')).toBe('true'), ); - const adminButton = await screen.findByRole('button', { - name: /admin/i, - }); - adminButton.click(); - await waitFor(() => - expect(adminButton.getAttribute('aria-expanded')).toBe('true'), - ); const links = await screen.findAllByRole('link'); return links.map((el: HTMLElement) => ({ diff --git a/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationSidebar.tsx b/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationSidebar.tsx index c2bebba15c..127590f834 100644 --- a/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationSidebar.tsx +++ b/frontend/src/component/layout/MainLayout/NavigationSidebar/NavigationSidebar.tsx @@ -30,7 +30,6 @@ import { ReactComponent as LogoOnlyWhite } from 'assets/img/logo.svg'; import { ReactComponent as LogoOnly } from 'assets/img/logoDark.svg'; import { Link } from 'react-router-dom'; import { useFlag } from '@unleash/proxy-client-react'; -import { useUiFlag } from 'hooks/useUiFlag'; import { useNewAdminMenu } from 'hooks/useNewAdminMenu'; export const MobileNavigationSidebar: FC<{ @@ -38,7 +37,6 @@ export const MobileNavigationSidebar: FC<{ NewInUnleash?: typeof NewInUnleash; }> = ({ onClick, NewInUnleash }) => { const { routes } = useRoutes(); - const newAdminUIEnabled = useUiFlag('adminNavUI'); return ( <> @@ -49,15 +47,7 @@ export const MobileNavigationSidebar: FC<{ mode='full' onClick={onClick} /> - {newAdminUIEnabled ? ( - - ) : ( - - )} + ); @@ -248,19 +238,17 @@ export const NavigationSidebar: FC<{ NewInUnleash?: typeof NewInUnleash }> = ({ } elseShow={ - <> - setMode('full')} - activeItem={activeItem} - onExpandChange={(expand) => { - changeExpanded('admin', expand); - }} - expanded={expanded.includes('admin')} - routes={routes.adminRoutes} - /> - + setMode('full')} + activeItem={activeItem} + onExpandChange={(expand) => { + changeExpanded('admin', expand); + }} + expanded={expanded.includes('admin')} + routes={routes.adminRoutes} + /> } /> diff --git a/frontend/src/component/layout/MainLayout/NavigationSidebar/__snapshots__/NavigationSidebar.test.tsx.snap b/frontend/src/component/layout/MainLayout/NavigationSidebar/__snapshots__/NavigationSidebar.test.tsx.snap index a00860d0b3..b4ef926ddc 100644 --- a/frontend/src/component/layout/MainLayout/NavigationSidebar/__snapshots__/NavigationSidebar.test.tsx.snap +++ b/frontend/src/component/layout/MainLayout/NavigationSidebar/__snapshots__/NavigationSidebar.test.tsx.snap @@ -59,56 +59,8 @@ exports[`order of items in navigation > menu for enterprise plan 1`] = ` "text": "Segments", }, { - "icon": "GroupOutlinedIcon", - "text": "Users", - }, - { - "icon": "ComputerIcon", - "text": "Service accounts", - }, - { - "icon": "GroupsOutlinedIcon", - "text": "Groups", - }, - { - "icon": "AdminPanelSettingsOutlinedIcon", - "text": "Roles", - }, - { - "icon": "KeyOutlinedIcon", - "text": "API access", - }, - { - "icon": "AssignmentOutlinedIcon", - "text": "Single sign-on", - }, - { - "icon": "HubOutlinedIcon", - "text": "Network", - }, - { - "icon": "BuildOutlinedIcon", - "text": "Maintenance", - }, - { - "icon": "ViewCarouselIcon", - "text": "Banners", - }, - { - "icon": "QueryStatsOutlinedIcon", - "text": "Instance stats", - }, - { - "icon": "ShieldOutlinedIcon", - "text": "Instance privacy", - }, - { - "icon": "HistoryOutlinedIcon", - "text": "Login history", - }, - { - "icon": "EventNoteOutlinedIcon", - "text": "Event log", + "icon": "SettingsIcon", + "text": "Admin settings", }, ] `; @@ -164,28 +116,8 @@ exports[`order of items in navigation > menu for open-source 1`] = ` "text": "Segments", }, { - "icon": "GroupOutlinedIcon", - "text": "Users", - }, - { - "icon": "KeyOutlinedIcon", - "text": "API access", - }, - { - "icon": "BuildOutlinedIcon", - "text": "Maintenance", - }, - { - "icon": "QueryStatsOutlinedIcon", - "text": "Instance stats", - }, - { - "icon": "ShieldOutlinedIcon", - "text": "Instance privacy", - }, - { - "icon": "EventNoteOutlinedIcon", - "text": "Event log", + "icon": "SettingsIcon", + "text": "Admin settings", }, ] `; @@ -249,56 +181,8 @@ exports[`order of items in navigation > menu for pro plan 1`] = ` "text": "Segments", }, { - "icon": "GroupOutlinedIcon", - "text": "Users", - }, - { - "icon": "ComputerIcon", - "text": "Service accounts", - }, - { - "icon": "GroupsOutlinedIcon", - "text": "Groups", - }, - { - "icon": "AdminPanelSettingsOutlinedIcon", - "text": "Roles", - }, - { - "icon": "KeyOutlinedIcon", - "text": "API access", - }, - { - "icon": "AssignmentOutlinedIcon", - "text": "Single sign-on", - }, - { - "icon": "HubOutlinedIcon", - "text": "Network", - }, - { - "icon": "BuildOutlinedIcon", - "text": "Maintenance", - }, - { - "icon": "ViewCarouselIcon", - "text": "Banners", - }, - { - "icon": "QueryStatsOutlinedIcon", - "text": "Instance stats", - }, - { - "icon": "ShieldOutlinedIcon", - "text": "Instance privacy", - }, - { - "icon": "HistoryOutlinedIcon", - "text": "Login history", - }, - { - "icon": "EventNoteOutlinedIcon", - "text": "Event log", + "icon": "SettingsIcon", + "text": "Admin settings", }, ] `; diff --git a/frontend/src/hooks/useNewAdminMenu.ts b/frontend/src/hooks/useNewAdminMenu.ts index 539a9a8332..55a0e8f0a6 100644 --- a/frontend/src/hooks/useNewAdminMenu.ts +++ b/frontend/src/hooks/useNewAdminMenu.ts @@ -1,14 +1,10 @@ -import { useUiFlag } from './useUiFlag'; import { useLocation } from 'react-router'; export const useNewAdminMenu = () => { - const newAdminUIEnabled = useUiFlag('adminNavUI'); const location = useLocation(); return { showOnlyAdminMenu: - newAdminUIEnabled && - (location.pathname.indexOf('/admin') === 0 || - location.pathname.indexOf('/history') === 0), - newAdminUIEnabled, + location.pathname.indexOf('/admin') === 0 || + location.pathname.indexOf('/history') === 0, }; }; diff --git a/frontend/src/interfaces/uiConfig.ts b/frontend/src/interfaces/uiConfig.ts index 137b929a7d..aa230fc7a1 100644 --- a/frontend/src/interfaces/uiConfig.ts +++ b/frontend/src/interfaces/uiConfig.ts @@ -89,7 +89,6 @@ export type UiFlags = { showUserDeviceCount?: boolean; consumptionModel?: boolean; edgeObservability?: boolean; - adminNavUI?: boolean; tagTypeColor?: boolean; addEditStrategy?: boolean; newStrategyDropdown?: boolean; diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index ebab8e76e3..dbcf64a018 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -60,7 +60,6 @@ export type IFlagKey = | 'consumptionModel' | 'teamsIntegrationChangeRequests' | 'edgeObservability' - | 'adminNavUI' | 'tagTypeColor' | 'addEditStrategy' | 'newStrategyDropdown' @@ -290,10 +289,6 @@ const flags: IFlags = { process.env.EXPERIMENTAL_EDGE_OBSERVABILITY, false, ), - adminNavUI: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_ADMIN_NAV_UI, - false, - ), tagTypeColor: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_TAG_TYPE_COLOR, false, diff --git a/src/server-dev.ts b/src/server-dev.ts index 5c57072ca8..50d0eb679e 100644 --- a/src/server-dev.ts +++ b/src/server-dev.ts @@ -54,7 +54,6 @@ process.nextTick(async () => { uniqueSdkTracking: true, filterExistingFlagNames: true, teamsIntegrationChangeRequests: true, - adminNavUI: true, tagTypeColor: true, newStrategyDropdown: true, addEditStrategy: true,