From 7dc941e4673cef3d4e7f16ae289a054239972e29 Mon Sep 17 00:00:00 2001 From: Jason Staack Date: Sun, 22 Mar 2026 07:50:35 -0500 Subject: [PATCH] fix(ui): fix credential profile field names and list response unwrapping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - credentialProfilesApi.list now unwraps {profiles: [...]} wrapper - CredentialProfilesPage handles both array and wrapped responses - Renamed privacy_protocol → priv_protocol to match backend schema - Renamed privacy_passphrase → priv_passphrase to match backend - Renamed security_name → username (SNMPv3 uses username field) - Removed security_name from CredentialProfileCreate type Co-Authored-By: Claude Opus 4.6 (1M context) --- .../components/settings/CredentialProfilesPage.tsx | 14 +++++++------- frontend/src/lib/api.ts | 7 +++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/settings/CredentialProfilesPage.tsx b/frontend/src/components/settings/CredentialProfilesPage.tsx index 7a3bb19..cbfd955 100644 --- a/frontend/src/components/settings/CredentialProfilesPage.tsx +++ b/frontend/src/components/settings/CredentialProfilesPage.tsx @@ -119,7 +119,7 @@ export function CredentialProfilesPage({ tenantId }: CredentialProfilesPageProps enabled: !!tenantId, }) - const profiles = data?.profiles ?? [] + const profiles = Array.isArray(data) ? data : (data?.profiles ?? []) const routerosProfiles = profiles.filter((p) => p.credential_type === 'routeros') const snmpProfiles = profiles.filter((p) => p.credential_type.startsWith('snmp_')) @@ -401,8 +401,8 @@ export function CredentialProfilesPage({ tenantId }: CredentialProfilesPageProps
updateForm({ security_name: e.target.value })} + value={form.username ?? ''} + onChange={(e) => updateForm({ username: e.target.value })} placeholder={ editingProfile ? 'Leave blank to keep current' : 'snmpuser' } @@ -473,8 +473,8 @@ export function CredentialProfilesPage({ tenantId }: CredentialProfilesPageProps
- updateForm({ privacy_passphrase: e.target.value }) + updateForm({ priv_passphrase: e.target.value }) } placeholder={ editingProfile ? 'Leave blank to keep current' : '' diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index 2644ef8..af34c96 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -491,9 +491,8 @@ export interface CredentialProfileCreate { security_level?: string auth_protocol?: string auth_passphrase?: string - privacy_protocol?: string - privacy_passphrase?: string - security_name?: string + priv_protocol?: string + priv_passphrase?: string } export interface CredentialProfileUpdate extends Partial {} @@ -505,7 +504,7 @@ export const credentialProfilesApi = { `/api/tenants/${tenantId}/credential-profiles`, { params: credentialType ? { credential_type: credentialType } : undefined }, ) - .then((r) => r.data), + .then((r) => r.data.profiles), get: (tenantId: string, profileId: string) => api