fix(ui): display error message when channel config save fails

- Add error display in renderChannelConfigSection
- Show props.lastError in danger callout when save fails
- Fixes #48923 where users couldn't see why config save failed

Root cause:
The saveConfig() function sets state.lastError on failure, but the
Channels UI never displayed it. Users saw unresponsive page with no
feedback, making it impossible to diagnose config save failures.

Fix:
1. Check props.lastError in renderChannelConfigSection
2. Display error in danger callout when present
3. Error clears on next successful save
This commit is contained in:
w-sss 2026-03-17 18:40:47 +08:00
parent f404ff32d5
commit 7030c00d45

View File

@ -118,6 +118,7 @@ export function renderChannelConfigForm(props: ChannelConfigFormProps) {
export function renderChannelConfigSection(params: { channelId: string; props: ChannelsProps }) {
const { channelId, props } = params;
const disabled = props.configSaving || props.configSchemaLoading;
const hasError = Boolean(props.lastError);
return html`
<div style="margin-top: 16px;">
${
@ -134,6 +135,15 @@ export function renderChannelConfigSection(params: { channelId: string; props: C
onPatch: props.onConfigPatch,
})
}
${
hasError
? html`
<div class="callout danger" style="margin-top: 12px;">
${props.lastError}
</div>
`
: nothing
}
<div class="row" style="margin-top: 12px;">
<button
class="btn primary"