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

DRAFT: Add function to extract and transform query string

parent 7522865b
Branches
Tags
2 merge requests!47Release v0.4.0,!44ENH: Add all query results to bookmarks
Checking pipeline status
...@@ -599,6 +599,20 @@ var ext_bookmarks = function ($, logger, config) { ...@@ -599,6 +599,20 @@ var ext_bookmarks = function ($, logger, config) {
} }
} }
/**
* Return the SELECT query created from the contents of the query response field
*/
const get_query_from_response = function () {
// Go through divs in response field and extract the query string.
const divs = $(".caosdb-query-response-heading").find("div");
for (const div of divs) {
if (div.innerText.startsWith("Query:") && !div.innerText.includes("Results:")) {
return get_select_id_query_string(
div.innerText.slice(div.innerText.indexOf(" ") + 1));
}
}
}
/** /**
* Initialize this module. * Initialize this module.
*/ */
...@@ -690,6 +704,7 @@ var ext_bookmarks = function ($, logger, config) { ...@@ -690,6 +704,7 @@ var ext_bookmarks = function ($, logger, config) {
init_button: init_button, init_button: init_button,
get_bookmark_data: get_bookmark_data, get_bookmark_data: get_bookmark_data,
get_select_id_query_string: get_select_id_query_string, get_select_id_query_string: get_select_id_query_string,
get_query_from_response: get_query_from_response,
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment