Adopt shared WebUI layout primitives

This commit is contained in:
2026-08-18 10:42:52 +02:00
parent 1e511e4c15
commit 44ba0ec9c1
4 changed files with 42 additions and 42 deletions
@@ -1,6 +1,6 @@
import { useEffect, useMemo, useState } from "react";
import { Edit3, Plus, RefreshCw, Save, ShieldCheck, Trash2, UserRoundKey } from "lucide-react";
import {
import { FormGrid,
Button,
Card,
ConnectionTree,
@@ -963,7 +963,7 @@ export default function FileConnectorSettingsPanel({
<LoadingFrame loading={loading} label="i18n:govoplan-files.loading_connector_policy.f12ab285">
<>
<div className="form-grid two">
<FormGrid columns={2} collapseAt="standard" className="">
<FormField label="i18n:govoplan-files.allowed_connection_ids.0df854c8">
<ReferenceMultiSelect
values={lines(policyDraft.allowedConnectors)}
@@ -1042,7 +1042,7 @@ export default function FileConnectorSettingsPanel({
<FormField label="i18n:govoplan-files.denied_endpoint_urls.1d8d4369">
<textarea value={policyDraft.deniedUrls} disabled={saving || !canWrite} onChange={(event) => patchPolicyDraft({ deniedUrls: event.target.value })} rows={3} placeholder={"http://*\n*://legacy.example.test/*"} />
</FormField>
</div>
</FormGrid>
{policyConflicts.length ? (
<DismissibleAlert
tone="warning"
@@ -1075,11 +1075,11 @@ export default function FileConnectorSettingsPanel({
</LoadingFrame>
</Card>
<Dialog
<Dialog variant="administration" size="wide"
open={Boolean(credentialDraft)}
title={editingCredentialId ? "i18n:govoplan-files.edit_file_credential.bc49d44f" : "i18n:govoplan-files.new_file_credential.4c061082"}
onClose={closeCredentialDialog}
className="admin-dialog admin-dialog-wide file-connector-dialog adaptive-config-dialog"
className="file-connector-dialog adaptive-config-dialog"
bodyClassName="adaptive-config-dialog-body"
closeDisabled={saving}
footer={credentialDraft ?
@@ -1098,7 +1098,7 @@ export default function FileConnectorSettingsPanel({
<h3>Credential</h3>
<p>Choose where this credential can be used and how it signs in.</p>
</header>
<div className="form-grid two">
<FormGrid columns={2} collapseAt="standard" className="">
<FormField label="i18n:govoplan-files.credential_id.9432a6e1">
<input className={!editingCredentialId && !credentialDraft.id.trim() ? "field-input-missing" : undefined} aria-invalid={!editingCredentialId && !credentialDraft.id.trim() || undefined} value={credentialDraft.id} disabled={Boolean(editingCredentialId) || saving} onChange={(event) => patchCredentialDraft({ id: event.target.value })} placeholder={`${scopeType}-webdav-credentials`} />
</FormField>
@@ -1137,7 +1137,7 @@ export default function FileConnectorSettingsPanel({
<option value="secret_ref">i18n:govoplan-files.secret_reference.04ed2221</option>
</select>
</FormField>
</div>
</FormGrid>
<div className="file-connector-settings-section">
<ToggleSwitch label="i18n:govoplan-files.enabled.df174a3f" checked={credentialDraft.enabled} disabled={saving} onChange={(enabled) => patchCredentialDraft({ enabled })} />
{editingCredentialId && <ToggleSwitch label="i18n:govoplan-files.clear_saved_password.7442260d" checked={credentialDraft.clearPassword} disabled={saving} onChange={(clearPassword) => patchCredentialDraft({ clearPassword })} />}
@@ -1176,11 +1176,11 @@ export default function FileConnectorSettingsPanel({
onChange={patchCredentialValues}
disabled={saving}
showPassword={false} />
<div className="form-grid two">
<FormGrid columns={2} collapseAt="standard" className="">
<FormField label="i18n:govoplan-files.secret_reference.04ed2221">
<input value={credentialDraft.secretRef} disabled={saving} onChange={(event) => patchCredentialDraft({ secretRef: event.target.value })} />
</FormField>
</div>
</FormGrid>
</>
}
{credentialDraft.credentialMode === "token" &&
@@ -1212,7 +1212,7 @@ export default function FileConnectorSettingsPanel({
<h3>Policy</h3>
<p>Limit where lower levels may use this credential.</p>
</header>
<div className="form-grid two">
<FormGrid columns={2} collapseAt="standard" className="">
<FormField label="i18n:govoplan-files.policy.bb9cf141" documentation={CONNECTOR_DOCUMENTATION}>
<select value={credentialDraft.policyMode} disabled={saving} onChange={(event) => patchCredentialDraft({ policyMode: event.target.value as PolicyMode })}>
<option value="allow-provider">i18n:govoplan-files.can_use_this_credential.f4a41971</option>
@@ -1228,7 +1228,7 @@ export default function FileConnectorSettingsPanel({
<FormField label="i18n:govoplan-files.denied_paths.d25e4315">
<textarea value={credentialDraft.deniedPaths} disabled={saving} onChange={(event) => patchCredentialDraft({ deniedPaths: event.target.value })} rows={3} placeholder={"private\narchive/closed"} />
</FormField>
</div>
</FormGrid>
<AdvancedOptionsPanel title="Credential metadata JSON" summary="For diagnostics or provider-specific compatibility flags. Normal setup should not need this.">
<FormField label="i18n:govoplan-files.metadata_json.b0e4c283" documentation={CONNECTOR_RECOVERY_DOCUMENTATION}>
<textarea value={credentialDraft.metadataJson} disabled={saving} onChange={(event) => patchCredentialDraft({ metadataJson: event.target.value })} rows={5} spellCheck={false} />
@@ -1239,11 +1239,11 @@ export default function FileConnectorSettingsPanel({
}
</Dialog>
<Dialog
<Dialog variant="administration" size="wide"
open={Boolean(draft)}
title={editingProfileId ? "i18n:govoplan-files.edit_file_connection.78698154" : "i18n:govoplan-files.new_file_connection.2ec6eb56"}
onClose={closeProfileDialog}
className="admin-dialog admin-dialog-wide file-connector-dialog adaptive-config-dialog"
className="file-connector-dialog adaptive-config-dialog"
bodyClassName="adaptive-config-dialog-body"
closeDisabled={saving}
footer={draft ?
@@ -1262,7 +1262,7 @@ export default function FileConnectorSettingsPanel({
<h3>Connection</h3>
<p>Name the file server connection and choose the provider.</p>
</header>
<div className="form-grid two">
<FormGrid columns={2} collapseAt="standard" className="">
<FormField label="i18n:govoplan-files.profile_id.25961d68">
<input className={!editingProfileId && !draft.id.trim() ? "field-input-missing" : undefined} aria-invalid={!editingProfileId && !draft.id.trim() || undefined} value={draft.id} disabled={Boolean(editingProfileId) || saving} onChange={(event) => patchDraft({ id: event.target.value })} placeholder={`${scopeType}-webdav`} />
</FormField>
@@ -1287,7 +1287,7 @@ export default function FileConnectorSettingsPanel({
<div className="field-block file-connector-settings-toggle-field">
<ToggleSwitch label="i18n:govoplan-files.enabled.df174a3f" checked={draft.enabled} disabled={saving} onChange={(enabled) => patchDraft({ enabled })} />
</div>
</div>
</FormGrid>
</section>
<section className="adaptive-config-section">
@@ -1295,7 +1295,7 @@ export default function FileConnectorSettingsPanel({
<h3>Location and credentials</h3>
<p>Only fields relevant for the selected provider and credential mode are shown.</p>
</header>
<div className="form-grid two">
<FormGrid columns={2} collapseAt="standard" className="">
<FormField label="i18n:govoplan-files.endpoint_url.65aaaa45" documentation={CONNECTOR_DOCUMENTATION}>
<input value={draft.endpointUrl} disabled={saving} onChange={(event) => patchDraft({ endpointUrl: event.target.value })} placeholder={ENDPOINT_PLACEHOLDERS[draft.provider]} />
</FormField>
@@ -1317,7 +1317,7 @@ export default function FileConnectorSettingsPanel({
{profileCredentialOptions.map((credential) => <option key={credential.id} value={credential.id}>{credential.label}</option>)}
</select>
</FormField>
</div>
</FormGrid>
<div className="button-row compact-actions">
<Button type="button" onClick={() => patchDraft({ endpointUrl: ENDPOINT_PLACEHOLDERS[draft.provider] })} disabled={saving} disabledReason={saving ? "Wait for the current connector change to finish." : undefined}>Use provider example</Button>
{canDiscoverProfileEndpoint &&
@@ -1332,7 +1332,7 @@ export default function FileConnectorSettingsPanel({
</DismissibleAlert>
}
<AdvancedOptionsPanel title="Protocol and compatibility options" summary="Change these only when the provider or network requires an override.">
<div className="form-grid two">
<FormGrid columns={2} collapseAt="standard" className="">
<FormField label="i18n:govoplan-files.browse_protocol.d1f27c90">
<select value={draft.browseProtocol} disabled={saving} onChange={(event) => patchDraft({ browseProtocol: event.target.value })}>
<option value="">i18n:govoplan-files.native_default.ba32f7b6</option>
@@ -1352,7 +1352,7 @@ export default function FileConnectorSettingsPanel({
</div>
</>
}
</div>
</FormGrid>
</AdvancedOptionsPanel>
</section>
@@ -1366,7 +1366,7 @@ export default function FileConnectorSettingsPanel({
<ToggleSwitch label="i18n:govoplan-files.import.d6fbc9d2" checked={draft.canImport} disabled={saving} onChange={(canImport) => patchDraft({ canImport })} />
<ToggleSwitch label="i18n:govoplan-files.sync.905f6309" checked={draft.canSync} disabled={saving} onChange={(canSync) => patchDraft({ canSync })} />
</div>
<div className="form-grid two">
<FormGrid columns={2} collapseAt="standard" className="">
<FormField label="i18n:govoplan-files.policy.bb9cf141" documentation={CONNECTOR_DOCUMENTATION}>
<select value={draft.policyMode} disabled={saving} onChange={(event) => patchDraft({ policyMode: event.target.value as PolicyMode })}>
<option value="allow-provider">i18n:govoplan-files.can_use_this_connection.5091a74c</option>
@@ -1382,7 +1382,7 @@ export default function FileConnectorSettingsPanel({
<FormField label="i18n:govoplan-files.denied_paths.d25e4315">
<textarea value={draft.deniedPaths} disabled={saving} onChange={(event) => patchDraft({ deniedPaths: event.target.value })} rows={3} placeholder={"private\narchive/closed"} />
</FormField>
</div>
</FormGrid>
<AdvancedOptionsPanel title="Connection metadata JSON" summary="For diagnostics or provider-specific compatibility flags. Normal setup should not need this.">
<FormField label="i18n:govoplan-files.metadata_json.b0e4c283" documentation={CONNECTOR_RECOVERY_DOCUMENTATION}>
<textarea value={draft.metadataJson} disabled={saving} onChange={(event) => patchDraft({ metadataJson: event.target.value })} rows={5} spellCheck={false} />