feat: implement section 9 - span annotation sidebar list

This commit is contained in:
Marko Djordjevic 2026-02-14 10:13:23 +01:00
parent 2f05136f20
commit 4089aab77c
4 changed files with 265 additions and 7 deletions

View file

@ -169,6 +169,22 @@ export default function Home() {
setSelectedSpanId(spanId);
};
const handleDeleteSpan = async (spanId: number) => {
try {
const response = await fetch(`/api/span-annotations/${spanId}`, {
method: 'DELETE',
});
if (response.ok) {
await fetchSpanAnnotations(activeChartId);
if (selectedSpanId === spanId) {
setSelectedSpanId(null);
}
}
} catch (error) {
console.error('Failed to delete span annotation:', error);
}
};
const handleLabelDelete = async (id: number) => {
setAnnotations(annotations.filter((a) => a.id !== id));
if (selectedLabelId === id) {
@ -258,6 +274,11 @@ export default function Home() {
onLabelSelect={handleLabelSelect}
onLabelDelete={handleLabelDelete}
activeChartId={activeChartId}
spanAnnotations={spanAnnotations}
spanLabelTypes={spanLabelTypes}
selectedSpanId={selectedSpanId}
onSelectSpan={handleSelectedSpanChange}
onDeleteSpan={handleDeleteSpan}
/>
</div>
</aside>