Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ab2c641130 | |||
| 412591dfe0 |
@@ -86,3 +86,8 @@
|
|||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
* **tournaments:** load both user bots and official bots in join dialog ([5b5fd6f](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/commit/5b5fd6f027b4aedb951a802725fcd929d514c359))
|
* **tournaments:** load both user bots and official bots in join dialog ([5b5fd6f](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/commit/5b5fd6f027b4aedb951a802725fcd929d514c359))
|
||||||
|
## [0.0.0](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/compare/0.4.4...0.0.0) (2026-06-21)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **tournaments:** remove external server add/remove UI ([412591d](https://git.janis-eccarius.de/NowChess/NowChess-Frontend/commit/412591dfe0119dbec84c3783cd94590810884580))
|
||||||
|
|||||||
@@ -271,7 +271,7 @@
|
|||||||
@if (serversLoading) {
|
@if (serversLoading) {
|
||||||
<div class="dialog-loading"><span class="pulse"></span>Loading servers…</div>
|
<div class="dialog-loading"><span class="pulse"></span>Loading servers…</div>
|
||||||
} @else if (servers.length === 0) {
|
} @else if (servers.length === 0) {
|
||||||
<p class="join-empty">No external servers registered yet.</p>
|
<p class="join-empty">No external servers registered.</p>
|
||||||
} @else {
|
} @else {
|
||||||
<div class="servers-list">
|
<div class="servers-list">
|
||||||
@for (s of servers; track s.id) {
|
@for (s of servers; track s.id) {
|
||||||
@@ -280,49 +280,14 @@
|
|||||||
<span class="server-label">{{ s.label }}</span>
|
<span class="server-label">{{ s.label }}</span>
|
||||||
<span class="server-url">{{ s.url }}</span>
|
<span class="server-url">{{ s.url }}</span>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="server-remove-btn"
|
|
||||||
[disabled]="removingServerId === s.id"
|
|
||||||
(click)="removeServer(s.id)"
|
|
||||||
title="Remove server">
|
|
||||||
@if (removingServerId === s.id) { … } @else {
|
|
||||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
||||||
stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/>
|
|
||||||
<path d="M10 11v6"/><path d="M14 11v6"/>
|
|
||||||
<path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/>
|
|
||||||
</svg>
|
|
||||||
}
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="server-add-form">
|
<div class="dialog-actions">
|
||||||
<h4 class="server-add-heading">Add server</h4>
|
<button type="button" class="btn-ghost" (click)="closeServersDialog()">Close</button>
|
||||||
<div class="dialog-field">
|
|
||||||
<label class="dialog-label">Label</label>
|
|
||||||
<input type="text" class="dialog-input" [(ngModel)]="newServerLabel"
|
|
||||||
placeholder="e.g. Local Dev Server" />
|
|
||||||
</div>
|
|
||||||
<div class="dialog-field">
|
|
||||||
<label class="dialog-label">URL</label>
|
|
||||||
<input type="url" class="dialog-input" [(ngModel)]="newServerUrl"
|
|
||||||
placeholder="http://host:8089" />
|
|
||||||
</div>
|
|
||||||
@if (addServerError) {
|
|
||||||
<div class="dialog-error">{{ addServerError }}</div>
|
|
||||||
}
|
|
||||||
<div class="dialog-actions">
|
|
||||||
<button type="button" class="btn-ghost" (click)="closeServersDialog()">Close</button>
|
|
||||||
<button type="button" class="btn-primary"
|
|
||||||
[disabled]="addingServer || !newServerLabel.trim() || !newServerUrl.trim()"
|
|
||||||
(click)="addServer()">
|
|
||||||
{{ addingServer ? 'Adding…' : 'Add' }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,11 +71,6 @@ export class TournamentsComponent implements OnInit {
|
|||||||
showServersDialog = false;
|
showServersDialog = false;
|
||||||
servers: ExternalTournamentServer[] = [];
|
servers: ExternalTournamentServer[] = [];
|
||||||
serversLoading = false;
|
serversLoading = false;
|
||||||
newServerLabel = '';
|
|
||||||
newServerUrl = '';
|
|
||||||
addingServer = false;
|
|
||||||
addServerError: string | null = null;
|
|
||||||
removingServerId: string | null = null;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.authService.currentUser$
|
this.authService.currentUser$
|
||||||
@@ -248,9 +243,6 @@ export class TournamentsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
openServersDialog(): void {
|
openServersDialog(): void {
|
||||||
this.newServerLabel = '';
|
|
||||||
this.newServerUrl = '';
|
|
||||||
this.addServerError = null;
|
|
||||||
this.showServersDialog = true;
|
this.showServersDialog = true;
|
||||||
this.serversLoading = true;
|
this.serversLoading = true;
|
||||||
this.tournamentServerService.list()
|
this.tournamentServerService.list()
|
||||||
@@ -265,40 +257,6 @@ export class TournamentsComponent implements OnInit {
|
|||||||
this.showServersDialog = false;
|
this.showServersDialog = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
addServer(): void {
|
|
||||||
const label = this.newServerLabel.trim();
|
|
||||||
const url = this.newServerUrl.trim();
|
|
||||||
if (!label || !url || this.addingServer) return;
|
|
||||||
this.addingServer = true;
|
|
||||||
this.addServerError = null;
|
|
||||||
this.tournamentServerService.register(label, url).subscribe({
|
|
||||||
next: server => {
|
|
||||||
this.addingServer = false;
|
|
||||||
this.servers = [...this.servers, server];
|
|
||||||
this.newServerLabel = '';
|
|
||||||
this.newServerUrl = '';
|
|
||||||
this.loadTournaments();
|
|
||||||
},
|
|
||||||
error: err => {
|
|
||||||
this.addingServer = false;
|
|
||||||
this.addServerError = err.error?.error ?? 'Failed to add server.';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
removeServer(id: string): void {
|
|
||||||
if (this.removingServerId) return;
|
|
||||||
this.removingServerId = id;
|
|
||||||
this.tournamentServerService.remove(id).subscribe({
|
|
||||||
next: () => {
|
|
||||||
this.removingServerId = null;
|
|
||||||
this.servers = this.servers.filter(s => s.id !== id);
|
|
||||||
this.loadTournaments();
|
|
||||||
},
|
|
||||||
error: () => { this.removingServerId = null; }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private loadTournaments(): void {
|
private loadTournaments(): void {
|
||||||
this.tournamentService.list()
|
this.tournamentService.list()
|
||||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
|
|||||||
@@ -20,12 +20,4 @@ export class TournamentServerService {
|
|||||||
list(): Observable<ExternalTournamentServerList> {
|
list(): Observable<ExternalTournamentServerList> {
|
||||||
return this.http.get<ExternalTournamentServerList>(this.base);
|
return this.http.get<ExternalTournamentServerList>(this.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
register(label: string, url: string): Observable<ExternalTournamentServer> {
|
|
||||||
return this.http.post<ExternalTournamentServer>(this.base, { label, url });
|
|
||||||
}
|
|
||||||
|
|
||||||
remove(id: string): Observable<void> {
|
|
||||||
return this.http.delete<void>(`${this.base}/${id}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
MAJOR=0
|
MAJOR=0
|
||||||
MINOR=4
|
MINOR=5
|
||||||
PATCH=4
|
PATCH=0
|
||||||
|
|||||||
Reference in New Issue
Block a user