ing
This commit is contained in:
parent
7e94b5eb30
commit
356ed2c912
13548
package-lock.json
generated
13548
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,12 @@
|
||||||
import { Component, Input, OnInit, EventEmitter, Output, ViewChild, OnDestroy } from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
Input,
|
||||||
|
OnInit,
|
||||||
|
EventEmitter,
|
||||||
|
Output,
|
||||||
|
ViewChild,
|
||||||
|
OnDestroy
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { catchError, map, take } from 'rxjs/operators';
|
import { catchError, map, take } from 'rxjs/operators';
|
||||||
|
@ -22,61 +30,65 @@ class NICInfo {
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-nic-dropdown',
|
selector: 'app-nic-dropdown',
|
||||||
templateUrl: './nic-dropdown.component.html',
|
templateUrl: './nic-dropdown.component.html',
|
||||||
styleUrls: ['./nic-dropdown.component.scss'],
|
styleUrls: ['./nic-dropdown.component.scss']
|
||||||
})
|
})
|
||||||
export class NicDropdownComponent implements OnInit {
|
export class NicDropdownComponent implements OnInit {
|
||||||
|
@Input()
|
||||||
@Input() blockTarget: any;
|
blockTarget: any;
|
||||||
@Output() select = new EventEmitter<Zone>();
|
@Output()
|
||||||
@ViewChild('panel') panel: DropdownPanelComponent;
|
select = new EventEmitter<Zone>();
|
||||||
|
@ViewChild('panel')
|
||||||
|
panel: DropdownPanelComponent;
|
||||||
|
|
||||||
nics: SelectItem[] = [];
|
nics: SelectItem[] = [];
|
||||||
selected: NICInfo;
|
selected: NICInfo;
|
||||||
|
|
||||||
constructor(
|
constructor(private probeService: ProbeService) {}
|
||||||
private probeService: ProbeService,
|
|
||||||
) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.probeService.call<Interface>('MachineService.Interfaces').pipe(
|
this.probeService
|
||||||
map((ifaces: Interface[]) => {
|
.call<Interface[]>('MachineService.Interfaces')
|
||||||
ifaces.forEach(iface => {
|
.pipe(
|
||||||
if (undefined === iface.addresses) {
|
map((ifaces: Interface[]) => {
|
||||||
return;
|
ifaces.forEach(iface => {
|
||||||
}
|
if (undefined === iface.addresses) {
|
||||||
iface.addresses.forEach(address => {
|
|
||||||
if (address.metaIPType.key !== toMetaIPType(MetaIPTypeEnum.V4).key) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const nicInfo = {
|
iface.addresses.forEach(address => {
|
||||||
iface: iface.iface,
|
if (
|
||||||
friendlyName: iface.friendlyName,
|
address.metaIPType.key !== toMetaIPType(MetaIPTypeEnum.V4).key
|
||||||
metaIPType: address.metaIPType,
|
) {
|
||||||
mac: iface.mac,
|
return;
|
||||||
address: address.address,
|
}
|
||||||
network: address.network,
|
const nicInfo = {
|
||||||
};
|
iface: iface.iface,
|
||||||
this.nics.push({
|
friendlyName: iface.friendlyName,
|
||||||
label: iface.friendlyName + ' (' + address.network + ')',
|
metaIPType: address.metaIPType,
|
||||||
value: nicInfo,
|
mac: iface.mac,
|
||||||
disabled: address.metaIPType.key !== toMetaIPType(MetaIPTypeEnum.V4).key ? true : false,
|
address: address.address,
|
||||||
|
network: address.network
|
||||||
|
};
|
||||||
|
this.nics.push({
|
||||||
|
label: iface.friendlyName + ' (' + address.network + ')',
|
||||||
|
value: nicInfo,
|
||||||
|
disabled:
|
||||||
|
address.metaIPType.key !== toMetaIPType(MetaIPTypeEnum.V4).key
|
||||||
|
? true
|
||||||
|
: false
|
||||||
|
});
|
||||||
|
if (address.gateway !== undefined && address.gateway.length > 0) {
|
||||||
|
this.nicSelected(nicInfo);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (address.gateway !== undefined && address.gateway.length > 0) {
|
|
||||||
this.nicSelected(nicInfo);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
}),
|
||||||
});
|
catchError(error => {
|
||||||
}),
|
console.log(error);
|
||||||
catchError(error => {
|
return of();
|
||||||
console.log(error);
|
}),
|
||||||
return of();
|
take(1)
|
||||||
}),
|
)
|
||||||
take(1),
|
.subscribe();
|
||||||
).subscribe();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nicSelected(nic: NICInfo) {
|
nicSelected(nic: NICInfo) {
|
||||||
|
@ -87,11 +99,10 @@ export class NicDropdownComponent implements OnInit {
|
||||||
iface: this.selected.iface,
|
iface: this.selected.iface,
|
||||||
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
|
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
|
||||||
address: this.selected.address,
|
address: this.selected.address,
|
||||||
mac: this.selected.mac,
|
mac: this.selected.mac
|
||||||
};
|
};
|
||||||
this.select.emit(zone);
|
this.select.emit(zone);
|
||||||
|
|
||||||
this.panel.hide();
|
this.panel.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user