43
43
/>
44
44
<div class =" flex w-full items-end justify-end gap-4" >
45
45
<div class =" h-full text-red-600 font-semibold flex items-center justify-center mb-2" >
46
- <p v-if =" isError === true" >{{ "Network error, please try again" }}</p >
46
+ <p v-if =" isError === true" >{{ errorMessage }}</p >
47
47
</div >
48
48
<button type =" button" class =" py-2.5 px-5 ms-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
49
49
@click =" closeDialog"
53
53
<Button
54
54
class =" w-64"
55
55
@click =" saveData"
56
- :disabled =" isLoading || checkedCount < 1"
56
+ :disabled =" isLoading || checkedCount < 1 || isCriticalError "
57
57
:loader =" isLoading"
58
58
>
59
59
{{ checkedCount > 1 ? 'Save fields' : 'Save field' }}
@@ -106,6 +106,7 @@ const primaryKey = props.meta.primaryKey;
106
106
const openGenerationCarousel = ref ([]);
107
107
const isLoading = ref (false );
108
108
const isError = ref (false );
109
+ const isCriticalError = ref (false );
109
110
const errorMessage = ref (' ' );
110
111
const checkedCount = ref (0 );
111
112
@@ -143,7 +144,7 @@ const openDialog = async () => {
143
144
}
144
145
145
146
watch (selected , (val ) => {
146
- // console.log('Selected changed:', val);
147
+ console .log (' Selected changed:' , val );
147
148
checkedCount .value = val .filter (item => item .isChecked === true ).length ;
148
149
}, { deep: true });
149
150
@@ -254,7 +255,7 @@ async function getRecords() {
254
255
} catch (error ) {
255
256
console .error (' Failed to get records:' , error );
256
257
isError .value = true ;
257
- errorMessage .value = ` Failed to get records ${ error } . Please, try to re-run the action. ` ;
258
+ errorMessage .value = ` Failed to fetch records. Please, try to re-run the action. ` ;
258
259
// Handle error appropriately
259
260
}
260
261
}
@@ -272,7 +273,7 @@ async function getImages() {
272
273
} catch (error ) {
273
274
console .error (' Failed to get images:' , error );
274
275
isError .value = true ;
275
- errorMessage .value = ` Failed to get images ${ error } . Please, try to re-run the action. ` ;
276
+ errorMessage .value = ` Failed to fetch images. Please, try to re-run the action. ` ;
276
277
// Handle error appropriately
277
278
}
278
279
}
@@ -353,9 +354,9 @@ async function analyzeFields() {
353
354
}
354
355
})
355
356
} catch (error ) {
356
- console .error (' Failed to get records :' , error );
357
+ console .error (' Failed to analyze image(s) :' , error );
357
358
isError .value = true ;
358
- errorMessage .value = ` Failed to get records ${ error } . Please, try to re-run the action. ` ;
359
+ errorMessage .value = ` Failed to fetch analyze image(s) . Please, try to re-run the action. ` ;
359
360
}
360
361
}
361
362
@@ -388,9 +389,9 @@ async function analyzeFieldsNoImages() {
388
389
}
389
390
})
390
391
} catch (error ) {
391
- console .error (' Failed to get records :' , error );
392
+ console .error (' Failed to analyze fields :' , error );
392
393
isError .value = true ;
393
- errorMessage .value = ` Failed to get records ${ error } . Please, try to re-run the action. ` ;
394
+ errorMessage .value = ` Failed to analyze fields . Please, try to re-run the action. ` ;
394
395
}
395
396
}
396
397
@@ -435,12 +436,12 @@ async function saveData() {
435
436
} else {
436
437
console .error (' Error saving data:' , res );
437
438
isError .value = true ;
438
- errorMessage .value = ` Failed to save data ${ res } . Please, try to re-run the action. ` ;
439
+ errorMessage .value = ` Failed to save data. Please, try to re-run the action. ` ;
439
440
}
440
441
} catch (error ) {
441
442
console .error (' Error saving data:' , error );
442
443
isError .value = true ;
443
- errorMessage .value = ` Failed to save data ${ error } . Please, try to re-run the action. ` ;
444
+ errorMessage .value = ` Failed to save data. Please, try to re-run the action. ` ;
444
445
} finally {
445
446
isLoading .value = false ;
446
447
}
@@ -462,7 +463,8 @@ async function generateImages() {
462
463
} catch (e ) {
463
464
console .error (' Error generating images:' , e );
464
465
isError .value = true ;
465
- errorMessage .value = ` Failed to generate images ${e }. Please, try to re-run the action. ` ;
466
+ isCriticalError .value = true ;
467
+ errorMessage .value = ` Failed to generate images. Please, try to re-run the action. ` ;
466
468
}
467
469
isAiResponseReceivedImage .value = props .checkboxes .map (() => true );
468
470
@@ -472,7 +474,8 @@ async function generateImages() {
472
474
if (! res ) {
473
475
error = ' Error generating images, something went wrong' ;
474
476
isError .value = true ;
475
- errorMessage .value = ` Failed to generate images ${e }. Please, try to re-run the action. ` ;
477
+ isCriticalError .value = true ;
478
+ errorMessage .value = ` Failed to generate images. Please, try to re-run the action. ` ;
476
479
}
477
480
478
481
if (error ) {
0 commit comments