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 { OpenSlidesComponent } from './openslides.component';
import { TranslateService } from '@ngx-translate/core';
/**
@ -9,7 +9,7 @@ import { TranslateService } from '@ngx-translate/core';
* A BaseComponent is an OpenSlides Component.
* 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"
*
@ -38,12 +38,7 @@ export abstract class BaseComponent extends OpenSlidesComponent {
link image charmap table | code preview fullscreen`
};
/**
* Child constructor that implements the titleServices and calls Super from OpenSlidesComponent
*/
public constructor(protected titleService?: Title, protected translate?: TranslateService) {
super();
}
public constructor(protected titleService?: Title, protected translate?: TranslateService) {}
/**
* 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 { OperatorService } from 'app/core/core-services/operator.service';
import { OpenSlidesComponent } from '../../openslides.component';
import { environment } from 'environments/environment';
import { User } from '../../shared/models/users/user';
import { OpenSlidesService } from './openslides.service';
@ -22,11 +21,10 @@ interface LoginResponse {
@Injectable({
providedIn: 'root'
})
export class AuthService extends OpenSlidesComponent {
export class AuthService {
/**
* Initializes the httpClient and the {@link OperatorService}.
*
* Calls `super()` from the parent class.
* @param http HttpService to send requests to the server
* @param operator Who is using OpenSlides
* @param OpenSlides The openslides service
@ -37,9 +35,7 @@ export class AuthService extends OpenSlidesComponent {
private operator: OperatorService,
private OpenSlides: OpenSlidesService,
private router: Router
) {
super();
}
) {}
/**
* Try to log in a user.

View File

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

View File

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

View File

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component';
import { DataStoreService } from './data-store.service';
import { WhoAmIResponse } from './operator.service';
@ -13,7 +12,7 @@ import { WhoAmIResponse } from './operator.service';
@Injectable({
providedIn: 'root'
})
export class OfflineService extends OpenSlidesComponent {
export class OfflineService {
private _offline = false;
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.
* @param DS
*/
public constructor(private DS: DataStoreService) {
super();
}
public constructor(private DS: DataStoreService) {}
/**
* Sets the offline flag. Restores the DataStoreService to the last known configuration.

View File

@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { OpenSlidesComponent } from 'app/openslides.component';
import { WebsocketService } from './websocket.service';
import { OperatorService } from './operator.service';
import { StorageService } from './storage.service';
@ -14,7 +13,7 @@ import { DataStoreService } from './data-store.service';
@Injectable({
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
*/
@ -37,8 +36,6 @@ export class OpenSlidesService extends OpenSlidesComponent {
private autoupdateService: AutoupdateService,
private DS: DataStoreService
) {
super();
// 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(() => {

View File

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

View File

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component';
import {
Projectable,
ProjectorElementBuildDeskriptor,
@ -29,7 +28,7 @@ import { ViewModelStoreService } from './view-model-store.service';
@Injectable({
providedIn: 'root'
})
export class ProjectorService extends OpenSlidesComponent {
export class ProjectorService {
/**
* Constructor.
*
@ -41,9 +40,7 @@ export class ProjectorService extends OpenSlidesComponent {
private http: HttpService,
private slideManager: SlideManager,
private viewModelStore: ViewModelStoreService
) {
super();
}
) {}
/**
* 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 { OpenSlidesComponent } from 'app/openslides.component';
import { HttpService } from './http.service';
import { environment } from 'environments/environment.prod';
@ -16,7 +15,7 @@ import { environment } from 'environments/environment.prod';
@Injectable({
providedIn: 'root'
})
export class ServertimeService extends OpenSlidesComponent {
export class ServertimeService {
private static FAILURE_TIMEOUT = 30;
private static NORMAL_TIMEOUT = 60 * 5;
@ -25,9 +24,7 @@ export class ServertimeService extends OpenSlidesComponent {
*/
private serverOffsetSubject = new BehaviorSubject<number>(0);
public constructor(private http: HttpService) {
super();
}
public constructor(private http: HttpService) {}
/**
* Starts the scheduler to sync with the server.

View File

@ -1,6 +1,5 @@
import { BehaviorSubject, Observable, Subject } from 'rxjs';
import { OpenSlidesComponent } from '../../openslides.component';
import { BaseViewModel } from '../../site/base/base-view-model';
import { BaseModel, ModelConstructor } from '../../shared/models/base/base-model';
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 { OnAfterAppsLoaded } from '../onAfterAppsLoaded';
export abstract class BaseRepository<V extends BaseViewModel, M extends BaseModel> extends OpenSlidesComponent
implements OnAfterAppsLoaded {
export abstract class BaseRepository<V extends BaseViewModel, M extends BaseModel> implements OnAfterAppsLoaded {
/**
* 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 depsModelCtors?: ModelConstructor<BaseModel>[]
) {
super();
this._name = baseModelCtor.name;
}

View File

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

View File

@ -1,6 +1,5 @@
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 '../core-services/data-store.service';
@ -23,7 +22,7 @@ import { DataStoreService } from '../core-services/data-store.service';
@Injectable({
providedIn: 'root'
})
export class ConfigService extends OpenSlidesComponent {
export class ConfigService {
/**
* 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.
*/
public constructor(private DS: DataStoreService) {
super();
this.DS.changeObservable.subscribe(data => {
// on changes notify the observers for specific keys.
if (data instanceof Config && this.configSubjects[data.key]) {

View File

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

View File

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

View File

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

View File

@ -1,8 +1,7 @@
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 { Projectable, ProjectorElementBuildDeskriptor, isProjectable } from 'app/site/base/projectable';
import {
ProjectionDialogComponent,
ProjectionDialogReturnType
@ -15,16 +14,14 @@ import { ProjectorService } from '../core-services/projector.service';
@Injectable({
providedIn: 'root'
})
export class ProjectionDialogService extends OpenSlidesComponent {
export class ProjectionDialogService {
/**
* Constructor.
*
* @param dialog
* @param projectorService
*/
public constructor(private dialog: MatDialog, private projectorService: ProjectorService) {
super();
}
public constructor(private dialog: MatDialog, private projectorService: ProjectorService) {}
/**
* 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 { OpenSlidesComponent } from 'app/openslides.component';
import { PromptDialogComponent } from '../../shared/components/prompt-dialog/prompt-dialog.component';
import { MatDialog } from '@angular/material';
@ -9,10 +8,8 @@ import { MatDialog } from '@angular/material';
@Injectable({
providedIn: 'root'
})
export class PromptService extends OpenSlidesComponent {
public constructor(private dialog: MatDialog) {
super();
}
export class PromptService {
public constructor(private dialog: MatDialog) {}
/**
* Opens the dialog. Returns true, if the user accepts.

View File

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from 'app/openslides.component';
import { Displayable } from 'app/site/base/displayable';
import { Identifiable } from 'app/shared/models/base/identifiable';
@ -21,14 +20,7 @@ export interface OSTreeNode<T> {
@Injectable({
providedIn: 'root'
})
export class TreeService extends OpenSlidesComponent {
/**
* Yes, a constructor.
*/
public constructor() {
super();
}
export class TreeService {
/**
* 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 { 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
@ -15,7 +14,7 @@ import { OpenSlidesComponent } from 'app/openslides.component';
@Directive({
selector: '[osPerms]'
})
export class PermsDirective extends OpenSlidesComponent implements OnInit, OnDestroy {
export class PermsDirective implements OnInit, OnDestroy {
/**
* 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 viewContainer: ViewContainerRef,
private operator: OperatorService
) {
super();
}
) {}
public ngOnInit(): void {
// 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 { Identifiable } from './identifiable';
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.
* 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
implements Deserializable, Identifiable, Collection {
export abstract class BaseModel<T = object> implements Deserializable, Identifiable, Collection {
/**
* force children of BaseModel to have a collectionString.
*
@ -40,7 +38,6 @@ export abstract class BaseModel<T = object> extends OpenSlidesComponent
* @param input
*/
protected constructor(collectionString: string, input?: any) {
super();
this._collectionString = collectionString;
if (input) {

View File

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