mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-28 00:14:21 +00:00
fix(web): refresh system status card when clicking Refresh Data button
Pass a refreshKey prop through OverviewCards to SystemStatusCard that increments on each Refresh Data click, triggering a re-fetch of Plugin and Box runtime status alongside the monitoring data refresh.
This commit is contained in:
@@ -15,6 +15,7 @@ interface OverviewCardsProps {
|
|||||||
messages?: MonitoringMessage[];
|
messages?: MonitoringMessage[];
|
||||||
llmCalls?: LLMCall[];
|
llmCalls?: LLMCall[];
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
|
refreshKey?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function OverviewCards({
|
export default function OverviewCards({
|
||||||
@@ -22,6 +23,7 @@ export default function OverviewCards({
|
|||||||
messages = [],
|
messages = [],
|
||||||
llmCalls = [],
|
llmCalls = [],
|
||||||
loading,
|
loading,
|
||||||
|
refreshKey,
|
||||||
}: OverviewCardsProps) {
|
}: OverviewCardsProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -94,7 +96,7 @@ export default function OverviewCards({
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<SystemStatusCard />
|
<SystemStatusCard refreshKey={refreshKey} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Traffic Chart */}
|
{/* Traffic Chart */}
|
||||||
|
|||||||
@@ -30,7 +30,13 @@ function StatusDot({ ok }: { ok: boolean | null }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SystemStatusCard() {
|
interface SystemStatusCardProps {
|
||||||
|
refreshKey?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function SystemStatusCard({
|
||||||
|
refreshKey,
|
||||||
|
}: SystemStatusCardProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [pluginStatus, setPluginStatus] =
|
const [pluginStatus, setPluginStatus] =
|
||||||
useState<ApiRespPluginSystemStatus | null>(null);
|
useState<ApiRespPluginSystemStatus | null>(null);
|
||||||
@@ -52,10 +58,12 @@ export default function SystemStatusCard() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchStatus(true);
|
// refreshKey changes when the user clicks "Refresh Data"
|
||||||
|
fetchStatus(refreshKey === undefined);
|
||||||
const interval = setInterval(() => fetchStatus(false), 30_000);
|
const interval = setInterval(() => fetchStatus(false), 30_000);
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
}, [fetchStatus]);
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [fetchStatus, refreshKey]);
|
||||||
|
|
||||||
const pluginOk = pluginStatus
|
const pluginOk = pluginStatus
|
||||||
? pluginStatus.is_enable && pluginStatus.is_connected
|
? pluginStatus.is_enable && pluginStatus.is_connected
|
||||||
|
|||||||
Reference in New Issue
Block a user