Skip to content

Commit

Permalink
shows graph button always in commit details
Browse files Browse the repository at this point in the history
  • Loading branch information
d13 committed Nov 9, 2022
1 parent d6d1243 commit 1e2f6b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 7 additions & 1 deletion src/plus/webviews/graph/graphWebview.ts
Expand Up @@ -1346,10 +1346,13 @@ export class GraphWebview extends WebviewBase<State> {
// 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
Expand Down Expand Up @@ -1448,6 +1451,9 @@ export class GraphWebview extends WebviewBase<State> {
if (this._selectedId === id) return;

this._selectedId = id;
if (id === GitRevision.uncommitted) {
id = GitGraphRowType.Working;
}
this._selectedRows = id != null ? { [id]: true } : undefined;
}

Expand Down
10 changes: 4 additions & 6 deletions src/webviews/apps/commitDetails/commitDetails.ts
Expand Up @@ -268,15 +268,13 @@ export class CommitDetailsApp extends App<Serialized<State>> {
}

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) {
Expand Down

0 comments on commit 1e2f6b4

Please sign in to comment.