Skip to content

Commit ebf933e

Browse files
authored
Merge pull request #639 from intersystems/issue-615
Added searchbar
2 parents 51288e8 + 2a2db80 commit ebf933e

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111
- Production Decomposition mode allows controlling interoperability productions as individual files for each host (#469)
1212
- Added saving settings as system default for new namespaces (#535)
13+
- Added filtering through branch names in UI (#615)
1314

1415
## [2.7.1] - 2024-11-13
1516

git-webui/release/share/git-webui/webui/js/git-webui.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,28 @@ webui.SideBarView = function(mainView, noEventHandlers) {
394394
}
395395
});
396396

397+
// Search bar to filter the results
398+
if (idPostfix =='popup') {
399+
var searchBar = $('<input type="text" id="search-input" placeholder="Filter..." style="width:100%">').appendTo(accordionDiv)[0];
400+
searchBar.onkeyup = function(){
401+
let branchCards = accordionDiv.getElementsByClassName("branch-card");
402+
403+
var filter = searchBar.value.toUpperCase().replaceAll('/', '-');
404+
405+
for (let i = 0; i < branchCards.length; i++) {
406+
let card = branchCards[i]
407+
let cardHeader = card.querySelector('.card-header');
408+
if (cardHeader) {
409+
if (cardHeader.id.toUpperCase().indexOf(filter) > -1) {
410+
card.style.display = '';
411+
} else {
412+
card.style.display = 'none';
413+
}
414+
}
415+
}
416+
};
417+
}
418+
397419
for (var i = 0; i < refs.length && i < maxRefsCount; ++i) {
398420
var ref = refs[i] + ""; // Get a copy of it
399421
if (ref[2] == '(' && ref[ref.length - 1] == ')') {
@@ -405,7 +427,7 @@ webui.SideBarView = function(mainView, noEventHandlers) {
405427
ref = ' ' + newref;
406428
}
407429
}
408-
var cardDiv = $('<div class="card custom-card">').appendTo(accordionDiv)[0];
430+
var cardDiv = $('<div class="card custom-card branch-card">').appendTo(accordionDiv)[0];
409431
if (id.indexOf("local-branches") > -1) {
410432
// parses the output of git branch --verbose --verbose
411433
var matches = /^\*?\s*([\w-.@&_\/]+)\s+([^\s]+)\s+(\[.*\])?.*/.exec(ref);

git-webui/src/share/git-webui/webui/js/git-webui.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,28 @@ webui.SideBarView = function(mainView, noEventHandlers) {
394394
}
395395
});
396396

397+
// Search bar to filter the results
398+
if (idPostfix =='popup') {
399+
var searchBar = $('<input type="text" id="search-input" placeholder="Filter..." style="width:100%">').appendTo(accordionDiv)[0];
400+
searchBar.onkeyup = function(){
401+
let branchCards = accordionDiv.getElementsByClassName("branch-card");
402+
403+
var filter = searchBar.value.toUpperCase().replaceAll('/', '-');
404+
405+
for (let i = 0; i < branchCards.length; i++) {
406+
let card = branchCards[i]
407+
let cardHeader = card.querySelector('.card-header');
408+
if (cardHeader) {
409+
if (cardHeader.id.toUpperCase().indexOf(filter) > -1) {
410+
card.style.display = '';
411+
} else {
412+
card.style.display = 'none';
413+
}
414+
}
415+
}
416+
};
417+
}
418+
397419
for (var i = 0; i < refs.length && i < maxRefsCount; ++i) {
398420
var ref = refs[i] + ""; // Get a copy of it
399421
if (ref[2] == '(' && ref[ref.length - 1] == ')') {
@@ -405,7 +427,7 @@ webui.SideBarView = function(mainView, noEventHandlers) {
405427
ref = ' ' + newref;
406428
}
407429
}
408-
var cardDiv = $('<div class="card custom-card">').appendTo(accordionDiv)[0];
430+
var cardDiv = $('<div class="card custom-card branch-card">').appendTo(accordionDiv)[0];
409431
if (id.indexOf("local-branches") > -1) {
410432
// parses the output of git branch --verbose --verbose
411433
var matches = /^\*?\s*([\w-.@&_\/]+)\s+([^\s]+)\s+(\[.*\])?.*/.exec(ref);

0 commit comments

Comments
 (0)