noauth
This commit is contained in:
parent
cd0745c362
commit
bb38d922e4
|
@ -8,6 +8,8 @@
|
|||
<p-table *ngIf="infraHostIPs" [value]="infraHostIPs" selectionMode="single" (onRowSelect)="select.emit($event.data)" [resizableColumns]="true">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th style="width: 3.25em">
|
||||
</th>
|
||||
<th>Interface</th>
|
||||
<th style="width:3em">Ver.</th>
|
||||
<th>Address</th>
|
||||
|
@ -15,8 +17,11 @@
|
|||
<th>Gateway</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-rowData>
|
||||
<ng-template pTemplate="body" let-rowData let-rowIndex="rowIndex">
|
||||
<tr [pSelectableRow]="rowData">
|
||||
<td>
|
||||
<p-tableRadioButton [value]="rowData" [disabled]="rowData.metaIPType.key !== 'V4'"></p-tableRadioButton>
|
||||
</td>
|
||||
<td>{{rowData.iface}}</td>
|
||||
<td>{{rowData.metaIPType.key}}</td>
|
||||
<td>{{rowData.address}}</td>
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
|
||||
|
||||
<div class="ui-g" dir="rtl">
|
||||
<button class="ui-button-width-fit" [disabled]="!selectedNIC" type="button" label="Accept" icon="ui-icon-check" pButton (click)="accept()"></button>
|
||||
<button class="ui-button-danger ui-button-width-fit" [disabled]="!selectedNIC" type="button" label="Deny" icon="ui-icon-close"
|
||||
pButton (click)="deny()"></button>
|
||||
<button class="ui-button-width-fit" [disabled]="!selectedNIC || selectedNIC.metaIPType.key !== 'V4'" type="button" label="Accept"
|
||||
icon="ui-icon-check" pButton (click)="accept()"></button>
|
||||
<button class="ui-button-danger ui-button-width-fit" [disabled]="!selectedNIC || selectedNIC.metaIPType.key !== 'V4'" type="button"
|
||||
label="Deny" icon="ui-icon-close" pButton (click)="deny()"></button>
|
||||
</div>
|
||||
</p-panel>
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
|
||||
import { Probe, ProbeHost } from '@overflow/commons-typescript/model/probe';
|
||||
import { Store, select } from '@ngrx/store';
|
||||
import { Observable, of, Subscription } from 'rxjs';
|
||||
import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { catchError, map, tap, take } from 'rxjs/operators';
|
||||
import { NoAuthProbeService } from '../service/noauth-probe.service';
|
||||
import { NoAuthProbe, InfraHostIP } from '@overflow/commons-typescript';
|
||||
import { ConfirmationService } from 'primeng/primeng';
|
||||
|
@ -50,13 +48,15 @@ export class NoAuthProbeDetailComponent implements OnInit {
|
|||
|
||||
onNICSelect(infraHostIP: InfraHostIP) {
|
||||
this.selectedNIC = infraHostIP;
|
||||
console.log(this.selectedNIC);
|
||||
}
|
||||
|
||||
accept() {
|
||||
let message = 'Start collecting data as a Probe.\n';
|
||||
message += this.selectedNIC.address;
|
||||
|
||||
this.confirmationService.confirm({
|
||||
header: 'Are you sure to accept this Probe?',
|
||||
message: 'Start collecting data as a Probe.',
|
||||
message: message,
|
||||
icon: 'fa-check',
|
||||
accept: () => {
|
||||
this.noAuthProbeService.acceptNoAuthProbe(this.id, this.selectedNIC.address)
|
||||
|
@ -84,6 +84,32 @@ export class NoAuthProbeDetailComponent implements OnInit {
|
|||
}
|
||||
|
||||
deny() {
|
||||
alert('609호에 있는 강아지 deny');
|
||||
this.confirmationService.confirm({
|
||||
header: 'Are you sure to deny this Probe',
|
||||
message: 'It will be permanently deleted.',
|
||||
icon: 'fa fa-trash',
|
||||
accept: () => {
|
||||
this.noAuthProbeService.denyNoauthProbe(this.id)
|
||||
.pipe(
|
||||
tap(() => {
|
||||
this.pending$ = of(true);
|
||||
}),
|
||||
map((noauthProbes: NoAuthProbe[]) => {
|
||||
this.back.emit();
|
||||
}),
|
||||
catchError(error => {
|
||||
this.error$ = of(error);
|
||||
return of();
|
||||
}),
|
||||
tap(() => {
|
||||
this.pending$ = of(false);
|
||||
}),
|
||||
take(1),
|
||||
).subscribe();
|
||||
},
|
||||
reject: () => {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<of-key-value [key]="'Connection'" [value]="'Not connected.'"></of-key-value>
|
||||
</ng-container>
|
||||
<ng-container *ngSwitchDefault>
|
||||
<of-key-value [key]="'Connection'" [value]="noAuthProbe.connectDate | date: 'dd/MM/yyyy' (noAuthProbe.connectAddress)"></of-key-value>
|
||||
<of-key-value [key]="'Connection'" [value]="noAuthProbe.connectAddress"></of-key-value>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
<p-table [value]="noauthProbes" selectionMode="single" dataKey="id" (onRowSelect)="select.emit($event.data)">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Probe Key</th>
|
||||
<th style="width: 20em">Probe Key</th>
|
||||
<th>Host Name</th>
|
||||
<th>OS</th>
|
||||
<th>Created at</th>
|
||||
<th style="width: 7em">Created at</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-rowData>
|
||||
<tr [pSelectableRow]="rowData">
|
||||
<td>{{rowData.tempProbeKey}}</td>
|
||||
<td>{{rowData.infraHost.infraHostOS.name}}</td>
|
||||
<td>{{rowData.infraHost.infraHostOS.os}}</td>
|
||||
<td>{{getOS(rowData)}}</td>
|
||||
<td>{{rowData.createDate | date: 'dd/MM/yyyy'}}</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
|
|
|
@ -88,10 +88,23 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy {
|
|||
noauthProbe.infraHost = JSON.parse(noauthProbe.infraHostMeta);
|
||||
});
|
||||
this.noauthProbes = noauthProbes;
|
||||
console.log(this.noauthProbes);
|
||||
}
|
||||
|
||||
private setError$(error: any): void {
|
||||
this.error$ = of(error);
|
||||
}
|
||||
|
||||
getOS(noauthProbe: NoAuthProbe): string {
|
||||
if (null == noauthProbe.infraHost.infraHostOS) {
|
||||
return null;
|
||||
}
|
||||
let os = noauthProbe.infraHost.infraHostOS.os;
|
||||
os += noauthProbe.infraHost.infraHostOS.platform ?
|
||||
noauthProbe.infraHost.infraHostOS.platform : '';
|
||||
os += noauthProbe.infraHost.infraHostOS.platformFamily ?
|
||||
noauthProbe.infraHost.infraHostOS.platformFamily : '';
|
||||
return os;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
<!-- <h1>Unauthorized</h1>
|
||||
|
||||
<of-error-message [error]="error$ | async" [closable]="false"></of-error-message>
|
||||
<of-block-progressbar [target]="content" [pending]="pending$ | async"></of-block-progressbar>
|
||||
|
||||
<p-panel #content [showHeader]="false" class="block-panel">
|
||||
<p-table #dt [value]="noauthProbes" selectionMode="single" dataKey="id">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th style="width: 3.25em" pResizableColumn></th>
|
||||
<th style="width: 20em">Probe Key</th>
|
||||
<th>Host Name</th>
|
||||
<th>OS</th>
|
||||
<th style="width: 7em">Created at</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-rowData let-expanded="expanded" let-columns="columns">
|
||||
<tr [pSelectableRow]="rowData" [pRowToggler]="rowData">
|
||||
<td>
|
||||
<a href="#">
|
||||
<i [ngClass]="expanded ? 'fa fa-fw fa-chevron-circle-down' : 'fa fa-fw fa-chevron-circle-right'"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td>{{rowData.tempProbeKey}}</td>
|
||||
<td>{{rowData.infraHost.infraHostOS.name}}</td>
|
||||
<td>{{rowData.infraHost.infraHostOS.os}}</td>
|
||||
<td>{{rowData.createDate | date: 'dd/MM/yyyy'}}</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="rowexpansion" let-rowData let-columns="columns">
|
||||
<tr>
|
||||
<td [attr.colspan]="5">
|
||||
<div class="ui-g ui-g-12">
|
||||
|
||||
<div class="ui-g-12 ui-md-6">
|
||||
<div class="ui-g-12">
|
||||
<b>Platform:</b> {{rowData.infraHost.infraHostOS.platform}}
|
||||
</div>
|
||||
|
||||
<div class="ui-g-12">
|
||||
<b>Platform family:</b> {{rowData.infraHost.infraHostOS.platformFamily}}
|
||||
</div>
|
||||
<div class="ui-g-12">
|
||||
<b>Kernel:</b> {{rowData.infraHost.infraHostOS.kernelVersion}}
|
||||
</div>
|
||||
<div class="ui-g-12">
|
||||
<b>HostID:</b> {{rowData.infraHost.infraHostOS.hostID}}
|
||||
</div>
|
||||
<div class="ui-g-12">
|
||||
<b>Connected:</b>
|
||||
<ng-container [ngSwitch]="rowData.connectDate">
|
||||
<ng-container *ngSwitchCase="undefined"> Not Connected</ng-container>
|
||||
<ng-container *ngSwitchDefault> {{rowData.connectDate | date: 'dd/MM/yyyy'}} ({{rowData.connectAddress}})</ng-container>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui-g-12 ui-md-6">
|
||||
<div class="ui-g">
|
||||
<div class="ui-g-12">
|
||||
<b>NIC:</b> {{rowData.infraHost.infraHostIPs[0].iface}}
|
||||
</div>
|
||||
<div class="ui-g-12">
|
||||
<b>Network Address:</b> {{rowData.infraHost.infraHostIPs[0].address}}
|
||||
</div>
|
||||
<div class="ui-g-12">
|
||||
<b>Gateway:</b> {{rowData.infraHost.infraHostIPs[0].gateway}}
|
||||
</div>
|
||||
<div class="ui-g-12">
|
||||
<b>Mac Address:</b> {{rowData.infraHost.infraHostIPs[0].mac}}
|
||||
</div>
|
||||
<div class="ui-g-12">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-g-12" dir="rtl">
|
||||
<button class="ui-button-danger ui-button-width-fit" type="button" label="Deny" icon="ui-icon-close" pButton (click)="onAcceptOrDeny(false, rowData.infraHost.infraHostIPs)"></button>
|
||||
<button class=" ui-button-width-fit" type="button" label="Accept" icon="fa-check" pButton (click)="onAccept(rowData.infraHost)"></button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
|
||||
<p-dialog *ngIf="selectedInfraHost" [(visible)]="visibleNICs" [contentStyle]="{'max-height':'400px'}">
|
||||
<ul>
|
||||
<li *ngFor="let infraHostIP of selectedInfraHost.infraHostIPs">
|
||||
<a style="cursor: pointer" (click)="onNICSelected(infraHostIP)">
|
||||
{{infraHostIP.iface}} {{infraHostIP.address}} {{infraHostIP.gateway}} {{infraHostIP.mac}}
|
||||
</a>
|
||||
<li>
|
||||
</ul>
|
||||
</p-dialog>
|
||||
|
||||
<p-confirmDialog header="Confirmation" icon="fa ui-icon-warning" width="425"></p-confirmDialog>
|
||||
</p-panel> -->
|
|
@ -1,164 +0,0 @@
|
|||
// import { Component, Input, Output, EventEmitter, AfterContentInit, OnInit, OnDestroy } from '@angular/core';
|
||||
// import { Store, select } from '@ngrx/store';
|
||||
// import { Observable, of, Subscription } from 'rxjs';
|
||||
// import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators';
|
||||
// import { ConfirmationService, Message } from 'primeng/primeng';
|
||||
|
||||
// import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
|
||||
// import { AuthSelector } from '@overflow/shared/auth/store';
|
||||
// import { DomainMember } from '@overflow/commons-typescript/model/domain';
|
||||
|
||||
// import { NoAuthProbeService } from '../service/noauth-probe.service';
|
||||
// import { NoAuthProbeSubscriber, NoAuthProbeNotify } from '../subscriber/noauth-probe.subscriber';
|
||||
// import { InfraHostIP, InfraHost } from '@overflow/commons-typescript';
|
||||
|
||||
// @Component({
|
||||
// selector: 'of-noauth-probe-list',
|
||||
// templateUrl: './noauth-probe-list.component.html',
|
||||
// providers: [ConfirmationService]
|
||||
// })
|
||||
// export class NoAuthProbeListComponent implements OnInit, OnDestroy {
|
||||
// pending$: Observable<boolean>;
|
||||
// error$: Observable<any>;
|
||||
|
||||
// noauthProbes: NoAuthProbe[];
|
||||
// noauthProbeSubscription: Subscription;
|
||||
|
||||
// selectedInfraHost: InfraHost;
|
||||
// visibleNICs: boolean;
|
||||
|
||||
// constructor(
|
||||
// private confirmationService: ConfirmationService,
|
||||
// private store: Store<any>,
|
||||
// private noAuthProbeService: NoAuthProbeService,
|
||||
// private noAuthProbeSubscriber: NoAuthProbeSubscriber,
|
||||
// ) {
|
||||
// this.noauthProbes = [];
|
||||
// this.noauthProbeSubscription = null;
|
||||
// }
|
||||
|
||||
// ngOnInit() {
|
||||
// this.store.pipe(
|
||||
// tap(() => {
|
||||
// this.pending$ = of(true);
|
||||
// }),
|
||||
// select(AuthSelector.selectDomainMember),
|
||||
// exhaustMap((domainMember: DomainMember) =>
|
||||
// this.noAuthProbeService.readAllByDomainID(domainMember.domain.id)
|
||||
// .pipe(
|
||||
// map((noauthProbes: NoAuthProbe[]) => {
|
||||
// this.setNoauthProbes(noauthProbes);
|
||||
// }),
|
||||
// catchError(error => {
|
||||
// this.setError$(error);
|
||||
// return of();
|
||||
// })
|
||||
// )
|
||||
// ),
|
||||
// tap(() => {
|
||||
// this.pending$ = of(false);
|
||||
// }),
|
||||
// take(1),
|
||||
// ).subscribe();
|
||||
|
||||
// this.noauthProbeSubscription = this.noAuthProbeSubscriber.observable().pipe(
|
||||
// tap((noAuthProbeNotify: NoAuthProbeNotify) => {
|
||||
// const noauthProbes = [];
|
||||
// this.noauthProbes.forEach(noauthProbe => {
|
||||
// const n = noAuthProbeNotify.params;
|
||||
// if (noauthProbe.id === n.id) {
|
||||
// noauthProbes.push(n);
|
||||
// } else {
|
||||
// noauthProbes.push(noauthProbe);
|
||||
// }
|
||||
// });
|
||||
|
||||
// this.setNoauthProbes(noauthProbes);
|
||||
// }
|
||||
// ),
|
||||
// ).subscribe();
|
||||
// }
|
||||
|
||||
// ngOnDestroy(): void {
|
||||
// if (null !== this.noauthProbeSubscription) {
|
||||
// this.noauthProbeSubscription.unsubscribe();
|
||||
// }
|
||||
// }
|
||||
|
||||
// onAccept(infraHost: InfraHost) {
|
||||
// this.selectedInfraHost = infraHost;
|
||||
// this.visibleNICs = true;
|
||||
// }
|
||||
|
||||
// onAcceptOrDeny(isAccept: boolean, selected: NoAuthProbe) {
|
||||
// const title = isAccept ?
|
||||
// 'Are you sure to accept this Probe?' : 'Are you sure to deny this Probe';
|
||||
// const message = isAccept ?
|
||||
// 'Start collecting data as a Probe.' : 'It will be permanently deleted.';
|
||||
|
||||
// this.confirmationService.confirm({
|
||||
// header: title,
|
||||
// message: message,
|
||||
// icon: isAccept ? 'fa-check' : 'fa fa-trash',
|
||||
// accept: () => {
|
||||
// if (isAccept) {
|
||||
// this.noAuthProbeService.acceptNoAuthProbe(selected.id)
|
||||
// .pipe(
|
||||
// tap(() => {
|
||||
// this.pending$ = of(true);
|
||||
// }),
|
||||
// map((noauthProbes: NoAuthProbe[]) => {
|
||||
// this.setNoauthProbes(noauthProbes);
|
||||
// }),
|
||||
// catchError(error => {
|
||||
// this.setError$(error);
|
||||
// return of();
|
||||
// }),
|
||||
// tap(() => {
|
||||
// this.pending$ = of(false);
|
||||
// }),
|
||||
// take(1),
|
||||
// ).subscribe();
|
||||
// } else {
|
||||
// this.noAuthProbeService.denyNoauthProbe(selected.id)
|
||||
// .pipe(
|
||||
// tap(() => {
|
||||
// this.pending$ = of(true);
|
||||
// }),
|
||||
// map((noauthProbes: NoAuthProbe[]) => {
|
||||
// this.setNoauthProbes(noauthProbes);
|
||||
// }),
|
||||
// catchError(error => {
|
||||
// this.setError$(error);
|
||||
// return of();
|
||||
// }),
|
||||
// tap(() => {
|
||||
// this.pending$ = of(false);
|
||||
// }),
|
||||
// take(1),
|
||||
// ).subscribe();
|
||||
// }
|
||||
// },
|
||||
// reject: () => {
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// private setNoauthProbes(noauthProbes: NoAuthProbe[]): void {
|
||||
// if (null === noauthProbes) {
|
||||
// return;
|
||||
// }
|
||||
// noauthProbes.forEach(noauthProbe => {
|
||||
// noauthProbe.infraHost = JSON.parse(noauthProbe.infraHostMeta);
|
||||
// });
|
||||
// this.noauthProbes = noauthProbes;
|
||||
// }
|
||||
|
||||
// private setError$(error: any): void {
|
||||
// this.error$ = of(error);
|
||||
// }
|
||||
|
||||
// onNICSelected(infraHostIP: InfraHostIP) {
|
||||
// console.log(infraHostIP);
|
||||
// }
|
||||
// }
|
|
@ -7,7 +7,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
|||
export class KeyValueComponent implements OnInit {
|
||||
|
||||
@Input() key: string;
|
||||
@Input() value: string;
|
||||
@Input() value: any;
|
||||
@Input() clickable = false;
|
||||
@Output() click = new EventEmitter<string>();
|
||||
|
||||
|
|
|
@ -1900,3 +1900,6 @@ body .ui-progressbar .ui-progressbar-value {
|
|||
background-color: #f3f3f3 !important;
|
||||
}
|
||||
}
|
||||
.ui-confirmdialog-message {
|
||||
white-space: pre-line;
|
||||
}
|
Loading…
Reference in New Issue
Block a user