Skip to content

Commit e72baa1

Browse files
rgeorgiev583hansu
authored andcommitted
Implement a selectMultipleAuthors setting which restricts author selection only to a single author when disabled.
1 parent 4f84fed commit e72baa1

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,11 @@
10951095
"default": false,
10961096
"markdownDescription": "Only follow the first parent of commits when discovering the commits to load in the Git Graph View. See [--first-parent](https://git-scm.com/docs/git-log#Documentation/git-log.txt---first-parent) to find out more about this setting. This can be overridden per repository in the Git Graph View's Repository Settings Widget."
10971097
},
1098+
"git-graph.repository.selectMultipleAuthors": {
1099+
"type": "boolean",
1100+
"default": true,
1101+
"description": "Enables the selection of multiple authors from the Authors dropdown."
1102+
},
10981103
"git-graph.repository.selectMultipleBranches": {
10991104
"type": "boolean",
11001105
"default": true,

src/config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,13 @@ class Config {
465465
return !!this.getRenamedExtensionSetting('repository.onlyFollowFirstParent', 'onlyFollowFirstParent', false);
466466
}
467467

468+
/**
469+
* Get the value of the `git-graph.repository.selectMultipleAuthors` Extension Setting.
470+
*/
471+
get selectMultipleAuthors() {
472+
return !!this.config.get('repository.selectMultipleAuthors', true);
473+
}
474+
468475
/**
469476
* Get the value of the `git-graph.repository.selectMultipleBranches` Extension Setting.
470477
*/

src/gitGraphView.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ export class GitGraphView extends Disposable {
691691
onRepoLoad: config.onRepoLoad,
692692
referenceLabels: config.referenceLabels,
693693
repoDropdownOrder: config.repoDropdownOrder,
694+
selectMultipleAuthors: config.selectMultipleAuthors,
694695
selectMultipleBranches: config.selectMultipleBranches,
695696
showRemoteBranches: config.showRemoteBranches,
696697
simplifyByDecoration: config.simplifyByDecoration,
@@ -721,6 +722,7 @@ export class GitGraphView extends Disposable {
721722
} else if (numRepos > 0) {
722723
const stickyClassAttr = initialState.config.stickyHeader ? ' class="sticky"' : '';
723724
const branchDropdownLabel = initialState.config.selectMultipleBranches ? 'Branches' : 'Branch';
725+
const authorDropdownLabel = initialState.config.selectMultipleAuthors ? 'Authors' : 'Author';
724726
let hideRemotes = '', hideSimplify = '';
725727
if (!config.toolbarButtonVisibility.remotes) { hideRemotes = 'style="display: none"'; }
726728
if (!config.toolbarButtonVisibility.simplify) { hideSimplify = 'style="display: none"'; }
@@ -729,7 +731,7 @@ export class GitGraphView extends Disposable {
729731
<div id="controls"${stickyClassAttr}>
730732
<span id="repoControl"><span class="unselectable">Repo: </span><div id="repoDropdown" class="dropdown"></div></span>
731733
<span id="branchControl"><span class="unselectable">${branchDropdownLabel}: </span><div id="branchDropdown" class="dropdown"></div></span>
732-
<span id="authorControl"><span class="unselectable">Authors: </span><div id="authorDropdown" class="dropdown"></div></span>
734+
<span id="authorControl"><span class="unselectable">${authorDropdownLabel}: </span><div id="authorDropdown" class="dropdown"></div></span>
733735
<label ${hideRemotes} id="showRemoteBranchesControl" title="Show Remote Branches"><input type="checkbox" id="showRemoteBranchesCheckbox" tabindex="-1"><span class="customCheckbox"></span>Remotes</label>
734736
<label ${hideSimplify} id="simplifyByDecorationControl" title="Simplify By Decoration"><input type="checkbox" id="simplifyByDecorationCheckbox" tabindex="-1"><span class="customCheckbox"></span>Simplify</label>
735737
<div id="currentBtn" title="Current"></div>

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ export interface GitGraphViewConfig {
263263
readonly onRepoLoad: OnRepoLoadConfig;
264264
readonly referenceLabels: ReferenceLabelsConfig;
265265
readonly repoDropdownOrder: RepoDropdownOrder;
266+
readonly selectMultipleAuthors: boolean;
266267
readonly selectMultipleBranches: boolean;
267268
readonly showRemoteBranches: boolean;
268269
readonly simplifyByDecoration: boolean;

web/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class GitGraphView {
9494
this.clearCommits();
9595
this.requestLoadRepoInfoAndCommits(true, true);
9696
});
97-
this.authorDropdown = new Dropdown('authorDropdown', false, true, 'Authors', (values) => {
97+
this.authorDropdown = new Dropdown('authorDropdown', false, this.config.selectMultipleAuthors, 'Authors', (values) => {
9898
this.currentAuthors = values;
9999
this.maxCommits = this.config.initialLoadCommits;
100100
this.saveState();

0 commit comments

Comments
 (0)