.
This commit is contained in:
parent
5f0f49c1be
commit
9ada8bf45b
|
@ -68,7 +68,7 @@
|
||||||
|
|
||||||
<p-sidebar [(visible)]="displaySidebar" styleClass="ui-sidebar-md" position="right">
|
<p-sidebar [(visible)]="displaySidebar" styleClass="ui-sidebar-md" position="right">
|
||||||
<div *ngIf="selectedNode">
|
<div *ngIf="selectedNode">
|
||||||
<app-node-detail [node]="selectedNode"></app-node-detail>
|
<app-node-detail [node]="selectedNode" (otherHostSelect)="otherHostSelected($event)"></app-node-detail>
|
||||||
</div>
|
</div>
|
||||||
</p-sidebar>
|
</p-sidebar>
|
||||||
|
|
||||||
|
|
|
@ -610,4 +610,15 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
return _n;
|
return _n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
otherHostSelected(host: Host) {
|
||||||
|
const foundNode = this.nodes.find(node => {
|
||||||
|
return node.group === 'host' && node.id === host.address;
|
||||||
|
});
|
||||||
|
if (!foundNode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.selectedNode = foundNode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p-tabView class="detail-content">
|
<p-tabView class="detail-content">
|
||||||
<button type="button" pButton label="Ping" (click)="setDefault($event)" class="ui-button-secondary ui-pingbn-position"></button>
|
<button type="button" pButton label="Ping" (click)="ping()" class="ui-button-secondary ui-pingbn-position"></button>
|
||||||
<p-tabPanel header="General">
|
<p-tabPanel header="General">
|
||||||
|
|
||||||
<ul class="key-value">
|
<ul class="key-value">
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { Host, Port } from '@overflow/model/discovery';
|
import { Host, DiscoverHost } from '@overflow/model/discovery';
|
||||||
|
import { ProbeService, requesterID } from '../service/probe.service';
|
||||||
|
import { RPCSubscriber } from '@overflow/commons/ui/decorator/RPCSubscriber';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -12,8 +14,24 @@ export class HostDetailComponent {
|
||||||
@Input() host: Host;
|
@Input() host: Host;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private probeService: ProbeService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ping() {
|
||||||
|
console.log(this.host);
|
||||||
|
// const discoverHost: DiscoverHost = {
|
||||||
|
// discoveryConfig: {},
|
||||||
|
// metaIPType: this.host.metaIPType,
|
||||||
|
// firstScanRange: this.host.address,
|
||||||
|
// lastScanRange: this.host.address,
|
||||||
|
// discoverPort: null,
|
||||||
|
// };
|
||||||
|
// this.probeService.send('DiscoveryService.DiscoverHost', requesterID, this.host.zone, discoverHost);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @RPCSubscriber({ method: 'DiscoveryService.DiscoveredHost' })
|
||||||
|
// public DiscoveredHost(host: Host) {
|
||||||
|
// console.log(host);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,17 @@ import { ProbeService } from '../service/probe.service';
|
||||||
import { Interface } from '@overflow/model/net/nic';
|
import { Interface } from '@overflow/model/net/nic';
|
||||||
import { SelectItem } from 'primeng/primeng';
|
import { SelectItem } from 'primeng/primeng';
|
||||||
import { Zone } from '@overflow/model/discovery';
|
import { Zone } from '@overflow/model/discovery';
|
||||||
import { toMetaIPType, MetaIPTypeEnum } from '@overflow/model/meta';
|
import { toMetaIPType, MetaIPType, MetaIPTypeEnum } from '@overflow/model/meta';
|
||||||
import { DropdownPanelComponent } from '@overflow/commons/ui/component/primeng';
|
import { DropdownPanelComponent } from '@overflow/commons/ui/component/primeng';
|
||||||
|
|
||||||
|
class NICInfo {
|
||||||
|
iface: string;
|
||||||
|
friendlyName: string;
|
||||||
|
metaIPType: MetaIPType;
|
||||||
|
mac: string;
|
||||||
|
address: string;
|
||||||
|
network: string;
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-nic-dropdown',
|
selector: 'app-nic-dropdown',
|
||||||
|
@ -23,7 +30,7 @@ export class NicDropdownComponent implements OnInit {
|
||||||
@ViewChild('panel') panel: DropdownPanelComponent;
|
@ViewChild('panel') panel: DropdownPanelComponent;
|
||||||
|
|
||||||
nics: SelectItem[] = [];
|
nics: SelectItem[] = [];
|
||||||
selected;
|
selected: NICInfo;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private probeService: ProbeService,
|
private probeService: ProbeService,
|
||||||
|
@ -39,23 +46,25 @@ export class NicDropdownComponent implements OnInit {
|
||||||
if (address.metaIPType.key !== toMetaIPType(MetaIPTypeEnum.V4).key) {
|
if (address.metaIPType.key !== toMetaIPType(MetaIPTypeEnum.V4).key) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const nicInfo = {
|
||||||
|
iface: iface.iface,
|
||||||
|
friendlyName: iface.friendlyName,
|
||||||
|
metaIPType: address.metaIPType,
|
||||||
|
mac: iface.mac,
|
||||||
|
address: address.address,
|
||||||
|
network: address.network,
|
||||||
|
};
|
||||||
this.nics.push({
|
this.nics.push({
|
||||||
label: iface.friendlyName + ' (' + address.network + ')',
|
label: iface.friendlyName + ' (' + address.network + ')',
|
||||||
value: {
|
value: nicInfo,
|
||||||
iface: iface.iface,
|
|
||||||
friendlyName: iface.friendlyName,
|
|
||||||
metaIPType: address.metaIPType,
|
|
||||||
mac: iface.mac,
|
|
||||||
address: address.address,
|
|
||||||
network: address.network,
|
|
||||||
},
|
|
||||||
disabled: address.metaIPType.key !== toMetaIPType(MetaIPTypeEnum.V4).key ? true : false,
|
disabled: address.metaIPType.key !== toMetaIPType(MetaIPTypeEnum.V4).key ? true : false,
|
||||||
});
|
});
|
||||||
|
if (address.gateway !== undefined && address.gateway.length > 0) {
|
||||||
|
this.nicSelected(nicInfo);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
if (this.nics.length > 0) {
|
|
||||||
this.nicSelected(this.nics[0].value);
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
catchError(error => {
|
catchError(error => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -66,7 +75,7 @@ export class NicDropdownComponent implements OnInit {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nicSelected(nic: SelectItem) {
|
nicSelected(nic: NICInfo) {
|
||||||
this.selected = nic;
|
this.selected = nic;
|
||||||
|
|
||||||
const zone: Zone = {
|
const zone: Zone = {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<ng-container [ngSwitch]="node.group">
|
<ng-container [ngSwitch]="node.group">
|
||||||
|
|
||||||
<ng-container *ngSwitchCase="'zone'">
|
<ng-container *ngSwitchCase="'zone'">
|
||||||
<app-zone-detail [zone]="node.target"></app-zone-detail>
|
<app-zone-detail [zone]="node.target" (otherHostSelect)="otherHostSelected($event)"></app-zone-detail>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container *ngSwitchCase="'host'">
|
<ng-container *ngSwitchCase="'host'">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input, Output, Host, EventEmitter } from '@angular/core';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -9,10 +9,14 @@ import { Component, Input } from '@angular/core';
|
||||||
export class NodeDetailComponent {
|
export class NodeDetailComponent {
|
||||||
|
|
||||||
@Input() node;
|
@Input() node;
|
||||||
|
@Output() otherHostSelect = new EventEmitter<Host>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
) {
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
otherHostSelected(host: Host) {
|
||||||
|
this.otherHostSelect.emit(host);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
|
|
||||||
<p-tabView class="detail-content">
|
<p-tabView class="detail-content">
|
||||||
<button type="button" pButton label="Ping" (click)="setDefault($event)" class="ui-button-secondary ui-pingbn-position"></button>
|
<button type="button" pButton label="Ping" (click)="ping()" class="ui-button-secondary ui-pingbn-position"></button>
|
||||||
<p-tabPanel header="General">
|
<p-tabPanel header="General">
|
||||||
|
|
||||||
<ul class="key-value">
|
<ul class="key-value">
|
||||||
|
|
|
@ -16,4 +16,8 @@ export class ServiceDetailComponent {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ping() {
|
||||||
|
console.log(this.service);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,10 @@
|
||||||
<p-tabPanel header="Hosts">
|
<p-tabPanel header="Hosts">
|
||||||
<ul class="key-value">
|
<ul class="key-value">
|
||||||
<li *ngFor="let host of zone.hostList | ipSort: 'address'">
|
<li *ngFor="let host of zone.hostList | ipSort: 'address'">
|
||||||
<span class="meta-value">{{host.address}}</span> <span *ngIf="host.name" class="meta-value">
|
<a href="javascript:void(0)" (click)="hostSelected(host)" style="text-decoration:none">
|
||||||
({{host.name}})</span>
|
<span class="meta-value">{{host.address}}</span> <span *ngIf="host.name" class="meta-value">
|
||||||
|
({{host.name}})</span>
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</p-tabPanel>
|
</p-tabPanel>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
|
||||||
import { Zone, Host } from '@overflow/model/discovery';
|
import { Zone, Host } from '@overflow/model/discovery';
|
||||||
|
|
||||||
const IPCIDR = require('ip-cidr');
|
const IPCIDR = require('ip-cidr');
|
||||||
|
@ -11,6 +11,7 @@ const IPCIDR = require('ip-cidr');
|
||||||
export class ZoneDetailComponent implements OnInit {
|
export class ZoneDetailComponent implements OnInit {
|
||||||
|
|
||||||
@Input() zone: Zone;
|
@Input() zone: Zone;
|
||||||
|
@Output() otherHostSelect = new EventEmitter<Host>();
|
||||||
ipRange: string;
|
ipRange: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -24,6 +25,9 @@ export class ZoneDetailComponent implements OnInit {
|
||||||
|
|
||||||
const cidr = new IPCIDR(this.zone.network);
|
const cidr = new IPCIDR(this.zone.network);
|
||||||
this.ipRange = cidr.start() + ' - ' + cidr.end();
|
this.ipRange = cidr.start() + ' - ' + cidr.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
hostSelected(host: Host) {
|
||||||
|
this.otherHostSelect.emit(host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user