improve loading on site page

This commit is contained in:
Cyberes 2024-07-08 21:03:35 -06:00
parent 856f769cee
commit aa90ed8cc4
3 changed files with 20 additions and 17 deletions

View File

@ -45,6 +45,7 @@ def import_worker():
geofetures = [] geofetures = []
messages = [] messages = []
try: try:
# The actual import.
geojson_data, kml_conv_messages = kml_to_geojson(item['raw_kml']) geojson_data, kml_conv_messages = kml_to_geojson(item['raw_kml'])
messages.extend(kml_conv_messages) messages.extend(kml_conv_messages)
geofetures, typing_messages = geojson_to_geofeature(geojson_data) geofetures, typing_messages = geojson_to_geofeature(geojson_data)
@ -61,7 +62,7 @@ def import_worker():
messages.append(create_import_log_msg(f'{err_name}: {err_msg}')) messages.append(create_import_log_msg(f'{err_name}: {err_msg}'))
log_to_db(msg, level=DatabaseLogLevel.ERROR, user_id=item['user_id'], source=DatabaseLogSource.IMPORT) log_to_db(msg, level=DatabaseLogLevel.ERROR, user_id=item['user_id'], source=DatabaseLogSource.IMPORT)
traceback.print_exc() traceback.print_exc()
features = [] features = [] # dummy data
if success: if success:
features = [json.loads(x.model_dump_json()) for x in geofetures] features = [json.loads(x.model_dump_json()) for x in geofetures]
with CursorFromConnectionFromPool(cursor_factory=RealDictCursor) as cursor: with CursorFromConnectionFromPool(cursor_factory=RealDictCursor) as cursor:

View File

@ -38,6 +38,7 @@ export default {
return { return {
msg: "", msg: "",
importResponse: {}, importResponse: {},
currentId: null,
} }
}, },
mixins: [authMixin], mixins: [authMixin],
@ -53,10 +54,15 @@ export default {
}, },
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {
next(async vm => { next(async vm => {
if (vm.currentId !== vm.id) {
vm.msg = ""
vm.importResponse = []
vm.currentId = null
axios.get('/api/data/item/import/get/' + vm.id).then(response => { axios.get('/api/data/item/import/get/' + vm.id).then(response => {
if (!response.data.success) { if (!response.data.success) {
vm.handleError(response.data.msg) vm.handleError(response.data.msg)
} else { } else {
vm.currentId = vm.id
if (Object.keys(response.data).length > 0) { if (Object.keys(response.data).length > 0) {
vm.importResponse = response.data vm.importResponse = response.data
} }
@ -64,7 +70,8 @@ export default {
} }
}).catch(error => { }).catch(error => {
vm.handleError(error.message) vm.handleError(error.message)
}); })
}
}) })
}, },
}; };

View File

@ -36,7 +36,6 @@ export default {
file: null, file: null,
disableUpload: false, disableUpload: false,
uploadMsg: "", uploadMsg: "",
processQueue: []
} }
}, },
methods: { methods: {
@ -78,10 +77,6 @@ export default {
this.uploadMsg = error.response.data.msg this.uploadMsg = error.response.data.msg
} }
}, },
async fetchQueueList() {
const response = await axios.get('/api/data/item/import/get/mine')
this.processQueue = response.data.data
},
}, },
async created() { async created() {
}, },