Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-webui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-webui
Commits
8eb922ee
Commit
8eb922ee
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Use specific class for query string
parent
6b77b064
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!47
Release v0.4.0
,
!44
ENH: Add all query results to bookmarks
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/core/js/ext_bookmarks.js
+28
-8
28 additions, 8 deletions
src/core/js/ext_bookmarks.js
src/core/xsl/query.xsl
+3
-1
3 additions, 1 deletion
src/core/xsl/query.xsl
test/core/js/modules/ext_bookmarks.js.js
+2
-1
2 additions, 1 deletion
test/core/js/modules/ext_bookmarks.js.js
with
33 additions
and
10 deletions
src/core/js/ext_bookmarks.js
+
28
−
8
View file @
8eb922ee
...
...
@@ -580,6 +580,30 @@ var ext_bookmarks = function ($, logger, config) {
$
(
"
.caosdb-query-response-heading
"
).
append
(
button_html
);
}
/**
* Execute select query and add all new ids to bookmarks.
*/
const
add_query_results_to_bookmarks
=
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
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.
*
...
...
@@ -603,14 +627,9 @@ 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
));
}
}
const
orig_query
=
$
(
"
.caosdb-query-response-string
"
)[
0
].
innerText
;
return
get_select_id_query_string
(
orig_query
);
}
/**
...
...
@@ -705,6 +724,7 @@ var ext_bookmarks = function ($, logger, config) {
get_bookmark_data
:
get_bookmark_data
,
get_select_id_query_string
:
get_select_id_query_string
,
get_query_from_response
:
get_query_from_response
,
add_query_results_to_bookmarks
:
add_query_results_to_bookmarks
,
}
};
...
...
This diff is collapsed.
Click to expand it.
src/core/xsl/query.xsl
+
3
−
1
View file @
8eb922ee
...
...
@@ -56,7 +56,9 @@
<div
class=
"col-sm-10 caosdb-overflow-box"
>
<div
class=
"caosdb-overflow-content"
>
<span>
Query:
</span>
<xsl:value-of
select=
"@string"
/>
<span
class=
"caosdb-query-response-string"
>
<xsl:value-of
select=
"@string"
/>
</span>
</div>
</div>
<div
class=
"col-sm-2 text-end"
>
...
...
This diff is collapsed.
Click to expand it.
test/core/js/modules/ext_bookmarks.js.js
+
2
−
1
View file @
8eb922ee
...
...
@@ -209,7 +209,8 @@ QUnit.test("select-query extraction", function (assert) {
<div class="row">
<div class="col-sm-10 caosdb-overflow-box">
<div class="caosdb-overflow-content">
<span>Query: </span>SELECT name, id FROM RECORD MusicalAnalysis
<span>Query: </span>
<span class = "caosdb-query-response-string">SELECT name, id FROM RECORD MusicalAnalysis</span>
</div>
</div>
<div class="col-sm-2 text-end">
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment