This commit is contained in:
crusader 2018-10-23 15:43:44 +09:00
parent a31da5a1fb
commit d0dc3d516a
2 changed files with 29 additions and 3 deletions

View File

@ -91,8 +91,9 @@
<div of-auto-height key="3"> <div of-auto-height key="3">
<perfect-scrollbar> <perfect-scrollbar>
<ul class="key-value"> <ul class="key-value">
<li *ngFor="let discoveredBy of host.discoveredBy"> <li *ngFor="let item of securityMap | keyvalue">
<span class="meta-value">{{discoveredBy.key}}</span> {{item.key | stringPrettify}}
<span class="meta-value">{{item.value}}</span>
</li> </li>
</ul> </ul>
</perfect-scrollbar> </perfect-scrollbar>

View File

@ -11,6 +11,7 @@ import { PingService } from '../../../service/ping.service';
import { PingOption } from '@overflow/model/config/ping'; import { PingOption } from '@overflow/model/config/ping';
import * as log from '../../../core/util/log'; import * as log from '../../../core/util/log';
import { MetaDiscovererTypeEnum, toMetaDiscovererTypeEnum } from '@overflow/model/meta';
@Component({ @Component({
selector: 'app-infra-detail-host', selector: 'app-infra-detail-host',
@ -18,7 +19,7 @@ import * as log from '../../../core/util/log';
styleUrls: ['./host.component.scss'], styleUrls: ['./host.component.scss'],
}) })
export class HostComponent implements OnChanges { export class HostComponent implements OnChanges {
@Input() host: Host; _host: Host;
@ViewChildren(AutoHeightDirective) autoHeightDirectives: QueryList<AutoHeightDirective>; @ViewChildren(AutoHeightDirective) autoHeightDirectives: QueryList<AutoHeightDirective>;
@ -32,6 +33,28 @@ export class HostComponent implements OnChanges {
pingResult: PingResult; pingResult: PingResult;
pingResultRaw: string; pingResultRaw: string;
securityMap: Map<string, string>;
@Input()
set host(host: Host) {
this._host = host;
if (undefined !== this._host.discoveredBy) {
this._host.discoveredBy.forEach((discovererType) => {
const discovererTypeEnum = toMetaDiscovererTypeEnum(discovererType);
switch (discovererTypeEnum) {
case MetaDiscovererTypeEnum.ICMP:
this.securityMap.set(MetaDiscovererTypeEnum.ICMP, 'ICMP(Ping) is not safe.');
break;
default:
break;
}
});
}
}
get host(): Host {
return this._host;
}
constructor( constructor(
private pingService: PingService, private pingService: PingService,
@ -40,6 +63,8 @@ export class HostComponent implements OnChanges {
this.count = 5; this.count = 5;
this.interval = 1; this.interval = 1;
this.deadline = 1; this.deadline = 1;
this.securityMap = new Map();
} }
ngOnChanges(simpleChanges: SimpleChanges): void { ngOnChanges(simpleChanges: SimpleChanges): void {