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 {
iface: string;
mac: string;
addresses: InterfaceAddress[] | null;
}
export interface InterfaceAddress {

View File

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