diff options
Diffstat (limited to 'client/src/app/+plugin-pages')
5 files changed, 75 insertions, 0 deletions
diff --git a/client/src/app/+plugin-pages/index.ts b/client/src/app/+plugin-pages/index.ts new file mode 100644 index 000000000..b988f13f6 --- /dev/null +++ b/client/src/app/+plugin-pages/index.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export * from './plugin-pages-routing.module' | ||
2 | export * from './plugin-pages.component' | ||
3 | export * from './plugin-pages.module' | ||
diff --git a/client/src/app/+plugin-pages/plugin-pages-routing.module.ts b/client/src/app/+plugin-pages/plugin-pages-routing.module.ts new file mode 100644 index 000000000..b47a787e0 --- /dev/null +++ b/client/src/app/+plugin-pages/plugin-pages-routing.module.ts | |||
@@ -0,0 +1,19 @@ | |||
1 | import { NgModule } from '@angular/core' | ||
2 | import { RouterModule, Routes } from '@angular/router' | ||
3 | import { PluginPagesComponent } from './plugin-pages.component' | ||
4 | |||
5 | const pluginPagesRoutes: Routes = [ | ||
6 | { | ||
7 | path: '**', | ||
8 | component: PluginPagesComponent, | ||
9 | data: { | ||
10 | reloadOnSameNavigation: true | ||
11 | } | ||
12 | } | ||
13 | ] | ||
14 | |||
15 | @NgModule({ | ||
16 | imports: [ RouterModule.forChild(pluginPagesRoutes) ], | ||
17 | exports: [ RouterModule ] | ||
18 | }) | ||
19 | export class PluginPagesRoutingModule {} | ||
diff --git a/client/src/app/+plugin-pages/plugin-pages.component.html b/client/src/app/+plugin-pages/plugin-pages.component.html new file mode 100644 index 000000000..cf62d1bd7 --- /dev/null +++ b/client/src/app/+plugin-pages/plugin-pages.component.html | |||
@@ -0,0 +1 @@ | |||
<div #root></div> | |||
diff --git a/client/src/app/+plugin-pages/plugin-pages.component.ts b/client/src/app/+plugin-pages/plugin-pages.component.ts new file mode 100644 index 000000000..5f294ee13 --- /dev/null +++ b/client/src/app/+plugin-pages/plugin-pages.component.ts | |||
@@ -0,0 +1,31 @@ | |||
1 | import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core' | ||
2 | import { ActivatedRoute, Router } from '@angular/router' | ||
3 | import { PluginService } from '@app/core' | ||
4 | |||
5 | @Component({ | ||
6 | templateUrl: './plugin-pages.component.html' | ||
7 | }) | ||
8 | export class PluginPagesComponent implements AfterViewInit { | ||
9 | @ViewChild('root') root: ElementRef | ||
10 | |||
11 | constructor ( | ||
12 | private route: ActivatedRoute, | ||
13 | private router: Router, | ||
14 | private pluginService: PluginService | ||
15 | ) { | ||
16 | |||
17 | } | ||
18 | |||
19 | ngAfterViewInit () { | ||
20 | const path = '/' + this.route.snapshot.url.map(u => u.path).join('/') | ||
21 | |||
22 | const registered = this.pluginService.getRegisteredClientRoute(path) | ||
23 | if (!registered) { | ||
24 | console.log('Could not find registered route %s.', path, this.pluginService.getAllRegisteredClientRoutes()) | ||
25 | |||
26 | return this.router.navigate([ '/404' ], { skipLocationChange: true }) | ||
27 | } | ||
28 | |||
29 | registered.onMount({ rootEl: this.root.nativeElement }) | ||
30 | } | ||
31 | } | ||
diff --git a/client/src/app/+plugin-pages/plugin-pages.module.ts b/client/src/app/+plugin-pages/plugin-pages.module.ts new file mode 100644 index 000000000..86f86c752 --- /dev/null +++ b/client/src/app/+plugin-pages/plugin-pages.module.ts | |||
@@ -0,0 +1,21 @@ | |||
1 | import { NgModule } from '@angular/core' | ||
2 | import { PluginPagesRoutingModule } from './plugin-pages-routing.module' | ||
3 | import { PluginPagesComponent } from './plugin-pages.component' | ||
4 | |||
5 | @NgModule({ | ||
6 | imports: [ | ||
7 | PluginPagesRoutingModule | ||
8 | ], | ||
9 | |||
10 | declarations: [ | ||
11 | PluginPagesComponent | ||
12 | ], | ||
13 | |||
14 | exports: [ | ||
15 | PluginPagesComponent | ||
16 | ], | ||
17 | |||
18 | providers: [ | ||
19 | ] | ||
20 | }) | ||
21 | export class PluginPagesModule { } | ||