Different layouts per project map and other pages

This commit is contained in:
ziajka 2017-10-27 13:55:40 +02:00
parent 2a671be4e9
commit 2039c5ed83
7 changed files with 69 additions and 21 deletions

View File

@ -4,11 +4,16 @@ import { RouterModule, Routes } from '@angular/router';
import { ProjectMapComponent } from './project-map/project-map.component';
import { ServersComponent } from "./servers/servers.component";
import { ProjectsComponent } from "./projects/projects.component";
import { DefaultLayoutComponent } from "./default-layout/default-layout.component";
const routes: Routes = [
{ path: '', redirectTo: '/servers', pathMatch: 'full' },
{ path: 'servers', component: ServersComponent },
{ path: 'server/:server_id/projects', component: ProjectsComponent },
{ path: '', component: DefaultLayoutComponent,
children: [
{ path: '', redirectTo: 'servers', pathMatch: 'full'},
{ path: 'servers', component: ServersComponent },
{ path: 'server/:server_id/projects', component: ProjectsComponent }
]
},
{ path: 'server/:server_id/project/:project_id', component: ProjectMapComponent },
];

View File

@ -1,19 +1 @@
<nav class="navbar navbar-expand-lg navbar-dark">
<a class="navbar-brand" href="/"><img src="assets/logo-header.png"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" [routerLink]="['/servers']" >Servers <span class="sr-only">(current)</span></a>
</li>
</ul>
</div>
</nav>
<router-outlet></router-outlet>
<footer class="footer">
<span class="text-muted">GNS3 Web UI demo</span>
</footer>

View File

@ -20,6 +20,7 @@ import { SymbolService } from "./services/symbol.service";
import { ServerService } from "./services/server.service";
import { IndexedDbService } from "./services/indexed-db.service";
import { HttpServer } from "./services/http-server.service";
import { DefaultLayoutComponent } from './default-layout/default-layout.component';
@NgModule({
@ -30,6 +31,7 @@ import { HttpServer } from "./services/http-server.service";
ServersComponent,
ServerCreateModalComponent,
ProjectsComponent,
DefaultLayoutComponent,
],
imports: [
NgbModule.forRoot(),

View File

@ -0,0 +1,19 @@
<nav class="navbar navbar-expand-lg navbar-dark">
<a class="navbar-brand" href="/"><img src="assets/logo-header.png"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" [routerLink]="['/servers']" >Servers <span class="sr-only">(current)</span></a>
</li>
</ul>
</div>
</nav>
<router-outlet></router-outlet>
<footer class="footer">
<span class="text-muted">GNS3 Web UI demo</span>
</footer>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DefaultLayoutComponent } from './default-layout.component';
describe('DefaultLayoutComponent', () => {
let component: DefaultLayoutComponent;
let fixture: ComponentFixture<DefaultLayoutComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DefaultLayoutComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DefaultLayoutComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-default-layout',
templateUrl: './default-layout.component.html',
styleUrls: ['./default-layout.component.css']
})
export class DefaultLayoutComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}