Skip to content

Commit

Permalink
#2016 CNN Validation - add error message when failed to call recordin…
Browse files Browse the repository at this point in the history
…g id
  • Loading branch information
RatreeOchn committed Jun 4, 2024
1 parent 1750e1b commit bd58aca
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
:selected-grouping="selectedGrouping"
:max-page="maxPage"
@emit-validation-result="onEmitValidateResult"
@show-alert-dialog="showAlertDialog"
/>
<alert-dialog
v-if="showAlert"
severity="error"
title="Loading Error"
message="Couldn't retrieve the recording ID. Please try again."
/>
</div>
</section>
Expand All @@ -46,6 +53,7 @@ import { type GetDetectionsQueryParams } from '@rfcx-bio/common/api-bio/cnn/dete
import type { GetDetectionsSummaryQueryParams } from '@rfcx-bio/common/api-bio/cnn/detections-summary'
import { CLASSIFIER_JOB_STATUS } from '@rfcx-bio/common/api-core/classifier-job/classifier-job-status'
import alertDialog from '@/_components/alert-dialog.vue'
import { useGetBestDetections, useGetBestDetectionsSummary } from '@/detect/_composables/use-get-best-detections'
import { apiClientKey } from '@/globals'
import { useDetectionsResultFilterBySpeciesStore } from '~/store'
Expand Down Expand Up @@ -244,4 +252,12 @@ onBeforeUnmount(() => {
detectionsResultFilterBySpeciesStore.resetFilter()
})
const showAlert = ref(false)
const showAlertDialog = () => {
showAlert.value = true
setTimeout(() => {
showAlert.value = false
}, 7000)
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
:score="dt.score"
:selected-grouping="selectedGrouping"
@emit-detection="updateSelectedDetections"
@show-alert-dialog="$emit('showAlertDialog')"
/>
</div>
</div>
Expand Down Expand Up @@ -129,7 +130,7 @@ const props = withDefaults(defineProps<{ isLoading: boolean, isError: boolean, d
data: undefined
})
const emit = defineEmits<{(e: 'update:page', value: number): void, (e: 'emitValidationResult'): void}>()
const emit = defineEmits<{(e: 'update:page', value: number): void, (e: 'emitValidationResult'): void, (e: 'showAlertDialog'): void}>()
const pageIndex = ref(props.page ?? 1)
const index = useDebounce(pageIndex, 1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const props = withDefaults(defineProps<{
selectedGrouping: undefined
})
const emit = defineEmits<{(e: 'emitDetection', detectionId: number, event: DetectionEvent): void}>()
const emit = defineEmits<{(e: 'emitDetection', detectionId: number, event: DetectionEvent): void, (e: 'showAlertDialog'): void}>()
const store = useStore()
const spectrogramLoading = ref(false)
Expand Down Expand Up @@ -200,7 +200,10 @@ const stop = () => {
const onVisualizerRedirect = async (): Promise<void> => {
if (!props.start || !props.siteIdCore) return
const response = await apiArbimonLegacyFindRecording(apiClientArbimon, store.project?.slug ?? '', { start: props.start, site_external_id: props.siteIdCore })
if (response == null) return
if (response == null) {
emit('showAlertDialog')
return
}
window.location.assign(`${window.location.origin}/project/${store.project?.slug}/visualizer/rec/${response}`)
}
Expand Down

0 comments on commit bd58aca

Please sign in to comment.