Skip to content
Snippets Groups Projects

FIX: use paging during options generation in edit mode

Merged Henrik tom Wörden requested to merge f-edit-mode-paging into dev
All threads resolved!
2 files
+ 15
20
Compare changes
  • Side-by-side
  • Inline

Files

+ 10
5
@@ -1867,11 +1867,11 @@ var edit_mode = new function () {
* which can be referenced by the property.
*/
this.retrieve_datatype_list = async function (datatype) {
var find_entity = ["FILE", "REFERENCE"].includes(datatype) ? "" : `"${datatype}"`;
var find_entity = ["FILE", "REFERENCE"].includes(datatype)? "" : `"${datatype}"`;
const max_options = 25;
// TODO cache this?
var n_entities = datatype !== "FILE" ? $(await connection.get(`Entity/?query=COUNT RECORD ${find_entity}`)).find('Query').attr('results') : 0;
var n_files =$(await connection.get(`Entity/?query=COUNT FILE ${find_entity}`)).find('Query').attr('results');
var n_entities = datatype !== "FILE" ? edit_mode.query(`COUNT Record ${find_entity}`, true) : 0;
var n_files =edit_mode.query(`COUNT File ${find_entity}`, true);
var entities = datatype !== "FILE" ? edit_mode.query(`FIND Record ${find_entity}&P=0L${max_options}`, true) : [];
var files = edit_mode.query(`FIND File ${find_entity}&P=0L${max_options}`, true);
@@ -2128,11 +2128,16 @@ var edit_mode = new function () {
const query_cache = {};
this.query = (str, use_cache) => {
this.query = async (str, use_cache) => {
if (use_cache && query_cache[str]) {
return query_cache[str];
}
const result = query(str);
if (str.toUpperCase().startsWith('COUNT')){
const res = await connection.get(`Entity/?query=${str}`);
const result = $(res).find('Query').attr('results')
} else {
const result = query(str);
}
if (use_cache) {
query_cache[str] = result;
}
Loading