Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
search-box
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
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
Applications
Knowledge Base
Components
search-box
Commits
b9fb95f2
Commit
b9fb95f2
authored
4 years ago
by
Benoit Alessandroni
Browse files
Options
Downloads
Patches
Plain Diff
update: fix connector script
parent
0348476c
No related branches found
No related tags found
1 merge request
!19
update: fix connector script
Pipeline
#10359
passed with stage
in 50 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/connector-script.js
+15
-51
15 additions, 51 deletions
js/connector-script.js
search-box.js
+1
-1
1 addition, 1 deletion
search-box.js
with
16 additions
and
52 deletions
js/connector-script.js
+
15
−
51
View file @
b9fb95f2
...
...
@@ -78,44 +78,6 @@ function manageAccordionByStep(){
}
}
/**
* Manage select hidden to fullfill them with more "more criterias" selection
* @param {HTMLElement} select_hidden - Hidden select to fullfill.
* @param {HTMLElement} option_selected - Option selcted to set in hidden select.
*/
function
selectHiddenManagement
(
select_hidden
,
option_selected
)
{
options_hidden
=
select_hidden
.
getElementsByTagName
(
"
option
"
);
for
(
let
option_hidden
of
options_hidden
)
{
//Removing the selected attribute from previous selection
option_hidden
.
removeAttribute
(
"
selected
"
);
if
(
option_hidden
.
value
==
option_selected
.
value
)
{
//Actually selecting the option if it is the good one
option_hidden
.
setAttribute
(
"
selected
"
,
"
selected
"
);
select_hidden
.
setAttribute
(
"
value
"
,
option_selected
.
value
);
}
}
//Trigerring a reload of the associated form
let
parent_form
=
select_hidden
.
closest
(
"
sib-form
"
);
parent_form
.
component
.
inputChange
();
refreshPagination
();
};
/**
* Manage input hidden field to fullfill them with more "more criterias" selection
* @param {HTMLElement} field - Hidden field to fullfill.
* @param {HTMLElement} field_search - Field with the value wanted by the user.
*/
function
inputHiddenManagement
(
field
,
field_search
)
{
field
.
setAttribute
(
"
value
"
,
field_search
.
value
);
let
parent_form
=
field
.
closest
(
"
sib-form
"
);
parent_form
.
component
.
inputChange
();
refreshPagination
();
}
/**
* Manage select hidden for type to fullfill them with more "more criterias" selection
* @param {HTMLElement} tab - Selected type tabs.
...
...
@@ -127,9 +89,9 @@ function selectHiddenManagementForType(tab, form) {
let
type_field_search
=
tab
.
querySelector
(
`solid-display`
)
.
getAttribute
(
"
data-src
"
);
//Fullfill hidden field
let
hidden_type_select
=
form
.
querySelector
(
'
select[name="type"]
'
);
hidden_options
=
hidden_type_select
.
getElementsByTagName
(
"
option
"
);
for
(
let
hidden_option
of
hidden_options
)
{
hidden_option
.
removeAttribute
(
"
selected
"
);
...
...
@@ -154,13 +116,16 @@ function selectHiddenManagementForType(tab, form) {
/**
* Init type to type 1
*/
function
InitManagementForType
(
timeout
)
{
setTimeout
(
function
()
{
var
tabs
=
document
.
querySelectorAll
(
"
.tablink.filter_by_type
"
);
tabs
[
0
].
click
();
tabs
[
0
].
classList
.
add
(
"
active
"
);
refreshPagination
();
},
timeout
);
function
initManagementForType
(
filterFormId
)
{
var
tabs
=
document
.
querySelectorAll
(
"
.tablink.filter_by_type
"
);
var
form
=
document
.
getElementById
(
filterFormId
);
var
baseElement
=
document
.
querySelector
(
'
solid-display.resource_by_step.panel
'
);
if
(
baseElement
)
{
baseElement
.
addEventListener
(
"
populate
"
,
event
=>
{
selectHiddenManagementForType
(
tabs
[
0
],
form
);
});
}
}
/**
...
...
@@ -171,7 +136,6 @@ function InitManagementForType(timeout) {
*/
function
addProperFilterToSearchComponents
(
targetId
,
filterFormId
)
{
var
baseElement
=
document
.
getElementById
(
targetId
);
if
(
baseElement
)
{
// Adding default type management
var
form
=
document
.
getElementById
(
filterFormId
);
...
...
@@ -190,12 +154,12 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXX ON LOAD XXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
(
function
()
{
refreshPagination
();
addProperFilterToSearchComponents
(
"
coopedia-search-results-component
"
,
"
coopedia-search-box-component
"
);
window
.
setTimeout
(
function
()
{
refreshPagination
();
manageAccordionByStep
();
},
3000
);
InitManagementForType
(
3000
);
addProperFilterToSearchComponents
(
"
coopedia-search-results-component
"
,
"
coopedia-search-box-component
"
);
initManagementForType
(
"
coopedia-search-box-component
"
);
},
4000
);
})();
...
...
This diff is collapsed.
Click to expand it.
search-box.js
+
1
−
1
View file @
b9fb95f2
import
{
SolidTemplateElement
,
Helpers
}
from
'
https://cdn.skypack.dev/@startinblox/core@
0.15
'
;
import
{
SolidTemplateElement
,
Helpers
}
from
'
https://cdn.skypack.dev/@startinblox/core@
beta
'
;
// Dev Mode
// const base_url = import.meta.url.replace(/\/[^\/]*$/, '');
...
...
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