9ee4fec3f2a8b8d79238f3d027679d9355203bb6
[eliot.git] / blueprints / common / eliot-ui / frontend-src / src / app / app-routing.module.ts
1 import { NgModule } from '@angular/core';
2 import { Routes, RouterModule, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
3 import { HomeComponent } from './home/home.component';
4 import { NodesComponent } from './nodes/nodes.component';
5 import { PodsComponent } from './pods/pods.component';
6 import { ServicesComponent } from './services/services.component';
7 import { DeploymentsComponent } from './deployments/deployments.component';
8 import { ReplicaComponent } from './replica/replica.component';
9 import { LoginComponent } from './login/login.component';
10 import { SignupComponent } from './signup/signup.component';
11
12 import { DescriptionComponent } from './description/description.component';
13 import { HistoryComponent } from './history/history.component';
14 import { TerminalComponent } from './terminal/terminal.component';
15 import { UninstallComponent } from './uninstall/uninstall.component';
16
17 import { AuthGuard } from './_services/AuthGuard';
18 import { Terminal } from 'xterm';
19 import { DashboardComponent } from './dashboard/dashboard.component';
20
21
22
23 const routes: Routes = [
24
25   {
26     path: '',
27     component: HomeComponent
28     // canActivate: [AuthGuard]
29   },
30   {
31     path: 'nodes',
32     component: NodesComponent
33     // canActivate: [AuthGuard]
34   },
35   {
36     path: 'pods',
37     component: PodsComponent,
38     // canActivate: [AuthGuard]
39   },
40   {
41     path: 'services',
42     component: ServicesComponent,
43     // canActivate: [AuthGuard]
44   },
45   {
46     path: 'deployments',
47     component: DeploymentsComponent
48     // canActivate: [AuthGuard]
49   },
50   {
51     path: 'replica',
52     component: ReplicaComponent,
53     canActivate: [AuthGuard]
54   },
55   {
56     path: 'login',
57     component: LoginComponent
58   },
59   {
60     path: 'signup',
61     component: SignupComponent,
62   },
63   {
64     path: 'describe',
65     component: DescriptionComponent
66     // canActivate: [AuthGuard]
67   },
68   {
69     path: 'history',
70     component: HistoryComponent
71     // canActivate: [AuthGuard]
72   },
73   {
74     path: 'terminal',
75     component: TerminalComponent
76     // canActivate: [AuthGuard]
77   },
78   {
79     path: 'uninstall',
80     component: UninstallComponent
81     // canActivate: [AuthGuard]
82   },
83   {
84     path: 'akrainowiki',
85     component: HomeComponent,
86     resolve: {
87       url: 'externalUrlRedirectResolver'
88     },
89     data: {
90       externalUrl: 'https://wiki.akraino.org/display/AK/ELIOT%3A+Edge+Lightweight+and+IoT+Blueprint+Family?src=contextnavpagetreemode'
91     }
92   },
93   {
94     path: 'graphana',
95     component: HomeComponent,
96     resolve: {
97       url: 'externalUrlRedirectResolver'
98     },
99     data: {
100       externalUrl: 'http://localhost:3000/'
101     }
102   },
103   {
104     path: 'dashboard',
105     component: DashboardComponent,
106     // canActivate: [AuthGuard]
107   },
108   {
109     path: '**',
110     redirectTo: ''
111   }
112 ];
113
114 @NgModule({
115   imports: [RouterModule.forRoot(routes, {
116     scrollPositionRestoration: 'enabled'
117   })],
118   exports: [RouterModule],
119   providers: [
120     {
121         provide: 'externalUrlRedirectResolver',
122         useValue: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) =>
123         {
124             // window.location.href = (route.data as any).externalUrl;
125             window.open((route.data as any).externalUrl);
126             debugger;
127             console.log(route.url);
128             route.url[0].path="";
129
130         }
131     }
132 ]
133 })
134 export class AppRoutingModule { }