feat: implement section 9 - span annotation sidebar list
This commit is contained in:
parent
2f05136f20
commit
4089aab77c
4 changed files with 265 additions and 7 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue