Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
AnSch1510 committed Jul 18, 2024
1 parent 351691f commit 2f8cd98
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
(ngModelChange)="externalUri.set($event)"
/>
<button pButton icon="i-[mdi--backspace]" (click)="clearExternalUri()"></button>
<button pButton icon="i-[mdi--check]" (click)="updateExternalUri()"></button>
</p-inputGroup>

<ng-template pTemplate="footer">
<p-button [text]="true" [label]="translations.shared_cancel()" (onClick)="visible.set(false)" />
<p-button [label]="translations.shared_save()" (onClick)="updateExternalUri()" />
</ng-template>
</p-dialog>
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
inject,
input,
signal,
ViewChild,
ElementRef,
viewChild,
} from '@angular/core';
import { FormsModule } from '@angular/forms';
import { Store } from '@ngrx/store';
Expand All @@ -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 {
Expand All @@ -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);
Expand All @@ -66,6 +65,6 @@ export class ModifyExternalUriDialogComponent {

protected clearExternalUri() {
this.externalUri.set('');
this.inputElement.nativeElement.focus();
this._inputElement().nativeElement.focus();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public class UpdateEventRequestValidator : Validator<UpdateEventRequest>
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");
}
}

Expand Down

0 comments on commit 2f8cd98

Please sign in to comment.