diff --git a/CHANGELOG.md b/CHANGELOG.md index dd575475b36d6d1d914dde278485385951271f5c..9cc5b17f0dad80ced68f9bf8628604db6cc18688 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### * Query shortcuts are now displayed when using the new query panel. +* [249](https://gitlab.com/linkahead/linkahead-webui/-/issues/249) only the + first ≈100 options were shown in edit-mode reference dropdown menus in case + of `BUILD_MAX_EDIT_MODE_DROPDOWN_OPTIONS=-1`. ### Security ### diff --git a/src/core/js/edit_mode.js b/src/core/js/edit_mode.js index 1a2c9092c2b6d234cc52691089c7094e93c49a2a..5b97fe30d5ecd1cc4bd4e00bff366014d6dc58a9 100644 --- a/src/core/js/edit_mode.js +++ b/src/core/js/edit_mode.js @@ -1033,14 +1033,16 @@ var edit_mode = new function () { $(manualInsertButton).click(function () { // toggle input // forward: - if ($(result).find('input.caosdb-f-manual-id-insert').is(':hidden')){ + if ($(result).find('input.caosdb-f-manual-id-insert').is(':hidden')) { // show ID input; hide dropdown $(result).find('.dropdown').hide(); $(result).find('input.caosdb-f-manual-id-insert').show(); $('.caosdb-f-entity-save-button').hide() } else { // backward: - $(result).find('input.caosdb-f-manual-id-insert')[0].dispatchEvent(new KeyboardEvent('keyup', {'key':'Enter'})); + $(result).find('input.caosdb-f-manual-id-insert')[0].dispatchEvent(new KeyboardEvent('keyup', { + 'key': 'Enter' + })); } }); // Add input for manual ID insertion @@ -1053,8 +1055,8 @@ var edit_mode = new function () { // was entered to the candidates and select that item $(result).find('input.caosdb-f-manual-id-insert').hide(); var sel_id = $(result).find('input.caosdb-f-manual-id-insert')[0].value - if (sel_id!=""){ - if ($(result).find(`option[value="${sel_id}"]`).length==0){ + if (sel_id != "") { + if ($(result).find(`option[value="${sel_id}"]`).length == 0) { select.append(`<option value="${sel_id}">ID: ${sel_id}</option>`); // workaround for selectpicker bug (options are // doubled otherwise) @@ -1891,14 +1893,16 @@ 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}"`; + const find_entity = ["FILE", "REFERENCE"].includes(datatype) ? "" : `"${datatype}"`; const max_options = parseInt("${BUILD_MAX_EDIT_MODE_DROPDOWN_OPTIONS}"); //for each query; there might be more candidates in total - if (max_options != -1){ + + const query_suffix = max_options != -1 ? `&P=0L${max_options}` : ""; + if (max_options != -1) { var n_entities = datatype !== "FILE" ? await edit_mode.query(`COUNT Record ${find_entity}`, true) : 0; var n_files = await 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); + const entities = datatype !== "FILE" ? edit_mode.query(`FIND Record ${find_entity}${query_suffix}`, true) : []; + const files = edit_mode.query(`FIND File ${find_entity}${query_suffix}`, true); await Promise.all([entities, files]) @@ -1907,7 +1911,7 @@ var edit_mode = new function () { .concat(edit_mode ._create_reference_options(await files)); - if (max_options !=- 1 && (n_entities > max_options || n_files > max_options)) { + if (max_options != -1 && (n_entities > max_options || n_files > max_options)) { // add notification that not all entities are shown options = [$(`<option disabled=true value="NA"/>`).text( `More than ${max_options} possible options; showing only a subset. You may need to enter the id manually.`