Skip to content

Commit e0bf5fc

Browse files
committed
Open URL on new tab on click in a row
1 parent 8d0c6c4 commit e0bf5fc

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

src/components/annotations/AnnotationDataTable.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
<template #body="slotProps">
55
<Button asChild variant="link">
66
<RouterLink
7-
:to="{ name: 'identification_task', params: { observationUuid: slotProps.data.observation_uuid } }"
8-
class="flex gap-2">
9-
<span class="hover:underline">{{ slotProps.data.observation_uuid }}</span>
10-
<i class="pi pi-link" />
7+
:to="{ name: 'identification_task', params: { observationUuid: slotProps.data.observation_uuid } }" custom
8+
v-slot="{ href }">
9+
<a :href="href" target="_blank" class="flex items-center gap-2">
10+
<span class="hover:underline">{{ slotProps.data.observation_uuid }}</span>
11+
<i class="pi pi-external-link" style="font-size: 0.8rem" />
12+
</a>
1113
</RouterLink>
1214
</Button>
1315
</template>

src/components/identificationTasks/IdentificationTaskList.vue

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
<template>
2-
<DataTable :value="tasks" ref="dt" stripedRows :loading="loading" data-key="observation.uuid" row-hover
3-
selectionMode="single" @rowClick="goToAnnotation">
2+
<DataTable :value="tasks" ref="dt" stripedRows :loading="loading" data-key="observation.uuid">
43
<!-- <template #header>
54
<div style="text-align:left">
65
<MultiSelect id="column_select" :modelValue="selectedColumns" :options="columns" optionLabel="header"
76
@update:modelValue="onSelectColumn" display="chip" :maxSelectedLabels="0" filter selectedItemsLabel="Columns"
87
placeholder="Columns" />
98
</div>
109
</template> -->
11-
<Column field="observation.uuid" header="UUID" />
10+
<Column field="observation.uuid" header="UUID">
11+
<template #body="slotProps">
12+
<RouterLink :to="{ name: 'identification_task', params: { observationUuid: slotProps.data.observation.uuid } }"
13+
custom v-slot="{ href }">
14+
<a :href="href" target="_blank" class="flex items-center gap-2">
15+
<span class="hover:underline">{{ slotProps.data.observation.uuid }}</span>
16+
<i class="pi pi-external-link" style="font-size: 0.8rem" />
17+
</a>
18+
</RouterLink>
19+
</template>
20+
</Column>
1221
<Column header="Status">
1322
<template #body="slotProps">
1423
<IdentificationTaskStatusTag :status="slotProps.data.status" />
@@ -108,10 +117,6 @@ const onSelectColumn = (value: Partial<ColumnProps>[]) => {
108117
selectedColumns.value = columns.value.filter(col => value.includes(col));
109118
};
110119
111-
function goToAnnotation(event: DataTableRowClickEvent) {
112-
router.push({ name: 'identification_task', params: { observationUuid: event.data.observation.uuid } });
113-
}
114-
115120
116121
defineExpose({
117122
exportCSV,

0 commit comments

Comments
 (0)