@@ -128,9 +128,10 @@ export default defineComponent({
128
128
129
129
const submitDialog = ref (false );
130
130
131
- const snackbar = ref (false );
131
+ const validationSuccessSnackbar = ref (false );
132
132
const importErrorSnackbar = ref (false );
133
133
const notImportedWorksheetNames = ref ([] as string []);
134
+ const emptySheetSnackbar = ref (false );
134
135
135
136
watch (activeTemplate , () => {
136
137
// WARNING: It's important to do the column settings update /before/ data. Otherwise,
@@ -386,7 +387,25 @@ export default defineComponent({
386
387
}
387
388
388
389
async function validate() {
389
- const data = harmonizerApi .exportJson ();
390
+ const data = harmonizerApi .exportJson (); // Gets data from harmonizer API
391
+
392
+ // Check if the spreadsheet is empty
393
+ const isEmpty = Object .keys (data ).length === 0 ;
394
+ // Update invalid cells if empty
395
+ if (isEmpty ) {
396
+ invalidCells .value = {
397
+ ... invalidCells .value ,
398
+ [activeTemplateKey .value ]: data ,
399
+ };
400
+ tabsValidated .value = {
401
+ ... tabsValidated .value ,
402
+ [activeTemplateKey .value ]: false ,
403
+ };
404
+ emptySheetSnackbar .value = true ;
405
+
406
+ return ;
407
+ }
408
+
390
409
mergeSampleData (activeTemplate .value .sampleDataSlot , data );
391
410
const result = await harmonizerApi .validate ();
392
411
const valid = Object .keys (result ).length === 0 ;
@@ -407,7 +426,7 @@ export default defineComponent({
407
426
[activeTemplateKey .value ]: valid ,
408
427
};
409
428
410
- snackbar .value = Object .values (tabsValidated .value ).every ((value ) => value );
429
+ validationSuccessSnackbar .value = Object .values (tabsValidated .value ).every ((value ) => value );
411
430
}
412
431
413
432
const canSubmit = computed (() => {
@@ -633,10 +652,11 @@ export default defineComponent({
633
652
submissionStatus ,
634
653
status ,
635
654
submitDialog ,
636
- snackbar ,
655
+ validationSuccessSnackbar ,
637
656
schemaLoading ,
638
657
importErrorSnackbar ,
639
658
notImportedWorksheetNames ,
659
+ emptySheetSnackbar ,
640
660
isTestSubmission ,
641
661
/* methods */
642
662
doSubmit ,
@@ -677,7 +697,7 @@ export default defineComponent({
677
697
</v-icon >
678
698
</v-btn >
679
699
<v-snackbar
680
- v-model =" snackbar "
700
+ v-model =" validationSuccessSnackbar "
681
701
color =" success"
682
702
timeout =" 3000"
683
703
>
@@ -690,6 +710,13 @@ export default defineComponent({
690
710
>
691
711
The following worksheet names were not recognized: {{ notImportedWorksheetNames.join(', ') }}
692
712
</v-snackbar >
713
+ <v-snackbar
714
+ v-model =" emptySheetSnackbar"
715
+ color =" error"
716
+ timeout =" 5000"
717
+ >
718
+ The spreadsheet is empty. Please add data.
719
+ </v-snackbar >
693
720
<v-card
694
721
v-if =" validationErrorGroups.length"
695
722
color =" error"
0 commit comments