Skip to content

Empty Data Sheet Validation/Warning #1600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 19, 2025
Merged
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
37 changes: 32 additions & 5 deletions web/src/views/SubmissionPortal/HarmonizerView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ export default defineComponent({

const submitDialog = ref(false);

const snackbar = ref(false);
const validationSuccessSnackbar = ref(false);
const importErrorSnackbar = ref(false);
const notImportedWorksheetNames = ref([] as string[]);
const emptySheetSnackbar = ref(false);

watch(activeTemplate, () => {
// WARNING: It's important to do the column settings update /before/ data. Otherwise,
Expand Down Expand Up @@ -386,7 +387,25 @@ export default defineComponent({
}

async function validate() {
const data = harmonizerApi.exportJson();
const data = harmonizerApi.exportJson(); // Gets data from harmonizer API

// Check if the spreadsheet is empty
const isEmpty = Object.keys(data).length === 0;
// Update invalid cells if empty
if (isEmpty) {
invalidCells.value = {
...invalidCells.value,
[activeTemplateKey.value]: data,
};
tabsValidated.value = {
...tabsValidated.value,
[activeTemplateKey.value]: false,
};
emptySheetSnackbar.value = true;

return;
}

mergeSampleData(activeTemplate.value.sampleDataSlot, data);
const result = await harmonizerApi.validate();
const valid = Object.keys(result).length === 0;
Expand All @@ -407,7 +426,7 @@ export default defineComponent({
[activeTemplateKey.value]: valid,
};

snackbar.value = Object.values(tabsValidated.value).every((value) => value);
validationSuccessSnackbar.value = Object.values(tabsValidated.value).every((value) => value);
}

const canSubmit = computed(() => {
Expand Down Expand Up @@ -633,10 +652,11 @@ export default defineComponent({
submissionStatus,
status,
submitDialog,
snackbar,
validationSuccessSnackbar,
schemaLoading,
importErrorSnackbar,
notImportedWorksheetNames,
emptySheetSnackbar,
isTestSubmission,
/* methods */
doSubmit,
Expand Down Expand Up @@ -677,7 +697,7 @@ export default defineComponent({
</v-icon>
</v-btn>
<v-snackbar
v-model="snackbar"
v-model="validationSuccessSnackbar"
color="success"
timeout="3000"
>
Expand All @@ -690,6 +710,13 @@ export default defineComponent({
>
The following worksheet names were not recognized: {{ notImportedWorksheetNames.join(', ') }}
</v-snackbar>
<v-snackbar
v-model="emptySheetSnackbar"
color="error"
timeout="5000"
>
The spreadsheet is empty. Please add data.
</v-snackbar>
<v-card
v-if="validationErrorGroups.length"
color="error"
Expand Down