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">
<perfect-scrollbar>
<ul class="key-value">
<li *ngFor="let discoveredBy of host.discoveredBy">
<span class="meta-value">{{discoveredBy.key}}</span>
<li *ngFor="let item of securityMap | keyvalue">
{{item.key | stringPrettify}}
<span class="meta-value">{{item.value}}</span>
</li>
</ul>
</perfect-scrollbar>

View File

@ -11,6 +11,7 @@ import { PingService } from '../../../service/ping.service';
import { PingOption } from '@overflow/model/config/ping';
import * as log from '../../../core/util/log';
import { MetaDiscovererTypeEnum, toMetaDiscovererTypeEnum } from '@overflow/model/meta';
@Component({
selector: 'app-infra-detail-host',
@ -18,7 +19,7 @@ import * as log from '../../../core/util/log';
styleUrls: ['./host.component.scss'],
})
export class HostComponent implements OnChanges {
@Input() host: Host;
_host: Host;
@ViewChildren(AutoHeightDirective) autoHeightDirectives: QueryList<AutoHeightDirective>;
@ -32,6 +33,28 @@ export class HostComponent implements OnChanges {
pingResult: PingResult;
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(
private pingService: PingService,
@ -40,6 +63,8 @@ export class HostComponent implements OnChanges {
this.count = 5;
this.interval = 1;
this.deadline = 1;
this.securityMap = new Map();
}
ngOnChanges(simpleChanges: SimpleChanges): void {