diff --git a/src/core/js/edit_mode.js b/src/core/js/edit_mode.js index 2af8fae75e2faff5d2210f209e70f864a789b791..ea3e61bc5143d390e235b8114e6284729a2bfab2 100644 --- a/src/core/js/edit_mode.js +++ b/src/core/js/edit_mode.js @@ -1015,26 +1015,28 @@ var edit_mode = new function () { options.then((_options) => { // The options might not include all entites (if there are // many). Include the property value if it is missing. - if (-1==_options.map((e)=>{return e.value}).indexOf(property.value)){ + if (-1 == _options.map((e) => { + return e.value + }).indexOf(property.value)) { _options = _options.concat([$(`<option value="${property.value}">ID: ${property.value}</option>`)[0]]) } edit_mode.fill_reference_drop_down(select[0], _options, property.value); result.empty(); result.append(select); // value=NA means that the first element is the warning that not all entities are provided - if(_options[0].getAttribute('value') == "NA") { + if (_options[0].getAttribute('value') == "NA") { // The button to show the input field for manual ID insertion var manualInsertButton = $('<button title="Insert Entity Id manually." class="btn btn-link caosdb-update-entity-button caosdb-f-list-item-button"><i class="bi-pencil"></i></button>'); - $(manualInsertButton ).click(function () { - // show ID input; hide dropdown - $(result).find('.dropdown').hide(); - $(result).find('input').show(); + $(manualInsertButton).click(function () { + // show ID input; hide dropdown + $(result).find('.dropdown').hide(); + $(result).find('input').show(); }); // Add input for manual ID insertion idinput = $("<input type='number' value=''></input>") idinput.hide() // Add callback for pressing Enter: the insertion is completed - idinput.on('keyup', function(e){ + idinput.on('keyup', function (e) { if (e.key === 'Enter' || e.keyCode === 13) { // hide the input, show the dropdown again and append the value that // was entered to the candidates and select that item @@ -1872,11 +1874,10 @@ 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 = 100; //for each query; there might be more candidates in total - // TODO cache this? 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 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); @@ -1889,7 +1890,7 @@ var edit_mode = new function () { if (n_entities > max_options || n_files > max_options) { // add notification that not all entities are shown - options=[$(`<option disabled=true value="NA"/>`).text('Dropdown only shows selection of possible entities!')[0]].concat(options); + options = [$(`<option disabled=true value="NA"/>`).text('Dropdown only shows selection of possible entities!')[0]].concat(options); } return options; } @@ -2137,7 +2138,7 @@ var edit_mode = new function () { if (use_cache && query_cache[str]) { return query_cache[str]; } - if (str.toUpperCase().startsWith('COUNT')){ + if (str.toUpperCase().startsWith('COUNT')) { const res = await connection.get(`Entity/?query=${str}`); const result = $(res).find('Query').attr('results') } else {