Removed OpenSlidesComponent

This commit is contained in:
FinnStutzenstein 2019-02-08 17:24:32 +01:00
parent 76210e807f
commit 090bf49d97
22 changed files with 35 additions and 136 deletions

View File

@ -1,5 +1,5 @@
import { Title } from '@angular/platform-browser'; import { Title } from '@angular/platform-browser';
import { OpenSlidesComponent } from './openslides.component';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
/** /**
@ -9,7 +9,7 @@ import { TranslateService } from '@ngx-translate/core';
* A BaseComponent is an OpenSlides Component. * A BaseComponent is an OpenSlides Component.
* Components in the 'Side'- or 'projector' Folder are BaseComponents * Components in the 'Side'- or 'projector' Folder are BaseComponents
*/ */
export abstract class BaseComponent extends OpenSlidesComponent { export abstract class BaseComponent {
/** /**
* To manipulate the browser title bar, adds the Suffix "OpenSlides" * To manipulate the browser title bar, adds the Suffix "OpenSlides"
* *
@ -38,12 +38,7 @@ export abstract class BaseComponent extends OpenSlidesComponent {
link image charmap table | code preview fullscreen` link image charmap table | code preview fullscreen`
}; };
/** public constructor(protected titleService?: Title, protected translate?: TranslateService) {}
* Child constructor that implements the titleServices and calls Super from OpenSlidesComponent
*/
public constructor(protected titleService?: Title, protected translate?: TranslateService) {
super();
}
/** /**
* Set the title in web browser using angulars TitleService * Set the title in web browser using angulars TitleService

View File

@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { OperatorService } from 'app/core/core-services/operator.service'; import { OperatorService } from 'app/core/core-services/operator.service';
import { OpenSlidesComponent } from '../../openslides.component';
import { environment } from 'environments/environment'; import { environment } from 'environments/environment';
import { User } from '../../shared/models/users/user'; import { User } from '../../shared/models/users/user';
import { OpenSlidesService } from './openslides.service'; import { OpenSlidesService } from './openslides.service';
@ -22,11 +21,10 @@ interface LoginResponse {
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class AuthService extends OpenSlidesComponent { export class AuthService {
/** /**
* Initializes the httpClient and the {@link OperatorService}. * Initializes the httpClient and the {@link OperatorService}.
* *
* Calls `super()` from the parent class.
* @param http HttpService to send requests to the server * @param http HttpService to send requests to the server
* @param operator Who is using OpenSlides * @param operator Who is using OpenSlides
* @param OpenSlides The openslides service * @param OpenSlides The openslides service
@ -37,9 +35,7 @@ export class AuthService extends OpenSlidesComponent {
private operator: OperatorService, private operator: OperatorService,
private OpenSlides: OpenSlidesService, private OpenSlides: OpenSlidesService,
private router: Router private router: Router
) { ) {}
super();
}
/** /**
* Try to log in a user. * Try to log in a user.

View File

@ -1,8 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component';
import { WebsocketService } from './websocket.service'; import { WebsocketService } from './websocket.service';
import { CollectionStringMapperService } from './collectionStringMapper.service'; import { CollectionStringMapperService } from './collectionStringMapper.service';
import { DataStoreService } from './data-store.service'; import { DataStoreService } from './data-store.service';
import { BaseModel } from '../../shared/models/base/base-model'; import { BaseModel } from '../../shared/models/base/base-model';
@ -42,13 +40,11 @@ interface AutoupdateFormat {
* Handles the initial update and automatic updates using the {@link WebsocketService} * Handles the initial update and automatic updates using the {@link WebsocketService}
* Incoming objects, usually BaseModels, will be saved in the dataStore (`this.DS`) * Incoming objects, usually BaseModels, will be saved in the dataStore (`this.DS`)
* This service usually creates all models * This service usually creates all models
*
* The dataStore will injected over the parent class: {@link OpenSlidesComponent}.
*/ */
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class AutoupdateService extends OpenSlidesComponent { export class AutoupdateService {
/** /**
* Constructor to create the AutoupdateService. Calls the constructor of the parent class. * Constructor to create the AutoupdateService. Calls the constructor of the parent class.
* @param websocketService * @param websocketService
@ -60,7 +56,6 @@ export class AutoupdateService extends OpenSlidesComponent {
private DS: DataStoreService, private DS: DataStoreService,
private modelMapper: CollectionStringMapperService private modelMapper: CollectionStringMapperService
) { ) {
super();
this.websocketService.getOberservable<AutoupdateFormat>('autoupdate').subscribe(response => { this.websocketService.getOberservable<AutoupdateFormat>('autoupdate').subscribe(response => {
this.storeResponse(response); this.storeResponse(response);
}); });

View File

@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
import { Subject, Observable } from 'rxjs'; import { Subject, Observable } from 'rxjs';
import { OpenSlidesComponent } from 'app/openslides.component';
import { WebsocketService } from './websocket.service'; import { WebsocketService } from './websocket.service';
import { OperatorService } from './operator.service'; import { OperatorService } from './operator.service';
@ -66,7 +65,7 @@ export interface NotifyResponse<T> extends NotifyBase<T> {
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class NotifyService extends OpenSlidesComponent { export class NotifyService {
/** /**
* A general subject for all messages. * A general subject for all messages.
*/ */
@ -84,8 +83,6 @@ export class NotifyService extends OpenSlidesComponent {
* @param websocketService * @param websocketService
*/ */
public constructor(private websocketService: WebsocketService, private operator: OperatorService) { public constructor(private websocketService: WebsocketService, private operator: OperatorService) {
super();
websocketService.getOberservable<NotifyResponse<any>>('notify').subscribe(notify => { websocketService.getOberservable<NotifyResponse<any>>('notify').subscribe(notify => {
notify.sendByThisUser = notify.senderUserId === (this.operator.user ? this.operator.user.id : 0); notify.sendByThisUser = notify.senderUserId === (this.operator.user ? this.operator.user.id : 0);
this.notifySubject.next(notify); this.notifySubject.next(notify);

View File

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component';
import { DataStoreService } from './data-store.service'; import { DataStoreService } from './data-store.service';
import { WhoAmIResponse } from './operator.service'; import { WhoAmIResponse } from './operator.service';
@ -13,7 +12,7 @@ import { WhoAmIResponse } from './operator.service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class OfflineService extends OpenSlidesComponent { export class OfflineService {
private _offline = false; private _offline = false;
public get offline(): boolean { public get offline(): boolean {
@ -24,9 +23,7 @@ export class OfflineService extends OpenSlidesComponent {
* Constructor to create the AutoupdateService. Calls the constructor of the parent class. * Constructor to create the AutoupdateService. Calls the constructor of the parent class.
* @param DS * @param DS
*/ */
public constructor(private DS: DataStoreService) { public constructor(private DS: DataStoreService) {}
super();
}
/** /**
* Sets the offline flag. Restores the DataStoreService to the last known configuration. * Sets the offline flag. Restores the DataStoreService to the last known configuration.

View File

@ -1,7 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { OpenSlidesComponent } from 'app/openslides.component';
import { WebsocketService } from './websocket.service'; import { WebsocketService } from './websocket.service';
import { OperatorService } from './operator.service'; import { OperatorService } from './operator.service';
import { StorageService } from './storage.service'; import { StorageService } from './storage.service';
@ -14,7 +13,7 @@ import { DataStoreService } from './data-store.service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class OpenSlidesService extends OpenSlidesComponent { export class OpenSlidesService {
/** /**
* if the user tries to access a certain URL without being authenticated, the URL will be stored here * if the user tries to access a certain URL without being authenticated, the URL will be stored here
*/ */
@ -37,8 +36,6 @@ export class OpenSlidesService extends OpenSlidesComponent {
private autoupdateService: AutoupdateService, private autoupdateService: AutoupdateService,
private DS: DataStoreService private DS: DataStoreService
) { ) {
super();
// Handler that gets called, if the websocket connection reconnects after a disconnection. // 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. // There might have changed something on the server, so we check the operator, if he changed.
websocketService.reconnectEvent.subscribe(() => { websocketService.reconnectEvent.subscribe(() => {

View File

@ -3,7 +3,6 @@ import { HttpClient } from '@angular/common/http';
import { Observable, BehaviorSubject } from 'rxjs'; import { Observable, BehaviorSubject } from 'rxjs';
import { OpenSlidesComponent } from 'app/openslides.component';
import { Group } from 'app/shared/models/users/group'; import { Group } from 'app/shared/models/users/group';
import { User } from '../../shared/models/users/user'; import { User } from '../../shared/models/users/user';
import { environment } from 'environments/environment'; import { environment } from 'environments/environment';
@ -34,13 +33,11 @@ export interface WhoAmIResponse {
* *
* Changes in operator can be observed, directives do so on order to show * Changes in operator can be observed, directives do so on order to show
* or hide certain information. * or hide certain information.
*
* The operator is an {@link OpenSlidesComponent}.
*/ */
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class OperatorService extends OpenSlidesComponent implements OnAfterAppsLoaded { export class OperatorService implements OnAfterAppsLoaded {
/** /**
* The operator. * The operator.
*/ */
@ -119,8 +116,6 @@ export class OperatorService extends OpenSlidesComponent implements OnAfterAppsL
private offlineService: OfflineService, private offlineService: OfflineService,
private collectionStringMapperService: CollectionStringMapperService private collectionStringMapperService: CollectionStringMapperService
) { ) {
super();
this.DS.changeObservable.subscribe(newModel => { this.DS.changeObservable.subscribe(newModel => {
if (this._user) { if (this._user) {
if (newModel instanceof Group) { if (newModel instanceof Group) {

View File

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component';
import { import {
Projectable, Projectable,
ProjectorElementBuildDeskriptor, ProjectorElementBuildDeskriptor,
@ -29,7 +28,7 @@ import { ViewModelStoreService } from './view-model-store.service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class ProjectorService extends OpenSlidesComponent { export class ProjectorService {
/** /**
* Constructor. * Constructor.
* *
@ -41,9 +40,7 @@ export class ProjectorService extends OpenSlidesComponent {
private http: HttpService, private http: HttpService,
private slideManager: SlideManager, private slideManager: SlideManager,
private viewModelStore: ViewModelStoreService private viewModelStore: ViewModelStoreService
) { ) {}
super();
}
/** /**
* Retusn the identifiable projector element from the given types of slides/elements/descriptors * Retusn the identifiable projector element from the given types of slides/elements/descriptors

View File

@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs'; import { BehaviorSubject, Observable } from 'rxjs';
import { OpenSlidesComponent } from 'app/openslides.component';
import { HttpService } from './http.service'; import { HttpService } from './http.service';
import { environment } from 'environments/environment.prod'; import { environment } from 'environments/environment.prod';
@ -16,7 +15,7 @@ import { environment } from 'environments/environment.prod';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class ServertimeService extends OpenSlidesComponent { export class ServertimeService {
private static FAILURE_TIMEOUT = 30; private static FAILURE_TIMEOUT = 30;
private static NORMAL_TIMEOUT = 60 * 5; private static NORMAL_TIMEOUT = 60 * 5;
@ -25,9 +24,7 @@ export class ServertimeService extends OpenSlidesComponent {
*/ */
private serverOffsetSubject = new BehaviorSubject<number>(0); private serverOffsetSubject = new BehaviorSubject<number>(0);
public constructor(private http: HttpService) { public constructor(private http: HttpService) {}
super();
}
/** /**
* Starts the scheduler to sync with the server. * Starts the scheduler to sync with the server.

View File

@ -1,6 +1,5 @@
import { BehaviorSubject, Observable, Subject } from 'rxjs'; import { BehaviorSubject, Observable, Subject } from 'rxjs';
import { OpenSlidesComponent } from '../../openslides.component';
import { BaseViewModel } from '../../site/base/base-view-model'; import { BaseViewModel } from '../../site/base/base-view-model';
import { BaseModel, ModelConstructor } from '../../shared/models/base/base-model'; import { BaseModel, ModelConstructor } from '../../shared/models/base/base-model';
import { CollectionStringMapperService } from '../core-services/collectionStringMapper.service'; import { CollectionStringMapperService } from '../core-services/collectionStringMapper.service';
@ -10,8 +9,7 @@ import { auditTime } from 'rxjs/operators';
import { ViewModelStoreService } from '../core-services/view-model-store.service'; import { ViewModelStoreService } from '../core-services/view-model-store.service';
import { OnAfterAppsLoaded } from '../onAfterAppsLoaded'; import { OnAfterAppsLoaded } from '../onAfterAppsLoaded';
export abstract class BaseRepository<V extends BaseViewModel, M extends BaseModel> extends OpenSlidesComponent export abstract class BaseRepository<V extends BaseViewModel, M extends BaseModel> implements OnAfterAppsLoaded {
implements OnAfterAppsLoaded {
/** /**
* Stores all the viewModel in an object * Stores all the viewModel in an object
*/ */
@ -54,7 +52,6 @@ export abstract class BaseRepository<V extends BaseViewModel, M extends BaseMode
protected baseModelCtor: ModelConstructor<M>, protected baseModelCtor: ModelConstructor<M>,
protected depsModelCtors?: ModelConstructor<BaseModel>[] protected depsModelCtors?: ModelConstructor<BaseModel>[]
) { ) {
super();
this._name = baseModelCtor.name; this._name = baseModelCtor.name;
} }

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from '../../openslides.component';
import { MatDialog } from '@angular/material'; import { MatDialog } from '@angular/material';
import { import {
ChoiceDialogComponent, ChoiceDialogComponent,
ChoiceDialogOptions, ChoiceDialogOptions,
@ -13,15 +13,13 @@ import {
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class ChoiceService extends OpenSlidesComponent { export class ChoiceService {
/** /**
* Ctor. * Ctor.
* *
* @param dialog For opening the ChoiceDialog * @param dialog For opening the ChoiceDialog
*/ */
public constructor(private dialog: MatDialog) { public constructor(private dialog: MatDialog) {}
super();
}
/** /**
* Opens the dialog. Returns the chosen value after the user accepts. * Opens the dialog. Returns the chosen value after the user accepts.

View File

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component';
import { Observable, BehaviorSubject } from 'rxjs'; import { Observable, BehaviorSubject } from 'rxjs';
import { Config } from '../../shared/models/core/config'; import { Config } from '../../shared/models/core/config';
import { DataStoreService } from '../core-services/data-store.service'; import { DataStoreService } from '../core-services/data-store.service';
@ -23,7 +22,7 @@ import { DataStoreService } from '../core-services/data-store.service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class ConfigService extends OpenSlidesComponent { export class ConfigService {
/** /**
* Stores a subject per key. Values are published, if the DataStore gets an update. * Stores a subject per key. Values are published, if the DataStore gets an update.
*/ */
@ -33,8 +32,6 @@ export class ConfigService extends OpenSlidesComponent {
* Listen for changes of config variables. * Listen for changes of config variables.
*/ */
public constructor(private DS: DataStoreService) { public constructor(private DS: DataStoreService) {
super();
this.DS.changeObservable.subscribe(data => { this.DS.changeObservable.subscribe(data => {
// on changes notify the observers for specific keys. // on changes notify the observers for specific keys.
if (data instanceof Config && this.configSubjects[data.key]) { if (data instanceof Config && this.configSubjects[data.key]) {

View File

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component';
import { WebsocketService } from '../core-services/websocket.service'; import { WebsocketService } from '../core-services/websocket.service';
import { Observable, of, Subject } from 'rxjs'; import { Observable, of, Subject } from 'rxjs';
@ -24,7 +23,7 @@ interface Constants {
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class ConstantsService extends OpenSlidesComponent { export class ConstantsService {
/** /**
* The constants * The constants
*/ */
@ -49,8 +48,6 @@ export class ConstantsService extends OpenSlidesComponent {
* @param websocketService * @param websocketService
*/ */
public constructor(private websocketService: WebsocketService) { public constructor(private websocketService: WebsocketService) {
super();
// The hook for recieving constants. // The hook for recieving constants.
websocketService.getOberservable<Constants>('constants').subscribe(constants => { websocketService.getOberservable<Constants>('constants').subscribe(constants => {
this.constants = constants; this.constants = constants;

View File

@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs'; import { Observable, Subject } from 'rxjs';
import { OpenSlidesComponent } from 'app/openslides.component';
import { NotifyService } from '../core-services/notify.service'; import { NotifyService } from '../core-services/notify.service';
import { OperatorService } from '../core-services/operator.service'; import { OperatorService } from '../core-services/operator.service';
@ -25,7 +24,7 @@ const RESPONSE_NAME = 'count-user-response';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class CountUsersService extends OpenSlidesComponent { export class CountUsersService {
private activeCounts: { [token: string]: Subject<number> } = {}; private activeCounts: { [token: string]: Subject<number> } = {};
private currentUserId: number; private currentUserId: number;
@ -37,8 +36,6 @@ export class CountUsersService extends OpenSlidesComponent {
* @param operator * @param operator
*/ */
public constructor(private notifyService: NotifyService, operator: OperatorService) { public constructor(private notifyService: NotifyService, operator: OperatorService) {
super();
// Listen for requests to send an answer. // Listen for requests to send an answer.
this.notifyService.getMessageObservable<CountUserRequest>(REQUEST_NAME).subscribe(request => { this.notifyService.getMessageObservable<CountUserRequest>(REQUEST_NAME).subscribe(request => {
if (request.content.token) { if (request.content.token) {

View File

@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs'; import { BehaviorSubject, Observable } from 'rxjs';
import { OpenSlidesComponent } from 'app/openslides.component';
import { ConfigService } from './config.service'; import { ConfigService } from './config.service';
/** /**
@ -12,7 +11,7 @@ import { ConfigService } from './config.service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class LoginDataService extends OpenSlidesComponent { export class LoginDataService {
/** /**
* Holds the privacy policy * Holds the privacy policy
*/ */
@ -43,8 +42,6 @@ export class LoginDataService extends OpenSlidesComponent {
* @param configService * @param configService
*/ */
public constructor(private configService: ConfigService) { public constructor(private configService: ConfigService) {
super();
this.configService.get<string>('general_event_privacy_policy').subscribe(value => { this.configService.get<string>('general_event_privacy_policy').subscribe(value => {
this.setPrivacyPolicy(value); this.setPrivacyPolicy(value);
}); });

View File

@ -1,8 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component';
import { Projectable, ProjectorElementBuildDeskriptor, isProjectable } from 'app/site/base/projectable';
import { MatDialog } from '@angular/material'; import { MatDialog } from '@angular/material';
import { Projectable, ProjectorElementBuildDeskriptor, isProjectable } from 'app/site/base/projectable';
import { import {
ProjectionDialogComponent, ProjectionDialogComponent,
ProjectionDialogReturnType ProjectionDialogReturnType
@ -15,16 +14,14 @@ import { ProjectorService } from '../core-services/projector.service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class ProjectionDialogService extends OpenSlidesComponent { export class ProjectionDialogService {
/** /**
* Constructor. * Constructor.
* *
* @param dialog * @param dialog
* @param projectorService * @param projectorService
*/ */
public constructor(private dialog: MatDialog, private projectorService: ProjectorService) { public constructor(private dialog: MatDialog, private projectorService: ProjectorService) {}
super();
}
/** /**
* Opens the projection dialog for the given projectable. After the user's choice, * Opens the projection dialog for the given projectable. After the user's choice,

View File

@ -1,5 +1,4 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component';
import { PromptDialogComponent } from '../../shared/components/prompt-dialog/prompt-dialog.component'; import { PromptDialogComponent } from '../../shared/components/prompt-dialog/prompt-dialog.component';
import { MatDialog } from '@angular/material'; import { MatDialog } from '@angular/material';
@ -9,10 +8,8 @@ import { MatDialog } from '@angular/material';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class PromptService extends OpenSlidesComponent { export class PromptService {
public constructor(private dialog: MatDialog) { public constructor(private dialog: MatDialog) {}
super();
}
/** /**
* Opens the dialog. Returns true, if the user accepts. * Opens the dialog. Returns true, if the user accepts.

View File

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component';
import { Displayable } from 'app/site/base/displayable'; import { Displayable } from 'app/site/base/displayable';
import { Identifiable } from 'app/shared/models/base/identifiable'; import { Identifiable } from 'app/shared/models/base/identifiable';
@ -21,14 +20,7 @@ export interface OSTreeNode<T> {
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class TreeService extends OpenSlidesComponent { export class TreeService {
/**
* Yes, a constructor.
*/
public constructor() {
super();
}
/** /**
* Returns the weight casted to a number from a given model. * Returns the weight casted to a number from a given model.
* *

View File

@ -1,27 +0,0 @@
import { Observable, of } from 'rxjs';
/**
* 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 {
/**
* Empty constructor
*
* Static injection of {@link DataStoreService} in all child instances of OpenSlidesComponent
* Throws a warning even tho it is the new syntax. Ignored for now.
*/
public constructor() {}
/**
* Generic error handling for everything that makes HTTP Calls
* TODO: could have more features
* @return an observable error
*/
public handleError<T>(): (error: any) => Observable<T> {
return (error: any): Observable<T> => {
console.error(error);
return of(error);
};
}
}

View File

@ -3,7 +3,6 @@ import { Directive, Input, TemplateRef, ViewContainerRef, OnDestroy, OnInit } fr
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { OperatorService, Permission } from 'app/core/core-services/operator.service'; import { OperatorService, Permission } from 'app/core/core-services/operator.service';
import { OpenSlidesComponent } from 'app/openslides.component';
/** /**
* Directive to check if the {@link OperatorService} has the correct permissions to access certain functions * Directive to check if the {@link OperatorService} has the correct permissions to access certain functions
@ -15,7 +14,7 @@ import { OpenSlidesComponent } from 'app/openslides.component';
@Directive({ @Directive({
selector: '[osPerms]' selector: '[osPerms]'
}) })
export class PermsDirective extends OpenSlidesComponent implements OnInit, OnDestroy { export class PermsDirective implements OnInit, OnDestroy {
/** /**
* Holds the required permissions the access a feature * Holds the required permissions the access a feature
*/ */
@ -62,9 +61,7 @@ export class PermsDirective extends OpenSlidesComponent implements OnInit, OnDes
private template: TemplateRef<any>, private template: TemplateRef<any>,
private viewContainer: ViewContainerRef, private viewContainer: ViewContainerRef,
private operator: OperatorService private operator: OperatorService
) { ) {}
super();
}
public ngOnInit(): void { public ngOnInit(): void {
// observe groups of operator, so the directive can actively react to changes // observe groups of operator, so the directive can actively react to changes

View File

@ -1,4 +1,3 @@
import { OpenSlidesComponent } from 'app/openslides.component';
import { Deserializable } from './deserializable'; import { Deserializable } from './deserializable';
import { Identifiable } from './identifiable'; import { Identifiable } from './identifiable';
import { Collection } from './collection'; import { Collection } from './collection';
@ -9,8 +8,7 @@ export type ModelConstructor<T extends BaseModel<T>> = new (...args: any[]) => T
* Abstract parent class to set rules and functions for all models. * Abstract parent class to set rules and functions for all models.
* When inherit from this class, give the subclass as the type. E.g. `class Motion extends BaseModel<Motion>` * When inherit from this class, give the subclass as the type. E.g. `class Motion extends BaseModel<Motion>`
*/ */
export abstract class BaseModel<T = object> extends OpenSlidesComponent export abstract class BaseModel<T = object> implements Deserializable, Identifiable, Collection {
implements Deserializable, Identifiable, Collection {
/** /**
* force children of BaseModel to have a collectionString. * force children of BaseModel to have a collectionString.
* *
@ -40,7 +38,6 @@ export abstract class BaseModel<T = object> extends OpenSlidesComponent
* @param input * @param input
*/ */
protected constructor(collectionString: string, input?: any) { protected constructor(collectionString: string, input?: any) {
super();
this._collectionString = collectionString; this._collectionString = collectionString;
if (input) { if (input) {

View File

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component';
import { CountUsersService } from 'app/core/ui-services/count-users.service'; import { CountUsersService } from 'app/core/ui-services/count-users.service';
import { Observable, BehaviorSubject } from 'rxjs'; import { Observable, BehaviorSubject } from 'rxjs';
import { UserRepositoryService } from 'app/core/repositories/users/user-repository.service'; import { UserRepositoryService } from 'app/core/repositories/users/user-repository.service';
@ -30,12 +29,10 @@ export interface CountUserStatistics {
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class CountUsersStatisticsService extends OpenSlidesComponent { export class CountUsersStatisticsService {
private runningCounts: { [token: string]: BehaviorSubject<CountUserStatistics> } = {}; private runningCounts: { [token: string]: BehaviorSubject<CountUserStatistics> } = {};
public constructor(private countUserService: CountUsersService, private userRepo: UserRepositoryService) { public constructor(private countUserService: CountUsersService, private userRepo: UserRepositoryService) {}
super();
}
/** /**
* Starts counting users. * Starts counting users.