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

ENH: Add waiting notification when adding bookmarks

parent aa0db65e
Branches
Tags
2 merge requests!47Release v0.4.0,!44ENH: Add all query results to bookmarks
Pipeline #15004 passed
......@@ -590,12 +590,17 @@ var ext_bookmarks = function ($, logger, config) {
const add_query_results_to_bookmarks = async function () {
const query_string = get_query_from_response();
const waiting_id = "caosdb-add-to-bookamrks-waiting-notification";
const waiting_notification = createWaitingNotification(
"Adding results to bookmarks. Please wait and do not reload the page.", id = waiting_id);
$("#caosdb-add-query-to-bookmarks-row").append(waiting_notification);
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();
$("#" + waiting_id).remove();
}
/**
......
......@@ -164,19 +164,19 @@ this.navbar = new function () {
// show form and hide the show_button
const _in = () => {
// xs means viewport <= 768px
form.removeClass("d-none");
form.addClass("d-xs-inline-block");
show_button.removeClass("d-inline-block");
show_button.addClass("d-none");
// xs means viewport <= 768px
form.removeClass("d-none");
form.addClass("d-xs-inline-block");
show_button.removeClass("d-inline-block");
show_button.addClass("d-none");
}
// hide form and show the show_button
const _out = () => {
// xs means viewport <= 768px
form.removeClass("d-xs-inline-block");
form.addClass("d-none");
show_button.removeClass("d-none");
show_button.addClass("d-inline-block");
// xs means viewport <= 768px
form.removeClass("d-xs-inline-block");
form.addClass("d-none");
show_button.removeClass("d-none");
show_button.addClass("d-inline-block");
}
show_button.on("click", () => {
// show form...
......@@ -1507,10 +1507,11 @@ function createErrorNotification(msg) {
* Create a waiting notification with a informative message for the waiting user.
*
* @param {String} info, a message for the user
* @param {String} id, optional, the id of the message div. Default is empty
* @return {HTMLElement} A div with class `caosdb-preview-waiting-notification`.
*/
function createWaitingNotification(info) {
return $('<div class="' + globalClassNames.WaitingNotification + '">' + info + '</div>')[0];
function createWaitingNotification(info, id = "") {
return $('<div class="' + globalClassNames.WaitingNotification + '" id="' + id + '">' + info + '</div>')[0];
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment