Browse Source

Adds a refresh button to Commit Details

main
Eric Amodio 1 year ago
parent
commit
9f9b70263c
2 changed files with 44 additions and 10 deletions
  1. +30
    -0
      package.json
  2. +14
    -10
      src/webviews/commitDetails/commitDetailsWebview.ts

+ 30
- 0
package.json View File

@ -6275,6 +6275,12 @@
"category": "GitLens" "category": "GitLens"
}, },
{ {
"command": "gitlens.views.commitDetails.refresh",
"title": "Refresh",
"category": "GitLens",
"icon": "$(refresh)"
},
{
"command": "gitlens.views.commits.copy", "command": "gitlens.views.commits.copy",
"title": "Copy", "title": "Copy",
"category": "GitLens" "category": "GitLens"
@ -6480,6 +6486,12 @@
"category": "GitLens" "category": "GitLens"
}, },
{ {
"command": "gitlens.views.graphDetails.refresh",
"title": "Refresh",
"category": "GitLens",
"icon": "$(refresh)"
},
{
"command": "gitlens.views.home.refresh", "command": "gitlens.views.home.refresh",
"title": "Refresh", "title": "Refresh",
"category": "GitLens", "category": "GitLens",
@ -9070,6 +9082,10 @@
"when": "false" "when": "false"
}, },
{ {
"command": "gitlens.views.commitDetails.refresh",
"when": "false"
},
{
"command": "gitlens.views.commits.copy", "command": "gitlens.views.commits.copy",
"when": "false" "when": "false"
}, },
@ -9218,6 +9234,10 @@
"when": "false" "when": "false"
}, },
{ {
"command": "gitlens.views.graphDetails.refresh",
"when": "false"
},
{
"command": "gitlens.views.home.refresh", "command": "gitlens.views.home.refresh",
"when": "false" "when": "false"
}, },
@ -10585,6 +10605,11 @@
"group": "navigation@11" "group": "navigation@11"
}, },
{ {
"command": "gitlens.views.commitDetails.refresh",
"when": "view =~ /^gitlens\\.views\\.commitDetails/",
"group": "navigation@99"
},
{
"command": "gitlens.views.commits.setMyCommitsOnlyOff", "command": "gitlens.views.commits.setMyCommitsOnlyOff",
"when": "view =~ /^gitlens\\.views\\.commits/ && gitlens:views:commits:myCommitsOnly", "when": "view =~ /^gitlens\\.views\\.commits/ && gitlens:views:commits:myCommitsOnly",
"group": "navigation@50" "group": "navigation@50"
@ -10780,6 +10805,11 @@
"group": "5_gitlens@0" "group": "5_gitlens@0"
}, },
{ {
"command": "gitlens.views.graphDetails.refresh",
"when": "view =~ /^gitlens\\.views\\.graphDetails/",
"group": "navigation@99"
},
{
"command": "gitlens.views.home.refresh", "command": "gitlens.views.home.refresh",
"when": "view =~ /^gitlens\\.views\\.home/", "when": "view =~ /^gitlens\\.views\\.home/",
"group": "navigation@99" "group": "navigation@99"

+ 14
- 10
src/webviews/commitDetails/commitDetailsWebview.ts View File

@ -27,7 +27,7 @@ import type { GitRevisionReference } from '../../git/models/reference';
import { createReference, getReferenceFromRevision, shortenRevision } from '../../git/models/reference'; import { createReference, getReferenceFromRevision, shortenRevision } from '../../git/models/reference';
import type { GitRemote } from '../../git/models/remote'; import type { GitRemote } from '../../git/models/remote';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol'; import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol';
import { executeCommand, executeCoreCommand } from '../../system/command';
import { executeCommand, executeCoreCommand, registerCommand } from '../../system/command';
import { configuration } from '../../system/configuration'; import { configuration } from '../../system/configuration';
import { getContext } from '../../system/context'; import { getContext } from '../../system/context';
import type { DateTimeFormat } from '../../system/date'; import type { DateTimeFormat } from '../../system/date';
@ -197,6 +197,19 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
return true; return true;
} }
includeBootstrap(): Promise<Serialized<State>> {
this._bootstraping = true;
this._context = { ...this._context, ...this._pendingContext };
this._pendingContext = undefined;
return this.getState(this._context);
}
registerCommands(): Disposable[] {
return [registerCommand(`${this.host.id}.refresh`, () => this.host.refresh(true))];
}
private onCommitSelected(e: CommitSelectedEvent) { private onCommitSelected(e: CommitSelectedEvent) {
if ( if (
e.data == null || e.data == null ||
@ -214,15 +227,6 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
} }
} }
includeBootstrap(): Promise<Serialized<State>> {
this._bootstraping = true;
this._context = { ...this._context, ...this._pendingContext };
this._pendingContext = undefined;
return this.getState(this._context);
}
onFocusChanged(focused: boolean): void { onFocusChanged(focused: boolean): void {
if (this._focused === focused) return; if (this._focused === focused) return;

Loading…
Cancel
Save