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
5d879f65
Commit
5d879f65
authored
2 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Plain Diff
Merge branch 'f-form-helpers' into 'dev'
F form helpers See merge request
!97
parents
cea7829f
e90ae8f8
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!103
Quick main-release of documentation
,
!97
F form helpers
Pipeline
#35110
passed
2 years ago
Stage: setup
Stage: linting
Stage: test
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+3
-0
3 additions, 0 deletions
CHANGELOG.md
src/core/js/ext_trigger_crawler_form.js
+4
-38
4 additions, 38 deletions
src/core/js/ext_trigger_crawler_form.js
src/core/js/form_elements.js
+52
-0
52 additions, 0 deletions
src/core/js/form_elements.js
with
59 additions
and
38 deletions
CHANGELOG.md
+
3
−
0
View file @
5d879f65
...
@@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
...
@@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
*
`caosdb-v-property-linkified`
css class to denote properties that have been
*
`caosdb-v-property-linkified`
css class to denote properties that have been
linkified already.
linkified already.
*
`form_elements.make_form_modal`
and
`form_elements.make_scripting_submission_button`
functions to create a form
modal and an SSS submission button, respectively.
### Changed (for changes in existing functionality)
### Changed (for changes in existing functionality)
...
...
This diff is collapsed.
Click to expand it.
src/core/js/ext_trigger_crawler_form.js
+
4
−
38
View file @
5d879f65
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
* variable `BUILD_MODULE_EXT_TRIGGER_CRAWLER_FORM_TOOLBOX`. The default is
* variable `BUILD_MODULE_EXT_TRIGGER_CRAWLER_FORM_TOOLBOX`. The default is
* `Tools`.
* `Tools`.
*/
*/
var
ext_trigger_crawler_form
=
function
()
{
var
ext_trigger_crawler_form
=
function
(
$
,
form_elements
)
{
var
init
=
function
(
toolbox
)
{
var
init
=
function
(
toolbox
)
{
const
_toolbox
=
toolbox
||
"
${BUILD_MODULE_EXT_TRIGGER_CRAWLER_FORM_TOOLBOX}
"
;
const
_toolbox
=
toolbox
||
"
${BUILD_MODULE_EXT_TRIGGER_CRAWLER_FORM_TOOLBOX}
"
;
...
@@ -52,7 +52,7 @@ var ext_trigger_crawler_form = function () {
...
@@ -52,7 +52,7 @@ var ext_trigger_crawler_form = function () {
const
crawler_form
=
make_scripting_caller_form
(
const
crawler_form
=
make_scripting_caller_form
(
script
,
button_name
);
script
,
button_name
);
const
modal
=
make_form_modal
(
crawler_form
);
const
modal
=
form_elements
.
make_form_modal
(
crawler_form
,
"
Trigger the crawler
"
,
"
Crawl the selected path
"
);
navbar
.
add_tool
(
button_name
,
_toolbox
,
{
navbar
.
add_tool
(
button_name
,
_toolbox
,
{
...
@@ -63,32 +63,6 @@ var ext_trigger_crawler_form = function () {
...
@@ -63,32 +63,6 @@ var ext_trigger_crawler_form = function () {
});
});
}
}
/**
* Wrap the form into a Bootstrap modal.
*/
var
make_form_modal
=
function
(
form
)
{
const
title
=
"
Trigger the Crawler
"
;
const
modal
=
$
(
`
<div class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">
${
title
}
</h4>
</div>
<div class="modal-body">
</div>
</div>
</div>`
);
modal
.
find
(
"
.modal-body
"
).
append
(
form
);
return
modal
[
0
];
}
/**
/**
* Create the trigger crawler form.
* Create the trigger crawler form.
*/
*/
...
@@ -104,15 +78,7 @@ var ext_trigger_crawler_form = function () {
...
@@ -104,15 +78,7 @@ var ext_trigger_crawler_form = function () {
});
});
$
(
warning_checkbox
).
find
(
"
input
"
).
attr
(
"
value
"
,
"
TRUE
"
);
$
(
warning_checkbox
).
find
(
"
input
"
).
attr
(
"
value
"
,
"
TRUE
"
);
const
scripting_caller
=
$
(
`
const
scripting_caller
=
form_elements
.
make_scripting_submission_button
(
script
,
button_name
);
<form method="POST" action="/scripting">
<input type="hidden" name="call" value="
${
script
}
"/>
<input type="hidden" name="-p0" value=""/>
<div class="form-control">
<input type="submit"
class="form-control btn btn-primary" value="
${
button_name
}
"/>
</div>
</form>`
);
scripting_caller
.
prepend
(
warning_checkbox
).
prepend
(
path_field
);
scripting_caller
.
prepend
(
warning_checkbox
).
prepend
(
path_field
);
...
@@ -123,7 +89,7 @@ var ext_trigger_crawler_form = function () {
...
@@ -123,7 +89,7 @@ var ext_trigger_crawler_form = function () {
init
:
init
,
init
:
init
,
};
};
}();
}(
$
,
form_elements
);
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
if
(
"
${BUILD_MODULE_EXT_TRIGGER_CRAWLER_FORM}
"
===
"
ENABLED
"
)
{
if
(
"
${BUILD_MODULE_EXT_TRIGGER_CRAWLER_FORM}
"
===
"
ENABLED
"
)
{
...
...
This diff is collapsed.
Click to expand it.
src/core/js/form_elements.js
+
52
−
0
View file @
5d879f65
...
@@ -1563,6 +1563,58 @@ var form_elements = new function () {
...
@@ -1563,6 +1563,58 @@ var form_elements = new function () {
}
}
}
}
/**
* Return a modal HTML element containing the given form.
*
* @param {HTMLElement} form - the form to be shown in the modal
* @param {string} title - the title of the form modal
* @param {string} explanationText - An optional paragraph shown between
* modal title and form.
*/
this
.
make_form_modal
=
function
(
form
,
title
,
explanationText
)
{
const
modal
=
$
(
`
<div class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
${
title
}
</h4>
<button type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close">
</button>
</div>
<div class="modal-body">
<p>
${
explanationText
}
</p>
</div>
</div>
</div>`
);
modal
.
find
(
"
.modal-body
"
).
append
(
form
);
return
modal
[
0
];
}
/**
* Return a submission button that triggers a given server-side-script.
*
* @param {string} script - Name of the server-side script to be triggered
* @param {string} buttonName - Display name of the submission button
*/
this
.
make_scripting_submission_button
=
function
(
script
,
buttonName
)
{
let
button_name
=
buttonName
||
"
Submit
"
;
const
scripting_caller
=
$
(
`
<form method="POST" action="/scripting">
<input type="hidden" name="call" value="
${
script
}
"/>
<input type="hidden" name="-p0" value=""/>
<div class="form-group">
<input type="submit"
class="form-control btn btn-primary" value="
${
button_name
}
"/>
</div>
</form>`
);
return
scripting_caller
}
/**
/**
* Return an input and a label, wrapped in a div with class
* Return an input and a label, wrapped in a div with class
...
...
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