Change routes configuration. Get community from path param if possible
This commit is contained in:
parent
99c443a32f
commit
94414b753b
|
@ -1,4 +1,4 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {SaveprofileComponent} from '../saveprofile/saveprofile.component';
|
||||
import {ConfigurationComponent} from '../configuration/configuration.component';
|
||||
|
@ -7,23 +7,18 @@ import {ManageprofilesComponent} from '../manageprofiles/manageprofiles.componen
|
|||
import {SaveProfileGuard, UploadContentGuard} from './save-profile-guard';
|
||||
|
||||
const interactiveMiningRoutes: Routes = [
|
||||
{path: '', redirectTo: '/mining/manage-profiles', pathMatch: 'full'},
|
||||
{path: 'manage-profiles', component: ManageprofilesComponent},
|
||||
{
|
||||
path: '',
|
||||
// component: InteractiveMiningComponent,
|
||||
children: [
|
||||
{ path: 'manage-profiles', component: ManageprofilesComponent },
|
||||
{ path: 'upload-content',
|
||||
component: ContentComponent,
|
||||
canDeactivate: [UploadContentGuard]
|
||||
},
|
||||
{ path: 'configure-profile',
|
||||
component: ConfigurationComponent,
|
||||
canDeactivate: [SaveProfileGuard]
|
||||
},
|
||||
{ path: 'save-profile', component: SaveprofileComponent }
|
||||
]
|
||||
}
|
||||
path: 'upload-content',
|
||||
component: ContentComponent,
|
||||
canDeactivate: [UploadContentGuard]
|
||||
},
|
||||
{
|
||||
path: 'configure-profile',
|
||||
component: ConfigurationComponent,
|
||||
canDeactivate: [SaveProfileGuard]
|
||||
},
|
||||
{path: 'save-profile', component: SaveprofileComponent}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
@ -38,4 +33,5 @@ const interactiveMiningRoutes: Routes = [
|
|||
SaveProfileGuard
|
||||
]
|
||||
})
|
||||
export class InteractiveMiningRoutingModule { }
|
||||
export class InteractiveMiningRoutingModule {
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
<router-outlet></router-outlet>
|
|
@ -1,25 +0,0 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { InteractiveMiningComponent } from './interactive-mining.component';
|
||||
|
||||
describe('InteractiveMiningComponent', () => {
|
||||
let component: InteractiveMiningComponent;
|
||||
let fixture: ComponentFixture<InteractiveMiningComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ InteractiveMiningComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(InteractiveMiningComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-interactive-mining',
|
||||
templateUrl: './interactive-mining.component.html',
|
||||
styleUrls: ['./interactive-mining.component.css']
|
||||
})
|
||||
export class InteractiveMiningComponent implements OnInit {
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router) { }
|
||||
|
||||
ngOnInit() {
|
||||
// this.router.navigate(['manage-profiles'], {relativeTo: this.route, queryParamsHandling: 'preserve' });
|
||||
}
|
||||
|
||||
}
|
|
@ -47,12 +47,19 @@ export class ManageprofilesComponent implements OnInit {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.queryParams
|
||||
.subscribe(
|
||||
params => {
|
||||
this.communityId = params['communityId'];
|
||||
this.route.params.subscribe(params => {
|
||||
if (params['community']) {
|
||||
this.communityId = params['community'];
|
||||
this.initialServerHandshake(this.communityId);
|
||||
});
|
||||
} else {
|
||||
this.route.queryParams
|
||||
.subscribe(
|
||||
queryParams => {
|
||||
this.communityId = queryParams['communityId'];
|
||||
this.initialServerHandshake(this.communityId);
|
||||
});
|
||||
}
|
||||
});
|
||||
this.isCommunityManager = this.manageProfilesService.isCommunityManager === 'true';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue