Showing synchronizer notification
Change-Id: Ibc0ef77471026b48fa2e0a577adde9e43dde2a10
diff --git a/src/app/datasources/stores/synchronizer.store.ts b/src/app/datasources/stores/synchronizer.store.ts
new file mode 100644
index 0000000..598d23c
--- /dev/null
+++ b/src/app/datasources/stores/synchronizer.store.ts
@@ -0,0 +1,26 @@
+/// <reference path="../../../../typings/index.d.ts"/>
+
+import {Subject} from 'rxjs/Rx';
+import {IWSEvent, IWSEventService} from '../websocket/global';
+
+export class SynchronizerStore {
+ static $inject = ['WebSocket'];
+ private _notifications: Subject<IWSEvent> = new Subject();
+ constructor(
+ private webSocket: IWSEventService
+ ) {
+ this.webSocket.list()
+ .filter((e: IWSEvent) => {
+ return e.msg.changed_fields.indexOf('backend_status') > -1;
+ })
+ .subscribe(
+ (event: IWSEvent) => {
+ this._notifications.next(event);
+ }
+ );
+ }
+
+ query() {
+ return this._notifications.asObservable();
+ }
+}