frontend: refresh gateway status after tools/config save

- ToolsPage: call refreshGatewayState after tool toggle success
- ConfigPage: call refreshGatewayState after config save success
- RawConfigPage: call refreshGatewayState after raw JSON save success
- Ensures restart-required indicator updates immediately after changes
This commit is contained in:
SiYue-ZO 2026-03-25 01:00:42 +08:00
parent 80e4c47b10
commit 95ca372568
3 changed files with 6 additions and 0 deletions

View file

@ -32,6 +32,7 @@ import {
} from "@/components/config/form-model" } from "@/components/config/form-model"
import { PageHeader } from "@/components/page-header" import { PageHeader } from "@/components/page-header"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { refreshGatewayState } from "@/store/gateway"
export function ConfigPage() { export function ConfigPage() {
const { t } = useTranslation() const { t } = useTranslation()
@ -280,6 +281,7 @@ export function ConfigPage() {
} }
toast.success(t("pages.config.save_success")) toast.success(t("pages.config.save_success"))
void refreshGatewayState({ force: true })
} catch (err) { } catch (err) {
toast.error( toast.error(
err instanceof Error ? err.message : t("pages.config.save_error"), err instanceof Error ? err.message : t("pages.config.save_error"),

View file

@ -19,6 +19,7 @@ import {
} from "@/components/ui/alert-dialog" } from "@/components/ui/alert-dialog"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Textarea } from "@/components/ui/textarea" import { Textarea } from "@/components/ui/textarea"
import { refreshGatewayState } from "@/store/gateway"
export function RawConfigPage() { export function RawConfigPage() {
const { t } = useTranslation() const { t } = useTranslation()
@ -56,6 +57,7 @@ export function RawConfigPage() {
} catch { } catch {
queryClient.invalidateQueries({ queryKey: ["config"] }) queryClient.invalidateQueries({ queryKey: ["config"] })
} }
void refreshGatewayState({ force: true })
}, },
onError: () => { onError: () => {
toast.error(t("pages.config.save_error")) toast.error(t("pages.config.save_error"))

View file

@ -14,6 +14,7 @@ import {
CardTitle, CardTitle,
} from "@/components/ui/card" } from "@/components/ui/card"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
import { refreshGatewayState } from "@/store/gateway"
export function ToolsPage() { export function ToolsPage() {
const { t } = useTranslation() const { t } = useTranslation()
@ -33,6 +34,7 @@ export function ToolsPage() {
: t("pages.agent.tools.disable_success"), : t("pages.agent.tools.disable_success"),
) )
void queryClient.invalidateQueries({ queryKey: ["tools"] }) void queryClient.invalidateQueries({ queryKey: ["tools"] })
void refreshGatewayState({ force: true })
}, },
onError: (err) => { onError: (err) => {
toast.error( toast.error(