Fix provider configuration response rendering
Align the admin page with the array response defined by the production API and OpenAPI contract so successful status loads cannot trip the route error boundary.
This commit is contained in:
@@ -135,9 +135,7 @@ export interface ManagedProviderStatus {
|
|||||||
updatedAt?: string;
|
updatedAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ManagedProviderOverview {
|
export type ManagedProviderOverview = ManagedProviderStatus[];
|
||||||
providers: ManagedProviderStatus[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface UpdateProviderApiKeyRequest {
|
export interface UpdateProviderApiKeyRequest {
|
||||||
apiKey: string;
|
apiKey: string;
|
||||||
|
|||||||
@@ -59,10 +59,10 @@ export function ProvidersPage() {
|
|||||||
const updateStatus = useCallback((updated: ManagedProviderStatus) => {
|
const updateStatus = useCallback((updated: ManagedProviderStatus) => {
|
||||||
setOverview((current) => {
|
setOverview((current) => {
|
||||||
if (!current) return current;
|
if (!current) return current;
|
||||||
const providers = current.providers.filter(
|
const providers = current.filter(
|
||||||
(item) => item.providerId !== updated.providerId,
|
(item) => item.providerId !== updated.providerId,
|
||||||
);
|
);
|
||||||
return { providers: [...providers, updated] };
|
return [...providers, updated];
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ export function ProvidersPage() {
|
|||||||
providerId={provider.id}
|
providerId={provider.id}
|
||||||
name={provider.name}
|
name={provider.name}
|
||||||
description={provider.description}
|
description={provider.description}
|
||||||
status={overview.providers.find((item) => item.providerId === provider.id)}
|
status={overview.find((item) => item.providerId === provider.id)}
|
||||||
onUpdated={updateStatus}
|
onUpdated={updateStatus}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -66,19 +66,17 @@ function mockProviders() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function providerOverview(): ManagedProviderOverview {
|
function providerOverview(): ManagedProviderOverview {
|
||||||
return {
|
return [
|
||||||
providers: [
|
{
|
||||||
{
|
providerId: "deepseek",
|
||||||
providerId: "deepseek",
|
configured: true,
|
||||||
configured: true,
|
source: "RUNTIME_OVERRIDE",
|
||||||
source: "RUNTIME_OVERRIDE",
|
updatedAt: "2026-08-22T07:30:00Z",
|
||||||
updatedAt: "2026-08-22T07:30:00Z",
|
},
|
||||||
},
|
{
|
||||||
{
|
providerId: "volcengine",
|
||||||
providerId: "volcengine",
|
configured: true,
|
||||||
configured: true,
|
source: "ENVIRONMENT",
|
||||||
source: "ENVIRONMENT",
|
},
|
||||||
},
|
];
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user