diff --git a/frontend/src/app/features/dashboard/dashboard-page.component.html b/frontend/src/app/features/dashboard/dashboard-page.component.html index 7fb06d5..f92ab84 100644 --- a/frontend/src/app/features/dashboard/dashboard-page.component.html +++ b/frontend/src/app/features/dashboard/dashboard-page.component.html @@ -15,7 +15,7 @@
- +
diff --git a/frontend/src/app/features/routers/router-detail-page.component.html b/frontend/src/app/features/routers/router-detail-page.component.html index 9cbc0fc..dd2923f 100644 --- a/frontend/src/app/features/routers/router-detail-page.component.html +++ b/frontend/src/app/features/routers/router-detail-page.component.html @@ -6,8 +6,8 @@
- - + +
diff --git a/frontend/src/app/features/swos-beta/swos-beta-page.component.html b/frontend/src/app/features/swos-beta/swos-beta-page.component.html deleted file mode 100644 index 0e4ab66..0000000 --- a/frontend/src/app/features/swos-beta/swos-beta-page.component.html +++ /dev/null @@ -1,80 +0,0 @@ - -
- -
-
- - -
-
- {{ 'switchosBeta.warningHeadline' | translate }} -

{{ 'switchosBeta.warningBody' | translate }}

-
- -
-
- -
- -
- - - - - - - - - - - - - - - - - - - - -
- - -
-
-
- - -
{{ 'switchosBeta.resultEmpty' | translate }}
- -
-
- {{ 'switchosBeta.baseUrl' | translate }} - {{ probeResult.base_url }} -
-
- {{ 'switchosBeta.httpStatus' | translate }} - {{ probeResult.status_code }} -
-
- {{ 'switchosBeta.authMode' | translate }} - {{ probeResult.auth_mode }} -
-
- {{ 'switchosBeta.pageTitle' | translate }} - {{ probeResult.page_title || '—' }} -
-
- {{ 'switchosBeta.serverHeader' | translate }} - {{ probeResult.server || '—' }} -
-
- {{ 'switchosBeta.backupEndpoint' | translate }} - {{ (probeResult.backup_endpoint_ok ? 'switchosBeta.available' : 'switchosBeta.unavailable') | translate }} -
-
{{ probeResult.note }}
-
- -
{{ lastError }}
-
-
diff --git a/frontend/src/app/features/swos-beta/swos-beta-page.component.ts b/frontend/src/app/features/swos-beta/swos-beta-page.component.ts deleted file mode 100644 index 97b9436..0000000 --- a/frontend/src/app/features/swos-beta/swos-beta-page.component.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { HttpErrorResponse, HttpResponse } from '@angular/common/http'; -import { Component, inject } from '@angular/core'; -import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; -import { TranslateModule } from '@ngx-translate/core'; -import { finalize } from 'rxjs'; -import { ButtonModule } from 'primeng/button'; -import { InputTextModule } from 'primeng/inputtext'; -import { TagModule } from 'primeng/tag'; - -import { ApiService } from '../../core/services/api.service'; -import { UiService } from '../../core/services/ui.service'; -import { PageHeaderComponent } from '../../shared/ui/page-header.component'; -import { SectionCardComponent } from '../../shared/ui/section-card.component'; - -interface SwosBetaProbeResult { - success: boolean; - base_url: string; - status_code: number; - auth_mode: string; - page_title?: string | null; - content_type?: string | null; - server?: string | null; - save_backup_visible: boolean; - backup_endpoint_ok: boolean; - note?: string | null; -} - -@Component({ - standalone: true, - imports: [CommonModule, ReactiveFormsModule, TranslateModule, ButtonModule, InputTextModule, TagModule, PageHeaderComponent, SectionCardComponent], - templateUrl: './swos-beta-page.component.html' -}) -export class SwosBetaPageComponent { - private readonly api = inject(ApiService); - private readonly fb = inject(FormBuilder); - private readonly ui = inject(UiService); - - probing = false; - downloading = false; - lastError = ''; - probeResult?: SwosBetaProbeResult; - - readonly form = this.fb.nonNullable.group({ - label: '', - host: ['', Validators.required], - port: [80, [Validators.required, Validators.min(1), Validators.max(65535)]], - username: ['admin', Validators.required], - password: '' - }); - - get formValue() { - return this.form.getRawValue(); - } - - probe() { - if (this.form.invalid || this.probing) { - this.form.markAllAsTouched(); - return; - } - - this.lastError = ''; - this.probing = true; - this.api.http - .post(`${this.api.baseUrl}/swos-beta/probe`, this.formValue) - .pipe(finalize(() => (this.probing = false))) - .subscribe({ - next: (result) => { - this.probeResult = result; - this.ui.success('toast.swosBetaProbeOk'); - }, - error: (error: HttpErrorResponse) => { - this.probeResult = undefined; - this.lastError = this.extractError(error); - this.ui.error('toast.swosBetaProbeFailed'); - } - }); - } - - download() { - if (this.form.invalid || this.downloading) { - this.form.markAllAsTouched(); - return; - } - - this.lastError = ''; - this.downloading = true; - this.api.http - .post(`${this.api.baseUrl}/swos-beta/download`, this.formValue, { - observe: 'response', - responseType: 'blob' - }) - .pipe(finalize(() => (this.downloading = false))) - .subscribe({ - next: (response) => { - this.saveBlob(response); - this.ui.success('toast.swosBetaDownloadOk'); - }, - error: (error: HttpErrorResponse) => { - this.lastError = this.extractError(error); - this.ui.error('toast.swosBetaDownloadFailed'); - } - }); - } - - private saveBlob(response: HttpResponse) { - const blob = response.body || new Blob(); - const url = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - link.download = this.extractFilename(response.headers.get('content-disposition')); - link.click(); - URL.revokeObjectURL(url); - } - - private extractFilename(disposition: string | null): string { - const match = disposition?.match(/filename="?([^\"]+)"?/i); - return match?.[1] || 'switchos-backup.swb'; - } - - private extractError(error: HttpErrorResponse): string { - const detail = error.error?.detail; - if (typeof detail === 'string' && detail.trim()) { - return detail.trim(); - } - if (typeof error.error === 'string' && error.error.trim()) { - return error.error.trim(); - } - return this.ui.instant('switchosBeta.genericError'); - } -} diff --git a/frontend/src/app/shared/layout/app-sidebar.component.html b/frontend/src/app/shared/layout/app-sidebar.component.html index bb9f9ef..4962149 100644 --- a/frontend/src/app/shared/layout/app-sidebar.component.html +++ b/frontend/src/app/shared/layout/app-sidebar.component.html @@ -1,6 +1,6 @@