diff --git a/@overflow/noauth-probe/component/noauth-probe-list.component.ts b/@overflow/noauth-probe/component/noauth-probe-list.component.ts
index 1e11343..b2939f7 100644
--- a/@overflow/noauth-probe/component/noauth-probe-list.component.ts
+++ b/@overflow/noauth-probe/component/noauth-probe-list.component.ts
@@ -30,6 +30,7 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy {
private noAuthProbeSubscriber: NoAuthProbeSubscriber,
) {
this.noauthProbes = [];
+ this.noauthProbeSubscription = null;
}
ngOnInit() {
@@ -75,7 +76,9 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy {
}
ngOnDestroy(): void {
- this.noauthProbeSubscription.unsubscribe();
+ if (null !== this.noauthProbeSubscription) {
+ this.noauthProbeSubscription.unsubscribe();
+ }
}
onAcceptOrDeny(isAccept: boolean, selected: NoAuthProbe) {
diff --git a/@overflow/probe/component/probe-list.component.html b/@overflow/probe/component/probe-list.component.html
index a3a28c1..2bef1a7 100644
--- a/@overflow/probe/component/probe-list.component.html
+++ b/@overflow/probe/component/probe-list.component.html
@@ -3,7 +3,7 @@
-
+
Probe Name |
diff --git a/@overflow/probe/component/probe-list.component.ts b/@overflow/probe/component/probe-list.component.ts
index 5f7f800..9b4ed39 100644
--- a/@overflow/probe/component/probe-list.component.ts
+++ b/@overflow/probe/component/probe-list.component.ts
@@ -1,7 +1,7 @@
-import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
+import { Component, OnInit, Output, EventEmitter, Input, OnDestroy } from '@angular/core';
import { Store, select } from '@ngrx/store';
-import { Observable, of } from 'rxjs';
+import { Observable, Subscription, of } from 'rxjs';
import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators';
import { AuthSelector } from '@overflow/shared/auth/store';
@@ -9,22 +9,27 @@ import { DomainMember } from '@overflow/commons-typescript/model/domain';
import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe';
import { ProbeHostService } from '../service/probe-host.service';
+import { ProbeSubscriber, ProbeNotify } from '../subscriber/probe.subscriber';
@Component({
selector: 'of-probe-list',
templateUrl: './probe-list.component.html',
})
-export class ProbeListComponent implements OnInit {
+export class ProbeListComponent implements OnInit, OnDestroy {
+ @Output() select = new EventEmitter();
- probeHosts$: Observable;
+ probeHosts: ProbeHost[];
pending$: Observable;
error$: Observable;
- @Output() select = new EventEmitter();
+
+ probeSubscription: Subscription;
constructor(
private store: Store,
private probeHostService: ProbeHostService,
+ private probeSubscriber: ProbeSubscriber,
) {
+ this.probeSubscription = null;
}
ngOnInit(): void {
@@ -34,10 +39,10 @@ export class ProbeListComponent implements OnInit {
}),
select(AuthSelector.selectDomainMember),
exhaustMap((domainMember: DomainMember) =>
- this.probeHostService.readAllByDomainID(domainMember.domain.id)
+ this.probeHostService.readAllByDomainID(domainMember.domain.id)
.pipe(
map((probeHosts: ProbeHost[]) => {
- this.probeHosts$ = of(probeHosts);
+ this.probeHosts = probeHosts;
}),
catchError(error => {
this.error$ = of(error);
@@ -50,6 +55,28 @@ export class ProbeListComponent implements OnInit {
}),
take(1),
).subscribe();
+
+ this.probeSubscription = this.probeSubscriber.observable().pipe(
+ tap((probeNotify: ProbeNotify) => {
+ const probeHosts = [];
+ this.probeHosts.forEach(probeHost => {
+ const n = probeNotify.params;
+ if (probeHost.probe.id === n.id) {
+ probeHost.probe = n;
+ }
+ probeHosts.push(probeHost);
+ });
+
+ this.probeHosts = probeHosts;
+ }
+ ),
+ ).subscribe();
+ }
+
+ ngOnDestroy(): void {
+ if (null !== this.probeSubscription) {
+ this.probeSubscription.unsubscribe();
+ }
}
onProbeSelect(event) {
@@ -60,7 +87,8 @@ export class ProbeListComponent implements OnInit {
// if (!probe.connectDate) {
// return 'Not Connected.';
// }
- // const hours = Math.abs(new Date().getTime() - probe.connectDate.getTime());
+ // const connectDate = new Date(probe.connectDate);
+ // const hours = Math.abs(new Date().getTime() - connectDate.getTime());
// return this.convertUptimeString(hours);
}
diff --git a/@overflow/probe/probe-logger.module.ts b/@overflow/probe/probe-logger.module.ts
new file mode 100644
index 0000000..56c3dac
--- /dev/null
+++ b/@overflow/probe/probe-logger.module.ts
@@ -0,0 +1,10 @@
+import { NgModule } from '@angular/core';
+import { LoggerModule } from '@loafer/ng-logger';
+
+
+@NgModule({
+ imports: [
+ LoggerModule.forFeature({}),
+ ],
+})
+export class ProbeLoggerModule { }
diff --git a/@overflow/probe/probe-rpc.module.ts b/@overflow/probe/probe-rpc.module.ts
new file mode 100644
index 0000000..7a35671
--- /dev/null
+++ b/@overflow/probe/probe-rpc.module.ts
@@ -0,0 +1,13 @@
+import { NgModule } from '@angular/core';
+import { RPCModule } from '@loafer/ng-rpc';
+
+import {
+ SUBSCRIBERS,
+} from './subscriber';
+
+@NgModule({
+ imports: [
+ RPCModule.forFeature(SUBSCRIBERS),
+ ],
+})
+export class ProbeRPCModule { }
diff --git a/@overflow/probe/probe.module.ts b/@overflow/probe/probe.module.ts
index f69abb2..ebaf85b 100644
--- a/@overflow/probe/probe.module.ts
+++ b/@overflow/probe/probe.module.ts
@@ -4,6 +4,10 @@ import { CommonModule } from '@angular/common';
import { COMPONENTS } from './component';
import { SERVICES } from './service';
import { FormsModule } from '@angular/forms';
+
+import { ProbeRPCModule } from './probe-rpc.module';
+import { ProbeLoggerModule } from './probe-logger.module';
+
import { MetaModule } from '@overflow/meta/meta.module';
// import { InfraModule } from '@overflow/infra/infra.module';
import { UIModule } from '@overflow/shared/ui/ui.module';
@@ -15,6 +19,8 @@ import { UIModule } from '@overflow/shared/ui/ui.module';
UIModule,
MetaModule,
// InfraModule,
+ ProbeRPCModule,
+ ProbeLoggerModule,
],
declarations: [
COMPONENTS,
diff --git a/@overflow/probe/subscriber/index.ts b/@overflow/probe/subscriber/index.ts
new file mode 100644
index 0000000..b1a7cd2
--- /dev/null
+++ b/@overflow/probe/subscriber/index.ts
@@ -0,0 +1,5 @@
+import { ProbeSubscriber } from './probe.subscriber';
+
+export const SUBSCRIBERS = [
+ ProbeSubscriber,
+];
diff --git a/@overflow/probe/subscriber/probe.subscriber.ts b/@overflow/probe/subscriber/probe.subscriber.ts
new file mode 100644
index 0000000..44f580a
--- /dev/null
+++ b/@overflow/probe/subscriber/probe.subscriber.ts
@@ -0,0 +1,53 @@
+import { Injectable } from '@angular/core';
+
+import { Observable, Subject } from 'rxjs';
+
+import { RPCSubscriber } from '@loafer/ng-rpc';
+import { LoggerService } from '@loafer/ng-logger';
+
+import { Probe } from '@overflow/commons-typescript/model/probe';
+
+export interface ProbeNotify {
+ method: string;
+ params: Probe;
+}
+
+export class ProbeSubscriberSubject extends Subject {
+
+}
+
+@Injectable()
+export class ProbeSubscriber {
+ private probeSubscriberSubject: ProbeSubscriberSubject;
+
+ public constructor(
+ private loggerService: LoggerService,
+ ) {
+ this.probeSubscriberSubject = null;
+ }
+
+ public observable(): Observable {
+ if (null === this.probeSubscriberSubject) {
+ this.probeSubscriberSubject = new ProbeSubscriberSubject();
+ }
+ return this.probeSubscriberSubject.asObservable();
+ }
+
+ private publish(method: string, params: any): void {
+ this.probeSubscriberSubject.next({ method: method, params: params });
+ }
+
+ @RPCSubscriber({method: 'ProbeService.onConnect'})
+ public onConnect(probe: Probe): void {
+ this.loggerService.debug('ProbeService.onConnect probe:', probe);
+
+ this.publish('ProbeService.onConnect', probe);
+ }
+
+ @RPCSubscriber({method: 'ProbeService.onDisconnect'})
+ public onDisconnect(probe: Probe): void {
+ this.loggerService.debug('ProbeService.onDisconnect noAuthProbe:', probe);
+
+ this.publish('ProbeService.onDisconnect', probe);
+ }
+}
diff --git a/package-lock.json b/package-lock.json
index e2090b6..fbb7c37 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -409,9 +409,9 @@
}
},
"@loafer/ng-rpc": {
- "version": "0.0.2",
- "resolved": "https://nexus.loafle.net/repository/npm-all/@loafer/ng-rpc/-/ng-rpc-0.0.2.tgz",
- "integrity": "sha512-UkCljxw+1DXfug2bLyDoJpUvQCNmtBsx01KO4leBY7zk/afLE69Qq3ZFG2k7VbK0ZIIeBfJLGa4NUX/21J2RqQ==",
+ "version": "0.0.3",
+ "resolved": "https://nexus.loafle.net/repository/npm-all/@loafer/ng-rpc/-/ng-rpc-0.0.3.tgz",
+ "integrity": "sha512-OOr1KtD3hPrTzbrJWFDGVpBECEZpQaOGvM8kmbRMaZGxFOaku34TDTo5w22e5tF+MC4wd2Rec5roSY0g3Cj4JQ==",
"requires": {
"tslib": "^1.9.0"
}
@@ -3763,23 +3763,21 @@
"dev": true,
"optional": true,
"requires": {
- "delegates": "1.0.0",
- "readable-stream": "2.3.6"
+ "delegates": "^1.0.0",
+ "readable-stream": "^2.0.6"
}
},
"balanced-match": {
"version": "1.0.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
- "balanced-match": "1.0.0",
+ "balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
@@ -3792,20 +3790,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"core-util-is": {
"version": "1.0.2",
@@ -3846,7 +3841,7 @@
"dev": true,
"optional": true,
"requires": {
- "minipass": "2.2.4"
+ "minipass": "^2.2.1"
}
},
"fs.realpath": {
@@ -3861,14 +3856,14 @@
"dev": true,
"optional": true,
"requires": {
- "aproba": "1.2.0",
- "console-control-strings": "1.1.0",
- "has-unicode": "2.0.1",
- "object-assign": "4.1.1",
- "signal-exit": "3.0.2",
- "string-width": "1.0.2",
- "strip-ansi": "3.0.1",
- "wide-align": "1.1.2"
+ "aproba": "^1.0.3",
+ "console-control-strings": "^1.0.0",
+ "has-unicode": "^2.0.0",
+ "object-assign": "^4.1.0",
+ "signal-exit": "^3.0.0",
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1",
+ "wide-align": "^1.1.0"
}
},
"glob": {
@@ -3877,12 +3872,12 @@
"dev": true,
"optional": true,
"requires": {
- "fs.realpath": "1.0.0",
- "inflight": "1.0.6",
- "inherits": "2.0.3",
- "minimatch": "3.0.4",
- "once": "1.4.0",
- "path-is-absolute": "1.0.1"
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
}
},
"has-unicode": {
@@ -3897,7 +3892,7 @@
"dev": true,
"optional": true,
"requires": {
- "safer-buffer": "2.1.2"
+ "safer-buffer": "^2.1.0"
}
},
"ignore-walk": {
@@ -3906,7 +3901,7 @@
"dev": true,
"optional": true,
"requires": {
- "minimatch": "3.0.4"
+ "minimatch": "^3.0.4"
}
},
"inflight": {
@@ -3915,15 +3910,14 @@
"dev": true,
"optional": true,
"requires": {
- "once": "1.4.0",
- "wrappy": "1.0.2"
+ "once": "^1.3.0",
+ "wrappy": "1"
}
},
"inherits": {
"version": "2.0.3",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"ini": {
"version": "1.3.5",
@@ -3935,9 +3929,8 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
- "number-is-nan": "1.0.1"
+ "number-is-nan": "^1.0.0"
}
},
"isarray": {
@@ -3950,25 +3943,22 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
- "brace-expansion": "1.1.11"
+ "brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
- "safe-buffer": "5.1.1",
- "yallist": "3.0.2"
+ "safe-buffer": "^5.1.1",
+ "yallist": "^3.0.0"
}
},
"minizlib": {
@@ -3977,14 +3967,13 @@
"dev": true,
"optional": true,
"requires": {
- "minipass": "2.2.4"
+ "minipass": "^2.2.1"
}
},
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -4001,9 +3990,9 @@
"dev": true,
"optional": true,
"requires": {
- "debug": "2.6.9",
- "iconv-lite": "0.4.21",
- "sax": "1.2.4"
+ "debug": "^2.1.2",
+ "iconv-lite": "^0.4.4",
+ "sax": "^1.2.4"
}
},
"node-pre-gyp": {
@@ -4012,16 +4001,16 @@
"dev": true,
"optional": true,
"requires": {
- "detect-libc": "1.0.3",
- "mkdirp": "0.5.1",
- "needle": "2.2.0",
- "nopt": "4.0.1",
- "npm-packlist": "1.1.10",
- "npmlog": "4.1.2",
- "rc": "1.2.7",
- "rimraf": "2.6.2",
- "semver": "5.5.0",
- "tar": "4.4.1"
+ "detect-libc": "^1.0.2",
+ "mkdirp": "^0.5.1",
+ "needle": "^2.2.0",
+ "nopt": "^4.0.1",
+ "npm-packlist": "^1.1.6",
+ "npmlog": "^4.0.2",
+ "rc": "^1.1.7",
+ "rimraf": "^2.6.1",
+ "semver": "^5.3.0",
+ "tar": "^4"
}
},
"nopt": {
@@ -4030,8 +4019,8 @@
"dev": true,
"optional": true,
"requires": {
- "abbrev": "1.1.1",
- "osenv": "0.1.5"
+ "abbrev": "1",
+ "osenv": "^0.1.4"
}
},
"npm-bundled": {
@@ -4046,8 +4035,8 @@
"dev": true,
"optional": true,
"requires": {
- "ignore-walk": "3.0.1",
- "npm-bundled": "1.0.3"
+ "ignore-walk": "^3.0.1",
+ "npm-bundled": "^1.0.1"
}
},
"npmlog": {
@@ -4056,17 +4045,16 @@
"dev": true,
"optional": true,
"requires": {
- "are-we-there-yet": "1.1.4",
- "console-control-strings": "1.1.0",
- "gauge": "2.7.4",
- "set-blocking": "2.0.0"
+ "are-we-there-yet": "~1.1.2",
+ "console-control-strings": "~1.1.0",
+ "gauge": "~2.7.3",
+ "set-blocking": "~2.0.0"
}
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"object-assign": {
"version": "4.1.1",
@@ -4078,9 +4066,8 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
- "wrappy": "1.0.2"
+ "wrappy": "1"
}
},
"os-homedir": {
@@ -4101,8 +4088,8 @@
"dev": true,
"optional": true,
"requires": {
- "os-homedir": "1.0.2",
- "os-tmpdir": "1.0.2"
+ "os-homedir": "^1.0.0",
+ "os-tmpdir": "^1.0.0"
}
},
"path-is-absolute": {
@@ -4123,10 +4110,10 @@
"dev": true,
"optional": true,
"requires": {
- "deep-extend": "0.5.1",
- "ini": "1.3.5",
- "minimist": "1.2.0",
- "strip-json-comments": "2.0.1"
+ "deep-extend": "^0.5.1",
+ "ini": "~1.3.0",
+ "minimist": "^1.2.0",
+ "strip-json-comments": "~2.0.1"
},
"dependencies": {
"minimist": {
@@ -4143,13 +4130,13 @@
"dev": true,
"optional": true,
"requires": {
- "core-util-is": "1.0.2",
- "inherits": "2.0.3",
- "isarray": "1.0.0",
- "process-nextick-args": "2.0.0",
- "safe-buffer": "5.1.1",
- "string_decoder": "1.1.1",
- "util-deprecate": "1.0.2"
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
}
},
"rimraf": {
@@ -4158,7 +4145,7 @@
"dev": true,
"optional": true,
"requires": {
- "glob": "7.1.2"
+ "glob": "^7.0.5"
}
},
"safe-buffer": {
@@ -4200,11 +4187,10 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
- "code-point-at": "1.1.0",
- "is-fullwidth-code-point": "1.0.0",
- "strip-ansi": "3.0.1"
+ "code-point-at": "^1.0.0",
+ "is-fullwidth-code-point": "^1.0.0",
+ "strip-ansi": "^3.0.0"
}
},
"string_decoder": {
@@ -4213,7 +4199,7 @@
"dev": true,
"optional": true,
"requires": {
- "safe-buffer": "5.1.1"
+ "safe-buffer": "~5.1.0"
}
},
"strip-ansi": {
@@ -4221,7 +4207,7 @@
"bundled": true,
"dev": true,
"requires": {
- "ansi-regex": "2.1.1"
+ "ansi-regex": "^2.0.0"
}
},
"strip-json-comments": {
@@ -4236,13 +4222,13 @@
"dev": true,
"optional": true,
"requires": {
- "chownr": "1.0.1",
- "fs-minipass": "1.2.5",
- "minipass": "2.2.4",
- "minizlib": "1.1.0",
- "mkdirp": "0.5.1",
- "safe-buffer": "5.1.1",
- "yallist": "3.0.2"
+ "chownr": "^1.0.1",
+ "fs-minipass": "^1.2.5",
+ "minipass": "^2.2.4",
+ "minizlib": "^1.1.0",
+ "mkdirp": "^0.5.0",
+ "safe-buffer": "^5.1.1",
+ "yallist": "^3.0.2"
}
},
"util-deprecate": {
@@ -4257,7 +4243,7 @@
"dev": true,
"optional": true,
"requires": {
- "string-width": "1.0.2"
+ "string-width": "^1.0.2"
}
},
"wrappy": {
diff --git a/package.json b/package.json
index 54d4df5..f34fd7d 100644
--- a/package.json
+++ b/package.json
@@ -31,7 +31,7 @@
"@loafer/ng-entity": "^0.0.2",
"@loafer/ng-logger": "^0.0.1",
"@loafer/ng-rest": "^0.0.1",
- "@loafer/ng-rpc": "^0.0.2",
+ "@loafer/ng-rpc": "^0.0.3",
"@ngrx/core": "^1.2.0",
"@ngrx/effects": "^5.2.0",
"@ngrx/router-store": "^5.2.0",