From 2f8cd984e08a195428f1a0439cdf3c7641d1c245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Schmidt?= <9435005+AnSch1510@users.noreply.github.com> Date: Thu, 18 Jul 2024 12:32:35 +0200 Subject: [PATCH] Apply suggestions from code review --- .../modify-external-uri-dialog.component.html | 6 +++++- .../modify-external-uri-dialog.component.scss | 0 .../modify-external-uri-dialog.component.ts | 7 +++---- .../player-event-details/player-event-details.component.ts | 5 ++++- .../Endpoints/Administration/Events/UpdateEventEndpoint.cs | 3 --- 5 files changed, 12 insertions(+), 9 deletions(-) delete mode 100644 src/client/src/app/components/events/event-details/modify-external-uri-dialog/modify-external-uri-dialog.component.scss diff --git a/src/client/src/app/components/events/event-details/modify-external-uri-dialog/modify-external-uri-dialog.component.html b/src/client/src/app/components/events/event-details/modify-external-uri-dialog/modify-external-uri-dialog.component.html index b7b5a51..b5180e0 100644 --- a/src/client/src/app/components/events/event-details/modify-external-uri-dialog/modify-external-uri-dialog.component.html +++ b/src/client/src/app/components/events/event-details/modify-external-uri-dialog/modify-external-uri-dialog.component.html @@ -15,6 +15,10 @@ (ngModelChange)="externalUri.set($event)" /> - + + + + + diff --git a/src/client/src/app/components/events/event-details/modify-external-uri-dialog/modify-external-uri-dialog.component.scss b/src/client/src/app/components/events/event-details/modify-external-uri-dialog/modify-external-uri-dialog.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/client/src/app/components/events/event-details/modify-external-uri-dialog/modify-external-uri-dialog.component.ts b/src/client/src/app/components/events/event-details/modify-external-uri-dialog/modify-external-uri-dialog.component.ts index 1d7b2b4..a14f559 100644 --- a/src/client/src/app/components/events/event-details/modify-external-uri-dialog/modify-external-uri-dialog.component.ts +++ b/src/client/src/app/components/events/event-details/modify-external-uri-dialog/modify-external-uri-dialog.component.ts @@ -4,8 +4,8 @@ import { inject, input, signal, - ViewChild, ElementRef, + viewChild, } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { Store } from '@ngrx/store'; @@ -31,7 +31,6 @@ import { TranslateService } from '../../../../services/translate.service'; InputTextModule, ], templateUrl: './modify-external-uri-dialog.component.html', - styleUrl: './modify-external-uri-dialog.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, }) export class ModifyExternalUriDialogComponent { @@ -43,7 +42,7 @@ export class ModifyExternalUriDialogComponent { protected readonly visible = signal(false); protected readonly externalUri = signal(''); - private _inputElement = viewChild.required('inputElement', { read: ElementRef }); + private readonly _inputElement = viewChild.required('inputElement', { read: ElementRef }); public open(currentValue: string | null | undefined) { this.visible.set(true); @@ -66,6 +65,6 @@ export class ModifyExternalUriDialogComponent { protected clearExternalUri() { this.externalUri.set(''); - this.inputElement.nativeElement.focus(); + this._inputElement().nativeElement.focus(); } } diff --git a/src/client/src/app/components/player-events/player-event-details/player-event-details.component.ts b/src/client/src/app/components/player-events/player-event-details/player-event-details.component.ts index bfa6158..e32f529 100644 --- a/src/client/src/app/components/player-events/player-event-details/player-event-details.component.ts +++ b/src/client/src/app/components/player-events/player-event-details/player-event-details.component.ts @@ -210,6 +210,9 @@ export class PlayerEventDetailsComponent { } protected openExternalUri() { - window.location.href = this.externalUri() as string; + const url = this.externalUri(); + if (url) { + window.location.href = url; + } } } diff --git a/src/server/host/Endpoints/Administration/Events/UpdateEventEndpoint.cs b/src/server/host/Endpoints/Administration/Events/UpdateEventEndpoint.cs index 44b7ba1..b33a8ed 100644 --- a/src/server/host/Endpoints/Administration/Events/UpdateEventEndpoint.cs +++ b/src/server/host/Endpoints/Administration/Events/UpdateEventEndpoint.cs @@ -27,9 +27,6 @@ public class UpdateEventRequestValidator : Validator public UpdateEventRequestValidator(IIdService idService) { RuleFor(x => x.EventId).NotEmpty().ValidSqid(idService.Event); - RuleFor(x => x) - .Must(x => x.Commit != null || x.ExternalUri != null) - .WithMessage("Either Commit or ExternalUri must be set"); } }