From 6d22f9f82c4df2731ca5cd97caff93209b0c759e Mon Sep 17 00:00:00 2001 From: "Zickermann, Jan" <jan.zickermann@dataport.de> Date: Tue, 26 Mar 2024 16:40:59 +0100 Subject: [PATCH] OZG-4995 Set `submitInProgress$` during construction --- .../organisationseinheit-form.component.ts | 10 +++------- .../postfach-form/postfach-form.component.ts | 10 +++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/alfa-client/libs/admin-settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-form/organisationseinheit-form.component.ts b/alfa-client/libs/admin-settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-form/organisationseinheit-form.component.ts index 20e324636c..2d831680ba 100644 --- a/alfa-client/libs/admin-settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-form/organisationseinheit-form.component.ts +++ b/alfa-client/libs/admin-settings/src/lib/organisationseinheit/organisationseinheit-container/organisationseinheit-form/organisationseinheit-form.component.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core'; +import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core'; import { OrganisationseinheitFormservice } from './organisationseinheit.formservice'; import { Observable, of, tap } from 'rxjs'; import { Organisationseinheit } from '../../../user/user.model'; @@ -8,7 +8,7 @@ import { Organisationseinheit } from '../../../user/user.model'; templateUrl: './organisationseinheit-form.component.html', providers: [OrganisationseinheitFormservice], }) -export class OrganisationseinheitFormComponent implements OnInit, AfterViewInit { +export class OrganisationseinheitFormComponent implements AfterViewInit { static CREATE_LABEL: string = 'Neue Organisationseinheit anlegen'; static EDIT_LABEL: string = 'Organisationseinheit bearbeiten'; @@ -17,7 +17,7 @@ export class OrganisationseinheitFormComponent implements OnInit, AfterViewInit @ViewChild('OrganisationseinheitDialog') private dialogRef: ElementRef<HTMLDialogElement>; dialog: HTMLDialogElement; - submitInProgress$: Observable<boolean>; + submitInProgress$: Observable<boolean> = of(false); label: string; @@ -27,10 +27,6 @@ export class OrganisationseinheitFormComponent implements OnInit, AfterViewInit this.dialog = this.dialogRef.nativeElement; } - ngOnInit(): void { - this.submitInProgress$ = of(false); - } - public submit() { this.submitInProgress$ = this.formService .submit() diff --git a/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.ts b/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.ts index c700cc756e..5eb448110d 100644 --- a/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.ts +++ b/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { PostfachFormService } from './postfach.formservice'; import { isNotNil, ProblemDetail, StateResource } from '@alfa-client/tech-shared'; import { PostfachResource } from '../../postfach.model'; @@ -9,8 +9,8 @@ import { map, Observable, of } from 'rxjs'; templateUrl: './postfach-form.component.html', providers: [PostfachFormService], }) -export class PostfachFormComponent implements OnInit { - submitInProgress$: Observable<boolean>; +export class PostfachFormComponent { + submitInProgress$: Observable<boolean> = of(false); @Input() set postfachStateResource(stateResource: StateResource<PostfachResource>) { this.updatePostfachResource(stateResource.resource); @@ -26,10 +26,6 @@ export class PostfachFormComponent implements OnInit { constructor(public formService: PostfachFormService) {} - ngOnInit(): void { - this.submitInProgress$ = of(false); - } - public submit(): void { this.submitInProgress$ = this.formService .submit() -- GitLab