improve loading on site page
This commit is contained in:
parent
856f769cee
commit
aa90ed8cc4
|
@ -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:
|
||||||
|
|
|
@ -38,6 +38,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
msg: "",
|
msg: "",
|
||||||
importResponse: {},
|
importResponse: {},
|
||||||
|
currentId: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mixins: [authMixin],
|
mixins: [authMixin],
|
||||||
|
@ -53,18 +54,24 @@ export default {
|
||||||
},
|
},
|
||||||
beforeRouteEnter(to, from, next) {
|
beforeRouteEnter(to, from, next) {
|
||||||
next(async vm => {
|
next(async vm => {
|
||||||
axios.get('/api/data/item/import/get/' + vm.id).then(response => {
|
if (vm.currentId !== vm.id) {
|
||||||
if (!response.data.success) {
|
vm.msg = ""
|
||||||
vm.handleError(response.data.msg)
|
vm.importResponse = []
|
||||||
} else {
|
vm.currentId = null
|
||||||
if (Object.keys(response.data).length > 0) {
|
axios.get('/api/data/item/import/get/' + vm.id).then(response => {
|
||||||
vm.importResponse = response.data
|
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)
|
}
|
||||||
});
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -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() {
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue