From 1e2f6b46d09515a5865e25a4bee3cc3bbb9c2525 Mon Sep 17 00:00:00 2001 From: Keith Daulton Date: Wed, 9 Nov 2022 10:53:58 -0500 Subject: [PATCH] shows graph button always in commit details --- src/plus/webviews/graph/graphWebview.ts | 8 +++++++- src/webviews/apps/commitDetails/commitDetails.ts | 10 ++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/plus/webviews/graph/graphWebview.ts b/src/plus/webviews/graph/graphWebview.ts index 4f04c75..976ee6b 100644 --- a/src/plus/webviews/graph/graphWebview.ts +++ b/src/plus/webviews/graph/graphWebview.ts @@ -1346,10 +1346,13 @@ export class GraphWebview extends WebviewBase { // If we have a set of data refresh to the same set const limit = Math.max(defaultItemLimit, this._graph?.ids.size ?? defaultItemLimit); + const ref = + this._selectedId == null || this._selectedId === GitRevision.uncommitted ? 'HEAD' : this._selectedId; + const dataPromise = this.container.git.getCommitsForGraph( this.repository.path, this._panel!.webview.asWebviewUri.bind(this._panel!.webview), - { limit: limit, ref: this._selectedId ?? 'HEAD' }, + { limit: limit, ref: ref }, ); // Check for GitLens+ access and working tree stats @@ -1448,6 +1451,9 @@ export class GraphWebview extends WebviewBase { if (this._selectedId === id) return; this._selectedId = id; + if (id === GitRevision.uncommitted) { + id = GitGraphRowType.Working; + } this._selectedRows = id != null ? { [id]: true } : undefined; } diff --git a/src/webviews/apps/commitDetails/commitDetails.ts b/src/webviews/apps/commitDetails/commitDetails.ts index 9723424..8b171cf 100644 --- a/src/webviews/apps/commitDetails/commitDetails.ts +++ b/src/webviews/apps/commitDetails/commitDetails.ts @@ -268,15 +268,13 @@ export class CommitDetailsApp extends App> { } renderActions(state: CommitState) { - const isHiddenForUncommitted = state.selected?.sha === uncommittedSha ? 'true' : 'false'; - for (const $el of document.querySelectorAll('[data-action-type="graph"],[data-action-type="more"]')) { + const isUncommitted = state.selected?.sha === uncommittedSha; + const isHiddenForUncommitted = isUncommitted.toString(); + for (const $el of document.querySelectorAll('[data-action-type="sha"],[data-action-type="more"]')) { $el.setAttribute('aria-hidden', isHiddenForUncommitted); } - const isHiddenForCommitted = state.selected?.sha !== uncommittedSha ? 'true' : 'false'; - for (const $el of document.querySelectorAll('[data-action-type="scm"]')) { - $el.setAttribute('aria-hidden', isHiddenForCommitted); - } + document.querySelector('[data-action-type="scm"]')?.setAttribute('aria-hidden', (!isUncommitted).toString()); } renderPin(state: CommitState) {