fix: dashboard provider card shows filtered count, fix provider update 400

- Dashboard providers card now shows count of providers matching the
  global provider type filter instead of special name/type display
- Fix provider update sending empty config when only name/icon changed,
  causing 400 validation error (api_key required)
This commit is contained in:
2026-03-23 21:30:25 +03:00
parent 4049efe186
commit 0702ec72af
2 changed files with 16 additions and 13 deletions
+8 -1
View File
@@ -106,7 +106,14 @@
}
}
if (editing) {
await api(`/providers/${editing}`, { method: 'PUT', body: JSON.stringify({ name: form.name, icon: form.icon, config }) });
// Only send config if user changed a config field (secrets are blank on edit)
const hasConfigChange = form.url !== (providers.find(p => p.id === editing)?.config?.url || '') ||
(form.type === 'immich' && (form.api_key || form.external_domain !== (providers.find(p => p.id === editing)?.config?.external_domain || ''))) ||
(form.type === 'gitea' && (form.api_token || form.webhook_secret)) ||
(form.type === 'planka' && (form.api_key || form.webhook_secret));
const body: any = { name: form.name, icon: form.icon };
if (hasConfigChange) body.config = config;
await api(`/providers/${editing}`, { method: 'PUT', body: JSON.stringify(body) });
} else {
await api('/providers', { method: 'POST', body: JSON.stringify({ type: form.type, name: form.name, icon: form.icon, config }) });
}