test
This commit is contained in:
		
							parent
							
								
									02fbb31949
								
							
						
					
					
						commit
						ab2ef8f5bd
					
				@ -59,9 +59,9 @@ export class DiscoveryComponent implements OnDestroy {
 | 
				
			|||||||
    // TODO: fix
 | 
					    // TODO: fix
 | 
				
			||||||
    const zone: Zone = {
 | 
					    const zone: Zone = {
 | 
				
			||||||
      network: '192.168.1.0/24', // this.selectedProbe.probe.cidr
 | 
					      network: '192.168.1.0/24', // this.selectedProbe.probe.cidr
 | 
				
			||||||
      address: '192.168.1.103',
 | 
					      address: '192.168.1.101',
 | 
				
			||||||
      iface: 'enp3s0',
 | 
					      iface: 'enp3s0',
 | 
				
			||||||
      mac: '44:8a:5b:44:8c:e8',
 | 
					      mac: '44:8a:5b:f1:f1:f3',
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    this.discoveryService.discoverHost(this.selectedProbe.probe.probeKey, zone, dz.discoverHost);
 | 
					    this.discoveryService.discoverHost(this.selectedProbe.probe.probeKey, zone, dz.discoverHost);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
<div *ngIf="discoverZone" class="ui-key-value ui-left-info2">
 | 
					<!-- <div *ngIf="discoverZone" class="ui-key-value ui-left-info2">
 | 
				
			||||||
    <div class="ui-g">
 | 
					    <div class="ui-g">
 | 
				
			||||||
        <of-key-value [key]="'Host Range'" [value]="hostRange"></of-key-value>
 | 
					        <of-key-value [key]="'Host Range'" [value]="hostRange"></of-key-value>
 | 
				
			||||||
        <of-key-value [key]="'Port Range'" [value]="portRange"></of-key-value>
 | 
					        <of-key-value [key]="'Port Range'" [value]="portRange"></of-key-value>
 | 
				
			||||||
@ -21,4 +21,4 @@
 | 
				
			|||||||
            <a style="cursor: pointer" (click)="op.toggle($event)">{{services.length}} services has selected.</a>
 | 
					            <a style="cursor: pointer" (click)="op.toggle($event)">{{services.length}} services has selected.</a>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
</div>
 | 
					</div> -->
 | 
				
			||||||
@ -104,10 +104,10 @@ export class SearchConfigComponent implements OnChanges {
 | 
				
			|||||||
    if (this.serviceChecked) {
 | 
					    if (this.serviceChecked) {
 | 
				
			||||||
      const services = [];
 | 
					      const services = [];
 | 
				
			||||||
      for (const service of this.includeServices) {
 | 
					      for (const service of this.includeServices) {
 | 
				
			||||||
        services.push(service.description);
 | 
					        services.push(service.key);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      discoverService = {
 | 
					      discoverService = {
 | 
				
			||||||
        includeServices: services,
 | 
					        includeServices: null,
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (this.portChecked) {
 | 
					    if (this.portChecked) {
 | 
				
			||||||
 | 
				
			|||||||
@ -44,13 +44,13 @@
 | 
				
			|||||||
        </ng-template>
 | 
					        </ng-template>
 | 
				
			||||||
    </p-tree>
 | 
					    </p-tree>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <button class="ui-button-width-fit ui-float-right ui-top-space-10" [disabled]="selectedItems.length === 0" type="button" label="Save" icon="ui-icon-close"
 | 
					    <button class="ui-button-width-fit ui-float-right ui-top-space-10" [disabled]="selectedItems.length === 0" type="button"
 | 
				
			||||||
        pButton (click)="saveTargets()"></button>
 | 
					        label="Save" icon="ui-icon-close" pButton (click)="saveTargets()"></button>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</p-panel>
 | 
					</p-panel>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<p-dialog header="Title" [(visible)]="displayTargetDone" [modal]="true" [responsive]="true" [width]="600" [minWidth]="200" [minY]="70"
 | 
					<!-- <p-dialog header="Title" [(visible)]="displayTargetDone" [modal]="true" [responsive]="true" [width]="600" [minWidth]="200" [minY]="70"
 | 
				
			||||||
[closeOnEscape]="false">
 | 
					[closeOnEscape]="false">
 | 
				
			||||||
    <span>Target 지정이 완료되었습니다. 이어서 Sensor를 등록하시면 좋겠다능</span>
 | 
					    <span>Target 지정이 완료되었습니다. 이어서 Sensor를 등록하시면 좋겠다능</span>
 | 
				
			||||||
        <p-footer>
 | 
					        <p-footer>
 | 
				
			||||||
@ -58,4 +58,4 @@
 | 
				
			|||||||
            <button type="button" pButton label="Target으로"></button>
 | 
					            <button type="button" pButton label="Target으로"></button>
 | 
				
			||||||
            <button type="button" pButton label="InfraMap으로"></button>
 | 
					            <button type="button" pButton label="InfraMap으로"></button>
 | 
				
			||||||
        </p-footer>
 | 
					        </p-footer>
 | 
				
			||||||
</p-dialog>
 | 
					</p-dialog> -->
 | 
				
			||||||
@ -4,17 +4,24 @@ import {
 | 
				
			|||||||
  OnInit,
 | 
					  OnInit,
 | 
				
			||||||
  OnChanges,
 | 
					  OnChanges,
 | 
				
			||||||
} from '@angular/core';
 | 
					} from '@angular/core';
 | 
				
			||||||
import { Subscription, Observable } from 'rxjs';
 | 
					 | 
				
			||||||
import { Host, Port, Service } from '@overflow/commons-typescript/model/discovery';
 | 
					import { Host, Port, Service } from '@overflow/commons-typescript/model/discovery';
 | 
				
			||||||
import { TreeNode, Message, Tree } from 'primeng/primeng';
 | 
					import { TreeNode, Message, Tree } from 'primeng/primeng';
 | 
				
			||||||
import { ProbeHost } from '@overflow/commons-typescript/model/probe';
 | 
					import { ProbeHost } from '@overflow/commons-typescript/model/probe';
 | 
				
			||||||
import { Anim } from './animation';
 | 
					import { Anim } from './animation';
 | 
				
			||||||
import { TargetService } from '@overflow/target/service/target.service';
 | 
					import { TargetService } from '@overflow/target/service/target.service';
 | 
				
			||||||
 | 
					import { InfraService, InfraHost, MetaTargetHostTypeEnum, toMetaTargetHostType, Infra } from '@overflow/commons-typescript';
 | 
				
			||||||
 | 
					import { InfraService as InfraRegistService } from '../../infra/service/infra.service';
 | 
				
			||||||
 | 
					import { Observable, of, Subscription } from 'rxjs';
 | 
				
			||||||
 | 
					import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Component({
 | 
					@Component({
 | 
				
			||||||
  selector: 'of-discovery-result',
 | 
					  selector: 'of-discovery-result',
 | 
				
			||||||
  templateUrl: './search-result.component.html',
 | 
					  templateUrl: './search-result.component.html',
 | 
				
			||||||
  animations: Anim,
 | 
					  animations: Anim,
 | 
				
			||||||
 | 
					  providers: [
 | 
				
			||||||
 | 
					    TargetService,
 | 
				
			||||||
 | 
					    InfraRegistService
 | 
				
			||||||
 | 
					  ]
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
export class SearchResultComponent implements OnInit, OnChanges {
 | 
					export class SearchResultComponent implements OnInit, OnChanges {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -33,8 +40,14 @@ export class SearchResultComponent implements OnInit, OnChanges {
 | 
				
			|||||||
  targetSaveSucceed: boolean;
 | 
					  targetSaveSucceed: boolean;
 | 
				
			||||||
  displayTargetDone: boolean;
 | 
					  displayTargetDone: boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  discoveredHosts: Host[] = [];
 | 
				
			||||||
 | 
					  discoveredServices: Service[] = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  pending$: Observable<boolean>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
    private targetService: TargetService
 | 
					    private targetService: TargetService,
 | 
				
			||||||
 | 
					    private infraRegistService: InfraRegistService
 | 
				
			||||||
  ) {
 | 
					  ) {
 | 
				
			||||||
    this.targetSaveSucceed = false;
 | 
					    this.targetSaveSucceed = false;
 | 
				
			||||||
    this.displayTargetDone = false;
 | 
					    this.displayTargetDone = false;
 | 
				
			||||||
@ -58,9 +71,34 @@ export class SearchResultComponent implements OnInit, OnChanges {
 | 
				
			|||||||
        severity: 'success',
 | 
					        severity: 'success',
 | 
				
			||||||
        summary: 'Discovery가 완료되었습니다. 모니터링 대상(들)을 선택 후 저장하세요.',
 | 
					        summary: 'Discovery가 완료되었습니다. 모니터링 대상(들)을 선택 후 저장하세요.',
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					      this.saveDiscoveredInfras();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  saveDiscoveredInfras() {
 | 
				
			||||||
 | 
					    this.infraRegistService.registDiscoverd(
 | 
				
			||||||
 | 
					      this.probeHost.probe.id,
 | 
				
			||||||
 | 
					      this.discoveredHosts,
 | 
				
			||||||
 | 
					      this.discoveredServices)
 | 
				
			||||||
 | 
					      .pipe(
 | 
				
			||||||
 | 
					        tap(() => {
 | 
				
			||||||
 | 
					          this.pending$ = of(true);
 | 
				
			||||||
 | 
					        }),
 | 
				
			||||||
 | 
					        map((infras: Infra[]) => {
 | 
				
			||||||
 | 
					          console.log(infras);
 | 
				
			||||||
 | 
					        }),
 | 
				
			||||||
 | 
					        catchError(error => {
 | 
				
			||||||
 | 
					          this.error$ = of(error);
 | 
				
			||||||
 | 
					          return of();
 | 
				
			||||||
 | 
					        }),
 | 
				
			||||||
 | 
					        tap(() => {
 | 
				
			||||||
 | 
					          this.pending$ = of(false);
 | 
				
			||||||
 | 
					        }),
 | 
				
			||||||
 | 
					        take(1),
 | 
				
			||||||
 | 
					    ).subscribe();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  addHost(host: Host) {
 | 
					  addHost(host: Host) {
 | 
				
			||||||
    // this.targetService.findExistHostTarget(this.probeHost.probe.id, host.ipv4)
 | 
					    // this.targetService.findExistHostTarget(this.probeHost.probe.id, host.ipv4)
 | 
				
			||||||
@ -89,6 +127,8 @@ export class SearchResultComponent implements OnInit, OnChanges {
 | 
				
			|||||||
      expanded: true,
 | 
					      expanded: true,
 | 
				
			||||||
      children: []
 | 
					      children: []
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    this.discoveredHosts.push(host);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  addService(service: Service) {
 | 
					  addService(service: Service) {
 | 
				
			||||||
@ -104,6 +144,7 @@ export class SearchResultComponent implements OnInit, OnChanges {
 | 
				
			|||||||
        target: service
 | 
					        target: service
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					    this.discoveredServices.push(service);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  addPort(port: Port) {
 | 
					  addPort(port: Port) {
 | 
				
			||||||
    // this.hostNode.forEach(node => {
 | 
					    // this.hostNode.forEach(node => {
 | 
				
			||||||
@ -181,16 +222,15 @@ export class SearchResultComponent implements OnInit, OnChanges {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  saveTargets() {
 | 
					  saveTargets() {
 | 
				
			||||||
    const hosts: Host[] = [];
 | 
					    // const hosts: Host[] = [];
 | 
				
			||||||
    const services: Service[] = [];
 | 
					    // const services: Service[] = [];
 | 
				
			||||||
    this.selectedItems.forEach(value => {
 | 
					    // this.selectedItems.forEach(value => {
 | 
				
			||||||
      if (value.ipv4) {
 | 
					    //   if (!value.port) {
 | 
				
			||||||
        hosts.push(value);
 | 
					    //     hosts.push(value);
 | 
				
			||||||
      } else {
 | 
					    //   } else {
 | 
				
			||||||
        services.push(value);
 | 
					    //     services.push(value);
 | 
				
			||||||
      }
 | 
					    //   }
 | 
				
			||||||
    });
 | 
					    // });
 | 
				
			||||||
 | 
					 | 
				
			||||||
    // this.targetService.registDiscoveredTargets(this.probeHost.probe.id, hosts, services)
 | 
					    // this.targetService.registDiscoveredTargets(this.probeHost.probe.id, hosts, services)
 | 
				
			||||||
    //   .pipe(
 | 
					    //   .pipe(
 | 
				
			||||||
    //     tap(() => {
 | 
					    //     tap(() => {
 | 
				
			||||||
 | 
				
			|||||||
@ -4,9 +4,9 @@
 | 
				
			|||||||
    <p-panel #content [showHeader]="false" class="block-panel">
 | 
					    <p-panel #content [showHeader]="false" class="block-panel">
 | 
				
			||||||
        <div class="ui-g" dir="rtl">
 | 
					        <div class="ui-g" dir="rtl">
 | 
				
			||||||
            <button pButton type="button" class="ui-button-secondary ui-button-width-fit ui-s-button" label="Unselect All" style="margin-bottom: 3px;"
 | 
					            <button pButton type="button" class="ui-button-secondary ui-button-width-fit ui-s-button" label="Unselect All" style="margin-bottom: 3px;"
 | 
				
			||||||
            (click)="onUnselectAll()"></button>
 | 
					                (click)="onUnselectAll()"></button>
 | 
				
			||||||
            <button pButton type="button" class="ui-button-secondary ui-button-width-fit ui-s-button" label="Select All" style="margin-bottom: 3px;"
 | 
					            <button pButton type="button" class="ui-button-secondary ui-button-width-fit ui-s-button" label="Select All" style="margin-bottom: 3px;"
 | 
				
			||||||
            (click)="onSelectAll()"></button>
 | 
					                (click)="onSelectAll()"></button>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <p-table selectionMode="multiple" [scrollable]="true" scrollHeight="200px" [value]="metaCrawlers" [(selection)]="includeServices"
 | 
					        <p-table selectionMode="multiple" [scrollable]="true" scrollHeight="200px" [value]="metaCrawlers" [(selection)]="includeServices"
 | 
				
			||||||
@ -18,7 +18,7 @@
 | 
				
			|||||||
                    </td> -->
 | 
					                    </td> -->
 | 
				
			||||||
                    <td>
 | 
					                    <td>
 | 
				
			||||||
                        <p-tableCheckbox [value]="rowData"></p-tableCheckbox>
 | 
					                        <p-tableCheckbox [value]="rowData"></p-tableCheckbox>
 | 
				
			||||||
                        {{rowData.description}}
 | 
					                        {{rowData.key}}
 | 
				
			||||||
                    </td>
 | 
					                    </td>
 | 
				
			||||||
                </tr>
 | 
					                </tr>
 | 
				
			||||||
            </ng-template>
 | 
					            </ng-template>
 | 
				
			||||||
 | 
				
			|||||||
@ -47,7 +47,7 @@
 | 
				
			|||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <div class="ui-g-12 ui-md-6 ui-key-value">
 | 
					            <div class="ui-g-12 ui-md-6 ui-key-value">
 | 
				
			||||||
              <of-host-ips-overlay [infraHostIPs]="infraHost.infraHostIPs"></of-host-ips-overlay>
 | 
					              <!-- <of-host-ips-overlay [infraHostIPs]="infraHost.infraHostIPs"></of-host-ips-overlay> -->
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,3 @@
 | 
				
			|||||||
<div *ngIf="!probeHostID">
 | 
					<div *ngIf="!probeHostID">
 | 
				
			||||||
  <p-dropdown [options]="options" [(ngModel)]="selected" optionLabel="displayName" placeholder="Select a Probe"
 | 
					  <p-dropdown [options]="options" [(ngModel)]="selected" optionLabel="name" placeholder="Select a Probe" (onChange)="onSelect()"></p-dropdown>
 | 
				
			||||||
    (onChange)="onSelect()"></p-dropdown>
 | 
					 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
@ -1,16 +1,16 @@
 | 
				
			|||||||
<p-panel [showHeader]="false" class="ui-top-space-10">
 | 
					<p-panel [showHeader]="false" class="ui-top-space-10">
 | 
				
			||||||
  <div *ngIf="probeHost" class="ui-g">
 | 
					  <div *ngIf="probeHost" class="ui-g">
 | 
				
			||||||
      <div class="ui-g-12 ui-md-4 ui-key-value">
 | 
					    <div class="ui-g-12 ui-md-4 ui-key-value">
 | 
				
			||||||
        <of-key-value [key]="'Status'" [value]="connectionStatus"></of-key-value>
 | 
					      <!-- <of-key-value [key]="'Status'" [value]="connectionStatus"></of-key-value> -->
 | 
				
			||||||
        <of-key-value [key]="'CIDR'" [value]="probeHost.probe.cidr"></of-key-value>
 | 
					      <of-key-value [key]="'CIDR'" [value]="probeHost.probe.cidr"></of-key-value>
 | 
				
			||||||
      </div>
 | 
					    </div>
 | 
				
			||||||
      <div class="ui-g-12 ui-md-4 ui-key-value">
 | 
					    <div class="ui-g-12 ui-md-4 ui-key-value">
 | 
				
			||||||
        <of-key-value [key]="'Name'" [value]="probeHost.probe.displayName"></of-key-value>
 | 
					      <of-key-value [key]="'Name'" [value]="probeHost.probe.name"></of-key-value>
 | 
				
			||||||
        <of-key-value [key]="'OS'" [value]="probeHost.infraHost.infraOS.metaInfraVendor.name"></of-key-value>
 | 
					      <!-- <of-key-value [key]="'OS'" [value]="probeHost.infraHost.infraOS.metaInfraVendor.name"></of-key-value> -->
 | 
				
			||||||
      </div>
 | 
					    </div>
 | 
				
			||||||
      <div class="ui-g-12 ui-md-4 ui-key-value">
 | 
					    <div class="ui-g-12 ui-md-4 ui-key-value">
 | 
				
			||||||
          <of-key-value [key]="'IPv4'" [value]="probeHost.infraHost.ipv4"></of-key-value>
 | 
					      <!-- <of-key-value [key]="'IPv4'" [value]="probeHost.infraHost.ipv4"></of-key-value> -->
 | 
				
			||||||
          <of-key-value [key]="'Mac Address'" [value]="probeHost.infraHost.mac"></of-key-value>
 | 
					      <!-- <of-key-value [key]="'Mac Address'" [value]="probeHost.infraHost.mac"></of-key-value> -->
 | 
				
			||||||
      </div>
 | 
					    </div>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</p-panel>
 | 
					</p-panel>
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user