feat(05-01): enrich BACKEND_REGISTRY and update all consumers

- Change BACKEND_REGISTRY shape from Record<BackendType, FieldDef[]> to
  Record<BackendType, { displayName, description, fields: FieldDef[] }>
- Add displayName and description to azureblob, s3, s3-compatible entries
- Update schemas/index.ts buildZodSchema to use .fields access
- Update RemoteConfigStep.tsx two .fields accesses (azureblob.find + map)
This commit is contained in:
2026-03-30 09:37:16 +02:00
parent 7ec45896e5
commit d495552b60
3 changed files with 112 additions and 96 deletions
+2 -2
View File
@@ -55,7 +55,7 @@ export function RemoteConfigStep() {
<> <>
{/* Account field via FieldRenderer */} {/* Account field via FieldRenderer */}
<FieldRenderer <FieldRenderer
field={BACKEND_REGISTRY.azureblob.find(f => f.key === 'account')!} field={BACKEND_REGISTRY.azureblob.fields.find(f => f.key === 'account')!}
register={register} register={register}
error={errors.account as FieldError | undefined} error={errors.account as FieldError | undefined}
/> />
@@ -70,7 +70,7 @@ export function RemoteConfigStep() {
</> </>
) : ( ) : (
/* S3 and S3-compatible: full registry loop — FieldRenderer handles provider hiding */ /* S3 and S3-compatible: full registry loop — FieldRenderer handles provider hiding */
BACKEND_REGISTRY[backendType].map(field => ( BACKEND_REGISTRY[backendType].fields.map(field => (
<FieldRenderer <FieldRenderer
key={field.key} key={field.key}
field={field} field={field}
+1 -1
View File
@@ -7,7 +7,7 @@ import { z } from 'zod';
import { BACKEND_REGISTRY, BackendType } from './registry'; import { BACKEND_REGISTRY, BackendType } from './registry';
function buildZodSchema(backendType: BackendType): z.ZodObject<Record<string, z.ZodTypeAny>> { function buildZodSchema(backendType: BackendType): z.ZodObject<Record<string, z.ZodTypeAny>> {
const fields = BACKEND_REGISTRY[backendType]; const fields = BACKEND_REGISTRY[backendType].fields;
const shape: Record<string, z.ZodTypeAny> = {}; const shape: Record<string, z.ZodTypeAny> = {};
for (const field of fields) { for (const field of fields) {
shape[field.key] = field.required shape[field.key] = field.required
+109 -93
View File
@@ -16,97 +16,113 @@ export interface FieldDef {
options?: { value: string; label: string }[]; // for inputType: 'select' options?: { value: string; label: string }[]; // for inputType: 'select'
} }
export const BACKEND_REGISTRY: Record<BackendType, FieldDef[]> = { export const BACKEND_REGISTRY: Record<BackendType, {
azureblob: [ displayName: string;
{ description: string;
key: 'account', fields: FieldDef[];
label: 'Storage Account Name', }> = {
inputType: 'text', azureblob: {
required: true, displayName: 'Azure Blob Storage',
placeholder: 'mystorageaccount', description: 'Microsoft Azure cloud storage',
helpText: 'The storage account name (not the full URL)', fields: [
}, {
{ key: 'account',
key: 'key', label: 'Storage Account Name',
label: 'Access Key', inputType: 'text',
inputType: 'password', required: true,
required: false, placeholder: 'mystorageaccount',
helpText: 'Base64-encoded storage account key. Provide either this or a SAS URL, not both.', helpText: 'The storage account name (not the full URL)',
}, },
{ {
key: 'sas_url', key: 'key',
label: 'SAS URL', label: 'Access Key',
inputType: 'password', inputType: 'password',
required: false, required: false,
placeholder: 'https://mystorageaccount.blob.core.windows.net/?sv=...', helpText: 'Base64-encoded storage account key. Provide either this or a SAS URL, not both.',
helpText: 'Full SAS URL including account and container. Provide either this or an access key, not both.', },
}, {
], key: 'sas_url',
s3: [ label: 'SAS URL',
{ inputType: 'password',
key: 'provider', required: false,
label: 'Provider', placeholder: 'https://mystorageaccount.blob.core.windows.net/?sv=...',
inputType: 'select', helpText: 'Full SAS URL including account and container. Provide either this or an access key, not both.',
required: true, },
options: [{ value: 'AWS', label: 'Amazon S3' }], ],
}, },
{ s3: {
key: 'access_key_id', displayName: 'Amazon S3',
label: 'Access Key ID', description: 'AWS Simple Storage Service',
inputType: 'text', fields: [
required: true, {
placeholder: 'AKIAIOSFODNN7EXAMPLE', key: 'provider',
}, label: 'Provider',
{ inputType: 'select',
key: 'secret_access_key', required: true,
label: 'Secret Access Key', options: [{ value: 'AWS', label: 'Amazon S3' }],
inputType: 'password', },
required: true, {
}, key: 'access_key_id',
{ label: 'Access Key ID',
key: 'region', inputType: 'text',
label: 'Region', required: true,
inputType: 'text', placeholder: 'AKIAIOSFODNN7EXAMPLE',
required: true, },
placeholder: 'us-east-1', {
}, key: 'secret_access_key',
], label: 'Secret Access Key',
's3-compatible': [ inputType: 'password',
{ required: true,
key: 'provider', },
label: 'Provider', {
inputType: 'select', key: 'region',
required: true, label: 'Region',
options: [{ value: 'Other', label: 'S3-Compatible' }], inputType: 'text',
helpText: 'Covers Wasabi, MinIO, Cloudflare R2, and any S3-compatible storage', required: true,
}, placeholder: 'us-east-1',
{ },
key: 'access_key_id', ],
label: 'Access Key ID', },
inputType: 'text', 's3-compatible': {
required: true, displayName: 'S3-Compatible',
}, description: 'Wasabi, MinIO, Cloudflare R2, and others',
{ fields: [
key: 'secret_access_key', {
label: 'Secret Access Key', key: 'provider',
inputType: 'password', label: 'Provider',
required: true, inputType: 'select',
}, required: true,
{ options: [{ value: 'Other', label: 'S3-Compatible' }],
key: 'endpoint', helpText: 'Covers Wasabi, MinIO, Cloudflare R2, and any S3-compatible storage',
label: 'Endpoint URL', },
inputType: 'text', {
required: true, key: 'access_key_id',
placeholder: 'https://s3.wasabisys.com', label: 'Access Key ID',
helpText: 'The S3-compatible endpoint URL for your storage provider', inputType: 'text',
}, required: true,
{ },
key: 'region', {
label: 'Region', key: 'secret_access_key',
inputType: 'text', label: 'Secret Access Key',
required: false, inputType: 'password',
placeholder: 'us-east-1', required: true,
helpText: 'Optional for most S3-compatible providers', },
}, {
], key: 'endpoint',
label: 'Endpoint URL',
inputType: 'text',
required: true,
placeholder: 'https://s3.wasabisys.com',
helpText: 'The S3-compatible endpoint URL for your storage provider',
},
{
key: 'region',
label: 'Region',
inputType: 'text',
required: false,
placeholder: 'us-east-1',
helpText: 'Optional for most S3-compatible providers',
},
],
},
}; };