From 1b691f5eb67d29b8d822ec8eb303e598a4609c12 Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Thu, 13 Sep 2018 14:40:04 +0200 Subject: [PATCH 1/2] Removed root injector --- client/src/app/app.component.ts | 45 +++---------------- .../app/core/services/autoupdate.service.ts | 3 +- .../src/app/core/services/config.service.ts | 5 +-- .../app/core/services/login-data.service.ts | 6 --- .../app/core/services/openslides.service.ts | 8 +++- .../src/app/core/services/operator.service.ts | 11 ++--- client/src/app/openslides.component.ts | 36 --------------- client/src/app/shared/models/agenda/item.ts | 16 +------ .../shared/models/assignments/assignment.ts | 18 +++----- .../app/shared/models/core/chat-message.ts | 5 --- .../app/shared/models/mediafiles/mediafile.ts | 5 --- .../app/shared/models/motions/motion-block.ts | 4 -- client/src/app/shared/models/topics/topic.ts | 10 ----- client/src/app/shared/models/users/group.ts | 8 ---- .../app/shared/models/users/personal-note.ts | 4 -- client/src/app/shared/models/users/user.ts | 5 --- client/src/app/site/base-repository.ts | 2 + .../category-list/category-list.component.ts | 13 ++++-- .../motion-detail/motion-detail.component.ts | 4 +- .../services/motion-repository.service.ts | 5 ++- client/src/app/site/start/start.component.ts | 3 +- client/src/main.ts | 4 -- 22 files changed, 46 insertions(+), 174 deletions(-) diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index c9f729762..4b24b5186 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -1,10 +1,6 @@ -import { Component, NgModuleRef } from '@angular/core'; +import { Component } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { OperatorService } from './core/services/operator.service'; -import { Subject } from 'rxjs'; -import { AppModule } from './app.module'; -import { OpenSlidesComponent } from './openslides.component'; -import { OpenSlidesService } from './core/services/openslides.service'; import { LoginDataService } from './core/services/login-data.service'; import { ConfigService } from './core/services/config.service'; @@ -17,20 +13,6 @@ import { ConfigService } from './core/services/config.service'; styleUrls: ['./app.component.scss'] }) export class AppComponent { - /** - * This subject gets called, when the bootstrapping of the hole application is done. - */ - private static bootstrapDoneSubject: Subject> = new Subject>(); - - /** - * This function should only be called, when the bootstrapping is done with a reference to - * the bootstrapped module. - * @param moduleRef Reference to the bootstrapped AppModule - */ - public static bootstrapDone(moduleRef: NgModuleRef): void { - AppComponent.bootstrapDoneSubject.next(moduleRef); - } - /** * Initialises the translation unit. * @param autoupdateService @@ -39,11 +21,11 @@ export class AppComponent { */ public constructor( translate: TranslateService, - private operator: OperatorService, - private OpenSlides: OpenSlidesService, - private configService: ConfigService, - private loginDataService: LoginDataService + operator: OperatorService, + configService: ConfigService, + loginDataService: LoginDataService ) { + console.log('app ctor'); // manually add the supported languages translate.addLangs(['en', 'de', 'fr']); // this language will be used as a fallback when a translation isn't found in the current language @@ -52,22 +34,5 @@ export class AppComponent { const browserLang = translate.getBrowserLang(); // try to use the browser language if it is available. If not, uses english. translate.use(translate.getLangs().includes(browserLang) ? browserLang : 'en'); - - AppComponent.bootstrapDoneSubject.asObservable().subscribe(this.setup.bind(this)); - } - - /** - * Gets called, when bootstrapping is done. Gets the root injector, sets up the operator and starts OpenSlides. - * @param moduleRef - */ - private setup(moduleRef: NgModuleRef): void { - OpenSlidesComponent.injector = moduleRef.injector; - - // Setup the operator after the root injector is known. - this.operator.setupSubscription(); - this.configService.setupSubscription(); - this.loginDataService.setupSubscription(); - - this.OpenSlides.bootup(); // Yeah! } } diff --git a/client/src/app/core/services/autoupdate.service.ts b/client/src/app/core/services/autoupdate.service.ts index 6a31eba0f..35ce98358 100644 --- a/client/src/app/core/services/autoupdate.service.ts +++ b/client/src/app/core/services/autoupdate.service.ts @@ -4,6 +4,7 @@ import { OpenSlidesComponent } from 'app/openslides.component'; import { WebsocketService } from './websocket.service'; import { CollectionStringModelMapperService } from './collectionStringModelMapper.service'; +import { DataStoreService } from './data-store.service'; /** * Handles the initial update and automatic updates using the {@link WebsocketService} @@ -20,7 +21,7 @@ export class AutoupdateService extends OpenSlidesComponent { * Constructor to create the AutoupdateService. Calls the constructor of the parent class. * @param websocketService */ - public constructor(websocketService: WebsocketService) { + public constructor(websocketService: WebsocketService, private DS: DataStoreService) { super(); websocketService.getOberservable('autoupdate').subscribe(response => { this.storeResponse(response); diff --git a/client/src/app/core/services/config.service.ts b/client/src/app/core/services/config.service.ts index da32623d2..b47b8de65 100644 --- a/client/src/app/core/services/config.service.ts +++ b/client/src/app/core/services/config.service.ts @@ -3,6 +3,7 @@ import { Injectable } from '@angular/core'; import { OpenSlidesComponent } from 'app/openslides.component'; import { Observable, BehaviorSubject } from 'rxjs'; import { Config } from '../../shared/models/core/config'; +import { DataStoreService } from './data-store.service'; /** * Handler for config variables. @@ -31,11 +32,9 @@ export class ConfigService extends OpenSlidesComponent { /** * Listen for changes of config variables. */ - public constructor() { + public constructor(private DS: DataStoreService) { super(); - } - public setupSubscription(): void { this.DS.changeObservable.subscribe(data => { // on changes notify the observers for specific keys. if (data instanceof Config && this.configSubjects[data.key]) { diff --git a/client/src/app/core/services/login-data.service.ts b/client/src/app/core/services/login-data.service.ts index 2f8af9f73..c8900840b 100644 --- a/client/src/app/core/services/login-data.service.ts +++ b/client/src/app/core/services/login-data.service.ts @@ -43,13 +43,7 @@ export class LoginDataService extends OpenSlidesComponent { */ public constructor(private configService: ConfigService) { super(); - } - /** - * Should be called, when the data store is set up. Updates the values when the - * corresponding config variables change. - */ - public setupSubscription(): void { this.configService.get('general_event_privacy_policy').subscribe(value => { this.setPrivacyPolicy(value); }); diff --git a/client/src/app/core/services/openslides.service.ts b/client/src/app/core/services/openslides.service.ts index f78c3269c..7672e2832 100644 --- a/client/src/app/core/services/openslides.service.ts +++ b/client/src/app/core/services/openslides.service.ts @@ -6,6 +6,7 @@ import { WebsocketService } from './websocket.service'; import { OperatorService } from './operator.service'; import { CacheService } from './cache.service'; import { AutoupdateService } from './autoupdate.service'; +import { DataStoreService } from './data-store.service'; /** * Handles the bootup/showdown of this application. @@ -32,15 +33,20 @@ export class OpenSlidesService extends OpenSlidesComponent { private operator: OperatorService, private websocketService: WebsocketService, private router: Router, - private autoupdateService: AutoupdateService + private autoupdateService: AutoupdateService, + private DS: DataStoreService ) { super(); + console.log('OS ctor'); + // Handler that gets called, if the websocket connection reconnects after a disconnection. // There might have changed something on the server, so we check the operator, if he changed. websocketService.reconnectEvent.subscribe(() => { this.checkOperator(); }); + + this.bootup(); } /** diff --git a/client/src/app/core/services/operator.service.ts b/client/src/app/core/services/operator.service.ts index 5e4449fd8..9b545c4b4 100644 --- a/client/src/app/core/services/operator.service.ts +++ b/client/src/app/core/services/operator.service.ts @@ -6,6 +6,7 @@ import { OpenSlidesComponent } from 'app/openslides.component'; import { Group } from 'app/shared/models/users/group'; import { User } from '../../shared/models/users/user'; import { environment } from 'environments/environment'; +import { DataStoreService } from './data-store.service'; /** * Permissions on the client are just strings. This makes clear, that @@ -74,15 +75,9 @@ export class OperatorService extends OpenSlidesComponent { /** * @param http HttpClient */ - public constructor(private http: HttpClient) { + public constructor(private http: HttpClient, private DS: DataStoreService) { super(); - } - /** - * Setup the subscription of the DataStore.Update the user and it's - * permissions if the user or groups changes. - */ - public setupSubscription(): void { this.DS.changeObservable.subscribe(newModel => { if (this._user) { if (newModel instanceof Group) { @@ -146,7 +141,7 @@ export class OperatorService extends OpenSlidesComponent { } } else { const permissionSet = new Set(); - this.user.groups.forEach(group => { + this.DS.getMany(Group, this.user.groups_id).forEach(group => { group.permissions.forEach(permission => { permissionSet.add(permission); }); diff --git a/client/src/app/openslides.component.ts b/client/src/app/openslides.component.ts index 0e191e43e..b2dfb4529 100644 --- a/client/src/app/openslides.component.ts +++ b/client/src/app/openslides.component.ts @@ -1,21 +1,10 @@ -import { Injector } from '@angular/core'; import { Observable, of } from 'rxjs'; -import { DataStoreService } from './core/services/data-store.service'; -import { CacheService } from './core/services/cache.service'; - /** * injects the {@link DataStoreService} to all its children and provides a generic function to catch errors * should be abstract and a mere parent to all {@link DataStoreService} accessors */ export abstract class OpenSlidesComponent { - /** - * The dataStore Service - */ - private static _DS: DataStoreService; - - public static injector: Injector; - /** * Empty constructor * @@ -24,31 +13,6 @@ export abstract class OpenSlidesComponent { */ public constructor() {} - /** - * getter to access the {@link DataStoreService} - * @example this.DS.get(User) - * @return access to dataStoreService - */ - public get DS(): DataStoreService { - if (!OpenSlidesComponent.injector) { - throw new Error('OpenSlides is not bootstrapping right. This component should have the Injector.'); - } - if (OpenSlidesComponent._DS == null) { - const injector = Injector.create({ - providers: [ - { - provide: DataStoreService, - useClass: DataStoreService, - deps: [CacheService] - } - ], - parent: OpenSlidesComponent.injector - }); - OpenSlidesComponent._DS = injector.get(DataStoreService); - } - return OpenSlidesComponent._DS; - } - /** * Generic error handling for everything that makes HTTP Calls * TODO: could have more features diff --git a/client/src/app/shared/models/agenda/item.ts b/client/src/app/shared/models/agenda/item.ts index 9a4334a08..6c7931ae0 100644 --- a/client/src/app/shared/models/agenda/item.ts +++ b/client/src/app/shared/models/agenda/item.ts @@ -1,6 +1,5 @@ import { BaseModel } from '../base.model'; import { Speaker } from './speaker'; -import { User } from '../users/user'; interface ContentObject { id: number; @@ -23,7 +22,7 @@ export class Item extends BaseModel { public duration: number; public speakers: Speaker[]; public speaker_list_closed: boolean; - private content_object: ContentObject; + public content_object: ContentObject; public weight: number; public parent_id: number; @@ -31,19 +30,6 @@ export class Item extends BaseModel { super('agenda/item', input); } - public getSpeakers(): User[] { - const speakerIds: number[] = this.speakers - .sort((a: Speaker, b: Speaker) => { - return a.weight - b.weight; - }) - .map((speaker: Speaker) => speaker.user_id); - return this.DS.getMany('users/user', speakerIds); - } - - public get contentObject(): BaseModel { - return this.DS.get(this.content_object.collection, this.content_object.id); - } - public deserialize(input: any): void { Object.assign(this, input); diff --git a/client/src/app/shared/models/assignments/assignment.ts b/client/src/app/shared/models/assignments/assignment.ts index 99809b142..aa9260d5a 100644 --- a/client/src/app/shared/models/assignments/assignment.ts +++ b/client/src/app/shared/models/assignments/assignment.ts @@ -1,8 +1,6 @@ import { BaseModel } from '../base.model'; import { AssignmentUser } from './assignment-user'; import { Poll } from './poll'; -import { Tag } from '../core/tag'; -import { User } from '../users/user'; /** * Representation of an assignment. @@ -24,16 +22,12 @@ export class Assignment extends BaseModel { super('assignments/assignment', input); } - public getAssignmentReleatedUsers(): BaseModel | BaseModel[] { - const userIds = []; - this.assignment_related_users.forEach(user => { - userIds.push(user.user_id); - }); - return this.DS.getMany('users/user', userIds); - } - - public getTags(): BaseModel | BaseModel[] { - return this.DS.getMany('core/tag', this.tags_id); + public get candidateIds(): number[] { + return this.assignment_related_users + .sort((a: AssignmentUser, b: AssignmentUser) => { + return a.weight - b.weight; + }) + .map((candidate: AssignmentUser) => candidate.user_id); } public deserialize(input: any): void { diff --git a/client/src/app/shared/models/core/chat-message.ts b/client/src/app/shared/models/core/chat-message.ts index 073adcf20..d254692f3 100644 --- a/client/src/app/shared/models/core/chat-message.ts +++ b/client/src/app/shared/models/core/chat-message.ts @@ -1,5 +1,4 @@ import { BaseModel } from '../base.model'; -import { User } from '../users/user'; /** * Representation of chat messages. @@ -15,10 +14,6 @@ export class ChatMessage extends BaseModel { super('core/chat-message', input); } - public getUser(): User { - return this.DS.get('users/user', this.user_id); - } - public toString(): string { return this.message; } diff --git a/client/src/app/shared/models/mediafiles/mediafile.ts b/client/src/app/shared/models/mediafiles/mediafile.ts index 8e28ee059..bb5b63145 100644 --- a/client/src/app/shared/models/mediafiles/mediafile.ts +++ b/client/src/app/shared/models/mediafiles/mediafile.ts @@ -1,6 +1,5 @@ import { BaseModel } from '../base.model'; import { File } from './file'; -import { User } from '../users/user'; /** * Representation of MediaFile. Has the nested property "File" @@ -25,10 +24,6 @@ export class Mediafile extends BaseModel { this.mediafile = new File(input.mediafile); } - public getUploader(): User { - return this.DS.get('users/user', this.uploader_id); - } - public toString(): string { return this.title; } diff --git a/client/src/app/shared/models/motions/motion-block.ts b/client/src/app/shared/models/motions/motion-block.ts index d8e7340ef..dc11f8606 100644 --- a/client/src/app/shared/models/motions/motion-block.ts +++ b/client/src/app/shared/models/motions/motion-block.ts @@ -14,10 +14,6 @@ export class MotionBlock extends BaseModel { super('motions/motion-block', input); } - public getAgenda(): BaseModel | BaseModel[] { - return this.DS.get('agenda/item', this.agenda_item_id); - } - public toString(): string { return this.title; } diff --git a/client/src/app/shared/models/topics/topic.ts b/client/src/app/shared/models/topics/topic.ts index 84bc7edb2..71b1671d0 100644 --- a/client/src/app/shared/models/topics/topic.ts +++ b/client/src/app/shared/models/topics/topic.ts @@ -1,6 +1,4 @@ import { BaseModel } from '../base.model'; -import { Mediafile } from '../mediafiles/mediafile'; -import { Item } from '../agenda/item'; /** * Representation of a topic. @@ -17,14 +15,6 @@ export class Topic extends BaseModel { super('topics/topic', input); } - public getAttachments(): Mediafile[] { - return this.DS.getMany('mediafiles/mediafile', this.attachments_id); - } - - public getAgenda(): Item { - return this.DS.get('agenda/item', this.agenda_item_id); - } - public toString(): string { return this.title; } diff --git a/client/src/app/shared/models/users/group.ts b/client/src/app/shared/models/users/group.ts index ce6e8f76b..fed9c4df4 100644 --- a/client/src/app/shared/models/users/group.ts +++ b/client/src/app/shared/models/users/group.ts @@ -1,5 +1,4 @@ import { BaseModel } from '../base.model'; -import { User } from './user'; /** * Representation of user group. @@ -14,13 +13,6 @@ export class Group extends BaseModel { super('users/group', input); } - public get users(): User[] { - // We have to use the string version to avoid circular dependencies. - return this.DS.filter('users/user', user => { - return user.groups_id.includes(this.id); - }); - } - public toString(): string { return this.name; } diff --git a/client/src/app/shared/models/users/personal-note.ts b/client/src/app/shared/models/users/personal-note.ts index a80233e37..48510110c 100644 --- a/client/src/app/shared/models/users/personal-note.ts +++ b/client/src/app/shared/models/users/personal-note.ts @@ -14,10 +14,6 @@ export class PersonalNote extends BaseModel { super('users/personal-note', input); } - public getUser(): User { - return this.DS.get('users/user', this.user_id); - } - public toString(): string { return this.notes.toString(); } diff --git a/client/src/app/shared/models/users/user.ts b/client/src/app/shared/models/users/user.ts index ce0b058f8..b6fd2c3e3 100644 --- a/client/src/app/shared/models/users/user.ts +++ b/client/src/app/shared/models/users/user.ts @@ -1,5 +1,4 @@ import { BaseModel } from '../base.model'; -import { Group } from './group'; /** * Representation of a user in contrast to the operator. @@ -27,10 +26,6 @@ export class User extends BaseModel { super('users/user', input); } - public get groups(): Group[] { - return this.DS.getMany(Group, this.groups_id); - } - public get full_name(): string { let name = this.short_name; const addition: string[] = []; diff --git a/client/src/app/site/base-repository.ts b/client/src/app/site/base-repository.ts index 1bed04e54..75f15ef90 100644 --- a/client/src/app/site/base-repository.ts +++ b/client/src/app/site/base-repository.ts @@ -3,6 +3,7 @@ import { BehaviorSubject, Observable } from 'rxjs'; import { BaseViewModel } from './base-view-model'; import { BaseModel, ModelConstructor } from '../shared/models/base.model'; import { CollectionStringModelMapperService } from '../core/services/collectionStringModelMapper.service'; +import { DataStoreService } from '../core/services/data-store.service'; export abstract class BaseRepository extends OpenSlidesComponent { /** @@ -27,6 +28,7 @@ export abstract class BaseRepository, protected depsModelCtors: ModelConstructor[] ) { diff --git a/client/src/app/site/motions/components/category-list/category-list.component.ts b/client/src/app/site/motions/components/category-list/category-list.component.ts index 1d44bc341..2923a1761 100644 --- a/client/src/app/site/motions/components/category-list/category-list.component.ts +++ b/client/src/app/site/motions/components/category-list/category-list.component.ts @@ -6,6 +6,7 @@ import { TranslateService } from '@ngx-translate/core'; import { BaseComponent } from '../../../../base.component'; import { Category } from '../../../../shared/models/motions/category'; +import { DataStoreService } from '../../../../core/services/data-store.service'; /** * List view for the categories. @@ -31,19 +32,25 @@ export class CategoryListComponent extends BaseComponent implements OnInit { /** * The table itself. */ - @ViewChild(MatTable) public table: MatTable; + @ViewChild(MatTable) + public table: MatTable; /** * Sort the Table */ - @ViewChild(MatSort) public sort: MatSort; + @ViewChild(MatSort) + public sort: MatSort; /** * The usual component constructor * @param titleService * @param translate */ - public constructor(protected titleService: Title, protected translate: TranslateService) { + public constructor( + protected titleService: Title, + protected translate: TranslateService, + protected DS: DataStoreService + ) { super(titleService, translate); } diff --git a/client/src/app/site/motions/components/motion-detail/motion-detail.component.ts b/client/src/app/site/motions/components/motion-detail/motion-detail.component.ts index 1d8e76ed5..c4d387969 100644 --- a/client/src/app/site/motions/components/motion-detail/motion-detail.component.ts +++ b/client/src/app/site/motions/components/motion-detail/motion-detail.component.ts @@ -9,6 +9,7 @@ import { ViewportService } from '../../../../core/services/viewport.service'; import { MotionRepositoryService } from '../../services/motion-repository.service'; import { ViewMotion } from '../../models/view-motion'; import { User } from '../../../../shared/models/users/user'; +import { DataStoreService } from '../../../../core/services/data-store.service'; /** * Component for the motion detail view @@ -77,7 +78,8 @@ export class MotionDetailComponent extends BaseComponent implements OnInit { private router: Router, private route: ActivatedRoute, private formBuilder: FormBuilder, - private repo: MotionRepositoryService + private repo: MotionRepositoryService, + private DS: DataStoreService ) { super(); this.createForm(); diff --git a/client/src/app/site/motions/services/motion-repository.service.ts b/client/src/app/site/motions/services/motion-repository.service.ts index 96c21afc5..d2290aba7 100644 --- a/client/src/app/site/motions/services/motion-repository.service.ts +++ b/client/src/app/site/motions/services/motion-repository.service.ts @@ -9,6 +9,7 @@ import { WorkflowState } from '../../../shared/models/motions/workflow-state'; import { ViewMotion } from '../models/view-motion'; import { Observable } from 'rxjs'; import { BaseRepository } from '../../base-repository'; +import { DataStoreService } from '../../../core/services/data-store.service'; /** * Repository Services for motions (and potentially categories) @@ -31,8 +32,8 @@ export class MotionRepositoryService extends BaseRepository * Handles CRUD using an observer to the DataStore * @param DataSend */ - public constructor(private dataSend: DataSendService) { - super(Motion, [Category, User, Workflow]); + public constructor(DS: DataStoreService, private dataSend: DataSendService) { + super(DS, Motion, [Category, User, Workflow]); } /** diff --git a/client/src/app/site/start/start.component.ts b/client/src/app/site/start/start.component.ts index ee3b28395..236ebdb0d 100644 --- a/client/src/app/site/start/start.component.ts +++ b/client/src/app/site/start/start.component.ts @@ -9,6 +9,7 @@ import { User } from 'app/shared/models/users/user'; import { Config } from '../../shared/models/core/config'; import { Motion } from '../../shared/models/motions/motion'; import { MotionSubmitter } from '../../shared/models/motions/motion-submitter'; +import { DataStoreService } from '../../core/services/data-store.service'; @Component({ selector: 'os-start', @@ -25,7 +26,7 @@ export class StartComponent extends BaseComponent implements OnInit { * @param titleService the title serve * @param translate to translation module */ - public constructor(titleService: Title, protected translate: TranslateService) { + public constructor(titleService: Title, protected translate: TranslateService, private DS: DataStoreService) { super(titleService, translate); } diff --git a/client/src/main.ts b/client/src/main.ts index 379e23834..cbf340b02 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -3,7 +3,6 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; import { environment } from './environments/environment'; -import { AppComponent } from 'app/app.component'; if (environment.production) { enableProdMode(); @@ -11,7 +10,4 @@ if (environment.production) { platformBrowserDynamic() .bootstrapModule(AppModule) - .then((moduleRef: NgModuleRef) => { - AppComponent.bootstrapDone(moduleRef); - }) .catch(err => console.log(err)); From faa2507c0daff059466f1e97d77a90ba6afac5f9 Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Thu, 13 Sep 2018 15:07:56 +0200 Subject: [PATCH 2/2] remove console.log --- client/src/app/app.component.ts | 1 - client/src/app/core/services/openslides.service.ts | 2 -- 2 files changed, 3 deletions(-) diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 4b24b5186..8fe2e8a55 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -25,7 +25,6 @@ export class AppComponent { configService: ConfigService, loginDataService: LoginDataService ) { - console.log('app ctor'); // manually add the supported languages translate.addLangs(['en', 'de', 'fr']); // this language will be used as a fallback when a translation isn't found in the current language diff --git a/client/src/app/core/services/openslides.service.ts b/client/src/app/core/services/openslides.service.ts index 7672e2832..b71e2eaaa 100644 --- a/client/src/app/core/services/openslides.service.ts +++ b/client/src/app/core/services/openslides.service.ts @@ -38,8 +38,6 @@ export class OpenSlidesService extends OpenSlidesComponent { ) { super(); - console.log('OS ctor'); - // Handler that gets called, if the websocket connection reconnects after a disconnection. // There might have changed something on the server, so we check the operator, if he changed. websocketService.reconnectEvent.subscribe(() => {