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 = []
messages = []
try:
# The actual import.
geojson_data, kml_conv_messages = kml_to_geojson(item['raw_kml'])
messages.extend(kml_conv_messages)
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}'))
log_to_db(msg, level=DatabaseLogLevel.ERROR, user_id=item['user_id'], source=DatabaseLogSource.IMPORT)
traceback.print_exc()
features = []
features = [] # dummy data
if success:
features = [json.loads(x.model_dump_json()) for x in geofetures]
with CursorFromConnectionFromPool(cursor_factory=RealDictCursor) as cursor:

View File

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

View File

@ -36,7 +36,6 @@ export default {
file: null,
disableUpload: false,
uploadMsg: "",
processQueue: []
}
},
methods: {
@ -78,10 +77,6 @@ export default {
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() {
},