Merge pull request #4132 from thornbill/react-router-admin-pages

Migrate admin routes to react router
This commit is contained in:
Bill Thornton 2022-11-03 17:40:24 -04:00 committed by GitHub
commit 6ae855f30a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 201 additions and 254 deletions

View file

@ -2,7 +2,7 @@ import React from 'react';
import { Navigate, Route, Routes } from 'react-router-dom';
import ConnectionRequired from '../components/ConnectionRequired';
import { LEGACY_USER_ROUTES, toViewManagerPageRoute } from './legacyRoutes';
import { LEGACY_ADMIN_ROUTES, LEGACY_USER_ROUTES, toViewManagerPageRoute } from './legacyRoutes';
import UserNew from './user/usernew';
import Search from './search';
import UserEdit from './user/useredit';
@ -35,6 +35,8 @@ const AppRoutes = () => (
<Route path='userlibraryaccess.html' element={<UserLibraryAccess />} />
<Route path='userparentalcontrol.html' element={<UserParentalControl />} />
<Route path='userpassword.html' element={<UserPassword />} />
{LEGACY_ADMIN_ROUTES.map(toViewManagerPageRoute)}
</Route>
{/* Public routes */}

View file

@ -0,0 +1,197 @@
import { LegacyRoute } from '.';
export const LEGACY_ADMIN_ROUTES: LegacyRoute[] = [
{
path: 'dashboard.html',
pageProps: {
controller: 'dashboard/dashboard',
view: 'dashboard/dashboard.html'
}
}, {
path: 'dashboardgeneral.html',
pageProps: {
controller: 'dashboard/general',
view: 'dashboard/general.html'
}
}, {
path: 'networking.html',
pageProps: {
controller: 'dashboard/networking',
view: 'dashboard/networking.html'
}
}, {
path: 'devices.html',
pageProps: {
controller: 'dashboard/devices/devices',
view: 'dashboard/devices/devices.html'
}
}, {
path: 'device.html',
pageProps: {
controller: 'dashboard/devices/device',
view: 'dashboard/devices/device.html'
}
}, {
path: 'quickConnect.html',
pageProps: {
controller: 'dashboard/quickConnect',
view: 'dashboard/quickConnect.html'
}
}, {
path: 'dlnaprofile.html',
pageProps: {
controller: 'dashboard/dlna/profile',
view: 'dashboard/dlna/profile.html'
}
}, {
path: 'dlnaprofiles.html',
pageProps: {
controller: 'dashboard/dlna/profiles',
view: 'dashboard/dlna/profiles.html'
}
}, {
path: 'dlnasettings.html',
pageProps: {
controller: 'dashboard/dlna/settings',
view: 'dashboard/dlna/settings.html'
}
}, {
path: 'addplugin.html',
pageProps: {
controller: 'dashboard/plugins/add/index',
view: 'dashboard/plugins/add/index.html'
}
}, {
path: 'library.html',
pageProps: {
controller: 'dashboard/library',
view: 'dashboard/library.html'
}
}, {
path: 'librarydisplay.html',
pageProps: {
controller: 'dashboard/librarydisplay',
view: 'dashboard/librarydisplay.html'
}
}, {
path: 'edititemmetadata.html',
pageProps: {
controller: 'edititemmetadata',
view: 'edititemmetadata.html'
}
}, {
path: 'encodingsettings.html',
pageProps: {
controller: 'dashboard/encodingsettings',
view: 'dashboard/encodingsettings.html'
}
}, {
path: 'log.html',
pageProps: {
controller: 'dashboard/logs',
view: 'dashboard/logs.html'
}
}, {
path: 'metadataimages.html',
pageProps: {
controller: 'dashboard/metadataImages',
view: 'dashboard/metadataimages.html'
}
}, {
path: 'metadatanfo.html',
pageProps: {
controller: 'dashboard/metadatanfo',
view: 'dashboard/metadatanfo.html'
}
}, {
path: 'notificationsetting.html',
pageProps: {
controller: 'dashboard/notifications/notification/index',
view: 'dashboard/notifications/notification/index.html'
}
}, {
path: 'notificationsettings.html',
pageProps: {
controller: 'dashboard/notifications/notifications/index',
view: 'dashboard/notifications/notifications/index.html'
}
}, {
path: 'playbackconfiguration.html',
pageProps: {
controller: 'dashboard/playback',
view: 'dashboard/playback.html'
}
}, {
path: 'availableplugins.html',
pageProps: {
controller: 'dashboard/plugins/available/index',
view: 'dashboard/plugins/available/index.html'
}
}, {
path: 'repositories.html',
pageProps: {
controller: 'dashboard/plugins/repositories/index',
view: 'dashboard/plugins/repositories/index.html'
}
}, {
path: 'livetvguideprovider.html',
pageProps: {
controller: 'livetvguideprovider',
view: 'livetvguideprovider.html'
}
}, {
path: 'livetvsettings.html',
pageProps: {
controller: 'livetvsettings',
view: 'livetvsettings.html'
}
}, {
path: 'livetvstatus.html',
pageProps: {
controller: 'livetvstatus',
view: 'livetvstatus.html'
}
}, {
path: 'livetvtuner.html',
pageProps: {
controller: 'livetvtuner',
view: 'livetvtuner.html'
}
}, {
path: 'installedplugins.html',
pageProps: {
controller: 'dashboard/plugins/installed/index',
view: 'dashboard/plugins/installed/index.html'
}
}, {
path: 'scheduledtask.html',
pageProps: {
controller: 'dashboard/scheduledtasks/scheduledtask',
view: 'dashboard/scheduledtasks/scheduledtask.html'
}
}, {
path: 'scheduledtasks.html',
pageProps: {
controller: 'dashboard/scheduledtasks/scheduledtasks',
view: 'dashboard/scheduledtasks/scheduledtasks.html'
}
}, {
path: 'serveractivity.html',
pageProps: {
controller: 'dashboard/serveractivity',
view: 'dashboard/serveractivity.html'
}
}, {
path: 'apikeys.html',
pageProps: {
controller: 'dashboard/apikeys',
view: 'dashboard/apikeys.html'
}
}, {
path: 'streamingsettings.html',
pageProps: {
view: 'dashboard/streaming.html',
controller: 'dashboard/streaming'
}
}
];

View file

@ -20,4 +20,5 @@ export function toViewManagerPageRoute(route: LegacyRoute) {
);
}
export * from './admin';
export * from './user';

View file

@ -70,259 +70,6 @@ import { appRouter } from '../components/appRouter';
controller: 'session/resetPassword/index'
});
defineRoute({
alias: '/dashboard.html',
path: 'dashboard/dashboard.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/dashboard'
});
defineRoute({
alias: '/dashboardgeneral.html',
path: 'dashboard/general.html',
controller: 'dashboard/general',
autoFocus: false,
roles: 'admin'
});
defineRoute({
alias: '/networking.html',
path: 'dashboard/networking.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/networking'
});
defineRoute({
alias: '/devices.html',
path: 'dashboard/devices/devices.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/devices/devices'
});
defineRoute({
alias: '/device.html',
path: 'dashboard/devices/device.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/devices/device'
});
defineRoute({
alias: '/quickConnect.html',
path: 'dashboard/quickConnect.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/quickConnect'
});
defineRoute({
alias: '/dlnaprofile.html',
path: 'dashboard/dlna/profile.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/dlna/profile'
});
defineRoute({
alias: '/dlnaprofiles.html',
path: 'dashboard/dlna/profiles.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/dlna/profiles'
});
defineRoute({
alias: '/dlnasettings.html',
path: 'dashboard/dlna/settings.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/dlna/settings'
});
defineRoute({
alias: '/addplugin.html',
path: 'dashboard/plugins/add/index.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/plugins/add/index'
});
defineRoute({
alias: '/library.html',
path: 'dashboard/library.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/library'
});
defineRoute({
alias: '/librarydisplay.html',
path: 'dashboard/librarydisplay.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/librarydisplay'
});
defineRoute({
alias: '/edititemmetadata.html',
path: 'edititemmetadata.html',
controller: 'edititemmetadata',
autoFocus: false
});
defineRoute({
alias: '/encodingsettings.html',
path: 'dashboard/encodingsettings.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/encodingsettings'
});
defineRoute({
alias: '/log.html',
path: 'dashboard/logs.html',
roles: 'admin',
controller: 'dashboard/logs'
});
defineRoute({
alias: '/metadataimages.html',
path: 'dashboard/metadataimages.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/metadataImages'
});
defineRoute({
alias: '/metadatanfo.html',
path: 'dashboard/metadatanfo.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/metadatanfo'
});
defineRoute({
alias: '/notificationsetting.html',
path: 'dashboard/notifications/notification/index.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/notifications/notification/index'
});
defineRoute({
alias: '/notificationsettings.html',
path: 'dashboard/notifications/notifications/index.html',
controller: 'dashboard/notifications/notifications/index',
autoFocus: false,
roles: 'admin'
});
defineRoute({
alias: '/playbackconfiguration.html',
path: 'dashboard/playback.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/playback'
});
defineRoute({
alias: '/availableplugins.html',
path: 'dashboard/plugins/available/index.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/plugins/available/index'
});
defineRoute({
alias: '/repositories.html',
path: 'dashboard/plugins/repositories/index.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/plugins/repositories/index'
});
defineRoute({
alias: '/livetvguideprovider.html',
path: 'livetvguideprovider.html',
autoFocus: false,
roles: 'admin',
controller: 'livetvguideprovider'
});
defineRoute({
alias: '/livetvsettings.html',
path: 'livetvsettings.html',
autoFocus: false,
controller: 'livetvsettings'
});
defineRoute({
alias: '/livetvstatus.html',
path: 'livetvstatus.html',
autoFocus: false,
roles: 'admin',
controller: 'livetvstatus'
});
defineRoute({
alias: '/livetvtuner.html',
path: 'livetvtuner.html',
autoFocus: false,
roles: 'admin',
controller: 'livetvtuner'
});
defineRoute({
alias: '/installedplugins.html',
path: 'dashboard/plugins/installed/index.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/plugins/installed/index'
});
defineRoute({
alias: '/scheduledtask.html',
path: 'dashboard/scheduledtasks/scheduledtask.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/scheduledtasks/scheduledtask'
});
defineRoute({
alias: '/scheduledtasks.html',
path: 'dashboard/scheduledtasks/scheduledtasks.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/scheduledtasks/scheduledtasks'
});
defineRoute({
alias: '/serveractivity.html',
path: 'dashboard/serveractivity.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/serveractivity'
});
defineRoute({
alias: '/apikeys.html',
path: 'dashboard/apikeys.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/apikeys'
});
defineRoute({
alias: '/streamingsettings.html',
path: 'dashboard/streaming.html',
autoFocus: false,
roles: 'admin',
controller: 'dashboard/streaming'
});
defineRoute({
alias: '/wizardremoteaccess.html',
path: 'wizard/remote/index.html',