fix(geplante-nachrichten): distinguish unconfigured bot from unreachable Nextcloud in room picker
This commit is contained in:
@@ -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' };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -49,4 +49,5 @@ export interface ScheduledMessageDetailResponse {
|
||||
export interface RoomsResponse {
|
||||
configured: boolean;
|
||||
data?: NextcloudRoom[];
|
||||
error?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user