a906c6705d
- Typ proxmox am Ende von WIDGET_TYPES, WIDGET_MODULE_SLUGS = { proxmox: 'proxmox' }
- gemeinsame Statusteile (proxmox-status, HealthBar, status-styles) nach components/proxmox/
- HealthBar variant compact: 6 px, ohne Legende, aria-hidden
- Registry 3/4/8/8, Katalog-/Registry-/API-Tests auf die erste Modul-Kachel umgestellt
- ProxmoxWidget liest nur listServers, zeigt Lade-, Leer-, Fehlerzustand
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
126 lines
3.9 KiB
TypeScript
126 lines
3.9 KiB
TypeScript
export const APP_NAME = "Tessera";
|
|
|
|
export interface HealthResponse {
|
|
status: string;
|
|
timestamp: string;
|
|
}
|
|
|
|
/**
|
|
* Antwort von `GET /health/version` (quick-260914-ku1).
|
|
* `channel` ist in der Praxis `beta` | `live` | `dev`; die Wahrheit der
|
|
* Version ist der Git-Tag (`git describe`), nicht eine package.json.
|
|
*/
|
|
export interface VersionResponse {
|
|
name: string;
|
|
version: string;
|
|
channel: string;
|
|
commit: string;
|
|
buildTime: string;
|
|
}
|
|
|
|
/**
|
|
* Desktop-Pakete (Phase 18, D-08): Quelle ist ausschliesslich `manifest.json`,
|
|
* geschrieben nur von `.gitea/scripts/desktop-collect.sh` im CI. `platform` ist
|
|
* ein geschlossener Wertevorrat -- eine dritte Plattform waere eine bewusste
|
|
* Erweiterung hier und an der Konstante `PLATFORMS` im API-Dienst.
|
|
*/
|
|
export type DesktopPlatform = 'windows' | 'linux';
|
|
|
|
export interface DesktopManifestFile {
|
|
name: string;
|
|
size: number;
|
|
sha256: string;
|
|
/**
|
|
* Base64-Inhalt der `.sig`-Datei des Tauri-Bundlers (minisign), geschrieben
|
|
* von desktop-collect.sh, gelesen nur von `GET /desktop/update`. Fehlt bei
|
|
* Bauten mit `--no-sign` -- dann gibt es kein Update in der App.
|
|
*/
|
|
signature?: string;
|
|
}
|
|
|
|
export interface DesktopManifest {
|
|
version: string;
|
|
channel: string;
|
|
commit: string;
|
|
buildTime: string;
|
|
/**
|
|
* SemVer-Form, die der Updater im Client vergleicht: `X.Y.Z` bei live,
|
|
* `X.Y.Z-beta.g<sha7>` bei beta (Praefix `g` Pflicht -- ein rein numerischer
|
|
* SHA mit fuehrender Null waere kein gueltiger SemVer-Identifier).
|
|
*/
|
|
updateVersion?: string;
|
|
files: Partial<Record<DesktopPlatform, DesktopManifestFile>>;
|
|
}
|
|
|
|
/**
|
|
* Antwort von `GET /desktop/update` -- das dynamische Antwortformat von
|
|
* `tauri-plugin-updater`. Die Feldnamen sind vom Plugin vorgegeben, darum
|
|
* snake_case `pub_date`. `url` muss absolut sein, `signature` ist Pflicht.
|
|
*/
|
|
export interface DesktopUpdateResponse {
|
|
version: string;
|
|
pub_date?: string;
|
|
url: string;
|
|
signature: string;
|
|
notes?: string;
|
|
}
|
|
|
|
export interface DesktopLatestFile extends DesktopManifestFile {
|
|
url: string;
|
|
}
|
|
|
|
export interface DesktopLatestResponse {
|
|
version: string;
|
|
channel: string;
|
|
commit: string;
|
|
buildTime: string;
|
|
files: Partial<Record<DesktopPlatform, DesktopLatestFile>>;
|
|
}
|
|
|
|
/**
|
|
* Dashboard-Kacheln: EINE Typliste fuer Web und API (quick-260922-m1h).
|
|
*
|
|
* Vorher stand dieselbe Liste an sieben Stellen (Union-Typ, Constraints,
|
|
* Registry, Katalog-Liste, `@IsIn`-Whitelist ...). Vergass man eine, fehlte
|
|
* die Kachel im Katalog oder die API lehnte sie mit 400 ab. Seit m1h leiten
|
|
* beide Seiten von hier ab: `apps/web/src/components/dashboard/
|
|
* widget-registry.tsx` (Registry + Katalog) und
|
|
* `apps/api/src/dashboard/dto/create-widget.dto.ts` (`@IsIn`).
|
|
*
|
|
* ACHTUNG: Dies ist der erste LAUFZEIT-Import aus `@tessera/shared` (alle
|
|
* uebrigen sind `import type`). `packages/shared` liefert rohes TypeScript
|
|
* (`main: src/index.ts`, kein Bauschritt); die API laedt es im Betrieb ueber
|
|
* das native Type-Stripping von Node 24. Deshalb darf diese Datei nur
|
|
* loeschbare Syntax enthalten — keine `enum`, kein `namespace`, keine
|
|
* Parameter-Eigenschaften.
|
|
*/
|
|
export const WIDGET_TYPES = [
|
|
'clock',
|
|
'search',
|
|
'calendar',
|
|
'note',
|
|
'calculator',
|
|
'favorites',
|
|
'stopwatch',
|
|
'picture-frame',
|
|
'xframe',
|
|
'proxmox',
|
|
] as const;
|
|
|
|
export type WidgetType = (typeof WIDGET_TYPES)[number];
|
|
|
|
/**
|
|
* Kachel → Modul-Slug. Eine Kachel ohne Eintrag ist immer sichtbar; eine
|
|
* Kachel MIT Eintrag erscheint nur fuer Benutzer, die das Modul nutzen
|
|
* duerfen — im Katalog (Komfort, `visibleWidgetTypes`) und verbindlich
|
|
* serverseitig in `DashboardService.getWidgets` (fail-closed).
|
|
*
|
|
* Die neun Kacheln von vor quick-260924-i8v sind Plattform-Kacheln ohne
|
|
* Modulbezug. Proxmox ist die erste modulgebundene Kachel; ihr Slug ist
|
|
* derselbe wie `@UseModule('proxmox')` im Controller und `slug: 'proxmox'`
|
|
* in `proxmox.seed.ts`.
|
|
*/
|
|
export const WIDGET_MODULE_SLUGS: Partial<Record<WidgetType, string>> = {
|
|
proxmox: 'proxmox',
|
|
};
|