Browse Source

Restricts graph filter options for virtual repos

main
Keith Daulton 1 year ago
parent
commit
019ea6a230
3 changed files with 40 additions and 27 deletions
  1. +2
    -1
      src/plus/webviews/graph/graphWebview.ts
  2. +1
    -0
      src/plus/webviews/graph/protocol.ts
  3. +37
    -26
      src/webviews/apps/plus/graph/GraphWrapper.tsx

+ 2
- 1
src/plus/webviews/graph/graphWebview.ts View File

@ -2207,13 +2207,14 @@ export class GraphWebview extends WebviewBase {
}
function formatRepositories(repositories: Repository[]): GraphRepository[] {
if (repositories.length === 0) return repositories;
if (repositories.length === 0) return [];
return repositories.map(r => ({
formattedName: r.formattedName,
id: r.id,
name: r.name,
path: r.path,
isVirtual: r.provider.virtual,
}));
}

+ 1
- 0
src/plus/webviews/graph/protocol.ts View File

@ -83,6 +83,7 @@ export interface GraphRepository {
id: string;
name: string;
path: string;
isVirtual: boolean;
}
export interface GraphCommitIdentity {

+ 37
- 26
src/webviews/apps/plus/graph/GraphWrapper.tsx View File

@ -872,39 +872,50 @@ export function GraphWrapper({
<MenuItem role="none">
<VSCodeRadioGroup
orientation="vertical"
value={isAllBranches ? 'branch-all' : 'branch-current'}
value={
isAllBranches && repo?.isVirtual !== true
? 'branch-all'
: 'branch-current'
}
readOnly={repo?.isVirtual === true}
>
<VSCodeRadio
name="branching-toggle"
value="branch-all"
onChange={handleLocalBranchFiltering}
>
Show All Local Branches
</VSCodeRadio>
{repo?.isVirtual !== true && (
<VSCodeRadio
name="branching-toggle"
value="branch-all"
onChange={handleLocalBranchFiltering}
>
Show All Local Branches
</VSCodeRadio>
)}
<VSCodeRadio name="branching-toggle" value="branch-current">
Show Current Branch Only
</VSCodeRadio>
</VSCodeRadioGroup>
</MenuItem>
<MenuDivider></MenuDivider>
<MenuItem role="none">
<VSCodeCheckbox
value="remotes"
onChange={handleExcludeTypeChange}
defaultChecked={excludeTypes?.remotes ?? false}
>
Hide Remote Branches
</VSCodeCheckbox>
</MenuItem>
<MenuItem role="none">
<VSCodeCheckbox
value="stashes"
onChange={handleExcludeTypeChange}
defaultChecked={excludeTypes?.stashes ?? false}
>
Hide Stashes
</VSCodeCheckbox>
</MenuItem>
{repo?.isVirtual !== true && (
<>
<MenuItem role="none">
<VSCodeCheckbox
value="remotes"
onChange={handleExcludeTypeChange}
defaultChecked={excludeTypes?.remotes ?? false}
>
Hide Remote Branches
</VSCodeCheckbox>
</MenuItem>
<MenuItem role="none">
<VSCodeCheckbox
value="stashes"
onChange={handleExcludeTypeChange}
defaultChecked={excludeTypes?.stashes ?? false}
>
Hide Stashes
</VSCodeCheckbox>
</MenuItem>
</>
)}
<MenuItem role="none">
<VSCodeCheckbox
value="tags"

Loading…
Cancel
Save