Skip to content
Snippets Groups Projects
Commit 7a59c854 authored by florian's avatar florian
Browse files

ENH: Add button functionality

parent 8eb922ee
Branches
Tags
2 merge requests!47Release v0.4.0,!44ENH: Add all query results to bookmarks
Pipeline #14899 passed
......@@ -574,7 +574,11 @@ var ext_bookmarks = function ($, logger, config) {
if ($("#" + row_id).length > 0) {
return;
}
const button_html = $(`<div class="row" id=${row_id}><p class="text-end">Bookmark all query results</p></div>`)[0];
const button_html = $(`<div class="row" id=${row_id}>
<p class="text-end">
<button class="btn btn-link" onclick="ext_bookmarks.add_query_results_to_bookmarks();">Bookmark all query results</button>
</p>
</div>`)[0];
// Add to query results box
$(".caosdb-query-response-heading").append(button_html);
......@@ -583,27 +587,17 @@ var ext_bookmarks = function ($, logger, config) {
/**
* Execute select query and add all new ids to bookmarks.
*/
const add_query_results_to_bookmarks = function () {
const add_query_results_to_bookmarks = async function () {
const query_string = get_query_from_response();
// const resp = await query(query_string);
// for (const eid of resp) {
// add_to_bookmarks(getEntityID(eid));
// }
// // re-init for correct display of counter and entities on page
const resp = await query(query_string);
for (const eid of resp) {
bookmark_storage.setItem(get_key(getEntityID(eid)), getEntityID(eid));
}
// re-init for correct display of counter and entities on page
init();
}
/**
* Add value to bookmarks if its key is new. Do nothing otherwise.
*
* @param {string} value
*/
const add_to_bookmarks = function (value) {
const key = get_key(value);
}
/**
* Transform a given query it to a "SELECT ID FROM ..." query.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment