2022-06-12 17:36:55 +02:00
|
|
|
import React, { lazy } from 'react';
|
2022-06-22 00:43:59 +02:00
|
|
|
import ServerConsole from '@/components/server/console/ServerConsoleContainer';
|
2022-06-12 17:36:55 +02:00
|
|
|
import DatabasesContainer from '@/components/server/databases/DatabasesContainer';
|
|
|
|
import ScheduleContainer from '@/components/server/schedules/ScheduleContainer';
|
|
|
|
import UsersContainer from '@/components/server/users/UsersContainer';
|
|
|
|
import BackupContainer from '@/components/server/backups/BackupContainer';
|
|
|
|
import NetworkContainer from '@/components/server/network/NetworkContainer';
|
|
|
|
import StartupContainer from '@/components/server/startup/StartupContainer';
|
2022-06-12 17:56:00 +02:00
|
|
|
import FileManagerContainer from '@/components/server/files/FileManagerContainer';
|
|
|
|
import SettingsContainer from '@/components/server/settings/SettingsContainer';
|
2022-06-12 19:33:25 +02:00
|
|
|
import AccountOverviewContainer from '@/components/dashboard/AccountOverviewContainer';
|
|
|
|
import AccountApiContainer from '@/components/dashboard/AccountApiContainer';
|
|
|
|
import AccountSSHContainer from '@/components/dashboard/ssh/AccountSSHContainer';
|
|
|
|
import ActivityLogContainer from '@/components/dashboard/activity/ActivityLogContainer';
|
2022-06-12 21:16:48 +02:00
|
|
|
import ServerActivityLogContainer from '@/components/server/ServerActivityLogContainer';
|
2022-06-12 17:36:55 +02:00
|
|
|
|
2022-06-12 19:33:25 +02:00
|
|
|
// Each of the router files is already code split out appropriately — so
|
|
|
|
// all of the items above will only be loaded in when that router is loaded.
|
|
|
|
//
|
|
|
|
// These specific lazy loaded routes are to avoid loading in heavy screens
|
|
|
|
// for the server dashboard when they're only needed for specific instances.
|
2022-06-12 17:36:55 +02:00
|
|
|
const FileEditContainer = lazy(() => import('@/components/server/files/FileEditContainer'));
|
|
|
|
const ScheduleEditContainer = lazy(() => import('@/components/server/schedules/ScheduleEditContainer'));
|
|
|
|
|
2022-06-12 19:33:25 +02:00
|
|
|
interface RouteDefinition {
|
2022-06-12 17:36:55 +02:00
|
|
|
path: string;
|
|
|
|
// If undefined is passed this route is still rendered into the router itself
|
|
|
|
// but no navigation link is displayed in the sub-navigation menu.
|
|
|
|
name: string | undefined;
|
|
|
|
component: React.ComponentType;
|
|
|
|
exact?: boolean;
|
|
|
|
}
|
|
|
|
|
2022-06-12 19:33:25 +02:00
|
|
|
interface ServerRouteDefinition extends RouteDefinition {
|
|
|
|
permission: string | string[] | null;
|
|
|
|
}
|
|
|
|
|
2022-06-12 17:36:55 +02:00
|
|
|
interface Routes {
|
2022-06-12 19:33:25 +02:00
|
|
|
// All of the routes available under "/account"
|
|
|
|
account: RouteDefinition[];
|
|
|
|
// All of the routes available under "/server/:id"
|
2022-06-12 17:36:55 +02:00
|
|
|
server: ServerRouteDefinition[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
2022-06-12 19:33:25 +02:00
|
|
|
account: [
|
|
|
|
{
|
|
|
|
path: '/',
|
|
|
|
name: 'Account',
|
|
|
|
component: AccountOverviewContainer,
|
|
|
|
exact: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/api',
|
|
|
|
name: 'API Credentials',
|
|
|
|
component: AccountApiContainer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/ssh',
|
|
|
|
name: 'SSH Keys',
|
|
|
|
component: AccountSSHContainer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/activity',
|
|
|
|
name: 'Activity',
|
|
|
|
component: ActivityLogContainer,
|
|
|
|
},
|
|
|
|
],
|
2022-06-12 17:36:55 +02:00
|
|
|
server: [
|
|
|
|
{
|
|
|
|
path: '/',
|
|
|
|
permission: null,
|
|
|
|
name: 'Console',
|
|
|
|
component: ServerConsole,
|
|
|
|
exact: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/files',
|
|
|
|
permission: 'file.*',
|
|
|
|
name: 'Files',
|
|
|
|
component: FileManagerContainer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/files/:action(edit|new)',
|
|
|
|
permission: 'file.*',
|
|
|
|
name: undefined,
|
|
|
|
component: FileEditContainer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/databases',
|
|
|
|
permission: 'database.*',
|
|
|
|
name: 'Databases',
|
|
|
|
component: DatabasesContainer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/schedules',
|
|
|
|
permission: 'schedule.*',
|
|
|
|
name: 'Schedules',
|
|
|
|
component: ScheduleContainer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/schedules/:id',
|
|
|
|
permission: 'schedule.*',
|
|
|
|
name: undefined,
|
|
|
|
component: ScheduleEditContainer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/users',
|
|
|
|
permission: 'user.*',
|
|
|
|
name: 'Users',
|
|
|
|
component: UsersContainer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/backups',
|
|
|
|
permission: 'backup.*',
|
|
|
|
name: 'Backups',
|
|
|
|
component: BackupContainer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/network',
|
|
|
|
permission: 'allocation.*',
|
|
|
|
name: 'Network',
|
|
|
|
component: NetworkContainer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/startup',
|
|
|
|
permission: 'startup.*',
|
|
|
|
name: 'Startup',
|
|
|
|
component: StartupContainer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/settings',
|
|
|
|
permission: [ 'settings.*', 'file.sftp' ],
|
|
|
|
name: 'Settings',
|
|
|
|
component: SettingsContainer,
|
|
|
|
},
|
2022-06-12 21:16:48 +02:00
|
|
|
{
|
|
|
|
path: '/activity',
|
|
|
|
permission: 'activity.*',
|
|
|
|
name: 'Activity',
|
|
|
|
component: ServerActivityLogContainer,
|
|
|
|
},
|
2022-06-12 17:36:55 +02:00
|
|
|
],
|
|
|
|
} as Routes;
|