|
|
@ -84,6 +84,7 @@ export class GraphWebview extends WebviewBase { |
|
|
|
private _etagRepository?: number; |
|
|
|
private _graph?: GitGraph; |
|
|
|
private _selectedSha?: string; |
|
|
|
private _selectedRows: { [sha: string]: true } = {}; |
|
|
|
private _repositoryEventsDisposable: Disposable | undefined; |
|
|
|
|
|
|
|
private _statusBarItem: StatusBarItem | undefined; |
|
|
@ -113,7 +114,7 @@ export class GraphWebview extends WebviewBase { |
|
|
|
this.container.subscription.onDidChange(this.onSubscriptionChanged, this), |
|
|
|
registerCommand(Commands.ShowCommitInGraph, (args: ShowCommitInGraphCommandArgs) => { |
|
|
|
this.repository = this.container.git.getRepository(args.repoPath); |
|
|
|
this._selectedSha = args.sha; |
|
|
|
this.setSelectedRows(args.sha); |
|
|
|
|
|
|
|
if (this._panel == null) { |
|
|
|
void this.show({ preserveFocus: args.preserveFocus }); |
|
|
@ -399,7 +400,7 @@ export class GraphWebview extends WebviewBase { |
|
|
|
if (!this.isReady || !this.visible) return false; |
|
|
|
|
|
|
|
return this.notify(DidChangeSelectionNotificationType, { |
|
|
|
selection: this._selectedSha != null ? [this._selectedSha] : [], |
|
|
|
selection: this._selectedRows, |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -474,14 +475,14 @@ export class GraphWebview extends WebviewBase { |
|
|
|
{ limit: limit, ref: this._selectedSha ?? 'HEAD' }, |
|
|
|
); |
|
|
|
this.setGraph(data); |
|
|
|
this._selectedSha = data.sha; |
|
|
|
this.setSelectedRows(data.sha); |
|
|
|
|
|
|
|
return { |
|
|
|
previewBanner: this.previewBanner, |
|
|
|
trialBanner: this.trialBanner, |
|
|
|
repositories: formatRepositories(this.container.git.openRepositories), |
|
|
|
selectedRepository: this.repository.path, |
|
|
|
selectedSha: this._selectedSha, |
|
|
|
selectedRows: this._selectedRows, |
|
|
|
selectedVisibility: visibility, |
|
|
|
subscription: access.subscription.current, |
|
|
|
allowed: access.allowed, |
|
|
@ -509,12 +510,19 @@ export class GraphWebview extends WebviewBase { |
|
|
|
|
|
|
|
private resetRepositoryState() { |
|
|
|
this.setGraph(undefined); |
|
|
|
this._selectedSha = undefined; |
|
|
|
this.setSelectedRows(undefined); |
|
|
|
} |
|
|
|
|
|
|
|
private setGraph(graph: GitGraph | undefined) { |
|
|
|
this._graph = graph; |
|
|
|
} |
|
|
|
|
|
|
|
private setSelectedRows(sha: string | undefined) { |
|
|
|
if (this._selectedSha === sha) return; |
|
|
|
|
|
|
|
this._selectedSha = sha; |
|
|
|
this._selectedRows = sha != null ? { [sha]: true } : {}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function formatRepositories(repositories: Repository[]): GraphRepository[] { |
|
|
|