From 791d575b7db59b6670a4617a0e371cd6619b8c48 Mon Sep 17 00:00:00 2001 From: ValueOn AG Date: Mon, 11 May 2026 23:59:27 +0200 Subject: [PATCH] fixed teamsbot issues --- src/pages/views/teamsbot/Teamsbot.module.css | 8 +- .../views/teamsbot/TeamsbotDashboardView.tsx | 87 +------------ .../views/teamsbot/TeamsbotSessionView.tsx | 122 ++++++++++-------- 3 files changed, 75 insertions(+), 142 deletions(-) diff --git a/src/pages/views/teamsbot/Teamsbot.module.css b/src/pages/views/teamsbot/Teamsbot.module.css index 4ca21b2..73d6a02 100644 --- a/src/pages/views/teamsbot/Teamsbot.module.css +++ b/src/pages/views/teamsbot/Teamsbot.module.css @@ -413,15 +413,12 @@ flex-direction: column; gap: 1rem; padding: 1rem; - height: 100%; } /* ----- Session Layout (UDB Sidebar + Main) ------------------------------- */ .sessionLayout { display: flex; - flex: 1; - min-height: 0; gap: 1rem; } @@ -430,7 +427,6 @@ flex-direction: column; flex: 1; min-width: 0; - min-height: 0; gap: 1rem; } @@ -820,8 +816,6 @@ display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; - flex: 1; - min-height: 0; } /* Transcript Panel */ @@ -833,6 +827,8 @@ display: flex; flex-direction: column; overflow: hidden; + height: 50vh; + min-height: 250px; } .panelTitle { diff --git a/src/pages/views/teamsbot/TeamsbotDashboardView.tsx b/src/pages/views/teamsbot/TeamsbotDashboardView.tsx index 089f121..dd5efc8 100644 --- a/src/pages/views/teamsbot/TeamsbotDashboardView.tsx +++ b/src/pages/views/teamsbot/TeamsbotDashboardView.tsx @@ -6,11 +6,9 @@ import type { TeamsbotSession, MeetingModule } from '../../../api/teamsbotApi'; import styles from './Teamsbot.module.css'; import { useLanguage } from '../../../providers/language/LanguageContext'; -const PAST_LIMIT = 10; - /** - * TeamsBot Dashboard — IA: KPIs, Modul-Aggregate, Quick-Actions, kompakte Session-Listen. - * Neues Meeting: Assistent (Wizard). Kein paralleler Vollformular-Start hier. + * TeamsBot Dashboard — IA: KPIs, Modul-Aggregate, Quick-Actions. + * Neues Meeting: Assistent (Wizard). Sessions sind via Module erreichbar. */ export const TeamsbotDashboardView: React.FC = () => { const { t } = useLanguage(); @@ -20,18 +18,14 @@ export const TeamsbotDashboardView: React.FC = () => { const [sessions, setSessions] = useState([]); const [modules, setModules] = useState([]); - const [loading, setLoading] = useState(true); const [error, setError] = useState(null); - const sessionsRef = useRef([]); - sessionsRef.current = sessions; const dashboardEsRef = useRef(null); - const dashboardReconnectRef = useRef | null>(null); + const dashboardReconnectRef = useRef(null); const applyDashboardPayload = useCallback((nextSessions: TeamsbotSession[], nextModules: MeetingModule[]) => { setSessions(nextSessions); setModules(nextModules); - sessionsRef.current = nextSessions; }, []); useEffect(() => { @@ -48,7 +42,6 @@ export const TeamsbotDashboardView: React.FC = () => { const connect = () => { if (cancelled) return; dashboardEsRef.current?.close(); - setLoading(true); const es = teamsbotApi.createDashboardStream(instanceId); dashboardEsRef.current = es; @@ -62,7 +55,6 @@ export const TeamsbotDashboardView: React.FC = () => { if (msg.type === 'dashboardState' && Array.isArray(msg.sessions) && Array.isArray(msg.modules)) { applyDashboardPayload(msg.sessions, msg.modules); setError(null); - setLoading(false); } } catch { /* ignore malformed SSE */ @@ -73,7 +65,6 @@ export const TeamsbotDashboardView: React.FC = () => { es.close(); dashboardEsRef.current = null; if (cancelled) return; - setLoading(false); clearReconnect(); dashboardReconnectRef.current = window.setTimeout(connect, 2500); }; @@ -92,19 +83,6 @@ export const TeamsbotDashboardView: React.FC = () => { () => sessions.filter((s) => ['pending', 'joining', 'active'].includes(s.status)), [sessions], ); - const pastSessions = useMemo( - () => - sessions - .filter((s) => ['ended', 'error', 'leaving'].includes(s.status)) - .sort((a, b) => { - const ta = a.startedAt ? new Date(a.startedAt).getTime() : 0; - const tb = b.startedAt ? new Date(b.startedAt).getTime() : 0; - return tb - ta; - }), - [sessions], - ); - const pastVisible = pastSessions.slice(0, PAST_LIMIT); - const moduleTitleById = useMemo(() => { const m = new Map(); modules.forEach((mod) => m.set(mod.id, mod.title)); @@ -165,10 +143,8 @@ export const TeamsbotDashboardView: React.FC = () => { teamsbotApi.listSessions(instanceId, true), teamsbotApi.listModules(instanceId), ]); - const nextSessions = r.sessions || []; - setSessions(nextSessions); + setSessions(r.sessions || []); setModules(m || []); - sessionsRef.current = nextSessions; } catch { /* ignore */ } }, [instanceId]); @@ -181,15 +157,6 @@ export const TeamsbotDashboardView: React.FC = () => { } }; - const _handleDeleteSession = async (sid: string) => { - try { - await teamsbotApi.deleteSession(instanceId, sid); - await _refreshLists(); - } catch (err: any) { - setError(err.message || t('Fehler beim Löschen')); - } - }; - return (
@@ -306,52 +273,6 @@ export const TeamsbotDashboardView: React.FC = () => { )} -
-
-

- {loading ? t('Laden…') : t('Letzte Sitzungen')} -

- {pastSessions.length > PAST_LIMIT && ( - - )} -
- {pastVisible.length === 0 && !loading ? ( -

{t('Noch keine beendeten Sitzungen')}

- ) : ( -
- {pastVisible.map((session) => ( -
-
- {session.botName} - - {_getStatusLabel(session.status)} - -
-
- {session.startedAt && ( - {new Date(session.startedAt).toLocaleString('de-CH')} - )} - {session.transcriptSegmentCount} {t('Segmente')} -
-
- - -
-
- ))} -
- )} -
); }; diff --git a/src/pages/views/teamsbot/TeamsbotSessionView.tsx b/src/pages/views/teamsbot/TeamsbotSessionView.tsx index 810ad70..0bbc91c 100644 --- a/src/pages/views/teamsbot/TeamsbotSessionView.tsx +++ b/src/pages/views/teamsbot/TeamsbotSessionView.tsx @@ -51,6 +51,7 @@ export const TeamsbotSessionView: React.FC = () => { const [screenshots, setScreenshots] = useState([]); const [screenshotsLoading, setScreenshotsLoading] = useState(false); const [screenshotsLoaded, setScreenshotsLoaded] = useState(false); + const [screenshotsExpanded, setScreenshotsExpanded] = useState(false); const [ttsStatusEvents, setTtsStatusEvents] = useState { )} - {/* Debug Screenshots (SysAdmin only) */} + {/* Debug Screenshots (SysAdmin only, collapsible) */} {_isSysAdmin && (
-
-

{t('Debug-Screenshots')}

- -
- {screenshotsLoaded && screenshots.length === 0 && ( -
{t('Keine Screenshots für diese Sitzung')}
- )} - {screenshots.length > 0 && ( -
- {screenshots.map((s) => { - const imgUrl = teamsbotApi.getScreenshotUrl(instanceId, s.name); - return ( - - {s.step} -
-
{s.step}
-
- {new Date(s.timestamp).toLocaleTimeString('de-CH')} — {(s.sizeBytes / 1024).toFixed(0)} KB -
-
-
- ); - })} +
setScreenshotsExpanded((v) => !v)} + > +

+ {screenshotsExpanded ? '\u25BC' : '\u25B6'} {t('Debug-Screenshots')} + {screenshotsLoaded && screenshots.length > 0 && ` (${screenshots.length})`} +

+
+ {screenshotsExpanded && ( + + )}
+
+ {screenshotsExpanded && ( + <> + {screenshotsLoaded && screenshots.length === 0 && ( +
{t('Keine Screenshots für diese Sitzung')}
+ )} + {screenshots.length > 0 && ( +
+ {screenshots.map((s) => { + const imgUrl = teamsbotApi.getScreenshotUrl(instanceId, s.name); + return ( + + {s.step} +
+
{s.step}
+
+ {new Date(s.timestamp).toLocaleTimeString('de-CH')} — {(s.sizeBytes / 1024).toFixed(0)} KB +
+
+
+ ); + })} +
+ )} + )}
)}