Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Import Project="../Turnierplan.Test.Common.props" />

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Turnierplan.App/Client/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
module.exports = function karmaConfig(config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
Expand All @@ -23,7 +23,7 @@ module.exports = function (config) {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/turnierplan-net'),
dir: require('node:path').join(__dirname, './coverage/turnierplan-net'),
subdir: '.',
reporters: [{ type: 'lcov' }]
},
Expand Down
1,966 changes: 715 additions & 1,251 deletions src/Turnierplan.App/Client/package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions src/Turnierplan.App/Client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
"e2e:run": "npx cypress run"
},
"dependencies": {
"@angular/common": "~20.3.15",
"@angular/compiler": "~20.3.15",
"@angular/core": "~20.3.15",
"@angular/forms": "~20.3.15",
"@angular/localize": "~20.3.15",
"@angular/platform-browser": "~20.3.15",
"@angular/platform-browser-dynamic": "~20.3.15",
"@angular/router": "~20.3.15",
"@angular/common": "~20.3.16",
"@angular/compiler": "~20.3.16",
"@angular/core": "~20.3.16",
"@angular/forms": "~20.3.16",
"@angular/localize": "~20.3.16",
"@angular/platform-browser": "~20.3.16",
"@angular/platform-browser-dynamic": "~20.3.16",
"@angular/router": "~20.3.16",
"@ng-bootstrap/ng-bootstrap": "~19.0.1",
"@ngx-translate/core": "~17.0.0",
"angularx-qrcode": "~20.0.0",
Expand All @@ -50,9 +50,9 @@
"zone.js": "~0.15.1"
},
"devDependencies": {
"@angular/build": "~20.3.13",
"@angular/cli": "~20.3.13",
"@angular/compiler-cli": "~20.3.15",
"@angular/build": "~20.3.15",
"@angular/cli": "~20.3.15",
"@angular/compiler-cli": "~20.3.16",
"@types/jasmine": "~5.1.13",
"@types/node": "~25.0.3",
"cypress": "~15.8.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ export class ColorThemeService {
}

private static setColorTheme(theme: ColorTheme): void {
document.documentElement.setAttribute('data-bs-theme', theme);
document.documentElement.dataset.bsTheme = theme;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
<div class="form-group">
<label
class="form-label"
for="content"
for="addTeamName"
translate="Portal.ConfigureTournament.Sections.Participants.AddTeam.NewTeam.TeamName"></label>
<input
#addTeamNameInput
class="form-control"
type="text"
id="content"
id="addTeamName"
autofocus
[(ngModel)]="addTeamName"
[tpE2E]="'add-team-dialog-team-name-field'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class DeleteWidgetComponent {

@Input()
public set targetObjectName(value: string) {
this.confirmationText = value.replace(/[^A-Za-z0-9.\-_|ÄÖÜäöüß ]+/g, '').trim();
this.confirmationText = value.replaceAll(/[^A-Za-z0-9.\-_|ÄÖÜäöüß ]+/g, '').trim();
}

@Output()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ export class DocumentConfigReceiptsComponent extends DocumentConfigComponent<Rec

// Entries need not be consecutive, this should probably be possible through the UI at some point.
// For now, we simply find the lowest number that is not currently a key in the map.
const existingEntries = this.amountKeys.map((x) => +x);
let newEntry = 2;
while (existingEntries.includes(newEntry)) {
while (this.amountKeys.includes(`${newEntry}`)) {
newEntry++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ export class DocumentManagerComponent {
}

private getDocumentFileName(name: string): string {
const fileNameSanitizeRegex = /[^.A-Za-z0-9Ä-Öä-öß _-]/g;
return `${name} - ${this.tournamentName}.pdf`.replace(fileNameSanitizeRegex, '_');
return `${name} - ${this.tournamentName}.pdf`.replaceAll(/[^.A-Za-z0-9Ä-Öä-öß _-]/g, '_');
}

private getDocumentConfig(document: DocumentDto): Observable<DocumentConfiguration> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class EditMatchComponent implements OnDestroy, AfterViewInit {
}

protected closeModal(action: 'cancel' | 'clear' | 'save' | 'saveLive'): void {
const isValidScore = (value: number): boolean => !isNaN(value) && value === parseInt(`${value}`, 10);
const isValidScore = (value: number): boolean => !Number.isNaN(value) && value === Number.parseInt(`${value}`, 10);

if (action !== 'cancel') {
let request: SetMatchOutcomeEndpointRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { uploadImage$FormData } from '../../../api/fn/images/upload-image-form-d
import { getImages } from '../../../api/fn/images/get-images';
import { ImageDto } from '../../../api/models/image-dto';
import { deleteImage } from '../../../api/fn/images/delete-image';
import { from, switchMap } from 'rxjs';

export interface ImageChooserResult {
type: 'ImageDeleted' | 'ImageSelected' | 'ImageUploaded';
Expand Down Expand Up @@ -96,34 +97,28 @@ export class ImageChooserComponent {
if (targetFile) {
this.isUploadingImage = true;

const reader = new FileReader();

reader.onload = (data) => {
const content = data.target?.result as ArrayBuffer;

if (content) {
this.turnierplanApi
.invoke(uploadImage$FormData, {
from(targetFile.arrayBuffer())
.pipe(
switchMap((arrayBuffer) =>
this.turnierplanApi.invoke(uploadImage$FormData, {
body: {
organizationId: this.organizationId,
imageType: this.imageType,
imageName: targetFile.name,
image: new Blob([content])
image: new Blob([arrayBuffer])
}
})
.subscribe({
next: (result) => {
this.modal.close({ type: 'ImageUploaded', image: result } as ImageChooserResult);
},
error: () => {
this.isUploadingImage = false;
this.hasUploadError = true;
}
});
}
};

reader.readAsArrayBuffer(targetFile);
)
)
.subscribe({
next: (result) => {
this.modal.close({ type: 'ImageUploaded', image: result } as ImageChooserResult);
},
error: () => {
this.isUploadingImage = false;
this.hasUploadError = true;
}
});
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@

<div>
<div>
<label for="name" class="form-label" translate="Portal.ViewPlanningRealm.InvitationLink.Properties.ColorCode"></label>
<label for="colorCode" class="form-label" translate="Portal.ViewPlanningRealm.InvitationLink.Properties.ColorCode"></label>
<tp-tooltip-icon
[icon]="'info-circle'"
[tooltipText]="'Portal.ViewPlanningRealm.InvitationLink.EditPropertiesDialog.InternalInformation'" />
Expand All @@ -304,7 +304,7 @@
<div class="mt-3">
@let control = editPropertiesForm.get('validUntil')!;
<input
id="maxTeamsPerRegistration"
id="validUntil"
type="datetime-local"
class="form-control"
formControlName="validUntil"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class MatchTreeComponent implements OnChanges, AfterViewInit {
nextMatchTileY += matchDiv.offsetHeight + paddingInPixels;
}

const missingSpaceY = Math.max(0.0, nextMatchTileY - this.layoutedDiv.nativeElement.offsetHeight);
const missingSpaceY = Math.max(0, nextMatchTileY - this.layoutedDiv.nativeElement.offsetHeight);
this.additionalPaddingDiv.nativeElement.style.height = `${missingSpaceY}px`;
}

Expand Down Expand Up @@ -254,9 +254,11 @@ export class MatchTreeComponent implements OnChanges, AfterViewInit {

const middleX = Math.round((targetConnectorX + dependencyConnectorX) / 2);

this.connectingLines.push({ x1: dependencyConnectorX, y1: dependencyConnectorY, x2: middleX, y2: dependencyConnectorY });
this.connectingLines.push({ x1: middleX, y1: dependencyConnectorY, x2: middleX, y2: targetConnectorY });
this.connectingLines.push({ x1: middleX, y1: targetConnectorY, x2: targetConnectorX, y2: targetConnectorY });
this.connectingLines.push(
{ x1: dependencyConnectorX, y1: dependencyConnectorY, x2: middleX, y2: dependencyConnectorY },
{ x1: middleX, y1: dependencyConnectorY, x2: middleX, y2: targetConnectorY },
{ x1: middleX, y1: targetConnectorY, x2: targetConnectorX, y2: targetConnectorY }
);
};

if (dependencyDiv1 !== undefined && dependencyDiv2 === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
</div>

<div class="form-group mb-2">
<label class="form-label" for="contact" translate="Portal.ViewPlanningRealm.AddApplication.Name"></label>
<label class="form-label" for="name" translate="Portal.ViewPlanningRealm.AddApplication.Name"></label>
<input
class="form-control"
id="contact"
id="name"
type="text"
formControlName="name"
[ngClass]="name.touched ? (name.invalid ? 'is-invalid' : 'is-valid') : ''" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ export class PageFrameComponent implements OnInit, OnChanges {
if ('navigationTabs' in changes) {
if (this.navigationTabs && this.navigationTabs.length > 0) {
if (this.currentTabId) {
const stillExists = this.navigationTabs.findIndex((x) => x.id === this.currentTabId) >= 0;
if (!stillExists) {
if (!this.navigationTabs.some((x) => x.id === this.currentTabId)) {
this.currentTabId = this.navigationTabs[0].id;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export class RenameDialogComponent {
const sanitizedInitial = (this.initialValue ?? '').trim();

if (sanitized.length > 0) {
if (sanitized !== sanitizedInitial) {
this.modal.close(sanitized);
} else {
if (sanitized === sanitizedInitial) {
this.modal.dismiss();
} else {
this.modal.close(sanitized);
}
} else if (sanitized.length === 0 && this.allowReset) {
if (sanitizedInitial.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ export class TextInputDialogComponent {
return;
}

if (sanitized !== sanitizedInitial) {
this.modal.close(sanitized);
} else {
if (sanitized === sanitizedInitial) {
this.modal.dismiss();
} else {
this.modal.close(sanitized);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export class LoadingStateDirective {

if (state.isLoading) {
this.viewContainer.createComponent(LoadingIndicatorComponent);
} else if (state.error !== undefined) {
} else if (state.error === undefined) {
this.viewContainer.createEmbeddedView(this.templateRef);
} else {
this.titleService.setTitleTranslated('Portal.ErrorPage.Title');
const component = this.viewContainer.createComponent(LoadingErrorComponent);
component.instance.error = state.error;
} else {
this.viewContainer.createEmbeddedView(this.templateRef);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ export class ConfigureTournamentComponent implements OnInit, OnDestroy, DiscardC
return;
}

if (!this.currentFinalRound || this.availableFinalRounds.indexOf(this.currentFinalRound) === -1) {
if (!this.currentFinalRound || !this.availableFinalRounds.includes(this.currentFinalRound)) {
this.currentFinalRound = this.availableFinalRounds[0];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class CreateTournamentComponent implements OnDestroy {
const index = currentFolder.indexOf('/');
if (index >= 0) {
const folderId = currentFolder.substring(index + 1);
if (folders.findIndex((x) => x.id === folderId) >= 0) {
if (folders.some((x) => x.id === folderId)) {
this.folderMode = 'ExistingFolder';
this.existingFolderId.setValue(currentFolder.substring(index + 1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class FolderStatisticsComponent implements OnInit, OnDestroy {
this.titleService.setCompoundTitle(statistics.folderName);

if (statistics.goalDistributionExcludedTournaments.length > 0) {
const names = [...statistics.goalDistributionExcludedTournaments.map((x) => x.tournamentName)];
const names = statistics.goalDistributionExcludedTournaments.map((x) => x.tournamentName);
names.sort((a, b) => a.localeCompare(b));
this.goalDistributionExcludedTournaments = names.join(', ');
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ export class ViewPlanningRealmComponent implements OnInit, OnDestroy, DiscardCha
];

private readonly destroyed$ = new Subject<void>();
private originalPlanningRealm?: PlanningRealmDto;

constructor(
private readonly turnierplanApi: TurnierplanApi,
Expand Down Expand Up @@ -412,10 +411,7 @@ export class ViewPlanningRealmComponent implements OnInit, OnDestroy, DiscardCha
}

private setPlanningRealm(planningRealm: PlanningRealmDto): void {
this.originalPlanningRealm = planningRealm;

// Create a working copy which can be modified and saved/discarded
this.planningRealm = JSON.parse(JSON.stringify(this.originalPlanningRealm)) as PlanningRealmDto;
this.planningRealm = planningRealm;
this._hasUnsavedChanges = false;

this.titleService.setTitleFrom(this.planningRealm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ export class LocalStorageService {
public getPlanningRealmApplicationsFilter(planningRealmId: string): ApplicationsFilter {
const value = this.getValueFromLocalStorage(`tp_applicationsFilter_${planningRealmId}`, (x) => x);

if (!value) {
return defaultApplicationsFilter;
if (value) {
return { ...defaultApplicationsFilter, ...(JSON.parse(value) as ApplicationsFilter) };
}

return { ...defaultApplicationsFilter, ...(JSON.parse(value) as ApplicationsFilter) };
return defaultApplicationsFilter;
}

public setAddTeamDialogMode(mode: string): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export class TitleService {
) {}

public setTitleFrom(value: NamedEntity | undefined): void {
if (!value) {
this.title.setTitle(environment.defaultTitle);
} else {
if (value) {
this.setCompoundTitle(value.name);
} else {
this.title.setTitle(environment.defaultTitle);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Turnierplan.App/Client/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<script>
const colorTheme = localStorage.getItem('tp_colorTheme');
if (colorTheme) {
document.documentElement.setAttribute('data-bs-theme', 'dark');
document.documentElement.dataset.bsTheme = 'dark';
}
</script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion src/Turnierplan.App/Client/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ body {
.tp-footer {
background: #f7f7f7;
box-shadow: 0 -5px 5px -5px #ccc;
color: #888 !important;
color: #545454 !important;
font-size: 0.9em;
width: 100%;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Microsoft.AspNetCore.Mvc;
using Turnierplan.App.Extensions;
using Turnierplan.App.Security;
using Turnierplan.Core.Exceptions;
using Turnierplan.Core.PublicId;
using Turnierplan.Core.Tournament.TeamSelectors;
using Turnierplan.Dal.Converters;
Expand Down
Loading