proj structure

This commit is contained in:
insanity 2018-05-18 15:09:32 +09:00
parent 96f1cd84a9
commit 36d169fccb
13 changed files with 72 additions and 53 deletions

View File

@ -24,7 +24,7 @@ export class AppMenuComponent implements OnInit {
label: 'Infra', icon: 'all_inclusive', items: [
{ label: 'Map', icon: 'map', routerLink: ['/map'] },
{ label: 'Sensors', icon: 'compare_arrows', routerLink: ['/sensors'] },
{ label: 'Probes', icon: 'dock', routerLink: ['/probe'] },
{ label: 'Probes', icon: 'dock', routerLink: ['/probe/list'] },
]
},
{

View File

@ -9,7 +9,7 @@ const routes: Routes = [
children: [
{ path: '', redirectTo: 'home' },
{ path: 'home', loadChildren: './home/home-page.module#HomePageModule' },
{ path: 'probe', loadChildren: './probes/probes-page.module#ProbesPageModule' },
{ path: 'probe', loadChildren: './probes/probe-tab-page.module#ProbeTabPageModule' },
// { path: 'sensors', loadChildren: './sensors/sensors-page.module#SensorsPageModule' },
// { path: 'sensor', loadChildren: './sensor/sensor-page.module#SensorPageModule' },
// { path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' },

View File

@ -0,0 +1,26 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ProbeTabPageComponent } from './probe-tab-page.component';
import { DownloadComponent } from 'packages/probe/component/download/download.component';
const routes: Routes = [
{
path: '',
component: ProbeTabPageComponent,
children: [
{ path: 'list', loadChildren: './probe/probe-page.module#ProbePageModule' },
{ path: 'noauth', loadChildren: './noauth-probe/noauth-probe-page.module#NoAuthProbePageModule' },
{ path: 'download', loadChildren: './download/download-page.module#ProbeDownloadPageModule' },
{ path: ':id/info', loadChildren: './probe/probe-page.module#ProbePageModule' },
// { path: ':id/targets', loadChildren: 'app/pages/targets/targets-page.module#TargetsPageModule'},
{ path: ':id/history', component: null },
]
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ProbeTabPageRoutingModule { }

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ProbesPageComponent } from './probes-page.component';
import { ProbeTabPageComponent } from './probe-tab-page.component';
describe('ProbeComponent', () => {
let component: ProbesPageComponent;
let fixture: ComponentFixture<ProbesPageComponent>;
describe('ProbeTabPageComponent', () => {
let component: ProbeTabPageComponent;
let fixture: ComponentFixture<ProbeTabPageComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ProbesPageComponent ]
declarations: [ ProbeTabPageComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ProbesPageComponent);
fixture = TestBed.createComponent(ProbeTabPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -3,10 +3,10 @@ import { Router, NavigationEnd } from '@angular/router';
import { Subscription } from 'rxjs/Subscription';
@Component({
selector: 'of-pages-probes',
templateUrl: './probes-page.component.html',
selector: 'of-pages-probe-tab',
templateUrl: './probe-tab-page.component.html',
})
export class ProbesPageComponent implements OnDestroy {
export class ProbeTabPageComponent implements OnDestroy {
private tabs = undefined;
private routerSubscription$: Subscription;
@ -27,7 +27,7 @@ export class ProbesPageComponent implements OnDestroy {
generateTabMenu(event: NavigationEnd) {
try {
const parsedUrl = event.url.split('probes/')[1].split('/')[0];
const parsedUrl = event.url.split('probe/')[1].split('/')[0];
switch (parsedUrl) {
case 'list':
case 'noauth':
@ -41,7 +41,7 @@ export class ProbesPageComponent implements OnDestroy {
default:
this.tabs = [
{ label: 'INFO', routerLink: ['/probe/', parsedUrl, 'info'] },
{ label: 'TARGETS', routerLink: ['/probe/', parsedUrl, 'targets'], disabled: true },
{ label: 'TARGETS', path: ['/probe/', parsedUrl, 'targets'], disabled: true },
{ label: 'HISTORY', path: ['/probe/', parsedUrl, 'history'], disabled: true },
];
break;

View File

@ -1,8 +1,8 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ProbesPageComponent } from './probes-page.component';
import { ProbesPageRoutingModule } from './probes-page-routing.module';
import { ProbeTabPageComponent } from './probe-tab-page.component';
import { ProbeTabPageRoutingModule } from './probe-tab-page-routing.module';
import { PrimeNGModules } from 'packages/commons/prime-ng/prime-ng.module';
import { ProbeModule } from 'packages/probe/probe.module';
import { TabbarModule } from 'app/commons/component/layout/tabbar/app.tabbar.module';
@ -10,13 +10,13 @@ import { TabbarModule } from 'app/commons/component/layout/tabbar/app.tabbar.mod
@NgModule({
imports: [
CommonModule,
ProbesPageRoutingModule,
ProbeTabPageRoutingModule,
PrimeNGModules,
ProbeModule,
TabbarModule,
],
declarations: [
ProbesPageComponent,
ProbeTabPageComponent,
]
})
export class ProbesPageModule { }
export class ProbeTabPageModule { }

View File

@ -5,7 +5,7 @@ import { ProbePageComponent } from './probe-page.component';
const routes: Routes = [
{
path: '',
component: null,
component: ProbePageComponent,
},
];

View File

@ -1 +1,7 @@
probe page module
<div *ngIf="!isDetail; else detailView">
<of-probe-list-container (select)="onProbeSelect($event)"></of-probe-list-container>
</div>
<ng-template #detailView>
<of-probe-detail-container (targetSelect)="onTargetSelect($event)"></of-probe-detail-container>
</ng-template>

View File

@ -1,5 +1,8 @@
import { Component } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Component, OnDestroy } from '@angular/core';
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';
@Component({
selector: 'of-pages-probe',
@ -7,11 +10,22 @@ import { Router, ActivatedRoute } from '@angular/router';
})
export class ProbePageComponent {
private index;
private isDetail: boolean;
constructor(
private router: Router,
private route: ActivatedRoute
) { }
) {
this.route.params.subscribe(params => {
this.isDetail = params['id'] ? true : false;
});
}
onProbeSelect(probe: Probe) {
this.router.navigate(['probe', probe.id, 'info']);
}
onTargetSelect(target: Target) {
console.log(target);
}
}

View File

@ -1,26 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ProbesPageComponent } from './probes-page.component';
import { DownloadComponent } from 'packages/probe/component/download/download.component';
const routes: Routes = [
{
path: '',
component: ProbesPageComponent,
// children: [
// { path: 'list', loadChildren: './probe/probe-page.module#ProbePageModule' },
// { path: 'noauth', loadChildren: './noauth-probe/noauth-probe-page.module#NoAuthProbePageModule' },
// { path: 'download', loadChildren: './download/download-page.module#ProbeDownloadPageModule' },
// { path: ':id/info', loadChildren: './probe/probe-page.module#ProbePageModule' },
// // { path: ':id/targets', loadChildren: 'app/pages/targets/targets-page.module#TargetsPageModule'},
// { path: ':id/history', component: null },
// ]
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ProbesPageRoutingModule { }

View File

@ -29,7 +29,6 @@ export class ListComponent implements OnInit, AfterContentInit, OnDestroy {
ngOnInit() {
this.probeHostsSubscription$ = this.probeHosts$.subscribe(
(probeHosts: ProbeHost[]) => {
console.log(probeHosts);
this.probeHosts = probeHosts;
},
(error: RPCClientError) => {

View File

@ -1 +1 @@
Probe Detail Container
<of-probe-detail></of-probe-detail>