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 {RouterModule, Routes} from '@angular/router';
|
||||||
import {SaveprofileComponent} from '../saveprofile/saveprofile.component';
|
import {SaveprofileComponent} from '../saveprofile/saveprofile.component';
|
||||||
import {ConfigurationComponent} from '../configuration/configuration.component';
|
import {ConfigurationComponent} from '../configuration/configuration.component';
|
||||||
|
@ -7,23 +7,18 @@ import {ManageprofilesComponent} from '../manageprofiles/manageprofiles.componen
|
||||||
import {SaveProfileGuard, UploadContentGuard} from './save-profile-guard';
|
import {SaveProfileGuard, UploadContentGuard} from './save-profile-guard';
|
||||||
|
|
||||||
const interactiveMiningRoutes: Routes = [
|
const interactiveMiningRoutes: Routes = [
|
||||||
{path: '', redirectTo: '/mining/manage-profiles', pathMatch: 'full'},
|
{path: 'manage-profiles', component: ManageprofilesComponent},
|
||||||
{
|
{
|
||||||
path: '',
|
path: 'upload-content',
|
||||||
// component: InteractiveMiningComponent,
|
component: ContentComponent,
|
||||||
children: [
|
canDeactivate: [UploadContentGuard]
|
||||||
{ path: 'manage-profiles', component: ManageprofilesComponent },
|
},
|
||||||
{ path: 'upload-content',
|
{
|
||||||
component: ContentComponent,
|
path: 'configure-profile',
|
||||||
canDeactivate: [UploadContentGuard]
|
component: ConfigurationComponent,
|
||||||
},
|
canDeactivate: [SaveProfileGuard]
|
||||||
{ path: 'configure-profile',
|
},
|
||||||
component: ConfigurationComponent,
|
{path: 'save-profile', component: SaveprofileComponent}
|
||||||
canDeactivate: [SaveProfileGuard]
|
|
||||||
},
|
|
||||||
{ path: 'save-profile', component: SaveprofileComponent }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -38,4 +33,5 @@ const interactiveMiningRoutes: Routes = [
|
||||||
SaveProfileGuard
|
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() {
|
ngOnInit() {
|
||||||
this.route.queryParams
|
this.route.params.subscribe(params => {
|
||||||
.subscribe(
|
if (params['community']) {
|
||||||
params => {
|
this.communityId = params['community'];
|
||||||
this.communityId = params['communityId'];
|
|
||||||
this.initialServerHandshake(this.communityId);
|
this.initialServerHandshake(this.communityId);
|
||||||
});
|
} else {
|
||||||
|
this.route.queryParams
|
||||||
|
.subscribe(
|
||||||
|
queryParams => {
|
||||||
|
this.communityId = queryParams['communityId'];
|
||||||
|
this.initialServerHandshake(this.communityId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
this.isCommunityManager = this.manageProfilesService.isCommunityManager === 'true';
|
this.isCommunityManager = this.manageProfilesService.isCommunityManager === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue