fix(desktop): offer a Restart gateway action on messaging save/toggle toasts

The "setup saved" and "platform enabled/disabled" toasts told users their
change needs a gateway restart but left it a separate hunt. Attach a "Restart
gateway" action (the shared runGatewayRestart), and reword the copy to state
the pending consequence ("...takes effect after a gateway restart") now that
the button carries the verb. Updated all 4 locales.
This commit is contained in:
Brooklyn Nicholson 2026-06-19 10:03:24 -05:00
parent 553cf4f977
commit a1639921ac
5 changed files with 15 additions and 10 deletions

View file

@ -17,6 +17,7 @@ import { type Translations, useI18n } from '@/i18n'
import { AlertTriangle, ExternalLink, Save, Trash2 } from '@/lib/icons'
import { cn } from '@/lib/utils'
import { notify, notifyError } from '@/store/notifications'
import { runGatewayRestart } from '@/store/system-actions'
import { useRefreshHotkey } from '../hooks/use-refresh-hotkey'
import { useRouteEnumParam } from '../hooks/use-route-enum-param'
@ -97,6 +98,8 @@ function fieldCopy(field: MessagingEnvVarInfo, m: Translations['messaging']) {
export function MessagingView({ setStatusbarItemGroup: _setStatusbarItemGroup, ...props }: MessagingViewProps) {
const { t } = useI18n()
const m = t.messaging
// Both save/toggle toasts offer the same one-click restart.
const restartGatewayAction = { label: t.commandCenter.restartGateway, onClick: () => void runGatewayRestart() }
const [platforms, setPlatforms] = useState<MessagingPlatformInfo[] | null>(null)
const [edits, setEdits] = useState<EditMap>({})
const [query, setQuery] = useState('')
@ -197,7 +200,8 @@ export function MessagingView({ setStatusbarItemGroup: _setStatusbarItemGroup, .
notify({
kind: 'success',
title: enabled ? m.platformEnabled(platform.name) : m.platformDisabled(platform.name),
message: m.restartToApply
message: m.restartToApply,
action: restartGatewayAction
})
} catch (err) {
notifyError(err, m.failedUpdate(platform.name))
@ -222,7 +226,8 @@ export function MessagingView({ setStatusbarItemGroup: _setStatusbarItemGroup, .
notify({
kind: 'success',
title: m.setupSaved(platform.name),
message: m.restartToReconnect
message: m.restartToReconnect,
action: restartGatewayAction
})
} catch (err) {
notifyError(err, m.failedSave(platform.name))

View file

@ -831,9 +831,9 @@ export const en: Translations = {
disableAria: name => `Disable ${name}`,
platformEnabled: name => `${name} enabled`,
platformDisabled: name => `${name} disabled`,
restartToApply: 'Restart the gateway for this change to take effect.',
restartToApply: 'This change takes effect after a gateway restart.',
setupSaved: name => `${name} setup saved`,
restartToReconnect: 'Restart the gateway to reconnect with the new credentials.',
restartToReconnect: 'New credentials take effect after a gateway restart.',
keyCleared: key => `${key} cleared`,
setupUpdated: name => `${name} setup was updated.`,
failedUpdate: name => `Failed to update ${name}`,

View file

@ -952,9 +952,9 @@ export const ja = defineLocale({
disableAria: name => `${name} を無効にする`,
platformEnabled: name => `${name} を有効にしました`,
platformDisabled: name => `${name} を無効にしました`,
restartToApply: 'この変更を有効にするにはゲートウェイを再起動してください。',
restartToApply: 'この変更はゲートウェイの再起動後に有効になります。',
setupSaved: name => `${name} の設定を保存しました`,
restartToReconnect: '新しい認証情報で再接続するにはゲートウェイを再起動してください。',
restartToReconnect: '新しい認証情報はゲートウェイの再起動後に有効になります。',
keyCleared: key => `${key} をクリアしました`,
setupUpdated: name => `${name} の設定が更新されました。`,
failedUpdate: name => `${name} の更新に失敗しました`,

View file

@ -924,9 +924,9 @@ export const zhHant = defineLocale({
disableAria: name => `停用 ${name}`,
platformEnabled: name => `${name} 已啟用`,
platformDisabled: name => `${name} 已停用`,
restartToApply: '重新啟動閘道後此變更才會生效。',
restartToApply: '此變更將在閘道重新啟動後生效。',
setupSaved: name => `${name} 設定已儲存`,
restartToReconnect: '重新啟動閘道以使用新憑證重新連線。',
restartToReconnect: '新憑證將在閘道重新啟動後生效。',
keyCleared: key => `${key} 已清除`,
setupUpdated: name => `${name} 設定已更新。`,
failedUpdate: name => `更新 ${name} 失敗`,

View file

@ -1021,9 +1021,9 @@ export const zh: Translations = {
disableAria: name => `禁用 ${name}`,
platformEnabled: name => `${name} 已启用`,
platformDisabled: name => `${name} 已禁用`,
restartToApply: '重启网关后此更改才会生效。',
restartToApply: '此更改将在网关重启后生效。',
setupSaved: name => `${name} 设置已保存`,
restartToReconnect: '重启网关以使用新凭据重新连接。',
restartToReconnect: '新凭据将在网关重启后生效。',
keyCleared: key => `${key} 已清除`,
setupUpdated: name => `${name} 设置已更新。`,
failedUpdate: name => `更新 ${name} 失败`,