forked from pterodactyl/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroutes.ts
More file actions
144 lines (139 loc) · 4.71 KB
/
routes.ts
File metadata and controls
144 lines (139 loc) · 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import React, { lazy } from 'react';
import ServerConsole from '@/components/server/console/ServerConsoleContainer';
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';
import FileManagerContainer from '@/components/server/files/FileManagerContainer';
import SettingsContainer from '@/components/server/settings/SettingsContainer';
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';
import ServerActivityLogContainer from '@/components/server/ServerActivityLogContainer';
// 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.
const FileEditContainer = lazy(() => import('@/components/server/files/FileEditContainer'));
const ScheduleEditContainer = lazy(() => import('@/components/server/schedules/ScheduleEditContainer'));
interface RouteDefinition {
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;
}
interface ServerRouteDefinition extends RouteDefinition {
permission: string | string[] | null;
}
interface Routes {
// All of the routes available under "/account"
account: RouteDefinition[];
// All of the routes available under "/server/:id"
server: ServerRouteDefinition[];
}
export default {
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,
},
],
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,
},
{
path: '/activity',
permission: 'activity.*',
name: 'Activity',
component: ServerActivityLogContainer,
},
],
} as Routes;