Skip to content

Commit 8048736

Browse files
committed
Added searchbar
1 parent 6880f7f commit 8048736

File tree

4 files changed

+52
-3
lines changed

4 files changed

+52
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.8.0] - Unreleased
9+
10+
### Added
11+
- Added filtering through branch names in UI (#615)
12+
813
## [2.7.1] - 2024-11-13
914

1015
### Fixed

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...">').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...">').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);

module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Document name="git-source-control.ZPM">
44
<Module>
55
<Name>git-source-control</Name>
6-
<Version>2.7.1</Version>
6+
<Version>2.8.0</Version>
77
<Description>Server-side source control extension for use of Git on InterSystems platforms</Description>
88
<Keywords>git source control studio vscode</Keywords>
99
<Packaging>module</Packaging>

0 commit comments

Comments
 (0)