From ace3a37ed5a386530f02f5af6be1fc2bcc092b2c Mon Sep 17 00:00:00 2001 From: Oak McIlwain Date: Wed, 16 Oct 2024 11:09:49 +0800 Subject: [PATCH 1/2] Add loading spinner when schema is validating as can take some time when schema has lots of columns. --- .../occurrence/bulk_import_schema.vue | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/boranga/frontend/boranga/src/components/internal/occurrence/bulk_import_schema.vue b/boranga/frontend/boranga/src/components/internal/occurrence/bulk_import_schema.vue index 2734e755..4cb1e333 100644 --- a/boranga/frontend/boranga/src/components/internal/occurrence/bulk_import_schema.vue +++ b/boranga/frontend/boranga/src/components/internal/occurrence/bulk_import_schema.vue @@ -39,9 +39,12 @@ class="bi bi-copy me-2"> Copy + Validat Preview @@ -450,7 +453,7 @@ @@ -580,6 +583,7 @@ export default { showDjangoImportFieldSelect: false, newColumn: null, saving: false, + validatingSchema: false, errors: null } }, @@ -804,7 +808,7 @@ export default { // Remove columns that are already in the schema newColumns = newColumns.filter(newColumn => !this.schema.columns.some(column => column.django_import_field_name == newColumn.django_import_field_name)) - if(newColumns.length == 0) { + if (newColumns.length == 0) { swal.fire({ title: 'No New Columns Added', text: 'All fields from the selected model are already in the schema', @@ -821,7 +825,7 @@ export default { newColumns = newColumns.filter(column => !column.xlsx_data_validation_allow_blank) } - if(newColumns.length == 0) { + if (newColumns.length == 0) { swal.fire({ title: 'No New Columns Added', text: 'There are no mandatory fields from the selected model that are not already in the schema', @@ -841,7 +845,7 @@ export default { this.addEditMode = false let lastColumnIndex = this.schema.columns.length; - if(this.schema.columns.filter(column => column.django_import_content_type == selectedContentType).length > 0) { + if (this.schema.columns.filter(column => column.django_import_content_type == selectedContentType).length > 0) { let lastColumn = this.schema.columns.findLast(column => column.django_import_content_type == selectedContentType) lastColumnIndex = this.schema.columns.indexOf(lastColumn) + 1 } @@ -947,6 +951,7 @@ export default { this.save(); }, validate() { + this.validatingSchema = true; this.$http.get(`${api_endpoints.occurrence_report_bulk_import_schemas}${this.schema.id}/validate/`) .then(response => { swal.fire({ @@ -983,6 +988,9 @@ export default { } }) }) + .finally(() => { + this.validatingSchema = false; + }) }, save() { // If there is a column with no django_import_content_type or django_import_field_name, remove it From 30911cd7b7a998953841f2ed4749bee5cd4ff3cb Mon Sep 17 00:00:00 2001 From: Oak McIlwain Date: Wed, 16 Oct 2024 12:15:56 +0800 Subject: [PATCH 2/2] Add ocr bulk importer cron tasks. --- boranga/settings.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boranga/settings.py b/boranga/settings.py index 47cd87c2..1b722baf 100755 --- a/boranga/settings.py +++ b/boranga/settings.py @@ -235,6 +235,8 @@ def show_toolbar(request): CRON_CLASSES = [ "appmonitor_client.cron.CronJobAppMonitorClient", "boranga.cron.CronJobFetchNomosTaxonDataDaily", + "boranga.cron.CronJobOCRPreProcessBulkImportTasks", + "boranga.cron.CronJobOCRProcessBulkImportQueue", ]