Skip to content

Commit 0e02fc2

Browse files
committed
Merge PR mhutchie#763 (Show HEAD Button): Resolve conflicts and fix tests
2 parents 4f77791 + 4f2d202 commit 0e02fc2

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* #910 Display GPG signature status for commits (verified/unverified) in the graph.
88
* #394 New "Sticky Scroll" option for the Commit Graph.
99
* #473 Display CI/CD Status (e.g. GitHub Actions) in the graph.
10+
* #763 New "Show HEAD" button in the controls bar to scroll to the HEAD commit.
1011

1112
### Español
1213
* #602 Nueva acción "Copiar Hash del Commit al Portapapeles".
@@ -15,6 +16,7 @@
1516
* #910 Muestra el estado de la firma GPG de los commits (verificado/no verificado) en el gráfico.
1617
* #394 Nueva opción de "Desplazamiento Pegajoso" para el Gráfico de Commits.
1718
* #473 Muestra el estado de CI/CD (por ejemplo, GitHub Actions) en el gráfico.
19+
* #763 Nuevo botón "Mostrar HEAD" en la barra de controles para desplazarse al commit HEAD.
1820

1921
## 1.30.0 - 2021-04-05
2022
* #395 Added a "Force Fetch" option onto the "Fetch into Local Branch" Dialog, allowing any local branch (that's not checked out) to be reset to the remote branch. This dialog is accessed via the Remote Branch Context Menu.

src/gitGraphView.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ export class GitGraphView extends Disposable {
741741
<span id="repoControl"><span class="unselectable">Repo: </span><div id="repoDropdown" class="dropdown"></div></span>
742742
<span id="branchControl"><span class="unselectable">Branches: </span><div id="branchDropdown" class="dropdown"></div></span>
743743
<label id="showRemoteBranchesControl"><input type="checkbox" id="showRemoteBranchesCheckbox" tabindex="-1"><span class="customCheckbox"></span>Show Remote Branches</label>
744+
<div id="headBtn" title="Scroll to HEAD"></div>
744745
<div id="findBtn" title="Find"></div>
745746
<div id="terminalBtn" title="Open a Terminal for this Repository"></div>
746747
<div id="settingsBtn" title="Repository Settings"></div>

tests/gitGraphView.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,7 +2176,8 @@ describe('GitGraphView', () => {
21762176
heads: ['master'],
21772177
tags: [],
21782178
remotes: [{ name: 'origin/master', remote: 'origin' }],
2179-
stash: null
2179+
stash: null,
2180+
signature: null
21802181
}
21812182
],
21822183
head: '1a2b3c4d5e6f1a2b3c4d5e6f1a2b3c4d5e6f1a2b',

web/main.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,21 @@ class GitGraphView {
149149
this.requestLoadRepoInfoAndCommits(false, false);
150150
}
151151

152-
const fetchBtn = document.getElementById('fetchBtn')!, findBtn = document.getElementById('findBtn')!, settingsBtn = document.getElementById('settingsBtn')!, terminalBtn = document.getElementById('terminalBtn')!;
152+
const headBtn = document.getElementById('headBtn')!;
153+
const fetchBtn = document.getElementById('fetchBtn')!;
154+
const findBtn = document.getElementById('findBtn')!;
155+
const settingsBtn = document.getElementById('settingsBtn')!;
156+
const terminalBtn = document.getElementById('terminalBtn')!;
157+
158+
headBtn.innerHTML = SVG_ICONS.eyeOpen;
159+
headBtn.addEventListener('click', () => {
160+
const headDots = document.getElementsByClassName('commitHeadDot');
161+
if (headDots.length === 1) {
162+
// Scroll its parent (the commit row) into view. If you just
163+
// scroll the dot into view it chops off part of the row.
164+
headDots[0].parentElement?.scrollIntoView();
165+
}
166+
});
153167
fetchBtn.title = 'Fetch' + (this.config.fetchAndPrune ? ' & Prune' : '') + ' from Remote(s)';
154168
fetchBtn.innerHTML = SVG_ICONS.download;
155169
fetchBtn.addEventListener('click', () => this.fetchFromRemotesAction());

web/styles/main.css

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ body.tagLabelsRightAligned .gitRef.tag{
875875
max-width:40vw;
876876
}
877877

878-
#findBtn, #terminalBtn, #settingsBtn, #fetchBtn, #refreshBtn{
878+
#headBtn, #findBtn, #terminalBtn, #settingsBtn, #fetchBtn, #refreshBtn{
879879
position:absolute;
880880
top:50%;
881881
width:20px;
@@ -885,6 +885,9 @@ body.tagLabelsRightAligned .gitRef.tag{
885885
-webkit-user-select:none;
886886
user-select:none;
887887
}
888+
#headBtn{
889+
right:130px;
890+
}
888891
#findBtn{
889892
right:100px;
890893
}
@@ -904,7 +907,7 @@ body.tagLabelsRightAligned .gitRef.tag{
904907
#refreshBtn.refreshing{
905908
cursor:default;
906909
}
907-
#findBtn svg, #terminalBtn svg, #settingsBtn svg, #fetchBtn svg, #refreshBtn svg{
910+
#headBtn svg, #findBtn svg, #terminalBtn svg, #settingsBtn svg, #fetchBtn svg, #refreshBtn svg{
908911
position:absolute;
909912
fill:var(--vscode-editor-foreground);
910913
opacity:0.8;
@@ -915,14 +918,14 @@ body.tagLabelsRightAligned .gitRef.tag{
915918
#findBtn svg, #terminalBtn svg{
916919
stroke-width:0.5px;
917920
}
918-
#findBtn:hover svg, #terminalBtn:hover svg, #settingsBtn:hover svg, #fetchBtn:hover svg, #refreshBtn:hover svg{
921+
#headBtn:hover svg, #findBtn:hover svg, #terminalBtn:hover svg, #settingsBtn:hover svg, #fetchBtn:hover svg, #refreshBtn:hover svg{
919922
opacity:1;
920923
stroke-width:0.5px;
921924
}
922925
#findBtn:hover svg, #terminalBtn:hover svg{
923926
stroke-width:1px;
924927
}
925-
#findBtn svg, #terminalBtn svg, #settingsBtn svg, #fetchBtn svg{
928+
#headBtn svg, #findBtn svg, #terminalBtn svg, #settingsBtn svg, #fetchBtn svg{
926929
left:1px;
927930
top:1px;
928931
width:18px !important;
@@ -945,6 +948,9 @@ body.tagLabelsRightAligned .gitRef.tag{
945948
#controls.fetchSupported{
946949
padding-right:162px;
947950
}
951+
#controls.fetchSupported #headBtn{
952+
right:160px;
953+
}
948954
#controls.fetchSupported #findBtn{
949955
right:130px;
950956
}
@@ -1084,6 +1090,7 @@ label > input[type=radio]:checked ~ .customRadio:after{
10841090
-webkit-user-select:none;
10851091
user-select:none;
10861092
}
1093+
<<<<<<< HEAD
10871094

10881095
/* cicdTooltip */
10891096

0 commit comments

Comments
 (0)