probe arrange

This commit is contained in:
insanity 2018-03-27 14:35:23 +09:00
parent 73d4672cbb
commit 3c636a238a
7 changed files with 69 additions and 39 deletions

View File

@ -1,5 +1,3 @@
<button mat-raised-button color="primary" (click)="authProbe()">Probe 인증</button> <button mat-raised-button color="primary" (click)="authProbe()">Probe 인증</button>
<button mat-raised-button color="primary" (click)="discovery()">Probe Discovery</button>
<of-infra-map></of-infra-map> <of-infra-map></of-infra-map>

View File

@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material'; import { MatDialog } from '@angular/material';
import { SettingComponent as DiscoverySettingComponent } from 'packages/discovery/component/setting/setting.component';
@Component({ @Component({
selector: 'of-infra-page', selector: 'of-infra-page',
@ -16,17 +15,6 @@ export class InfraPageComponent implements OnInit {
ngOnInit() { ngOnInit() {
} }
discovery() {
const dialogRef = this.dialog.open(DiscoverySettingComponent, {
width: '80%',
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
});
}
authProbe() { authProbe() {
} }
} }

View File

@ -6,7 +6,6 @@ import { InfraPageRoutingModule } from './infra-page-routing.module';
import { MaterialModule } from 'packages/commons/material/material.module'; import { MaterialModule } from 'packages/commons/material/material.module';
import { InfraModule } from 'packages/infra/infra.module'; import { InfraModule } from 'packages/infra/infra.module';
import { SettingComponent as DiscoverySettingComponent } from 'packages/discovery/component/setting/setting.component';
import { InfraPageComponent } from './infra-page.component'; import { InfraPageComponent } from './infra-page.component';
import { DiscoveryModule } from 'packages/discovery/discovery.module'; import { DiscoveryModule } from 'packages/discovery/discovery.module';
@ -21,8 +20,5 @@ import { DiscoveryModule } from 'packages/discovery/discovery.module';
declarations: [ declarations: [
InfraPageComponent, InfraPageComponent,
], ],
entryComponents: [
DiscoverySettingComponent
]
}) })
export class InfraPageModule { } export class InfraPageModule { }

View File

@ -19,6 +19,7 @@
</div> </div>
</mat-grid-tile> </mat-grid-tile>
<mat-grid-tile [colspan]="1" [rowspan]="1"> <mat-grid-tile [colspan]="1" [rowspan]="1">
Status: 기본 센서 데이터에서 저장한 metric으로..
</mat-grid-tile> </mat-grid-tile>
<mat-grid-tile [colspan]="2" [rowspan]="1" class="text-inside-grid"> <mat-grid-tile [colspan]="2" [rowspan]="1" class="text-inside-grid">
<div class="text-inside-grid">????</div> <div class="text-inside-grid">????</div>

View File

@ -1,16 +1,16 @@
<div><h3>{{probe.displayName}}</h3></div> <div *ngIf="probe !== null">
<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: {{probe.status.name}}</mat-card> <mat-card [style.padding]="'15px 50px'">Status: {{probe.status.name}}</mat-card>
<div> <div>
<button *ngIf="probe.status.id === 1" mat-raised-button color="primary" (click)="handleStartStop()">Start</button> <button mat-raised-button color="primary" (click)="discovery()">Discovery</button>
<button *ngIf="probe.status.id === 2" mat-raised-button color="accent" (click)="handleStartStop()">Stop</button> </div>
<button mat-raised-button color="warn" (click)="handleRemove()">Remove</button>
</div> </div>
</div>
<div fxLayout="row" fxLayoutWrap fxLayoutGap="10px" fxLayoutAlign="center" [style.margin]="'20px'"> <div fxLayout="row" fxLayoutWrap fxLayoutGap="10px" fxLayoutAlign="center" [style.margin]="'20px'">
<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]="'Title1'" [data]="networkInfo"></of-info-table> <of-info-table [title]="'Title1'" [data]="networkInfo"></of-info-table>
</mat-card> </mat-card>
@ -20,4 +20,16 @@
<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 fxLayoutAlign="end">
<button *ngIf="probe.status.id === 1" mat-raised-button color="primary" (click)="handleStartStop()">Start</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>
</div>
</div>
<div *ngIf="probe === null">
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
</div> </div>

View File

@ -10,6 +10,8 @@ import { ConfirmDialogComponent } from 'packages/commons/component/confirm-dialo
import * as DetailStore from '../../store/detail'; import * as DetailStore from '../../store/detail';
import { DetailSelector } from '../../store'; import { DetailSelector } from '../../store';
import { Probe } from '../../model'; import { Probe } from '../../model';
import { SettingComponent as DiscoverySettingComponent } from 'packages/discovery/component/setting/setting.component';
import * as CIDR from 'ip-cidr';
@Component({ @Component({
selector: 'of-probe-detail', selector: 'of-probe-detail',
@ -37,6 +39,7 @@ export class DetailComponent implements OnInit, AfterContentInit {
(probe: Probe) => { (probe: Probe) => {
if (probe != null) { if (probe != null) {
this.probe = probe; this.probe = probe;
console.log(probe);
this.arrangeInfo(); this.arrangeInfo();
} }
}, },
@ -56,18 +59,29 @@ export class DetailComponent implements OnInit, AfterContentInit {
} }
arrangeInfo() { arrangeInfo() {
const cidr = new CIDR(this.probe.cidr);
if (!cidr.isValid()) {
}
const startIP = cidr.addressStart.address;
const endIP = cidr.addressEnd.address;
this.networkInfo = [ this.networkInfo = [
{ {
key: 'IP', key: 'Probe IP Range',
value: '192.168.1.1' value: startIP + '~' + endIP,
},
{
key: 'Installed IP',
value: '???',
}, },
{ {
key: 'NIC', key: 'NIC',
value: 'enps30' value: '???'
}, },
{ {
key: 'Targets', key: 'Targets',
value: '12' value: 'count 반정규화 필요 '
}, },
]; ];
this.deviceInfo = [ this.deviceInfo = [
@ -91,7 +105,7 @@ export class DetailComponent implements OnInit, AfterContentInit {
this.probeInfo = [ this.probeInfo = [
{ {
key: 'Authorized at', key: 'Authorized at',
value: String(new Date()) value: String(new Date(this.probe.authorizeDate))
}, },
{ {
key: 'Authorized by', key: 'Authorized by',
@ -99,11 +113,27 @@ export class DetailComponent implements OnInit, AfterContentInit {
}, },
{ {
key: 'Installed at', key: 'Installed at',
value: String(new Date()) value: String(new Date(this.probe.createDate))
},
{
key: 'Probe Key',
value: this.probe.probeKey,
}, },
]; ];
} }
discovery() {
const dialogRef = this.dialog.open(DiscoverySettingComponent, {
width: '80%',
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
});
}
handleStartStop() { handleStartStop() {
// this.isUpState = !this.isUpState; // this.isUpState = !this.isUpState;
} }

View File

@ -10,6 +10,9 @@ import { ConfirmDialogComponent } from 'packages/commons/component/confirm-dialo
import { COMPONENTS } from './component'; import { COMPONENTS } from './component';
import { ProbeStoreModule } from './probe-store.module'; import { ProbeStoreModule } from './probe-store.module';
import { SERVICES } from './service'; import { SERVICES } from './service';
import { SettingComponent as DiscoverySettingComponent } from 'packages/discovery/component/setting/setting.component';
import { DiscoveryModule } from '../discovery/discovery.module';
@NgModule({ @NgModule({
imports: [ imports: [
@ -18,6 +21,7 @@ import { SERVICES } from './service';
InfoTableModule, InfoTableModule,
ConfirmDialogModule, ConfirmDialogModule,
ProbeStoreModule, ProbeStoreModule,
DiscoveryModule
], ],
declarations: [ declarations: [
COMPONENTS, COMPONENTS,
@ -30,6 +34,7 @@ import { SERVICES } from './service';
], ],
entryComponents: [ entryComponents: [
ConfirmDialogComponent, ConfirmDialogComponent,
DiscoverySettingComponent
] ]
}) })
export class ProbeModule { } export class ProbeModule { }