Skip to content

Commit

Permalink
Merge branch 'master' into new-buttons-1-dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Apr 20, 2022
2 parents 41d45b5 + b28d225 commit 8cbfe00
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ work
*.iml
*.iws
*.ipr
.idea
/.idea/*
!/.idea/icon.svg
!/.idea/.name
out

# Eclipse and VSCode project files
Expand Down
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 81 additions & 0 deletions .idea/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ THE SOFTWARE.
<!-- https://docs.spring.io/spring-security/site/docs/5.5.4/reference/html5/#getting-maven-no-boot -->
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-bom</artifactId>
<version>5.6.2</version>
<version>5.6.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
function createFilterMenuButton(button, menu, menuAlignment, menuMinScrollHeight) {
var MIN_NUM_OPTIONS = 5;
var menuButton = new YAHOO.widget.Button(button, {
type: "menu",
menu: menu,
menualignment: menuAlignment,
menuminscrollheight: menuMinScrollHeight
});

var filter = _createFilterMenuButton(menuButton._menu);

menuButton._menu.element.appendChild(filter);
menuButton._menu.showEvent.subscribe(function () {
filter.firstElementChild.value = '';
_applyFilterKeyword(menuButton._menu, filter.firstElementChild);
filter.style.display = (_getItemList(menuButton._menu).children.length >= MIN_NUM_OPTIONS) ? '' : 'NONE';
});
menuButton._menu.setInitialFocus = function () {
setTimeout(function () {
filter.firstElementChild.focus();
}, 0);
};

return menuButton;
}

function _createFilterMenuButton(menu) {
const filterInput = document.createElement("input");
filterInput.classList.add('jenkins-input')
filterInput.setAttribute("placeholder", "Filter");
filterInput.setAttribute("spellcheck", "false");
filterInput.setAttribute("type", "search");

filterInput.addEventListener('input', (event) => _applyFilterKeyword(menu, event));

const filterContainer = document.createElement("div");
filterContainer.appendChild(filterInput);

return filterContainer;
}

function _applyFilterKeyword(menu, filterInput) {
const filterKeyword = (filterInput.currentTarget.value || '').toLowerCase();
const itemList = _getItemList(menu);
let item, match;
for (item of itemList.children) {
match = item.innerText.toLowerCase().includes(filterKeyword);
item.style.display = match ? '' : 'NONE';
}
menu.align();
}

function _getItemList(menu) {
return menu.body.children[0];
}
4 changes: 3 additions & 1 deletion core/src/main/resources/lib/form/hetero-list/hetero-list.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @include lib.form.filter-menu-button.filter-menu-button

// do the ones that extract innerHTML so that they can get their original HTML before
// other behavior rules change them (like YUI buttons.)
Behaviour.specify("DIV.hetero-list-container", 'hetero-list', -100, function(e) {
Expand Down Expand Up @@ -40,7 +42,7 @@ Behaviour.specify("DIV.hetero-list-container", 'hetero-list', -100, function(e)

var menuAlign = (btn.getAttribute("menualign")||"tl-bl");

var menuButton = new YAHOO.widget.Button(btn, { type: "menu", menu: menu, menualignment: menuAlign.split("-"), menuminscrollheight: 250 });
var menuButton = createFilterMenuButton(btn, menu, menuAlign.split("-"), 250);
$(menuButton._button).addClassName(btn.className); // copy class names
$(menuButton._button).setAttribute("suffix",btn.getAttribute("suffix"));
menuButton.getMenu().clickEvent.subscribe(function(type,args,value) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ THE SOFTWARE.
</issueManagement>

<properties>
<revision>2.344</revision>
<revision>2.345</revision>
<changelist>-SNAPSHOT</changelist>

<!-- *.html files are in UTF-8, and *.properties are in iso-8859-1, so this configuration is actually incorrect,
Expand Down
2 changes: 1 addition & 1 deletion test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<version>1.58</version>
<version>1.59</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>executable-war</artifactId>
<version>2.3</version>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<!-- offline profiler API when we need it -->
Expand Down

0 comments on commit 8cbfe00

Please sign in to comment.