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[] { function formatRepositories(repositories: Repository[]): GraphRepository[] {
if (repositories.length === 0) return repositories;
if (repositories.length === 0) return [];
return repositories.map(r => ({ return repositories.map(r => ({
formattedName: r.formattedName, formattedName: r.formattedName,
id: r.id, id: r.id,
name: r.name, name: r.name,
path: r.path, 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; id: string;
name: string; name: string;
path: string; path: string;
isVirtual: boolean;
} }
export interface GraphCommitIdentity { export interface GraphCommitIdentity {

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

@ -872,39 +872,50 @@ export function GraphWrapper({
<MenuItem role="none"> <MenuItem role="none">
<VSCodeRadioGroup <VSCodeRadioGroup
orientation="vertical" 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"> <VSCodeRadio name="branching-toggle" value="branch-current">
Show Current Branch Only Show Current Branch Only
</VSCodeRadio> </VSCodeRadio>
</VSCodeRadioGroup> </VSCodeRadioGroup>
</MenuItem> </MenuItem>
<MenuDivider></MenuDivider> <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"> <MenuItem role="none">
<VSCodeCheckbox <VSCodeCheckbox
value="tags" value="tags"

Loading…
Cancel
Save