Always return all schema config fields in maskRow
Config object starts empty so the frontend had nothing to render for plaintext fields (region, username etc). Now populates all schema-defined fields with empty string when not yet saved. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e7b08ccf31
commit
f5f87fdd1f
1 changed files with 6 additions and 1 deletions
|
|
@ -12,12 +12,17 @@ function decryptSecrets(row) {
|
||||||
|
|
||||||
function maskRow(row) {
|
function maskRow(row) {
|
||||||
const schema = INTEGRATIONS[row.slug]
|
const schema = INTEGRATIONS[row.slug]
|
||||||
|
// Always return all schema-defined config fields, even if not yet saved
|
||||||
|
const config = {}
|
||||||
|
for (const f of schema?.configFields ?? []) {
|
||||||
|
config[f] = row.config?.[f] ?? ''
|
||||||
|
}
|
||||||
const existing = decryptSecrets(row)
|
const existing = decryptSecrets(row)
|
||||||
const masked = {}
|
const masked = {}
|
||||||
for (const f of schema?.secretFields ?? []) {
|
for (const f of schema?.secretFields ?? []) {
|
||||||
masked[f] = existing[f] ? MASKED : null
|
masked[f] = existing[f] ? MASKED : null
|
||||||
}
|
}
|
||||||
return { slug: row.slug, name: row.name, config: row.config, secrets: masked, enabled: row.enabled, updated_at: row.updated_at }
|
return { slug: row.slug, name: row.name, config, secrets: masked, enabled: row.enabled, updated_at: row.updated_at }
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function integrationRoutes(app) {
|
export async function integrationRoutes(app) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue