-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp-routing.module.ts
More file actions
66 lines (62 loc) · 2.77 KB
/
app-routing.module.ts
File metadata and controls
66 lines (62 loc) · 2.77 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
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { BmsDebugPageComponent } from 'src/pages/bms-debug-page/bms-debug-page.component';
import { BmsSegmentViewComponent } from 'src/pages/bms-debug-page/bms-segment-view/bms-segment-view.component';
import { CameraPageComponent } from 'src/pages/camera-page/camera-page.component';
import CarCommandComponent from 'src/pages/car-command-page/car-command.component';
import ChargingPageComponent from 'src/pages/charging-page/charging-page.component';
import EfusesPageComponent from 'src/pages/efuses-page/efuses-page.component';
import FaultPageComponent from 'src/pages/fault-page/fault-page.component';
import GraphPageComponent from 'src/pages/graph-page/graph-page.component';
import LandingPageComponent from 'src/pages/landing-page/landing-page.component';
import LapTimerPageComponent from 'src/pages/lap-timer-page/lap-timer-page.component';
import MapComponent from 'src/pages/map/map.component';
import { Segment } from 'src/utils/bms.utils';
const landingRoute = () => `/landing`;
const graphRoute = () => `/graph`;
const mapRoute = () => `/map`;
const chargingRoute = () => `/charging`;
const bmsRoute = () => `/bms`;
const bmsSegmentViewRoute = (id: Segment) => `/bms/segment/${id + 1}`;
const cameraRoute = () => `/camera`;
const faultsRoute = () => `/faults`;
const faultsGraphRoute = () => `/faults/fault-graph`;
const commandsRoute = () => `/commands`;
const efusesRoute = () => `/efuses`;
const lapTimerRoute = () => `/lap-timer`;
export const appRoutes = {
landingRoute,
graphRoute,
mapRoute,
chargingRoute,
bmsRoute,
bmsSegmentViewRoute,
cameraRoute,
faultsRoute,
faultsGraphRoute,
commandsRoute,
efusesRoute,
lapTimerRoute
};
// Routes should be defined carefully in accordance with the appRoutes
const routes: Routes = [
{ path: 'landing', component: LandingPageComponent },
{ path: 'graph', component: GraphPageComponent },
{ path: '', redirectTo: appRoutes.landingRoute(), pathMatch: 'full' },
{ path: 'map', component: MapComponent },
{ path: 'charging', component: ChargingPageComponent },
{ path: 'bms', component: BmsDebugPageComponent },
// NOTE: paramaterized routes should be even more carefully defined in accordance with the appRoutes
{ path: 'bms/segment/:id', component: BmsSegmentViewComponent },
{ path: 'faults', component: FaultPageComponent },
{ path: 'faults/fault-graph', component: GraphPageComponent },
{ path: 'camera', component: CameraPageComponent },
{ path: 'commands', component: CarCommandComponent },
{ path: 'efuses', component: EfusesPageComponent },
{ path: 'lap-timer', component: LapTimerPageComponent }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule {}