Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default defineComponent({
v-if="isNaBat"
class="mx-3"
>
NA Bat Spectrogram Viewer
NABat Spectrogram Viewer
</h3>
<v-spacer />
<v-tooltip
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/RecordingAnnotationDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default defineComponent({
<v-data-table
:headers="[
{ title: 'Label', value: 'label', sortable: true },
{ title: 'Value', value: 'value', sortable: true }
{ title: 'Confidence', value: 'value', sortable: true }
]"
:items="annotationData.confidences"
:items-per-page="-1"
Expand Down
24 changes: 21 additions & 3 deletions client/src/components/RecordingAnnotationEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default defineComponent({

};



const deleteAnnotation = async () => {
if (props.annotation && props.recordingId) {
Expand All @@ -108,7 +108,25 @@ export default defineComponent({
<v-card>
<v-card-title>
<v-row class="pa-2">
Choose Labels
Choose Label
<v-tooltip
v-if="type === 'nabat'"
width="250"
right
>
<template #activator="{ props }">
<v-icon
v-bind="props"
size="x-small"
>
mdi-information
</v-icon>
</template>
<span>
Each user may only add one label per file. Once you have saved
your selection it may not be deleted.
</span>
</v-tooltip>
<v-spacer />
<v-btn
v-if="type !== 'nabat'"
Expand Down Expand Up @@ -167,7 +185,7 @@ export default defineComponent({
@change="updateAnnotation()"
/>
</v-row>
</v-card-text>
</v-card-text>
</v-card>
</template>

Expand Down
18 changes: 12 additions & 6 deletions client/src/components/RecordingAnnotations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ export default defineComponent({
const annotations: Ref<FileAnnotation[]> = ref([]);
const detailsDialog = ref(false);
const detailRecordingId = ref(-1);
const { configuration } = useState();
const { configuration, isNaBat } = useState();

const setSelectedId = (annotation: FileAnnotation) => {
selectedAnnotation.value = annotation;
};

const currentNaBatUser: Ref<string | null> = ref(null);



const loadFileAnnotations = async () => {
if (props.type === 'nabat') {
Expand Down Expand Up @@ -116,6 +116,10 @@ export default defineComponent({
return ( currentUserAnnotations.length > 0 && props.type === 'nabat');
});

function getConfidenceLabelText(confidence: number) {
return `Confidence: ${confidence.toFixed(2)}`;
}

return {
selectedAnnotation,
annotationState,
Expand All @@ -124,6 +128,8 @@ export default defineComponent({
addAnnotation,
updatedAnnotation,
loadDetails,
getConfidenceLabelText,
isNaBat,
detailsDialog,
detailRecordingId,
disableNaBatAnnotations,
Expand All @@ -135,12 +141,12 @@ export default defineComponent({

<template>
<div>
<v-row class="pa-2">
<v-col>
<v-row class="pa-4">
<v-col v-if="!isNaBat()">
Annotations
</v-col>
<v-spacer />
<v-col>
<v-col v-if="!isNaBat() || !disableNaBatAnnotations">
<v-btn
:disabled="annotationState === 'creating' || disableNaBatAnnotations"
@click="addAnnotation()"
Expand Down Expand Up @@ -172,7 +178,7 @@ export default defineComponent({
</v-btn>
</v-col>
<v-col class="annotation-confidence">
<span>{{ annotation.confidence }} </span>
<span>{{ getConfidenceLabelText(annotation.confidence) }} </span>
</v-col>
<v-col class="annotation-model">
<span>{{ annotation.model }} </span>
Expand Down
13 changes: 13 additions & 0 deletions client/src/use/useState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ref, Ref, watch } from "vue";
import { useRouter } from 'vue-router';
import { cloneDeep } from "lodash";
import * as d3 from "d3";
import {
Expand Down Expand Up @@ -121,6 +122,17 @@ export default function useState() {
configuration.value = (await getConfiguration()).data;
}

/**
* Function used to determine whether or not we are currently looking
* at an NABat-specific view.
*
* returns `true` if looking at an NABat view, `false` otherwise
*/
function isNaBat(): boolean {
const router = useRouter();
return router.currentRoute.value.fullPath.includes('nabat');
}

return {
annotationState,
creationType,
Expand All @@ -137,6 +149,7 @@ export default function useState() {
currentUser,
setSelectedId,
loadConfiguration,
isNaBat,
// State Passing Elements
annotations,
configuration,
Expand Down