diff --git a/@overflow/noauth-probe/component/index.ts b/@overflow/noauth-probe/component/index.ts index 8dc365d..4bf7e89 100644 --- a/@overflow/noauth-probe/component/index.ts +++ b/@overflow/noauth-probe/component/index.ts @@ -1,5 +1,7 @@ import { NoAuthProbeListComponent } from './noauth-probe-list.component'; +import { NoAuthProbeDetailComponent } from './noauth-probe-detail.component'; export const COMPONENTS = [ NoAuthProbeListComponent, + NoAuthProbeDetailComponent ]; diff --git a/@overflow/noauth-probe/component/noauth-probe-detail.component.html b/@overflow/noauth-probe/component/noauth-probe-detail.component.html new file mode 100644 index 0000000..ab4b2fa --- /dev/null +++ b/@overflow/noauth-probe/component/noauth-probe-detail.component.html @@ -0,0 +1,11 @@ +noauthprobe_detail + \ No newline at end of file diff --git a/@overflow/noauth-probe/component/noauth-probe-detail.component.ts b/@overflow/noauth-probe/component/noauth-probe-detail.component.ts new file mode 100644 index 0000000..000bcfb --- /dev/null +++ b/@overflow/noauth-probe/component/noauth-probe-detail.component.ts @@ -0,0 +1,45 @@ +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 { NoAuthProbeService } from '../service/noauth-probe.service'; + +@Component({ + selector: 'of-noauth-probe-detail', + templateUrl: './noauth-probe-detail.component.html', +}) +export class NoAuthProbeDetailComponent implements OnInit { + + // @Input() probeHostID; + pending$: Observable; + error$: Observable; + + @Output() discovery = new EventEmitter(); + + constructor( + private noAuthProbeService: NoAuthProbeService, + ) { + } + + ngOnInit() { + // this.noAuthProbeService.read(1) + // .pipe( + // tap(() => { + // this.pending$ = of(true); + // }), + // map((probeHost: ProbeHost) => { + // this.probeHost = probeHost; + // }), + // catchError(error => { + // this.error$ = of(error); + // return of(); + // }), + // tap(() => { + // this.pending$ = of(false); + // }), + // take(1), + // ).subscribe(); + } + +} diff --git a/@overflow/noauth-probe/component/noauth-probe-list.component.html b/@overflow/noauth-probe/component/noauth-probe-list.component.html index 26c791d..9893d83 100644 --- a/@overflow/noauth-probe/component/noauth-probe-list.component.html +++ b/@overflow/noauth-probe/component/noauth-probe-list.component.html @@ -4,94 +4,22 @@ - + - - Probe Key + Probe Key Host Name OS - Created at + Created at - - - - - - - + + {{rowData.tempProbeKey}} {{rowData.infraHost.infraHostOS.name}} {{rowData.infraHost.infraHostOS.os}} {{rowData.createDate | date: 'dd/MM/yyyy'}} - - - -
- -
-
- Platform: {{rowData.infraHost.infraHostOS.platform}} -
- -
- Platform family: {{rowData.infraHost.infraHostOS.platformFamily}} -
-
- Kernel: {{rowData.infraHost.infraHostOS.kernelVersion}} -
-
- HostID: {{rowData.infraHost.infraHostOS.hostID}} -
-
- Connected: - - Not Connected - {{rowData.connectDate | date: 'dd/MM/yyyy'}} ({{rowData.connectAddress}}) - -
-
- -
-
-
- NIC: {{rowData.infraHost.infraHostIPs[0].iface}} -
-
- Network Address: {{rowData.infraHost.infraHostIPs[0].address}} -
-
- Gateway: {{rowData.infraHost.infraHostIPs[0].gateway}} -
-
- Mac Address: {{rowData.infraHost.infraHostIPs[0].mac}} -
-
-
-
-
-
- - -
-
- - -
- - - - - -
\ No newline at end of file diff --git a/@overflow/noauth-probe/component/noauth-probe-list.component.spec.ts b/@overflow/noauth-probe/component/noauth-probe-list.component.spec.ts deleted file mode 100644 index cc06c94..0000000 --- a/@overflow/noauth-probe/component/noauth-probe-list.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { NoAuthProbeListComponent } from './noauth-probe-list.component'; - -describe('NoAuthProbeListComponent', () => { - let component: NoAuthProbeListComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ NoAuthProbeListComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(NoAuthProbeListComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/@overflow/noauth-probe/component/noauth-probe-list.component.ts b/@overflow/noauth-probe/component/noauth-probe-list.component.ts index feeea16..a25038d 100644 --- a/@overflow/noauth-probe/component/noauth-probe-list.component.ts +++ b/@overflow/noauth-probe/component/noauth-probe-list.component.ts @@ -1,8 +1,7 @@ -import { Component, Input, Output, EventEmitter, AfterContentInit, OnInit, OnDestroy } from '@angular/core'; +import { Component, OnInit, OnDestroy, Output, EventEmitter } 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'; @@ -10,12 +9,10 @@ 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; @@ -24,11 +21,9 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy { noauthProbes: NoAuthProbe[]; noauthProbeSubscription: Subscription; - selectedInfraHost: InfraHost; - visibleNICs: boolean; + @Output() select = new EventEmitter(); constructor( - private confirmationService: ConfirmationService, private store: Store, private noAuthProbeService: NoAuthProbeService, private noAuthProbeSubscriber: NoAuthProbeSubscriber, @@ -85,65 +80,6 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy { } } - 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; @@ -158,7 +94,4 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy { this.error$ = of(error); } - onNICSelected(infraHostIP: InfraHostIP) { - console.log(infraHostIP); - } } diff --git a/@overflow/noauth-probe/component/old/noauth-probe-list.component.html b/@overflow/noauth-probe/component/old/noauth-probe-list.component.html new file mode 100644 index 0000000..c8c2217 --- /dev/null +++ b/@overflow/noauth-probe/component/old/noauth-probe-list.component.html @@ -0,0 +1,97 @@ + \ No newline at end of file diff --git a/@overflow/noauth-probe/component/old/noauth-probe-list.component.ts b/@overflow/noauth-probe/component/old/noauth-probe-list.component.ts new file mode 100644 index 0000000..a272d12 --- /dev/null +++ b/@overflow/noauth-probe/component/old/noauth-probe-list.component.ts @@ -0,0 +1,164 @@ +// 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; +// error$: Observable; + +// noauthProbes: NoAuthProbe[]; +// noauthProbeSubscription: Subscription; + +// selectedInfraHost: InfraHost; +// visibleNICs: boolean; + +// constructor( +// private confirmationService: ConfirmationService, +// private store: Store, +// 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); +// } +// } diff --git a/src/app/pages/probes/noauth-probe/noauth-probe-detail-page.component.html b/src/app/pages/probes/noauth-probe/noauth-probe-detail-page.component.html new file mode 100644 index 0000000..260b4ed --- /dev/null +++ b/src/app/pages/probes/noauth-probe/noauth-probe-detail-page.component.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/app/pages/probes/noauth-probe/noauth-probe-detail-page.component.ts b/src/app/pages/probes/noauth-probe/noauth-probe-detail-page.component.ts new file mode 100644 index 0000000..2073ce3 --- /dev/null +++ b/src/app/pages/probes/noauth-probe/noauth-probe-detail-page.component.ts @@ -0,0 +1,27 @@ +import { Component } from '@angular/core'; +import { BreadcrumbService } from '@app/commons/service/breadcrumb.service'; +import { ActivatedRoute, Router } from '@angular/router'; +import { NoAuthProbe } from '@overflow/commons-typescript'; + +@Component({ + selector: 'of-pages-noauth-probe-detail', + templateUrl: './noauth-probe-detail-page.component.html', +}) +export class NoAuthProbeDetailPageComponent { + + id: number; + + constructor( + private breadcrumbService: BreadcrumbService, + private activatedRoute: ActivatedRoute, + private router: Router, + ) { + breadcrumbService.setItems([ + { label: 'Probe', routerLink: ['/probe/list'] }, + { label: 'Unauthroized', routerLink: ['/probe/noauth'] }, + ]); + this.id = this.activatedRoute.snapshot.params['id']; + + } + +} diff --git a/src/app/pages/probes/noauth-probe/noauth-probe-list-page.component.html b/src/app/pages/probes/noauth-probe/noauth-probe-list-page.component.html new file mode 100644 index 0000000..160e722 --- /dev/null +++ b/src/app/pages/probes/noauth-probe/noauth-probe-list-page.component.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/app/pages/probes/noauth-probe/noauth-probe-list-page.component.ts b/src/app/pages/probes/noauth-probe/noauth-probe-list-page.component.ts new file mode 100644 index 0000000..d61913d --- /dev/null +++ b/src/app/pages/probes/noauth-probe/noauth-probe-list-page.component.ts @@ -0,0 +1,26 @@ +import { Component } from '@angular/core'; +import { BreadcrumbService } from '@app/commons/service/breadcrumb.service'; +import { Router } from '@angular/router'; +import { NoAuthProbe } from '@overflow/commons-typescript'; + +@Component({ + selector: 'of-pages-noauth-probe-list', + templateUrl: './noauth-probe-list-page.component.html', +}) +export class NoAuthProbeListPageComponent { + + + constructor( + private breadcrumbService: BreadcrumbService, + private router: Router + ) { + breadcrumbService.setItems([ + { label: 'Probe', routerLink: ['/probe/list'] }, + { label: 'Unauthroized', routerLink: ['/probe/noauth'] }, + ]); + } + + onNoAuthProbeSelect(noAuthProbe: NoAuthProbe) { + this.router.navigate(['probe/noauth', noAuthProbe.id]); + } +} diff --git a/src/app/pages/probes/noauth-probe/noauth-probe-page.component.html b/src/app/pages/probes/noauth-probe/noauth-probe-page.component.html deleted file mode 100644 index c2d4736..0000000 --- a/src/app/pages/probes/noauth-probe/noauth-probe-page.component.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/app/pages/probes/noauth-probe/noauth-probe-page.component.ts b/src/app/pages/probes/noauth-probe/noauth-probe-page.component.ts deleted file mode 100644 index 0ccf121..0000000 --- a/src/app/pages/probes/noauth-probe/noauth-probe-page.component.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { BreadcrumbService } from '@app/commons/service/breadcrumb.service'; - -@Component({ - selector: 'of-pages-noauth-probe', - templateUrl: './noauth-probe-page.component.html', -}) -export class NoAuthProbePageComponent { - - constructor( - private breadcrumbService: BreadcrumbService - ) { - breadcrumbService.setItems([ - { label: 'Probe', routerLink: ['/probe/list'] }, - { label: 'Unauthroized', routerLink: ['/probe/noauth'] }, - ]); - } -} diff --git a/src/app/pages/probes/probe-tab-page-routing.module.ts b/src/app/pages/probes/probe-tab-page-routing.module.ts index 7828dcd..864ce44 100644 --- a/src/app/pages/probes/probe-tab-page-routing.module.ts +++ b/src/app/pages/probes/probe-tab-page-routing.module.ts @@ -3,8 +3,9 @@ import { Routes, RouterModule } from '@angular/router'; import { ProbeTabPageComponent } from './probe-tab-page.component'; import { ProbeListPageComponent } from '@app/pages/probes/probe/probe-list-page.component'; import { ProbeDetailPageComponent } from '@app/pages/probes/probe/probe-detail-page.component'; -import { NoAuthProbePageComponent } from '@app/pages/probes/noauth-probe/noauth-probe-page.component'; import { ProbeDownloadPageComponent } from '@app/pages/probes/download/download-page.component'; +import { NoAuthProbeListPageComponent } from '@app/pages/probes/noauth-probe/noauth-probe-list-page.component'; +import { NoAuthProbeDetailPageComponent } from '@app/pages/probes/noauth-probe/noauth-probe-detail-page.component'; const routes: Routes = [ { @@ -12,7 +13,8 @@ const routes: Routes = [ component: ProbeTabPageComponent, children: [ { path: 'list', component: ProbeListPageComponent }, - { path: 'noauth', component: NoAuthProbePageComponent }, + { path: 'noauth', component: NoAuthProbeListPageComponent }, + { path: 'noauth/:id', component: NoAuthProbeDetailPageComponent }, { path: 'download', component: ProbeDownloadPageComponent }, { path: 'download/:idx', component: ProbeDownloadPageComponent }, { path: ':id/info', component: ProbeDetailPageComponent }, diff --git a/src/app/pages/probes/probe-tab-page.module.ts b/src/app/pages/probes/probe-tab-page.module.ts index 07de76b..47725af 100644 --- a/src/app/pages/probes/probe-tab-page.module.ts +++ b/src/app/pages/probes/probe-tab-page.module.ts @@ -9,9 +9,10 @@ import { ProbeTabPageRoutingModule } from './probe-tab-page-routing.module'; import { TabbarModule } from '../../commons/component/layout/tabbar/app.tabbar.module'; import { ProbeListPageComponent } from '@app/pages/probes/probe/probe-list-page.component'; import { ProbeDetailPageComponent } from '@app/pages/probes/probe/probe-detail-page.component'; -import { NoAuthProbePageComponent } from '@app/pages/probes/noauth-probe/noauth-probe-page.component'; import { ProbeDownloadPageComponent } from '@app/pages/probes/download/download-page.component'; import { NoauthProbeModule } from '@overflow/noauth-probe/noauth-probe.module'; +import { NoAuthProbeDetailPageComponent } from '@app/pages/probes/noauth-probe/noauth-probe-detail-page.component'; +import { NoAuthProbeListPageComponent } from '@app/pages/probes/noauth-probe/noauth-probe-list-page.component'; @NgModule({ imports: [ @@ -26,8 +27,9 @@ import { NoauthProbeModule } from '@overflow/noauth-probe/noauth-probe.module'; ProbeTabPageComponent, ProbeListPageComponent, ProbeDetailPageComponent, - NoAuthProbePageComponent, - ProbeDownloadPageComponent + ProbeDownloadPageComponent, + NoAuthProbeListPageComponent, + NoAuthProbeDetailPageComponent ] }) export class ProbeTabPageModule { }