This commit is contained in:
crusader 2018-09-27 18:45:01 +09:00
commit ac59d35c26
4 changed files with 51 additions and 20 deletions

View File

@ -18,8 +18,8 @@
<h3>{{host.name}} <span>{{host.address}}</span></h3> <h3>{{host.name}} <span>{{host.address}}</span></h3>
</div> </div>
<p-tabView class="detail-content"> <p-tabView class="detail-content" (onChange)="onTabViewChange($event)">
<p-tabPanel header="General"> <p-tabPanel header=" General">
<ul class="key-value"> <ul class="key-value">
@ -70,11 +70,15 @@
</p-tabPanel> </p-tabPanel>
<p-tabPanel header="Ports" *ngIf="host.portList"> <p-tabPanel header="Ports" *ngIf="host.portList">
<ul class="key-value"> <div of-auto-height>
<li *ngFor="let port of host.portList | sort: 'portNumber'"> <perfect-scrollbar>
<span class="meta-value">{{port.portNumber}} ({{port.metaPortType.key}})</span> <ul class="key-value">
</li> <li *ngFor="let port of host.portList | sort: 'portNumber'">
</ul> <span class="meta-value">{{port.portNumber}} ({{port.metaPortType.key}})</span>
</li>
</ul>
</perfect-scrollbar>
</div>
</p-tabPanel> </p-tabPanel>
<p-tabPanel header="Health"> <p-tabPanel header="Health">

View File

@ -1,4 +1,4 @@
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; import { Component, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { map, catchError, take } from 'rxjs/operators'; import { map, catchError, take } from 'rxjs/operators';
@ -7,6 +7,7 @@ import { Host } from '@overflow/model/discovery';
import { PingResult } from '@overflow/model/ping'; import { PingResult } from '@overflow/model/ping';
import { ProbeService } from '../service/probe.service'; import { ProbeService } from '../service/probe.service';
import { AutoHeightDirective } from '@overflow/commons/ui/directive/auto-height.directive';
@Component({ @Component({
@ -16,6 +17,8 @@ import { ProbeService } from '../service/probe.service';
}) })
export class HostDetailComponent implements OnChanges { export class HostDetailComponent implements OnChanges {
@Input() host: Host; @Input() host: Host;
@ViewChild(AutoHeightDirective) autoHeightDirective;
pingWaiting: boolean; pingWaiting: boolean;
@ -26,6 +29,7 @@ export class HostDetailComponent implements OnChanges {
pingResult: PingResult; pingResult: PingResult;
pingResultRaw: string; pingResultRaw: string;
constructor( constructor(
private probeService: ProbeService, private probeService: ProbeService,
) { ) {
@ -70,4 +74,8 @@ export class HostDetailComponent implements OnChanges {
.subscribe(); .subscribe();
} }
onTabViewChange($event) {
this.autoHeightDirective.forceCalculate();
}
} }

View File

@ -21,7 +21,7 @@
</div> </div>
<p-tabView class="detail-content"> <p-tabView class="detail-content" (onChange)="onTabViewChange($event)">
<p-tabPanel header="General"> <p-tabPanel header="General">
<ul class="key-value"> <ul class="key-value">
@ -46,18 +46,22 @@
</p-tabPanel> </p-tabPanel>
<p-tabPanel header="Metadata" *ngIf="service.meta"> <p-tabPanel header="Metadata" *ngIf="service.meta">
<ul class="detail-content-meta-title"> <div of-auto-height>
<li *ngFor="let key of service.meta | objectKeys"> <perfect-scrollbar>
{{key | stringPrettify}} <ul class="detail-content-meta-title">
<li *ngFor="let key of service.meta | objectKeys">
{{key | stringPrettify}}
<ul class="key-value"> <ul class="key-value">
<li *ngFor="let skey of service.meta[key] | objectKeys"> <li *ngFor="let skey of service.meta[key] | objectKeys">
{{skey | stringPrettify}} {{skey | stringPrettify}}
<span class="meta-value">{{service.meta[key][skey]}}</span> <span class="meta-value">{{service.meta[key][skey]}}</span>
</li>
</ul>
</li> </li>
</ul> </ul>
</li> </perfect-scrollbar>
</ul> </div>
</p-tabPanel> </p-tabPanel>
<p-tabPanel header="Health" *ngIf="service.port.metaPortType.key === 'TCP'"> <p-tabPanel header="Health" *ngIf="service.port.metaPortType.key === 'TCP'">

View File

@ -1,18 +1,23 @@
import { Component, Input, Output, EventEmitter } from '@angular/core'; import { Component, Input, Output, EventEmitter, ViewChild, OnChanges, SimpleChanges } from '@angular/core';
import { Service } from '@overflow/model/discovery'; import { Service } from '@overflow/model/discovery';
import { PingResult } from '@overflow/model/ping'; import { PingResult } from '@overflow/model/ping';
import { ProbeService } from '../service/probe.service'; import { ProbeService } from '../service/probe.service';
import { map, catchError, take } from 'rxjs/operators'; import { map, catchError, take } from 'rxjs/operators';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { AutoHeightDirective } from '@overflow/commons/ui/directive/auto-height.directive';
@Component({ @Component({
selector: 'app-service-detail', selector: 'app-service-detail',
templateUrl: './service-detail.component.html', templateUrl: './service-detail.component.html',
styleUrls: ['./service-detail.component.scss'], styleUrls: ['./service-detail.component.scss'],
}) })
export class ServiceDetailComponent { export class ServiceDetailComponent implements OnChanges {
@Input() service: Service; @Input() service: Service;
@ViewChild(AutoHeightDirective) autoHeightDirective;
pingWaiting: boolean; pingWaiting: boolean;
pingResult: PingResult; pingResult: PingResult;
pingResultStr: string; pingResultStr: string;
@ -31,6 +36,15 @@ export class ServiceDetailComponent {
this.deadline = 1; this.deadline = 1;
} }
onTabViewChange($event) {
this.autoHeightDirective.forceCalculate();
}
ngOnChanges(simpleChanges: SimpleChanges): void {
this.pingResult = null;
}
doPing() { doPing() {
this.pingWaiting = true; this.pingWaiting = true;
@ -60,4 +74,5 @@ export class ServiceDetailComponent {
) )
.subscribe(); .subscribe();
} }
} }