feat: Update FaceAI upload panel and improve race storage metadata handling in tests
All checks were successful
Publish FaceAI Container / publish (push) Successful in 4m32s
All checks were successful
Publish FaceAI Container / publish (push) Successful in 4m32s
This commit is contained in:
parent
0926c52a00
commit
c0d072c6ea
6 changed files with 130 additions and 47 deletions
|
|
@ -46,8 +46,8 @@ const props = defineProps({
|
|||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
fileInput: {
|
||||
type: Object,
|
||||
assignFileInput: {
|
||||
type: Function,
|
||||
required: true
|
||||
},
|
||||
t: {
|
||||
|
|
@ -56,10 +56,6 @@ const props = defineProps({
|
|||
}
|
||||
});
|
||||
|
||||
function assignFileInput(element) {
|
||||
props.fileInput.value = element;
|
||||
}
|
||||
|
||||
const emit = defineEmits([
|
||||
'open-file-picker',
|
||||
'file-change',
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ const knownServerCodes = {
|
|||
RATE_LIMITED: 'rateLimited',
|
||||
MISSING_SELFIE: 'chooseSelfie',
|
||||
RACE_PKL_UNAVAILABLE: 'raceDataUnavailable',
|
||||
RACE_DIRECTORY_NOT_FOUND: 'invalidRaceData',
|
||||
RACE_DIRECTORY_NOT_FOUND: 'raceDataUnavailable',
|
||||
MISSING_RACE_STORAGE: 'invalidRaceData'
|
||||
};
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ const simulatorUrl = legacyUrl('/faceai_simulator.php?raceId=101&lang=it');
|
|||
const legacyHomeUrl = legacyUrl('/');
|
||||
|
||||
function isInvalidRaceAvailability(availability) {
|
||||
return availability?.reasonCode === 'RACE_DIRECTORY_NOT_FOUND' || availability?.reasonCode === 'MISSING_RACE_STORAGE';
|
||||
return availability?.reasonCode === 'MISSING_RACE_STORAGE';
|
||||
}
|
||||
|
||||
function buildLegacyReturnUrl(url) {
|
||||
|
|
@ -204,8 +204,9 @@ export function useFaceAiHome() {
|
|||
}
|
||||
|
||||
function getAvailabilityUserMessage(availability, fallbackKey = 'unavailableDefault') {
|
||||
if (isInvalidRaceAvailability(availability)) {
|
||||
return t('invalidRaceData');
|
||||
const mappedCodeKey = availability?.reasonCode ? knownServerCodes[availability.reasonCode] : null;
|
||||
if (mappedCodeKey) {
|
||||
return t(mappedCodeKey);
|
||||
}
|
||||
|
||||
return localizeServerMessage(availability?.message, fallbackKey);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ const {
|
|||
submitSearch,
|
||||
t
|
||||
} = useFaceAiHome();
|
||||
|
||||
function assignFileInput(element) {
|
||||
fileInput.value = element;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -63,7 +67,7 @@ const {
|
|||
:selected-file="selectedFile"
|
||||
:selected-file-size-label="selectedFileSizeLabel"
|
||||
:can-start-search="canStartSearch"
|
||||
:file-input="fileInput"
|
||||
:assign-file-input="assignFileInput"
|
||||
:t="t"
|
||||
@open-file-picker="openFilePicker"
|
||||
@file-change="onFileChange"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue