feat(labs): keep a marker's panel when it is merged into one without

A merge into a target without a panel now takes over the first panel
a source carries, in the order the sources were given, so the merged
marker keeps its category. The result reports it as adoptedPanel, on
a dry run as well, and the merge preview says so before the person
confirms. A target with its own panel keeps it. The ledger does not
record panels; a merge has no undo.

The integration suite also proves the clear path end to end: an
explicit null on PUT clears panel, context and both bounds.

Refs #1349
This commit is contained in:
Marc-André Bombeck committed 2026-11-06 17:53:56 +01:00
1 parent 910f28dcfe
commit 65f1a3db91
17 files changed
+232 -54

No files matched your search

+27 -12
View File
@@ -204,18 +204,7 @@ export function BiomarkerMergeSheet({
</li>
))}
</ul>
{preview.aliasesAdded.length > 0 ? (
<div className="space-y-1.5">
<p className="text-muted-foreground text-xs">
{t("labs.merge.aliasesAdded")}
</p>
<div className="flex flex-wrap gap-1.5">
{preview.aliasesAdded.map((alias) => (
<TagChip key={alias}>{alias}</TagChip>
))}
</div>
</div>
) : null}
<MergePreviewNotes preview={preview} />
{(refused?.length ?? 0) > 0 ? (
<p role="alert" className="text-destructive text-sm">
{t("labs.merge.blocked")}
@@ -283,3 +272,29 @@ export function BiomarkerMergeSheet({
</ResponsiveSheet>
);
}
/** What the kept marker gains besides the readings: spellings and a panel. */
function MergePreviewNotes({ preview }: { preview: BiomarkerMergeResultDto }) {
const { t } = useTranslations();
return (
<>
{preview.aliasesAdded.length > 0 ? (
<div className="space-y-1.5">
<p className="text-muted-foreground text-xs">
{t("labs.merge.aliasesAdded")}
</p>
<div className="flex flex-wrap gap-1.5">
{preview.aliasesAdded.map((alias) => (
<TagChip key={alias}>{alias}</TagChip>
))}
</div>
</div>
) : null}
{preview.adoptedPanel ? (
<p className="text-sm" data-slot="biomarker-merge-adopts-panel">
{t("labs.merge.adoptsPanel", { panel: preview.adoptedPanel })}
</p>
) : null}
</>
);
}
+2
View File
@@ -183,5 +183,7 @@ export interface BiomarkerMergeResultDto {
movedReadings: number;
convertedReadings: number;
aliasesAdded: string[];
/** The panel the target takes over from a source, or null. */
adoptedPanel: string | null;
mergeId: string | null;
}