refactor(ui): DiffView CSS module + drop duplicate snapshot type

This commit is contained in:
hsiegeln
2026-04-23 13:43:15 +02:00
parent 1a97e2146e
commit 25d2a3014a
3 changed files with 34 additions and 27 deletions

View File

@@ -63,3 +63,30 @@
.logTimestamp {
color: var(--text-muted);
}
/* ConfigPanel.tsx / DiffView */
.diffList {
font-family: monospace;
font-size: 12px;
}
.diffEntry {
margin-bottom: 8px;
}
.diffPath {
color: var(--text-muted);
margin-bottom: 2px;
}
.diffRemoved {
background: var(--red-bg, rgba(239, 68, 68, 0.15));
border-left: 2px solid var(--red, #ef4444);
padding: 2px 6px;
}
.diffAdded {
background: var(--green-bg, rgba(34, 197, 94, 0.15));
border-left: 2px solid var(--green, #22c55e);
padding: 2px 6px;
}

View File

@@ -115,28 +115,12 @@ function DiffView({ diffs }: { diffs: FieldDiff[] }) {
return <div className={styles.emptyState}>No differences in this section.</div>;
}
return (
<div style={{ fontFamily: 'monospace', fontSize: 12 }}>
<div className={styles.diffList}>
{diffs.map((d) => (
<div key={d.path} style={{ marginBottom: 8 }}>
<div style={{ color: 'var(--text-muted)' }}>{d.path}</div>
<div
style={{
background: 'var(--red-bg, rgba(239,68,68,0.15))',
borderLeft: '2px solid var(--red, #ef4444)',
padding: '2px 6px',
}}
>
- {JSON.stringify(d.oldValue)}
</div>
<div
style={{
background: 'var(--green-bg, rgba(34,197,94,0.15))',
borderLeft: '2px solid var(--green, #22c55e)',
padding: '2px 6px',
}}
>
+ {JSON.stringify(d.newValue)}
</div>
<div key={d.path} className={styles.diffEntry}>
<div className={styles.diffPath}>{d.path}</div>
<div className={styles.diffRemoved}>- {JSON.stringify(d.oldValue)}</div>
<div className={styles.diffAdded}>+ {JSON.stringify(d.newValue)}</div>
</div>
))}
</div>

View File

@@ -1,11 +1,7 @@
import type { Deployment } from '../../../../api/queries/admin/apps';
import type { DeploymentPageFormState } from '../hooks/useDeploymentPageState';
interface DeployedConfigSnapshot {
jarVersionId: string;
agentConfig: Record<string, unknown> | null;
containerConfig: Record<string, unknown>;
sensitiveKeys: string[] | null;
}
type DeployedConfigSnapshot = NonNullable<Deployment['deployedConfigSnapshot']>;
/**
* Maps a deployment snapshot to the page's form-state shape.