Skip to content
Snippets Groups Projects
Commit 40844cf0 authored by OZGCloud's avatar OZGCloud
Browse files

Client: clean up some sonar issues

parent 39bf0625
No related branches found
No related tags found
No related merge requests found
Showing
with 38 additions and 48 deletions
...@@ -49,7 +49,7 @@ export class AppComponent implements OnInit { ...@@ -49,7 +49,7 @@ export class AppComponent implements OnInit {
} }
private buildConfiguration(): AuthConfig { private buildConfiguration(): AuthConfig {
const authConfig: AuthConfig = { return {
// Url of the Identity Provider // Url of the Identity Provider
issuer: this.envConfig.authServer + '/realms/' + this.envConfig.realm, issuer: this.envConfig.authServer + '/realms/' + this.envConfig.realm,
...@@ -68,8 +68,6 @@ export class AppComponent implements OnInit { ...@@ -68,8 +68,6 @@ export class AppComponent implements OnInit {
scope: 'openid profile email', scope: 'openid profile email',
requireHttps: false requireHttps: false
}; };
return authConfig;
} }
} }
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`. // The list of file replacements can be found in `angular.json`.
import { isFakeMousedownFromScreenReader } from '@angular/cdk/a11y';
import { Environment } from 'libs/environment-shared/src/lib/environment.model';
export const environment = { export const environment = {
production: false, production: false,
environmentUrl: null environmentUrl: null
......
...@@ -16,7 +16,7 @@ export class CommandService { ...@@ -16,7 +16,7 @@ export class CommandService {
public createCommand(resource: Resource, linkRel: string, command: CreateCommand): Observable<StateResource<CommandResource>> { public createCommand(resource: Resource, linkRel: string, command: CreateCommand): Observable<StateResource<CommandResource>> {
return this.repository.createCommand(resource, linkRel, command).pipe( return this.repository.createCommand(resource, linkRel, command).pipe(
mergeMap(command => this.startPolling(command)), mergeMap(createdCommand => this.startPolling(createdCommand)),
catchError(apiError => of(createErrorStateResource(apiError))) //TODO only status code 422 catchError(apiError => of(createErrorStateResource(apiError))) //TODO only status code 422
); );
} }
......
...@@ -3,6 +3,6 @@ import { ResourceUri } from '@ngxp/rest/lib/resource.model'; ...@@ -3,6 +3,6 @@ import { ResourceUri } from '@ngxp/rest/lib/resource.model';
export interface Environment { export interface Environment {
production: boolean, production: boolean,
remoteHost: ResourceUri, remoteHost: ResourceUri,
authServer: String, authServer: string,
realm: String realm: string
} }
\ No newline at end of file
...@@ -10,6 +10,6 @@ export interface Forwarding { ...@@ -10,6 +10,6 @@ export interface Forwarding {
createdByName: string; createdByName: string;
} }
export interface ForwardingResource extends Forwarding, Resource { }; export interface ForwardingResource extends Forwarding, Resource { }
export interface ForwardingListResource extends ListResource { } export interface ForwardingListResource extends ListResource { }
\ No newline at end of file
...@@ -25,7 +25,7 @@ export class VorgangForwardFormService extends AbstractFormService { ...@@ -25,7 +25,7 @@ export class VorgangForwardFormService extends AbstractFormService {
} }
protected initForm(): FormGroup { protected initForm(): FormGroup {
return this.form = this.formBuilder.group({ return this.formBuilder.group({
[VorgangForwardFormService.FIELD_EMAIL]: new FormControl(), [VorgangForwardFormService.FIELD_EMAIL]: new FormControl(),
[VorgangForwardFormService.FIELD_PASSWORD]: new FormControl() [VorgangForwardFormService.FIELD_PASSWORD]: new FormControl()
}) })
......
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { Params } from "@angular/router"; import { Params } from '@angular/router';
import { CommandResource, CommandService, CreateCommand, isDone } from "@goofy-client/command-shared"; import { CommandResource, CommandService, CreateCommand, isDone } from '@goofy-client/command-shared';
import { createEmptyStateResource, createStateResource, doIfLoadingRequired, NavigationService, StateResource } from "@goofy-client/tech-shared"; import { createEmptyStateResource, createStateResource, doIfLoadingRequired, NavigationService, StateResource } from '@goofy-client/tech-shared';
import { VorgangResource, VorgangService } from "@goofy-client/vorgang-shared"; import { VorgangResource, VorgangService } from '@goofy-client/vorgang-shared';
import { Resource } from "@ngxp/rest"; import { Resource } from '@ngxp/rest';
import { isNil } from "lodash"; import { isNil } from 'lodash';
import { BehaviorSubject, Observable, Subscription } from "rxjs"; import { BehaviorSubject, Observable, Subscription } from 'rxjs';
import { startWith, tap } from "rxjs/operators"; import { startWith, tap } from 'rxjs/operators';
import { KommentarLinkRel, KommentarListLinkRel } from "./kommentar.linkrel"; import { KommentarLinkRel, KommentarListLinkRel } from './kommentar.linkrel';
import { CreateKommentarCommand, Kommentar, KommentarListResource, KommentarOrder, KommentarResource } from "./kommentar.model"; import { CreateKommentarCommand, Kommentar, KommentarListResource, KommentarOrder, KommentarResource } from './kommentar.model';
import { KommentarRepository } from "./kommentar.repository"; import { KommentarRepository } from './kommentar.repository';
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class KommentarService { export class KommentarService {
...@@ -99,7 +99,7 @@ export class KommentarService { ...@@ -99,7 +99,7 @@ export class KommentarService {
createKommentarCommand(resource: Resource, linkRel: string, command: CreateCommand): Observable<StateResource<CommandResource>> { createKommentarCommand(resource: Resource, linkRel: string, command: CreateCommand): Observable<StateResource<CommandResource>> {
return this.commandService.createCommand(resource, linkRel, command).pipe( return this.commandService.createCommand(resource, linkRel, command).pipe(
tap((command: StateResource<CommandResource>) => this.afterCreateOrEditKommentar(command)), tap((createdCommand: StateResource<CommandResource>) => this.afterCreateOrEditKommentar(createdCommand)),
startWith(createEmptyStateResource<CommandResource>(true))); startWith(createEmptyStateResource<CommandResource>(true)));
} }
......
export function getBaseUrl(): string { export function getBaseUrl(): string {
const { protocol, host, } = window.location; const { protocol, host, } = window.location;
const basePath = `${protocol}//${host}`; const basePath = `${protocol}//${host}`;
const url = basePath.endsWith('/') ? `${basePath}` : `${basePath}/`; return basePath.endsWith('/') ? `${basePath}` : `${basePath}/`;
return url;
} }
export function isEmptyObject(obj: any): boolean { export function isEmptyObject(obj: any): boolean {
......
...@@ -8,14 +8,14 @@ export function isValidationError(issue: Issue): boolean { ...@@ -8,14 +8,14 @@ export function isValidationError(issue: Issue): boolean {
return issue.messageCode.includes('javax.validation.constraints') return issue.messageCode.includes('javax.validation.constraints')
} }
export function setValidationError(form: FormGroup, issue: Issue, pathPrefix?: String) { export function setValidationError(form: FormGroup, issue: Issue, pathPrefix?: string) {
const control = getControlForIssue(form, issue, pathPrefix); const control = getControlForIssue(form, issue, pathPrefix);
control.setErrors({ [issue.messageCode]: issue }); control.setErrors({ [issue.messageCode]: issue });
control.markAsTouched(); control.markAsTouched();
} }
export function getControlForIssue(form: FormGroup, issue: Issue, pathPrefix?: String): AbstractControl { export function getControlForIssue(form: FormGroup, issue: Issue, pathPrefix?: string): AbstractControl {
const fieldPath = pathPrefix ? issue.field.substr(pathPrefix.length + 1) : issue.field; const fieldPath = pathPrefix ? issue.field.substr(pathPrefix.length + 1) : issue.field;
let curControl: AbstractControl = form; let curControl: AbstractControl = form;
......
...@@ -11,8 +11,6 @@ export class ValidationErrorComponent { ...@@ -11,8 +11,6 @@ export class ValidationErrorComponent {
@Input() label: string; @Input() label: string;
@Input() issues: Issue[]; @Input() issues: Issue[];
constructor() { }
message(issue: Issue): string { message(issue: Issue): string {
return getMessageForIssue(this.label, issue); return getMessageForIssue(this.label, issue);
} }
......
...@@ -10,8 +10,7 @@ import { VorgangHeaderLinkRel, VorgangWithEingangLinkRel, VorgangWithEingangReso ...@@ -10,8 +10,7 @@ import { VorgangHeaderLinkRel, VorgangWithEingangLinkRel, VorgangWithEingangReso
export class VorgangDetailAreaComponent { export class VorgangDetailAreaComponent {
@Input() vorgangStateResource: StateResource<VorgangWithEingangResource>; @Input() vorgangStateResource: StateResource<VorgangWithEingangResource>;
readonly linkRel = VorgangHeaderLinkRel; readonly linkRel = VorgangHeaderLinkRel;
readonly vorgangWithEingangLinkRel = VorgangWithEingangLinkRel; readonly vorgangWithEingangLinkRel = VorgangWithEingangLinkRel;
constructor() {}
} }
\ No newline at end of file
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input } from '@angular/core';
import { Antragsteller } from '@goofy-client/vorgang-shared'; import { Antragsteller } from '@goofy-client/vorgang-shared';
@Component({ @Component({
...@@ -9,5 +9,4 @@ import { Antragsteller } from '@goofy-client/vorgang-shared'; ...@@ -9,5 +9,4 @@ import { Antragsteller } from '@goofy-client/vorgang-shared';
export class AntragstellerComponent { export class AntragstellerComponent {
@Input() antragsteller: Antragsteller; @Input() antragsteller: Antragsteller;
} }
\ No newline at end of file
...@@ -129,8 +129,8 @@ export class VorgangCommandService { ...@@ -129,8 +129,8 @@ export class VorgangCommandService {
private handleRevokeCommand(commandResource: CommandResource): void { private handleRevokeCommand(commandResource: CommandResource): void {
this.revokeCommand$.next(createEmptyStateResource(true)); this.revokeCommand$.next(createEmptyStateResource(true));
const subscription: Subscription = this.commandService.revokeCommand(commandResource).subscribe(commandResource => { const subscription: Subscription = this.commandService.revokeCommand(commandResource).subscribe(command => {
this.proceedWithRevokeCommand(commandResource); this.proceedWithRevokeCommand(command);
subscription.unsubscribe(); subscription.unsubscribe();
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment