diff --git a/src/plus/webviews/graph/graphWebview.ts b/src/plus/webviews/graph/graphWebview.ts index 9078312..2120083 100644 --- a/src/plus/webviews/graph/graphWebview.ts +++ b/src/plus/webviews/graph/graphWebview.ts @@ -1278,10 +1278,10 @@ export class GraphWebview extends WebviewBase { // return this.container.storage.getWorkspace('graph:excludeTypes'); return { - heads: true, + heads: false, remotes: true, stashes: true, - tags: true + tags: true, }; } @@ -1597,7 +1597,6 @@ export class GraphWebview extends WebviewBase { void this.notifyDidChangeRefsVisibility(); } - private updateIncludeOnlyRefs(refs: GraphIncludeOnlyRef[], include: boolean) { let storedIncludeOnlyRefs = this.container.storage.getWorkspace('graph:includeOnlyRefs'); for (const ref of refs) { diff --git a/src/webviews/apps/plus/graph/GraphWrapper.tsx b/src/webviews/apps/plus/graph/GraphWrapper.tsx index 41f9b60..8e1efcb 100644 --- a/src/webviews/apps/plus/graph/GraphWrapper.tsx +++ b/src/webviews/apps/plus/graph/GraphWrapper.tsx @@ -10,7 +10,8 @@ import type { GraphRow, OnFormatCommitDateTime, } from '@gitkraken/gitkraken-components'; -import type { ReactElement } from 'react'; +import { VSCodeCheckbox, VSCodeRadio, VSCodeRadioGroup } from '@vscode/webview-ui-toolkit/react'; +import type { FormEvent, ReactElement } from 'react'; import React, { createElement, useEffect, useMemo, useRef, useState } from 'react'; import { getPlatform } from '@env/platform'; import { DateStyle } from '../../../../config'; @@ -25,6 +26,7 @@ import type { GraphColumnsConfig, GraphComponentConfig, GraphExcludedRef, + GraphExcludeTypes, GraphMissingRefsMetadata, GraphRepository, GraphSearchResults, @@ -50,7 +52,7 @@ import type { Subscription } from '../../../../subscription'; import { getSubscriptionTimeRemaining, SubscriptionState } from '../../../../subscription'; import { pluralize } from '../../../../system/string'; import type { IpcNotificationType } from '../../../../webviews/protocol'; -import { MenuItem, MenuList } from '../../shared/components/menu/react'; +import { MenuDivider, MenuItem, MenuLabel, MenuList } from '../../shared/components/menu/react'; import { PopMenu } from '../../shared/components/overlays/pop-menu/react'; import { PopOver } from '../../shared/components/overlays/react'; import { SearchBox } from '../../shared/components/search/react'; @@ -318,6 +320,14 @@ export function GraphWrapper({ return searchIndex < 1 ? 1 : searchIndex + 1; }, [activeRow, searchResults]); + const hasFilters = useMemo(() => { + if (excludeTypes == null) { + return false; + } + + return Object.values(excludeTypes).includes(true); + }, [excludeTypes]); + const handleSearchInput = (e: CustomEvent) => { const detail = e.detail; setSearchQuery(detail); @@ -460,6 +470,25 @@ export function GraphWrapper({ } }; + const handleExcludeTypeChange = (e: Event | FormEvent) => { + const $el = e.target as HTMLInputElement; + + const value = $el.value; + const isLocalBranches = ['branch-all', 'branch-current'].includes(value); + if (!isLocalBranches && !['remotes', 'stashes', 'tags'].includes(value)) return; + + const key = value; + const isChecked = $el.checked; + + const currentFilter = excludeTypes?.[key as keyof GraphExcludeTypes]; + if ((currentFilter == null && isChecked) || (currentFilter != null && currentFilter !== isChecked)) { + setExcludeTypes({ + ...excludeTypes, + [key]: isChecked, + }); + } + }; + const handleMissingAvatars = (emails: GraphAvatars) => { onMissingAvatars?.(emails); }; @@ -790,17 +819,58 @@ export function GraphWrapper({ {isAccessAllowed && (
- {/* - - - - + + + + Filter options + + + + Show All Local Branches + + Show Current Branch Only + + + + + + Hide Remote Branches + + + + + Hide Stashes + + + + + Hide Tags + + + + - */} +