This commit is contained in:
insanity 2018-03-15 12:47:25 +09:00
parent 72a2ecc904
commit 63a3288969
11 changed files with 156 additions and 78 deletions

View File

@ -66,7 +66,7 @@ export const menus = [
{ {
'name': 'App.Alert', 'name': 'App.Alert',
'icon': 'warning', 'icon': 'warning',
'link': '', 'link': '/alert',
'open': true, 'open': true,
}, },
{ {

View File

@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AlertPageComponent } from './alert-page.component';
const routes: Routes = [
{
path: '',
component: AlertPageComponent,
children: [
]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class AlertPageRoutingModule { }

View File

@ -0,0 +1 @@
<div>alert page</div>

View File

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

View File

@ -0,0 +1,18 @@
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
@Component({
selector: 'of-pages-alert',
templateUrl: './alert-page.component.html',
styleUrls: ['./alert-page.component.scss']
})
export class AlertPageComponent implements OnInit {
constructor(private route: ActivatedRoute, private router: Router) {
}
ngOnInit() {
}
}

View File

@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AlertPageRoutingModule } from './alert-page-routing.module';
import { MaterialModule } from 'app/commons/ui/material/material.module';
import { AlertPageComponent } from './alert-page.component';
@NgModule({
imports: [
CommonModule,
AlertPageRoutingModule,
MaterialModule,
// NotificationModule,
],
declarations: [
AlertPageComponent,
]
})
export class AlertPageModule { }

View File

@ -21,6 +21,7 @@ const routes: Routes = [
{ path: 'overview', loadChildren: './overview/overview-page.module#OverviewPageModule' }, { path: 'overview', loadChildren: './overview/overview-page.module#OverviewPageModule' },
{ path: 'dashboard', loadChildren: './dashboard/dashboard-page.module#DashboardPageModule' }, { path: 'dashboard', loadChildren: './dashboard/dashboard-page.module#DashboardPageModule' },
{ path: 'notification', loadChildren: './notification/notification-page.module#NotificationPageModule' }, { path: 'notification', loadChildren: './notification/notification-page.module#NotificationPageModule' },
{ path: 'alert', loadChildren: './alert/alert-page.module#AlertPageModule' },
{ path: 'settings/member', loadChildren: './settings/member/member-page.module#MemberPageModule' }, { path: 'settings/member', loadChildren: './settings/member/member-page.module#MemberPageModule' },
] ]
} }

View File

@ -1,10 +1,10 @@
<!-- <div><h3>{{probeAlias}}</h3></div> <div><h3>{{probe.displayName}}</h3></div>
<div fxLayout="row" fxLayoutWrap fxLayoutAlign="space-between center"> <div fxLayout="row" fxLayoutWrap fxLayoutAlign="space-between center">
<mat-card [style.padding]="'15px 50px'">Status: UP</mat-card> <mat-card [style.padding]="'15px 50px'">Status: {{probe.status.name}}</mat-card>
<div> <div>
<button *ngIf="!isUpState" mat-raised-button color="primary" (click)="handleStartStop()">Start</button> <button *ngIf="probe.status.id === 1" mat-raised-button color="primary" (click)="handleStartStop()">Start</button>
<button *ngIf="isUpState" mat-raised-button color="accent" (click)="handleStartStop()">Stop</button> <button *ngIf="probe.status.id === 2" mat-raised-button color="accent" (click)="handleStartStop()">Stop</button>
<button mat-raised-button color="warn" (click)="handleRemove()">Remove</button> <button mat-raised-button color="warn" (click)="handleRemove()">Remove</button>
</div> </div>
@ -20,5 +20,4 @@
<mat-card fxFlex="30%" fxFlex.lt-sm="100" fxFlex.sm="30"> <mat-card fxFlex="30%" fxFlex.lt-sm="100" fxFlex.sm="30">
<of-info-table [title]="'Title3'" [data]="probeInfo"></of-info-table> <of-info-table [title]="'Title3'" [data]="probeInfo"></of-info-table>
</mat-card> </mat-card>
</div> --> </div>
<div>aaa</div>

View File

@ -15,14 +15,45 @@ import { RPCError } from 'packages/core/rpc/error';
}) })
export class DetailComponent implements OnInit, AfterContentInit { export class DetailComponent implements OnInit, AfterContentInit {
probe$ = this.store.pipe(select(DetailSelector.select('probe'))); probe$ = this.detailStore.pipe(select(DetailSelector.select('probe')));
probe: Probe = null; probe: Probe = null;
networkInfo = null;
deviceInfo = null;
probeInfo = null;
probeAlias = '';
probeId = undefined;
isUpState = false;
networkInfo = [ constructor(
private route: ActivatedRoute,
private router: Router,
public dialog: MatDialog,
private detailStore: Store<DetailStore.State>
) { }
ngOnInit() {
this.probe$.subscribe(
(probe: Probe) => {
if (probe != null) {
this.probe = probe;
this.arrangeInfo();
}
},
(error: RPCError) => {
console.log(error.message);
}
);
}
ngAfterContentInit() {
const probeId = this.route.snapshot.paramMap.get('id');
this.detailStore.dispatch(
new DetailStore.Read(
{ id: probeId }
)
);
}
arrangeInfo() {
this.networkInfo = [
{ {
key: 'IP', key: 'IP',
value: '192.168.1.1' value: '192.168.1.1'
@ -36,8 +67,7 @@ export class DetailComponent implements OnInit, AfterContentInit {
value: '12' value: '12'
}, },
]; ];
this.deviceInfo = [
deviceInfo = [
{ {
key: 'OS', key: 'OS',
value: 'Linux' value: 'Linux'
@ -55,8 +85,7 @@ export class DetailComponent implements OnInit, AfterContentInit {
value: '...' value: '...'
}, },
]; ];
this.probeInfo = [
probeInfo = [
{ {
key: 'Authorized at', key: 'Authorized at',
value: String(new Date()) value: String(new Date())
@ -70,38 +99,10 @@ export class DetailComponent implements OnInit, AfterContentInit {
value: String(new Date()) value: String(new Date())
}, },
]; ];
constructor(
private route: ActivatedRoute,
private router: Router,
public dialog: MatDialog,
private store: Store<DetailStore.State>
) { }
ngOnInit() {
this.probeId = this.route.snapshot.paramMap.get('id');
this.probeAlias = 'Probe Alias 블라블라';
}
ngAfterContentInit() {
this.store.dispatch(
new DetailStore.Read(
{ id: this.probeId }
)
);
this.probe$.subscribe(
(probe: Probe) => {
console.log(probe);
this.probe = probe;
},
(error: RPCError) => {
console.log(error.message);
}
);
} }
handleStartStop() { handleStartStop() {
this.isUpState = !this.isUpState; // this.isUpState = !this.isUpState;
} }
handleRemove() { handleRemove() {

View File

@ -24,9 +24,6 @@ export class ProbeService {
} }
public read(id: string): Observable<Probe> { public read(id: string): Observable<Probe> {
const param = { return this.rpcClient.call<Probe>('ProbeService.read', id);
id: id,
};
return this.rpcClient.call<Probe>('ProbeService.read', param);
} }
} }