From cd1e53f67acced07b310ea6179a994805982577a Mon Sep 17 00:00:00 2001 From: crusader Date: Mon, 4 Jun 2018 17:25:29 +0900 Subject: [PATCH] ing --- .../discovery/service/discovery.service.ts | 2 +- .../service/target-discovery.service.ts | 2 +- @overflow/infra/component/index.ts | 4 +- .../infra/component/infra-host.component.html | 46 +++++++ .../infra/component/infra-host.component.ts | 56 ++++++++ .../infra/component/infra-map.component.ts | 2 +- @overflow/infra/infra.module.ts | 4 +- .../infra/service/infra-host.service.spec.ts | 15 ++ @overflow/infra/service/infra-host.service.ts | 28 ++++ @overflow/infra/service/infra.service.ts | 2 +- .../member/service/email-auth.service.ts | 2 +- .../member/service/member-totp.service.ts | 2 +- @overflow/member/service/member.service.ts | 2 +- .../meta-crawler-input-item.service.ts | 2 +- .../meta/service/meta-history-type.service.ts | 2 +- .../meta/service/meta-infra-type.service.ts | 2 +- .../meta/service/meta-infra-vendor.service.ts | 2 +- .../meta/service/meta-input-type.service.ts | 2 +- .../service/meta-member-status.service.ts | 2 +- .../meta-noauth-probe-status.service.ts | 2 +- .../meta/service/meta-notification.service.ts | 2 +- .../meta-probe-architecture.service.ts | 2 +- .../meta/service/meta-probe-os.service.ts | 2 +- .../service/meta-probe-package.service.ts | 2 +- .../meta/service/meta-probe-status.service.ts | 2 +- .../service/meta-probe-task-type.service.ts | 2 +- .../service/meta-probe-version.service.ts | 2 +- .../meta-sensor-display-item.service.ts | 2 +- .../meta-sensor-display-mapping.service.ts | 2 +- .../service/meta-sensor-item-key.service.ts | 2 +- .../service/meta-sensor-item-type.service.ts | 2 +- .../service/meta-sensor-item-unit.service.ts | 2 +- .../meta/service/meta-sensor-item.service.ts | 2 +- .../service/meta-sensor-status.service.ts | 2 +- ...meta-vendor-crawler-sensor-item.service.ts | 2 +- .../service/meta-vendor-crawler.service.ts | 2 +- .../service/noauth-probe.service.ts | 2 +- .../badge/badge-container.component.ts | 2 +- .../list/list-container.component.ts | 2 +- .../service/notification.service.ts | 2 +- .../notification/notification.effect.ts | 2 +- @overflow/probe/component/index.ts | 7 +- .../component/probe-detail.component.html | 90 +----------- .../probe/component/probe-detail.component.ts | 70 +--------- .../component/probe-general.component.html | 66 +++++++++ .../component/probe-general.component.ts | 129 ++++++++++++++++++ .../probe/component/probe-host.component.html | 46 +++++++ .../probe/component/probe-host.component.ts | 38 ++++++ @overflow/probe/probe.module.ts | 2 + @overflow/probe/service/probe-host.service.ts | 2 +- @overflow/probe/service/probe.service.ts | 8 +- .../service/sensor-item-dependency.service.ts | 2 +- @overflow/sensor/service/sensor.service.ts | 2 +- @overflow/target/service/target.service.ts | 2 +- .../layout/banner/app.banner.component.ts | 2 +- .../layout/profile/app.profile.component.ts | 2 +- src/app/commons/service/auth.service.ts | 2 +- src/app/commons/service/breadcrumb.service.ts | 2 +- 58 files changed, 490 insertions(+), 205 deletions(-) create mode 100644 @overflow/infra/component/infra-host.component.html create mode 100644 @overflow/infra/component/infra-host.component.ts create mode 100644 @overflow/infra/service/infra-host.service.spec.ts create mode 100644 @overflow/infra/service/infra-host.service.ts create mode 100644 @overflow/probe/component/probe-general.component.html create mode 100644 @overflow/probe/component/probe-general.component.ts create mode 100644 @overflow/probe/component/probe-host.component.html create mode 100644 @overflow/probe/component/probe-host.component.ts diff --git a/@overflow/discovery/service/discovery.service.ts b/@overflow/discovery/service/discovery.service.ts index 856fb4c..4817764 100644 --- a/@overflow/discovery/service/discovery.service.ts +++ b/@overflow/discovery/service/discovery.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { diff --git a/@overflow/discovery/service/target-discovery.service.ts b/@overflow/discovery/service/target-discovery.service.ts index 984fd11..30f29d4 100644 --- a/@overflow/discovery/service/target-discovery.service.ts +++ b/@overflow/discovery/service/target-discovery.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { DiscoveryStartInfo, diff --git a/@overflow/infra/component/index.ts b/@overflow/infra/component/index.ts index c3c1206..bda64db 100644 --- a/@overflow/infra/component/index.ts +++ b/@overflow/infra/component/index.ts @@ -1,11 +1,13 @@ import { InfraMapComponent } from './infra-map.component'; // import { InfraProbeSummaryComponent } from './infra-probe-summary.component'; +import { InfraHostComponent } from './infra-host.component'; import { InfraHostSummaryComponent } from './infra-host-summary.component'; import { InfraServiceSummaryComponent } from './infra-service-summary.component'; export const COMPONENTS = [ InfraMapComponent, // InfraProbeSummaryComponent, + InfraHostComponent, InfraHostSummaryComponent, - InfraServiceSummaryComponent + InfraServiceSummaryComponent, ]; diff --git a/@overflow/infra/component/infra-host.component.html b/@overflow/infra/component/infra-host.component.html new file mode 100644 index 0000000..31195c5 --- /dev/null +++ b/@overflow/infra/component/infra-host.component.html @@ -0,0 +1,46 @@ + + + + + +
+
+

Host

+
+ +
+
+
+ + +
+
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/@overflow/infra/component/infra-host.component.ts b/@overflow/infra/component/infra-host.component.ts new file mode 100644 index 0000000..493bbaa --- /dev/null +++ b/@overflow/infra/component/infra-host.component.ts @@ -0,0 +1,56 @@ +import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core'; +import { Store, select } from '@ngrx/store'; +import { Observable, of, Subscription } from 'rxjs'; +import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; + +import { AuthSelector } from '@overflow/shared/auth/store'; +import { DomainMember } from '@overflow/commons-typescript/model/domain'; +import { InfraHost } from '@overflow/commons-typescript/model/infra'; +import { InfraHostService } from '../service/infra-host.service'; + +@Component({ + selector: 'of-infra-host', + templateUrl: './infra-host.component.html', +}) +export class InfraHostComponent implements OnInit { + + @Input() infraHost: InfraHost; + @Input() infraHostID: number; + error$: Observable; + pending$: Observable; + + constructor( + private infraHostService: InfraHostService, + ) { + } + + ngOnInit() { + if (undefined === this.infraHost && undefined === this.infraHostID) { + // Create + } else if (undefined !== this.infraHost && undefined === this.infraHostID) { + // use infraHost + } else if (undefined === this.infraHost && undefined !== this.infraHostID) { + // get infraHost + this.infraHostService.read(this.infraHostID) + .pipe( + tap(() => { + this.pending$ = of(true); + }), + map((infraHost: InfraHost) => { + this.infraHost = infraHost; + }), + catchError(error => { + this.error$ = of(error); + return of(); + }), + tap(() => { + this.pending$ = of(false); + }), + ).take(1).subscribe(); + } else { + // error + } + } + +} + diff --git a/@overflow/infra/component/infra-map.component.ts b/@overflow/infra/component/infra-map.component.ts index 33ba6b6..85a8245 100644 --- a/@overflow/infra/component/infra-map.component.ts +++ b/@overflow/infra/component/infra-map.component.ts @@ -64,7 +64,7 @@ export class InfraMapComponent implements OnInit, AfterContentInit { constructor( private store: Store, - private infraService: InfraService, + // private infraService: InfraService, ) { } diff --git a/@overflow/infra/infra.module.ts b/@overflow/infra/infra.module.ts index 1d3b048..a60b624 100644 --- a/@overflow/infra/infra.module.ts +++ b/@overflow/infra/infra.module.ts @@ -5,7 +5,7 @@ import { SERVICES } from './service'; import { FormsModule } from '@angular/forms'; import { DiscoveryModule } from '@overflow/discovery/discovery.module'; import { SensorModule } from '@overflow/sensor/sensor.module'; -import { ProbeModule } from '@overflow/probe/probe.module'; +// import { ProbeModule } from '@overflow/probe/probe.module'; import { MetaModule } from '@overflow/meta/meta.module'; import { UIModule } from '@overflow/shared/ui/ui.module'; @@ -16,7 +16,7 @@ import { UIModule } from '@overflow/shared/ui/ui.module'; UIModule, DiscoveryModule, SensorModule, - ProbeModule, + // ProbeModule, MetaModule, ], declarations: [ diff --git a/@overflow/infra/service/infra-host.service.spec.ts b/@overflow/infra/service/infra-host.service.spec.ts new file mode 100644 index 0000000..8ea4409 --- /dev/null +++ b/@overflow/infra/service/infra-host.service.spec.ts @@ -0,0 +1,15 @@ +import { TestBed, inject } from '@angular/core/testing'; + +import { InfraHostService } from './infra-host.service'; + +describe('InfraHostService', () => { + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [InfraHostService] + }); + }); + + it('should be created', inject([InfraHostService], (service: InfraHostService) => { + expect(service).toBeTruthy(); + })); +}); diff --git a/@overflow/infra/service/infra-host.service.ts b/@overflow/infra/service/infra-host.service.ts new file mode 100644 index 0000000..4ce6740 --- /dev/null +++ b/@overflow/infra/service/infra-host.service.ts @@ -0,0 +1,28 @@ +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; + +import { RPCService } from '@loafer/ng-rpc'; + +import { InfraHost } from '@overflow/commons-typescript/model/infra'; + +@Injectable() +export class InfraHostService { + + public constructor( + private rpcService: RPCService, + ) { + + } + + // public readAllByDomain(domain: Domain, pageParams: PageParams): Observable { + // return this.rpcService.call('InfraService.readAllByDomain', domain, pageParams); + // } + + // public readAllByProbe(probe: Probe, pageParams: PageParams): Observable { + // return this.rpcService.call('InfraService.readAllByProbe', probe, pageParams); + // } + + public read(id: number): Observable { + return this.rpcService.call('InfraHostService.read', id); + } +} diff --git a/@overflow/infra/service/infra.service.ts b/@overflow/infra/service/infra.service.ts index 5313c9b..fe31a55 100644 --- a/@overflow/infra/service/infra.service.ts +++ b/@overflow/infra/service/infra.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; diff --git a/@overflow/member/service/email-auth.service.ts b/@overflow/member/service/email-auth.service.ts index b2cdc8a..6691dd9 100644 --- a/@overflow/member/service/email-auth.service.ts +++ b/@overflow/member/service/email-auth.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; diff --git a/@overflow/member/service/member-totp.service.ts b/@overflow/member/service/member-totp.service.ts index 72154ba..2610605 100644 --- a/@overflow/member/service/member-totp.service.ts +++ b/@overflow/member/service/member-totp.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { RPCService } from '@loafer/ng-rpc'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { MemberTotp } from '@overflow/commons-typescript/model/member'; import { Member } from '@overflow/commons-typescript/model/member'; diff --git a/@overflow/member/service/member.service.ts b/@overflow/member/service/member.service.ts index ff276f9..d6c9789 100644 --- a/@overflow/member/service/member.service.ts +++ b/@overflow/member/service/member.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; diff --git a/@overflow/meta/service/meta-crawler-input-item.service.ts b/@overflow/meta/service/meta-crawler-input-item.service.ts index cbc0872..61dba3b 100644 --- a/@overflow/meta/service/meta-crawler-input-item.service.ts +++ b/@overflow/meta/service/meta-crawler-input-item.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaCrawlerInputItem } from '@overflow/commons-typescript/model/meta'; import { MetaCrawler } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-history-type.service.ts b/@overflow/meta/service/meta-history-type.service.ts index 63ae8c9..3caf6ed 100644 --- a/@overflow/meta/service/meta-history-type.service.ts +++ b/@overflow/meta/service/meta-history-type.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaHistoryType } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-infra-type.service.ts b/@overflow/meta/service/meta-infra-type.service.ts index 2ae1809..9346690 100644 --- a/@overflow/meta/service/meta-infra-type.service.ts +++ b/@overflow/meta/service/meta-infra-type.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaInfraType } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-infra-vendor.service.ts b/@overflow/meta/service/meta-infra-vendor.service.ts index c92b60b..0e06f2f 100644 --- a/@overflow/meta/service/meta-infra-vendor.service.ts +++ b/@overflow/meta/service/meta-infra-vendor.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaInfraType, MetaInfraVendor } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-input-type.service.ts b/@overflow/meta/service/meta-input-type.service.ts index 10b5ca8..2a140aa 100644 --- a/@overflow/meta/service/meta-input-type.service.ts +++ b/@overflow/meta/service/meta-input-type.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaInputType } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-member-status.service.ts b/@overflow/meta/service/meta-member-status.service.ts index 30c6a15..d0699e4 100644 --- a/@overflow/meta/service/meta-member-status.service.ts +++ b/@overflow/meta/service/meta-member-status.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaMemberStatus } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-noauth-probe-status.service.ts b/@overflow/meta/service/meta-noauth-probe-status.service.ts index d6caf67..dbeb4a2 100644 --- a/@overflow/meta/service/meta-noauth-probe-status.service.ts +++ b/@overflow/meta/service/meta-noauth-probe-status.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaNoAuthProbeStatus } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-notification.service.ts b/@overflow/meta/service/meta-notification.service.ts index 4fba504..a8ffa3c 100644 --- a/@overflow/meta/service/meta-notification.service.ts +++ b/@overflow/meta/service/meta-notification.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaCrawler, MetaNotification } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-probe-architecture.service.ts b/@overflow/meta/service/meta-probe-architecture.service.ts index 4d43e16..b4dccee 100644 --- a/@overflow/meta/service/meta-probe-architecture.service.ts +++ b/@overflow/meta/service/meta-probe-architecture.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaProbeArchitecture } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-probe-os.service.ts b/@overflow/meta/service/meta-probe-os.service.ts index 0f30608..105b8cf 100644 --- a/@overflow/meta/service/meta-probe-os.service.ts +++ b/@overflow/meta/service/meta-probe-os.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaProbeOs } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-probe-package.service.ts b/@overflow/meta/service/meta-probe-package.service.ts index 24a96a0..9fa995e 100644 --- a/@overflow/meta/service/meta-probe-package.service.ts +++ b/@overflow/meta/service/meta-probe-package.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaProbeOs, MetaProbePackage } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-probe-status.service.ts b/@overflow/meta/service/meta-probe-status.service.ts index 0057464..4ec7a46 100644 --- a/@overflow/meta/service/meta-probe-status.service.ts +++ b/@overflow/meta/service/meta-probe-status.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaProbeStatus } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-probe-task-type.service.ts b/@overflow/meta/service/meta-probe-task-type.service.ts index 64233a0..e32f1ac 100644 --- a/@overflow/meta/service/meta-probe-task-type.service.ts +++ b/@overflow/meta/service/meta-probe-task-type.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaProbeTaskType } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-probe-version.service.ts b/@overflow/meta/service/meta-probe-version.service.ts index b1a639a..1ba35be 100644 --- a/@overflow/meta/service/meta-probe-version.service.ts +++ b/@overflow/meta/service/meta-probe-version.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaProbeVersion } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-sensor-display-item.service.ts b/@overflow/meta/service/meta-sensor-display-item.service.ts index 069db45..ab9a03f 100644 --- a/@overflow/meta/service/meta-sensor-display-item.service.ts +++ b/@overflow/meta/service/meta-sensor-display-item.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; diff --git a/@overflow/meta/service/meta-sensor-display-mapping.service.ts b/@overflow/meta/service/meta-sensor-display-mapping.service.ts index 432f3ba..d213977 100644 --- a/@overflow/meta/service/meta-sensor-display-mapping.service.ts +++ b/@overflow/meta/service/meta-sensor-display-mapping.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaSensorDisplayItem, MetaSensorItemKey } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-sensor-item-key.service.ts b/@overflow/meta/service/meta-sensor-item-key.service.ts index 47c9047..c507a61 100644 --- a/@overflow/meta/service/meta-sensor-item-key.service.ts +++ b/@overflow/meta/service/meta-sensor-item-key.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaCrawler, MetaSensorItemKey } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-sensor-item-type.service.ts b/@overflow/meta/service/meta-sensor-item-type.service.ts index c2226c9..af7c101 100644 --- a/@overflow/meta/service/meta-sensor-item-type.service.ts +++ b/@overflow/meta/service/meta-sensor-item-type.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaSensorItemType } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-sensor-item-unit.service.ts b/@overflow/meta/service/meta-sensor-item-unit.service.ts index aa4b521..3a413f2 100644 --- a/@overflow/meta/service/meta-sensor-item-unit.service.ts +++ b/@overflow/meta/service/meta-sensor-item-unit.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaCrawler, MetaSensorItemUnit } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-sensor-item.service.ts b/@overflow/meta/service/meta-sensor-item.service.ts index e07fe19..9944e9e 100644 --- a/@overflow/meta/service/meta-sensor-item.service.ts +++ b/@overflow/meta/service/meta-sensor-item.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaSensorItem } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-sensor-status.service.ts b/@overflow/meta/service/meta-sensor-status.service.ts index cb7479e..5364132 100644 --- a/@overflow/meta/service/meta-sensor-status.service.ts +++ b/@overflow/meta/service/meta-sensor-status.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaSensorStatus } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-vendor-crawler-sensor-item.service.ts b/@overflow/meta/service/meta-vendor-crawler-sensor-item.service.ts index 9ed1b9b..88ef9ad 100644 --- a/@overflow/meta/service/meta-vendor-crawler-sensor-item.service.ts +++ b/@overflow/meta/service/meta-vendor-crawler-sensor-item.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaVendorCrawlerSensorItem } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/meta/service/meta-vendor-crawler.service.ts b/@overflow/meta/service/meta-vendor-crawler.service.ts index 0a14d3f..e6a5d84 100644 --- a/@overflow/meta/service/meta-vendor-crawler.service.ts +++ b/@overflow/meta/service/meta-vendor-crawler.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { MetaInfraVendor, MetaVendorCrawler } from '@overflow/commons-typescript/model/meta'; diff --git a/@overflow/noauth-probe/service/noauth-probe.service.ts b/@overflow/noauth-probe/service/noauth-probe.service.ts index d8db948..459a70e 100644 --- a/@overflow/noauth-probe/service/noauth-probe.service.ts +++ b/@overflow/noauth-probe/service/noauth-probe.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; diff --git a/@overflow/notification/container/badge/badge-container.component.ts b/@overflow/notification/container/badge/badge-container.component.ts index 783b2ed..fca8d08 100644 --- a/@overflow/notification/container/badge/badge-container.component.ts +++ b/@overflow/notification/container/badge/badge-container.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; import { AfterContentInit, OnDestroy, OnChanges, SimpleChanges } from '@angular/core/src/metadata/lifecycle_hooks'; import { Store, select } from '@ngrx/store'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { Domain, DomainMember } from '@overflow/commons-typescript/model/domain'; import * as NotificationEntityStore from '../../store/entity/notification'; import { NotificationEntitySelector } from '../../store/'; diff --git a/@overflow/notification/container/list/list-container.component.ts b/@overflow/notification/container/list/list-container.component.ts index adf2f92..3fbb303 100644 --- a/@overflow/notification/container/list/list-container.component.ts +++ b/@overflow/notification/container/list/list-container.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; import { AfterContentInit, OnDestroy } from '@angular/core/src/metadata/lifecycle_hooks'; import { Store, select } from '@ngrx/store'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import * as NotificationEntityStore from '../../store/entity/notification'; import { NotificationEntitySelector } from '../../store/'; import { AuthSelector } from '@overflow/shared/auth/store'; diff --git a/@overflow/notification/service/notification.service.ts b/@overflow/notification/service/notification.service.ts index 3646af7..bf22edf 100644 --- a/@overflow/notification/service/notification.service.ts +++ b/@overflow/notification/service/notification.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; diff --git a/@overflow/notification/store/entity/notification/notification.effect.ts b/@overflow/notification/store/entity/notification/notification.effect.ts index ca0b279..8e8b36e 100644 --- a/@overflow/notification/store/entity/notification/notification.effect.ts +++ b/@overflow/notification/store/entity/notification/notification.effect.ts @@ -4,7 +4,7 @@ import { Router } from '@angular/router'; import { Effect, Actions, ofType } from '@ngrx/effects'; import { Action } from '@ngrx/store'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { of } from 'rxjs/observable/of'; import 'rxjs/add/operator/catch'; diff --git a/@overflow/probe/component/index.ts b/@overflow/probe/component/index.ts index 2b7f95d..cd44f67 100644 --- a/@overflow/probe/component/index.ts +++ b/@overflow/probe/component/index.ts @@ -4,10 +4,15 @@ import { ProbeDownloadComponent } from './probe-download.component'; import { ProbeSelectorComponent } from './probe-selector.component'; import { ProbeSummaryComponent } from './probe-summary.component'; +import { ProbeGeneralComponent } from './probe-general.component'; +import { ProbeHostComponent } from './probe-host.component'; + export const COMPONENTS = [ ProbeListComponent, ProbeDetailComponent, ProbeDownloadComponent, ProbeSelectorComponent, - ProbeSummaryComponent + ProbeSummaryComponent, + ProbeGeneralComponent, + ProbeHostComponent, ]; diff --git a/@overflow/probe/component/probe-detail.component.html b/@overflow/probe/component/probe-detail.component.html index 439ca27..dcbcc14 100644 --- a/@overflow/probe/component/probe-detail.component.html +++ b/@overflow/probe/component/probe-detail.component.html @@ -1,95 +1,13 @@ - - -
-
-

Info

-
- -
- - - -
-
- - -
-
- -
-
-
-
- Name - - -
{{displayNameErrMsg}}
-
-
- -
- -
- -
-
-
- Description - - -
{{descriptionErrMsg}}
-
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
- - -
-
- -
-
-
- -
- -
- -
- -
- -
- -
- -
-
-
-
-
-
+ + +
+ (click)="remove(probeHost)">
diff --git a/@overflow/probe/component/probe-detail.component.ts b/@overflow/probe/component/probe-detail.component.ts index 6e7cddb..15a38fc 100644 --- a/@overflow/probe/component/probe-detail.component.ts +++ b/@overflow/probe/component/probe-detail.component.ts @@ -6,7 +6,6 @@ import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { AuthSelector } from '@overflow/shared/auth/store'; import { DomainMember } from '@overflow/commons-typescript/model/domain'; import { ProbeHostService } from '../service/probe-host.service'; -import { ProbeService } from '../service/probe.service'; @Component({ selector: 'of-probe-detail', @@ -21,16 +20,9 @@ export class ProbeDetailComponent implements OnInit { @Output() discovery = new EventEmitter(); - editMode = false; - displayNameErrMsg: string; - descriptionErrMsg: string; - displayName: string; - description: string; - constructor( private store: Store, private probeHostService: ProbeHostService, - private probeService: ProbeService, ) { } @@ -53,70 +45,12 @@ export class ProbeDetailComponent implements OnInit { ).take(1).subscribe(); } + modifiedGeneral(probe: Probe) { - onDisplayNameEditing(value: string) { - const msg: string = this.checkValidDisplayName(value); - if (msg !== null) { - this.displayNameErrMsg = msg; - } else { - this.displayNameErrMsg = null; - this.displayName = value.trim(); - } } - onDescriptionEditing(value: string) { - const msg: string = this.checkValidDescription(value); - if (msg !== null) { - this.descriptionErrMsg = msg; - } else { - this.descriptionErrMsg = null; - this.description = value.trim(); - } - } + remove(probeHost: ProbeHost) { - onEditSave() { - this.probeHost.probe.displayName = this.displayName ? this.displayName : this.probeHost.probe.displayName; - this.probeHost.probe.description = this.description ? this.description : this.probeHost.probe.description; - - this.probeService.modify(this.probeHost.probe) - .pipe( - tap(() => { - this.pending$ = of(true); - }), - map((probe: Probe) => { - this.editMode = false; - this.probeHost.probe = probe; - }), - catchError(error => { - this.error$ = of(error); - return of(); - }), - tap(() => { - this.pending$ = of(false); - }), - ).take(1).subscribe(); - } - - checkValidDisplayName(value: string): string | null { - if (value.length <= 2 || value.length > 20) { - return 'displayname length : 3 ~ 20'; - } - const regex = /[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi; - if (value.match(regex)) { - return 'Cannot use special characters.'; - } - return null; - } - - checkValidDescription(value: string): string | null { - if (value.length > 50) { - return 'description length : 0 ~ 50'; - } - const regex = /[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi; - if (value.match(regex)) { - return 'Cannot use special characters.'; - } - return null; } } diff --git a/@overflow/probe/component/probe-general.component.html b/@overflow/probe/component/probe-general.component.html new file mode 100644 index 0000000..4dfe417 --- /dev/null +++ b/@overflow/probe/component/probe-general.component.html @@ -0,0 +1,66 @@ + + + + + +
+
+

General

+
+ +
+ + + +
+
+ + +
+
+ +
+
+
+
+ Name + + +
{{displayNameErrMsg}}
+
+
+ +
+ +
+ +
+
+
+ Description + + +
{{descriptionErrMsg}}
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/@overflow/probe/component/probe-general.component.ts b/@overflow/probe/component/probe-general.component.ts new file mode 100644 index 0000000..1c84bfb --- /dev/null +++ b/@overflow/probe/component/probe-general.component.ts @@ -0,0 +1,129 @@ +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 } from 'rxjs/operators'; +import { AuthSelector } from '@overflow/shared/auth/store'; +import { DomainMember } from '@overflow/commons-typescript/model/domain'; +import { ProbeHostService } from '../service/probe-host.service'; +import { ProbeService } from '../service/probe.service'; + +@Component({ + selector: 'of-probe-general', + templateUrl: './probe-general.component.html', +}) +export class ProbeGeneralComponent implements OnInit { + + @Input() probeID: number; + @Input() probe: Probe; + @Output() modified = new EventEmitter(); + + error$: Observable; + pending$: Observable; + + editMode = false; + displayNameErrMsg: string; + descriptionErrMsg: string; + displayName: string; + description: string; + + constructor( + private probeService: ProbeService, + ) { + } + + ngOnInit() { + if (undefined === this.probe && undefined === this.probeID) { + // Create + } else if (undefined !== this.probe && undefined === this.probeID) { + // use probe + } else if (undefined === this.probe && undefined !== this.probeID) { + // get probe + this.probeService.read(this.probeID) + .pipe( + tap(() => { + this.pending$ = of(true); + }), + map((probe: Probe) => { + this.probe = probe; + }), + catchError(error => { + this.error$ = of(error); + return of(); + }), + tap(() => { + this.pending$ = of(false); + }), + ).take(1).subscribe(); + } else { + // error + } + } + + onDisplayNameEditing(value: string) { + const msg: string = this.checkValidDisplayName(value); + if (msg !== null) { + this.displayNameErrMsg = msg; + } else { + this.displayNameErrMsg = null; + this.displayName = value.trim(); + } + } + + onDescriptionEditing(value: string) { + const msg: string = this.checkValidDescription(value); + if (msg !== null) { + this.descriptionErrMsg = msg; + } else { + this.descriptionErrMsg = null; + this.description = value.trim(); + } + } + + onEditSave() { + this.probe.displayName = this.displayName ? this.displayName : this.probe.displayName; + this.probe.description = this.description ? this.description : this.probe.description; + + this.probeService.modify(this.probe) + .pipe( + tap(() => { + this.pending$ = of(true); + }), + map((probe: Probe) => { + this.editMode = false; + this.probe = probe; + this.modified.emit(probe); + }), + catchError(error => { + this.error$ = of(error); + return of(); + }), + tap(() => { + this.pending$ = of(false); + }), + ).take(1).subscribe(); + } + + checkValidDisplayName(value: string): string | null { + if (value.length <= 2 || value.length > 20) { + return 'displayname length : 3 ~ 20'; + } + const regex = /[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi; + if (value.match(regex)) { + return 'Cannot use special characters.'; + } + return null; + } + + checkValidDescription(value: string): string | null { + if (value.length > 50) { + return 'description length : 0 ~ 50'; + } + const regex = /[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi; + if (value.match(regex)) { + return 'Cannot use special characters.'; + } + return null; + } +} + diff --git a/@overflow/probe/component/probe-host.component.html b/@overflow/probe/component/probe-host.component.html new file mode 100644 index 0000000..31195c5 --- /dev/null +++ b/@overflow/probe/component/probe-host.component.html @@ -0,0 +1,46 @@ + + + + + +
+
+

Host

+
+ +
+
+
+ + +
+
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/@overflow/probe/component/probe-host.component.ts b/@overflow/probe/component/probe-host.component.ts new file mode 100644 index 0000000..5ccae67 --- /dev/null +++ b/@overflow/probe/component/probe-host.component.ts @@ -0,0 +1,38 @@ +import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core'; +import { Store, select } from '@ngrx/store'; +import { Observable, of, Subscription } from 'rxjs'; +import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; + +import { AuthSelector } from '@overflow/shared/auth/store'; +import { DomainMember } from '@overflow/commons-typescript/model/domain'; +import { InfraHost } from '@overflow/commons-typescript/model/infra'; + +@Component({ + selector: 'of-probe-host', + templateUrl: './probe-host.component.html', +}) +export class ProbeHostComponent implements OnInit { + + @Input() infraHost: InfraHost; + @Input() infraHostID: number; + error$: Observable; + pending$: Observable; + + constructor( + ) { + } + + ngOnInit() { + if (undefined === this.infraHost && undefined === this.infraHostID) { + // Create + } else if (undefined !== this.infraHost && undefined === this.infraHostID) { + // use infraHost + } else if (undefined === this.infraHost && undefined !== this.infraHostID) { + // get infraHost + } else { + // error + } + } + +} + diff --git a/@overflow/probe/probe.module.ts b/@overflow/probe/probe.module.ts index 9939dc7..f69abb2 100644 --- a/@overflow/probe/probe.module.ts +++ b/@overflow/probe/probe.module.ts @@ -5,6 +5,7 @@ import { COMPONENTS } from './component'; import { SERVICES } from './service'; import { FormsModule } from '@angular/forms'; import { MetaModule } from '@overflow/meta/meta.module'; +// import { InfraModule } from '@overflow/infra/infra.module'; import { UIModule } from '@overflow/shared/ui/ui.module'; @NgModule({ @@ -13,6 +14,7 @@ import { UIModule } from '@overflow/shared/ui/ui.module'; FormsModule, UIModule, MetaModule, + // InfraModule, ], declarations: [ COMPONENTS, diff --git a/@overflow/probe/service/probe-host.service.ts b/@overflow/probe/service/probe-host.service.ts index c63c3f2..755ab71 100644 --- a/@overflow/probe/service/probe-host.service.ts +++ b/@overflow/probe/service/probe-host.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; import { RPCService } from '@loafer/ng-rpc'; import { Probe, ProbeHost } from '@overflow/commons-typescript/model/probe'; diff --git a/@overflow/probe/service/probe.service.ts b/@overflow/probe/service/probe.service.ts index 37e64f4..60a1ab1 100644 --- a/@overflow/probe/service/probe.service.ts +++ b/@overflow/probe/service/probe.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; @@ -23,7 +23,7 @@ export class ProbeService { return this.rpcService.call('ProbeService.readAllByDomain', domain); } - public read(id: string): Observable { + public read(id: number): Observable { return this.rpcService.call('ProbeService.read', id); } @@ -31,11 +31,11 @@ export class ProbeService { return this.rpcService.call('ProbeService.modify', probe); } - public remove(id: string): Observable { + public remove(id: number): Observable { return this.rpcService.call('ProbeService.remove', id); } - public modifyDisplayName(id: string, displayName: string): Observable { + public modifyDisplayName(id: number, displayName: string): Observable { return this.rpcService.call('ProbeService.modifyDisplayName', id, displayName); } diff --git a/@overflow/sensor-item/service/sensor-item-dependency.service.ts b/@overflow/sensor-item/service/sensor-item-dependency.service.ts index b8af764..ff46a91 100644 --- a/@overflow/sensor-item/service/sensor-item-dependency.service.ts +++ b/@overflow/sensor-item/service/sensor-item-dependency.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; import { SensorItemDependency } from '@overflow/commons-typescript/model/sensor-item'; diff --git a/@overflow/sensor/service/sensor.service.ts b/@overflow/sensor/service/sensor.service.ts index 4461fe2..c287b58 100644 --- a/@overflow/sensor/service/sensor.service.ts +++ b/@overflow/sensor/service/sensor.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; diff --git a/@overflow/target/service/target.service.ts b/@overflow/target/service/target.service.ts index f625b46..4c8f8e0 100644 --- a/@overflow/target/service/target.service.ts +++ b/@overflow/target/service/target.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; diff --git a/src/app/commons/component/layout/banner/app.banner.component.ts b/src/app/commons/component/layout/banner/app.banner.component.ts index 3fa3122..1703e7d 100644 --- a/src/app/commons/component/layout/banner/app.banner.component.ts +++ b/src/app/commons/component/layout/banner/app.banner.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { trigger, state, transition, style, animate } from '@angular/animations'; import { ActivatedRoute, Router } from '@angular/router'; import { select, Store } from '@ngrx/store'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; @Component({ diff --git a/src/app/commons/component/layout/profile/app.profile.component.ts b/src/app/commons/component/layout/profile/app.profile.component.ts index 6dc2c9d..3b78cd3 100644 --- a/src/app/commons/component/layout/profile/app.profile.component.ts +++ b/src/app/commons/component/layout/profile/app.profile.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { trigger, state, transition, style, animate } from '@angular/animations'; import { ActivatedRoute, Router } from '@angular/router'; import { select, Store } from '@ngrx/store'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { Member } from '@overflow/commons-typescript/model/member'; import { AuthSelector } from '@overflow/shared/auth/store'; diff --git a/src/app/commons/service/auth.service.ts b/src/app/commons/service/auth.service.ts index af02707..3418dca 100644 --- a/src/app/commons/service/auth.service.ts +++ b/src/app/commons/service/auth.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { RESTService } from '@loafer/ng-rest'; import { DomainMember } from '@overflow/commons-typescript/model/domain'; diff --git a/src/app/commons/service/breadcrumb.service.ts b/src/app/commons/service/breadcrumb.service.ts index 8161d9e..eb5f017 100644 --- a/src/app/commons/service/breadcrumb.service.ts +++ b/src/app/commons/service/breadcrumb.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { MenuItem } from 'primeng/primeng'; @Injectable()