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
7c911fb3
Verified
Commit
7c911fb3
authored
3 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Early return for add_query_to_bookmarks_button if no results
parent
9f16bb22
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!47
Release v0.4.0
,
!44
ENH: Add all query results to bookmarks
Pipeline
#15093
passed
3 years ago
Stage: linting
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/core/js/ext_bookmarks.js
+9
-3
9 additions, 3 deletions
src/core/js/ext_bookmarks.js
src/core/xsl/query.xsl
+1
-1
1 addition, 1 deletion
src/core/xsl/query.xsl
test/core/js/modules/ext_bookmarks.js.js
+2
-2
2 additions, 2 deletions
test/core/js/modules/ext_bookmarks.js.js
with
12 additions
and
6 deletions
src/core/js/ext_bookmarks.js
+
9
−
3
View file @
7c911fb3
...
...
@@ -569,11 +569,17 @@ var ext_bookmarks = function ($, logger, config) {
* Add a button to add all query results to bookmarks.
*/
const
add_add_query_results_button
=
function
()
{
const
row_id
=
"
caosdb-add-query-to-bookmarks-row
"
const
row_id
=
"
caosdb-
f-
add-query-to-bookmarks-row
"
// do nothing if already existing
if
(
$
(
"
#
"
+
row_id
).
length
>
0
)
{
return
;
}
// do nothing if no results
if
(
$
(
"
.caosdb-query-response-results
"
).
text
().
trim
()
==
"
0
"
)
{
return
;
}
const
button_html
=
$
(
`<div class="text-end" id=
${
row_id
}
>
<button class="btn btn-link" onclick="ext_bookmarks.add_query_results_to_bookmarks();">Bookmark all query results</button>
</div>`
)[
0
];
...
...
@@ -590,7 +596,7 @@ var ext_bookmarks = function ($, logger, config) {
const
query_string
=
get_query_from_response
();
const
waiting_notification
=
createWaitingNotification
(
"
Adding results to bookmarks. Please wait and do not reload the page.
"
);
const
bookmarks_row
=
$
(
"
#caosdb-add-query-to-bookmarks-row
"
);
const
bookmarks_row
=
$
(
"
#caosdb-
f-
add-query-to-bookmarks-row
"
);
bookmarks_row
.
find
(
"
button
"
).
hide
();
bookmarks_row
.
append
(
waiting_notification
);
const
resp
=
await
query
(
query_string
);
...
...
@@ -627,7 +633,7 @@ var ext_bookmarks = function ($, logger, config) {
*/
const
get_query_from_response
=
function
()
{
const
orig_query
=
$
(
"
.caosdb-query-response-string
"
)[
0
].
innerText
;
const
orig_query
=
$
(
"
.caosdb-
f-
query-response-string
"
)[
0
].
innerText
;
return
get_select_id_query_string
(
orig_query
.
trim
());
}
...
...
This diff is collapsed.
Click to expand it.
src/core/xsl/query.xsl
+
1
−
1
View file @
7c911fb3
...
...
@@ -56,7 +56,7 @@
<div
class=
"col-sm-10 caosdb-overflow-box"
>
<div
class=
"caosdb-overflow-content"
>
<span>
Query:
</span>
<span
class=
"caosdb-query-response-string"
>
<span
class=
"caosdb-
f-
query-response-string"
>
<xsl:value-of
select=
"@string"
/>
</span>
</div>
...
...
This diff is collapsed.
Click to expand it.
test/core/js/modules/ext_bookmarks.js.js
+
2
−
2
View file @
7c911fb3
...
...
@@ -210,7 +210,7 @@ QUnit.test("select-query extraction", function (assert) {
<div class="col-sm-10 caosdb-overflow-box">
<div class="caosdb-overflow-content">
<span>Query: </span>
<span class = "caosdb-query-response-string">SELECT name, id FROM RECORD MusicalAnalysis</span>
<span class = "caosdb-
f-
query-response-string">SELECT name, id FROM RECORD MusicalAnalysis</span>
</div>
</div>
<div class="col-sm-2 text-end">
...
...
@@ -224,4 +224,4 @@ QUnit.test("select-query extraction", function (assert) {
assert
.
equal
(
ext_bookmarks
.
get_query_from_response
(),
"
SELECT ID FROM RECORD MusicalAnalysis
"
);
});
});
\ No newline at end of file
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