fix: add unsaved changes banners to edit mode forms

Adds amber edit-mode banners to AppConfigDetailPage and both
DefaultResourcesSection/JarRetentionSection in EnvironmentsPage,
matching the existing ConfigSubTab pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-09 18:47:55 +02:00
parent 39687bc8a9
commit 9466551044
7 changed files with 68 additions and 24 deletions

View File

@@ -90,3 +90,13 @@
color: var(--text-muted);
font-family: var(--font-body);
}
.editBanner {
padding: 8px 16px;
background: color-mix(in srgb, var(--amber) 8%, transparent);
border: 1px solid var(--amber);
border-radius: var(--radius-sm);
font-size: 13px;
color: var(--text-primary);
margin-bottom: 16px;
}

View File

@@ -317,6 +317,12 @@ export default function AppConfigDetailPage() {
)}
</div>
{editing && (
<div className={styles.editBanner}>
Editing configuration. Changes are not saved until you click Save.
</div>
)}
<div className={styles.header}>
<h2 className={styles.title}><MonoText size="md">{appId}</MonoText></h2>
<div className={styles.meta}>

View File

@@ -392,6 +392,11 @@ function DefaultResourcesSection({ environment, onSave, saving }: {
return (
<div className={sectionStyles.section}>
<SectionHeader>Default Resource Limits</SectionHeader>
{editing && (
<div className={styles.editBanner}>
Editing resource defaults. Changes are not saved until you click Save.
</div>
)}
<p className={styles.inheritedNote}>
These defaults apply to new apps in this environment unless overridden per-app.
</p>
@@ -485,6 +490,11 @@ function JarRetentionSection({ environment, onSave, saving }: {
return (
<div className={sectionStyles.section}>
<SectionHeader>JAR Retention</SectionHeader>
{editing && (
<div className={styles.editBanner}>
Editing resource defaults. Changes are not saved until you click Save.
</div>
)}
<p className={styles.inheritedNote}>
Old JAR versions are cleaned up nightly. Currently deployed versions are never deleted.
</p>

View File

@@ -1,4 +1,5 @@
import { useEffect, useState } from 'react';
import { Eye, EyeOff } from 'lucide-react';
import {
Button, Input, Toggle, FormField, SectionHeader, Tag, ConfirmDialog,
} from '@cameleer/design-system';
@@ -41,6 +42,7 @@ export default function OidcConfigPage() {
const [editing, setEditing] = useState(false);
const [formDraft, setFormDraft] = useState<OidcFormData | null>(null);
const [newRole, setNewRole] = useState('');
const [showSecret, setShowSecret] = useState(false);
const [deleteOpen, setDeleteOpen] = useState(false);
const [saving, setSaving] = useState(false);
const [testing, setTesting] = useState(false);
@@ -200,13 +202,25 @@ export default function OidcConfigPage() {
/>
</FormField>
<FormField label="Client Secret" htmlFor="client-secret">
<Input
id="client-secret"
type="password"
value={current?.clientSecret ?? ''}
onChange={(e) => updateDraft('clientSecret', e.target.value)}
disabled={!editing}
/>
<div style={{ position: 'relative' }}>
<Input
id="client-secret"
type={showSecret ? 'text' : 'password'}
value={current?.clientSecret ?? ''}
onChange={(e) => updateDraft('clientSecret', e.target.value)}
disabled={!editing}
/>
{editing && (
<Button
variant="ghost"
size="sm"
style={{ position: 'absolute', right: 4, top: '50%', transform: 'translateY(-50%)' }}
onClick={() => setShowSecret(!showSecret)}
>
{showSecret ? <EyeOff size={14} /> : <Eye size={14} />}
</Button>
)}
</div>
</FormField>
<FormField label="Audience / API Resource" htmlFor="audience" hint="RFC 8707 resource indicator sent in the authorization request">
<Input

View File

@@ -161,3 +161,13 @@
font-size: 12px;
color: var(--text-muted);
}
.editBanner {
padding: 8px 16px;
background: color-mix(in srgb, var(--amber) 8%, transparent);
border: 1px solid var(--amber);
border-radius: var(--radius-sm);
font-size: 13px;
color: var(--text-primary);
margin-bottom: 16px;
}