breadcrumb example

This commit is contained in:
insanity 2018-05-18 20:29:16 +09:00
parent c652f228a6
commit b1c4b6eaec
15 changed files with 46 additions and 47 deletions

View File

@ -5,5 +5,6 @@ import { Component } from '@angular/core';
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
export class AppComponent {
}

View File

@ -14,16 +14,4 @@
<li *ngIf="!last">/</li>
</ng-template>
</ul>
<div class="layout-breadcrumb-options">
<a routerLink="/" title="Backup">
<i class="material-icons">backup</i>
</a>
<a routerLink="/" title="Bookmark">
<i class="material-icons">bookmark</i>
</a>
<a routerLink="/" title="Logout">
<i class="material-icons">power_settings_new</i>
</a>
</div>
</div>

View File

@ -1,6 +1,6 @@
import { Component, OnDestroy } from '@angular/core';
import { AppComponent } from 'app/app.component';
import { BreadcrumbService } from './breadcrumb.service';
import { BreadcrumbService } from 'app/commons/service/breadcrumb.service';
import { Subscription } from 'rxjs/Subscription';
import { MenuItem } from 'primeng/primeng';

View File

@ -1,16 +0,0 @@
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
import { Observable } from 'rxjs/Observable';
import { MenuItem } from 'primeng/primeng';
@Injectable()
export class BreadcrumbService {
private itemsSource = new Subject<MenuItem[]>();
itemsHandler = this.itemsSource.asObservable();
setItems(items: MenuItem[]) {
this.itemsSource.next(items);
}
}

View File

@ -3,8 +3,6 @@
<div class="ui-g-12">
<div class="card no-margin">
<of-infra-map></of-infra-map>
<of-infra-map></of-infra-map>
<of-infra-map></of-infra-map>
</div>
</div>
</div>

View File

@ -1,7 +1,8 @@
import { Component, AfterViewInit, ElementRef, Renderer, ViewChild, OnDestroy, OnInit, NgZone } from '@angular/core';
import { ScrollPanel } from 'primeng/primeng';
import { Router } from '@angular/router';
import { Router, NavigationStart } from '@angular/router';
import { slide, fade } from './pages-animation';
import { BreadcrumbService } from '../commons/service/breadcrumb.service';
enum MenuOrientation {
STATIC,
OVERLAY,
@ -60,7 +61,13 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit {
rippleMouseDownListener: any;
constructor(public renderer: Renderer, public zone: NgZone, private router: Router) {
constructor(public renderer: Renderer, public zone: NgZone, private router: Router, private breadcrumbService: BreadcrumbService) {
router.events.subscribe((val) => {
console.log(val);
if (val instanceof NavigationStart) {
breadcrumbService.setItems(null);
}
});
}
ngOnInit() {

View File

@ -8,8 +8,7 @@ import { AppFooterComponent } from 'app/commons/component/layout/footer/app.foot
import { AppBreadcrumbComponent } from 'app/commons/component/layout/breadcrumb/app.breadcrumb.component';
import { AppRightpanelComponent } from 'app/commons/component/layout/right-panel/app.rightpanel.component';
import { AppInlineProfileComponent } from 'app/commons/component/layout/profile/app.profile.component';
import { BreadcrumbService } from 'app/commons/component/layout/breadcrumb/breadcrumb.service';
import { BreadcrumbService } from 'app/commons/service/breadcrumb.service';
import {
LocalizationModule,
} from 'angular-l10n';

View File

@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { BreadcrumbService } from '../../../commons/service/breadcrumb.service';
@Component({
selector: 'of-pages-download',
@ -11,8 +12,14 @@ export class ProbeDownloadPageComponent implements OnInit {
constructor(
private router: Router,
private route: ActivatedRoute
) { }
private route: ActivatedRoute,
private breadcrumbService: BreadcrumbService
) {
breadcrumbService.setItems([
{ label: 'Probe', routerLink: ['/probe/list'] },
{ label: 'Download', routerLink: ['/probe/download'] },
]);
}
ngOnInit() {
this.route.params.subscribe((params: any) => {

View File

@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { NoAuthProbePageComponent } from './noauth-probe-page.component';
import { ProbeListComponent } from 'packages/probe/component/list/list.component';
import { ListComponent } from 'packages/noauth/component/list/list.component';
import { NoAuthProbeListComponent } from 'packages/noauth/component/list/list.component';
import { ProbeDownloadComponent } from 'packages/probe/component/download/download.component';
const routes: Routes = [

View File

@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { BreadcrumbService } from 'app/commons/service/breadcrumb.service';
@Component({
selector: 'of-pages-noauth-probe',
@ -7,7 +8,11 @@ import { Component, OnInit } from '@angular/core';
export class NoAuthProbePageComponent {
constructor(
private breadcrumbService: BreadcrumbService
) {
breadcrumbService.setItems([
{ label: 'Probe', routerLink: ['/probe/list'] },
{ label: 'Unauthroized', routerLink: ['/probe/noauth'] },
]);
}
}

View File

@ -3,6 +3,7 @@ import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
import { Subscription } from 'rxjs/Subscription';
import { Probe } from '@overflow/commons-typescript/model/probe';
import { Target } from '@overflow/commons-typescript/model/target';
import { BreadcrumbService } from 'app/commons/service/breadcrumb.service';
@Component({
selector: 'of-pages-probe',
@ -14,11 +15,20 @@ export class ProbePageComponent {
constructor(
private router: Router,
private route: ActivatedRoute
private route: ActivatedRoute,
private breadcrumbService: BreadcrumbService
) {
this.route.params.subscribe(params => {
this.isDetail = params['id'] ? true : false;
});
this.breadcrumbService.setItems([
{ label: 'Probe', routerLink: ['/probe/list'], }
]);
}
test() {
alert('test');
}
onProbeSelect(probe: Probe) {

View File

@ -1,5 +1,5 @@
import { ListComponent } from './list/list.component';
import { NoAuthProbeListComponent } from './list/list.component';
export const COMPONENTS = [
ListComponent,
NoAuthProbeListComponent,
];

View File

@ -8,7 +8,7 @@ import { MessageService } from 'primeng/components/common/messageservice';
templateUrl: './list.component.html',
providers: [ConfirmationService, MessageService]
})
export class ListComponent {
export class NoAuthProbeListComponent {
@Input() noauthProbes: NoAuthProbe[];
@Output() accept = new EventEmitter<NoAuthProbe>();
@Output() deny = new EventEmitter<NoAuthProbe>();

View File

@ -1,5 +1,5 @@
import { ListContainerComponent } from './list/list-container.component';
import { NoAuthProbeListContainerComponent } from './list/list-container.component';
export const CONTAINER_COMPONENTS = [
ListContainerComponent,
NoAuthProbeListContainerComponent,
];

View File

@ -17,7 +17,7 @@ import { MessageService } from 'primeng/components/common/messageservice';
templateUrl: './list-container.component.html',
providers: [ConfirmationService, MessageService]
})
export class ListContainerComponent implements OnInit, AfterContentInit, OnDestroy {
export class NoAuthProbeListContainerComponent implements OnInit, AfterContentInit, OnDestroy {
noauthProbes$: Observable<NoAuthProbe[]>;
constructor(