diff --git a/src/app/app.module.ts b/src/app/app.module.ts index c492a1f..bc7198f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -62,7 +62,7 @@ import { PadContainerComponent } from './components/pad/pad-container/pad-contai const appRoutes: Routes = [ { path: '', component: LandingComponent }, { path: 'home', component: HomeComponent }, - { path: 'pad/:id', component: PadComponent }, + { path: 'pad/:name', component: PadComponent }, { path: 'login', component: LoginComponent }, { path: '**', component: NotFoundComponent } ]; diff --git a/src/app/components/home/home.component.ts b/src/app/components/home/home.component.ts index eb43b89..f24e0e9 100644 --- a/src/app/components/home/home.component.ts +++ b/src/app/components/home/home.component.ts @@ -47,7 +47,7 @@ export class HomeComponent implements OnInit, OnDestroy { this.swellService.getObject(name) .then( object => { this.swellService.setObjectName(object.id, name) - this.router.navigate(['/pad', object.id]); + this.router.navigate(['/pad', name]); }) .catch( err => { this.launchError = true; diff --git a/src/app/components/pad/pad.component.html b/src/app/components/pad/pad.component.html index e769ae9..bbd8edf 100644 --- a/src/app/components/pad/pad.component.html +++ b/src/app/components/pad/pad.component.html @@ -2,7 +2,7 @@ -

Pad {{object?.id}}

+

Pad {{name}}

diff --git a/src/app/components/pad/pad.component.ts b/src/app/components/pad/pad.component.ts index f4fa22e..1cc6604 100644 --- a/src/app/components/pad/pad.component.ts +++ b/src/app/components/pad/pad.component.ts @@ -15,12 +15,13 @@ export class PadComponent implements OnInit, OnDestroy, AfterViewInit { private objectSubscription: Subscription; object: any; - + name: string; constructor( private route: ActivatedRoute, private router: Router, - private padService: PadService) {} + private padService: PadService, + private swellService: SwellService) {} ngOnInit() { console.log('Pad ngOnInit()'); @@ -29,7 +30,15 @@ export class PadComponent implements OnInit, OnDestroy, AfterViewInit { }); this.route.paramMap.subscribe( params => { - this.padService.init(params.get('id')); + this.name = params.get('name'); + + this.swellService.getObjectNames(this.name) + .then( response => { + let names_json = JSON.parse(JSON.stringify(response)); + let id = names_json['waveId']['domain'].concat('/').concat(names_json['waveId']['id']); + this.padService.init(id); + }); + }); } diff --git a/src/app/services/swell.service.ts b/src/app/services/swell.service.ts index 7802b1b..9aa990f 100644 --- a/src/app/services/swell.service.ts +++ b/src/app/services/swell.service.ts @@ -155,6 +155,11 @@ export class SwellService { }) } + getObjectNames(name) { + return this.api.getObjectNames({ name: name }) + .then( response => { return response } ); + } + /** * Propagate session info