fix(geplante-nachrichten): distinguish unconfigured bot from unreachable Nextcloud in room picker

This commit is contained in:
Matthias Hochmeister
2026-04-17 09:47:31 +02:00
parent 510b44e48c
commit 5811ac201e
3 changed files with 8 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ interface RoomInfo {
interface RoomsResult {
configured: boolean;
data?: RoomInfo[];
error?: string;
}
// ── Helpers ──────────────────────────────────────────────────────────────────
@@ -327,7 +328,7 @@ async function getRooms(): Promise<RoomsResult> {
logger.error('scheduledMessages.getRooms failed', {
error: error instanceof Error ? error.message : String(error),
});
return { configured: false };
return { configured: true, data: [], error: 'Verbindung zu Nextcloud fehlgeschlagen' };
}
}

View File

@@ -167,6 +167,7 @@ export default function GeplanteMachrichtenForm({ ruleId }: GeplanteMachrichtenF
const isEventType = messageType === 'fahrzeug_event';
const rooms = roomsData?.data ?? [];
const roomsConfigured = roomsData?.configured ?? false;
const roomsError = roomsData?.error;
if (ruleId && ruleLoading) {
return (
@@ -308,6 +309,10 @@ export default function GeplanteMachrichtenForm({ ruleId }: GeplanteMachrichtenF
<Alert severity="warning" sx={{ mt: 1 }}>
Bot-Konto nicht konfiguriert. Bitte in den Admin-Einstellungen unter Nextcloud konfigurieren.
</Alert>
) : roomsError ? (
<Alert severity="error" sx={{ mt: 1 }}>
Nextcloud nicht erreichbar Raumliste kann nicht geladen werden.
</Alert>
) : (
<Select
value={targetRoomToken}

View File

@@ -49,4 +49,5 @@ export interface ScheduledMessageDetailResponse {
export interface RoomsResponse {
configured: boolean;
data?: NextcloudRoom[];
error?: string;
}