This commit is contained in:
crusader 2018-08-27 10:41:27 +09:00
parent aaf3e23966
commit 20aeeb1a9b
3 changed files with 20 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import { MetaIPType } from '../meta';
export interface Interface { export interface Interface {
iface: string; iface: string;
mac: string; mac: string;
addresses: InterfaceAddress[] | null;
} }
export interface InterfaceAddress { export interface InterfaceAddress {

View File

@ -15,7 +15,7 @@
</button> </button>
</p-header> </p-header>
<div id="nic-list-border"> <div id="nic-list-border">
<p-listbox [options]="cities" [(ngModel)]="selectedCity" optionLabel="name"></p-listbox> <p-listbox [options]="addresses" [(ngModel)]="selectedAddress" optionLabel="label"></p-listbox>
</div> </div>
<!-- <div>Body Content</div> <!-- <div>Body Content</div>

View File

@ -7,6 +7,12 @@ import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators';
import { ProbeService } from '../service/probe.service'; import { ProbeService } from '../service/probe.service';
import { Interface } from '@overflow/model/net/nic'; import { Interface } from '@overflow/model/net/nic';
export interface Address {
label: string;
value: string;
}
@Component({ @Component({
selector: 'app-nic-dropdown', selector: 'app-nic-dropdown',
templateUrl: './nic-dropdown.component.html', templateUrl: './nic-dropdown.component.html',
@ -15,6 +21,9 @@ import { Interface } from '@overflow/model/net/nic';
export class NicDropdownComponent implements OnInit { export class NicDropdownComponent implements OnInit {
@Input() blockTarget: any; @Input() blockTarget: any;
addresses: Address[];
selectedAddress: Address;
constructor( constructor(
private probeService: ProbeService, private probeService: ProbeService,
) { ) {
@ -25,6 +34,15 @@ export class NicDropdownComponent implements OnInit {
this.probeService.call<Interface>('MachineService.Interfaces').pipe( this.probeService.call<Interface>('MachineService.Interfaces').pipe(
map((ifaces: Interface[]) => { map((ifaces: Interface[]) => {
console.log(ifaces); console.log(ifaces);
this.addresses = [];
ifaces.forEach(iface => {
iface.addresses.forEach(address => {
this.addresses.push({
label: address.address,
value: address.address,
});
});
});
}), }),
catchError(error => { catchError(error => {
console.log(error); console.log(error);