Skip to content

Commit

Permalink
Added searchbar
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-etamarch committed Nov 15, 2024
1 parent 6880f7f commit 8048736
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.8.0] - Unreleased

### Added
- Added filtering through branch names in UI (#615)

## [2.7.1] - 2024-11-13

### Fixed
Expand Down
24 changes: 23 additions & 1 deletion git-webui/release/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,28 @@ webui.SideBarView = function(mainView, noEventHandlers) {
}
});

// Search bar to filter the results
if (idPostfix =='popup') {
var searchBar = $('<input type="text" id="search-input" placeholder="Filter...">').appendTo(accordionDiv)[0];
searchBar.onkeyup = function(){
let branchCards = accordionDiv.getElementsByClassName("branch-card");

var filter = searchBar.value.toUpperCase().replaceAll('/', '-');

for (let i = 0; i < branchCards.length; i++) {
let card = branchCards[i]
let cardHeader = card.querySelector('.card-header');
if (cardHeader) {
if (cardHeader.id.toUpperCase().indexOf(filter) > -1) {
card.style.display = '';
} else {
card.style.display = 'none';
}
}
}
};
}

for (var i = 0; i < refs.length && i < maxRefsCount; ++i) {
var ref = refs[i] + ""; // Get a copy of it
if (ref[2] == '(' && ref[ref.length - 1] == ')') {
Expand All @@ -405,7 +427,7 @@ webui.SideBarView = function(mainView, noEventHandlers) {
ref = ' ' + newref;
}
}
var cardDiv = $('<div class="card custom-card">').appendTo(accordionDiv)[0];
var cardDiv = $('<div class="card custom-card branch-card">').appendTo(accordionDiv)[0];
if (id.indexOf("local-branches") > -1) {
// parses the output of git branch --verbose --verbose
var matches = /^\*?\s*([\w-.@&_\/]+)\s+([^\s]+)\s+(\[.*\])?.*/.exec(ref);
Expand Down
24 changes: 23 additions & 1 deletion git-webui/src/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,28 @@ webui.SideBarView = function(mainView, noEventHandlers) {
}
});

// Search bar to filter the results
if (idPostfix =='popup') {
var searchBar = $('<input type="text" id="search-input" placeholder="Filter...">').appendTo(accordionDiv)[0];
searchBar.onkeyup = function(){
let branchCards = accordionDiv.getElementsByClassName("branch-card");

var filter = searchBar.value.toUpperCase().replaceAll('/', '-');

for (let i = 0; i < branchCards.length; i++) {
let card = branchCards[i]
let cardHeader = card.querySelector('.card-header');
if (cardHeader) {
if (cardHeader.id.toUpperCase().indexOf(filter) > -1) {
card.style.display = '';
} else {
card.style.display = 'none';
}
}
}
};
}

for (var i = 0; i < refs.length && i < maxRefsCount; ++i) {
var ref = refs[i] + ""; // Get a copy of it
if (ref[2] == '(' && ref[ref.length - 1] == ')') {
Expand All @@ -405,7 +427,7 @@ webui.SideBarView = function(mainView, noEventHandlers) {
ref = ' ' + newref;
}
}
var cardDiv = $('<div class="card custom-card">').appendTo(accordionDiv)[0];
var cardDiv = $('<div class="card custom-card branch-card">').appendTo(accordionDiv)[0];
if (id.indexOf("local-branches") > -1) {
// parses the output of git branch --verbose --verbose
var matches = /^\*?\s*([\w-.@&_\/]+)\s+([^\s]+)\s+(\[.*\])?.*/.exec(ref);
Expand Down
2 changes: 1 addition & 1 deletion module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Document name="git-source-control.ZPM">
<Module>
<Name>git-source-control</Name>
<Version>2.7.1</Version>
<Version>2.8.0</Version>
<Description>Server-side source control extension for use of Git on InterSystems platforms</Description>
<Keywords>git source control studio vscode</Keywords>
<Packaging>module</Packaging>
Expand Down

0 comments on commit 8048736

Please sign in to comment.