Browse Source

Add type exclusion (WIP)

main
Ramin Tadayon 1 year ago
committed by Keith Daulton
parent
commit
0732f3c0e4
3 changed files with 19 additions and 0 deletions
  1. +13
    -0
      src/plus/webviews/graph/graphWebview.ts
  2. +3
    -0
      src/plus/webviews/graph/protocol.ts
  3. +3
    -0
      src/webviews/apps/plus/graph/GraphWrapper.tsx

+ 13
- 0
src/plus/webviews/graph/graphWebview.ts View File

@ -88,6 +88,7 @@ import type {
GraphComponentConfig, GraphComponentConfig,
GraphExcludedRef, GraphExcludedRef,
GraphExcludeRefs, GraphExcludeRefs,
GraphExcludeTypes,
GraphHostingServiceType, GraphHostingServiceType,
GraphIncludeOnlyRef, GraphIncludeOnlyRef,
GraphMissingRefsMetadataType, GraphMissingRefsMetadataType,
@ -1269,6 +1270,17 @@ export class GraphWebview extends WebviewBase {
return this.container.storage.getWorkspace('graph:columns'); return this.container.storage.getWorkspace('graph:columns');
} }
private getExcludedTypes(graph: GitGraph | undefined): GraphExcludeTypes | undefined {
// if (graph == null) return undefined;
return {
heads: true,
remotes: true,
stashes: true,
tags: true
};
}
private getExcludedRefs(graph: GitGraph | undefined): Record<string, GraphExcludedRef> | undefined { private getExcludedRefs(graph: GitGraph | undefined): Record<string, GraphExcludedRef> | undefined {
return this.filterExcludedRefs(this.container.storage.getWorkspace('graph:excludeRefs'), graph); return this.filterExcludedRefs(this.container.storage.getWorkspace('graph:excludeRefs'), graph);
} }
@ -1519,6 +1531,7 @@ export class GraphWebview extends WebviewBase {
header: this.getColumnHeaderContext(columns), header: this.getColumnHeaderContext(columns),
}, },
excludeRefs: data != null ? this.getExcludedRefs(data) : undefined, excludeRefs: data != null ? this.getExcludedRefs(data) : undefined,
excludeTypes: this.getExcludedTypes(data),
includeOnlyRefs: data != null ? this.getIncludeOnlyRefs(data) : undefined, includeOnlyRefs: data != null ? this.getIncludeOnlyRefs(data) : undefined,
nonce: this.cspNonce, nonce: this.cspNonce,
workingTreeStats: getSettledValue(workingStatsResult) ?? { added: 0, deleted: 0, modified: 0 }, workingTreeStats: getSettledValue(workingStatsResult) ?? { added: 0, deleted: 0, modified: 0 },

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

@ -1,5 +1,6 @@
import type { import type {
CssVariables, CssVariables,
ExcludeByType,
ExcludeRefsById, ExcludeRefsById,
GraphColumnSetting, GraphColumnSetting,
GraphContexts, GraphContexts,
@ -61,6 +62,7 @@ export interface State {
workingTreeStats?: GraphWorkingTreeStats; workingTreeStats?: GraphWorkingTreeStats;
searchResults?: DidSearchParams['results']; searchResults?: DidSearchParams['results'];
excludeRefs?: GraphExcludeRefs; excludeRefs?: GraphExcludeRefs;
excludeTypes?: GraphExcludeTypes;
includeOnlyRefs?: GraphIncludeOnlyRefs; includeOnlyRefs?: GraphIncludeOnlyRefs;
// Props below are computed in the webview (not passed) // Props below are computed in the webview (not passed)
@ -123,6 +125,7 @@ export type GraphColumnsConfig = { [name: string]: GraphColumnConfig };
export type GraphExcludeRefs = ExcludeRefsById; export type GraphExcludeRefs = ExcludeRefsById;
export type GraphExcludedRef = GraphRefOptData; export type GraphExcludedRef = GraphRefOptData;
export type GraphExcludeTypes = ExcludeByType;
export type GraphIncludeOnlyRefs = IncludeOnlyRefsById; export type GraphIncludeOnlyRefs = IncludeOnlyRefsById;
export type GraphIncludeOnlyRef = GraphRefOptData; export type GraphIncludeOnlyRef = GraphRefOptData;

+ 3
- 0
src/webviews/apps/plus/graph/GraphWrapper.tsx View File

@ -163,6 +163,7 @@ export function GraphWrapper({
// const [graphDateFormatter, setGraphDateFormatter] = useState(getGraphDateFormatter(config)); // const [graphDateFormatter, setGraphDateFormatter] = useState(getGraphDateFormatter(config));
const [columns, setColumns] = useState(state.columns); const [columns, setColumns] = useState(state.columns);
const [excludeRefsById, setExcludeRefsById] = useState(state.excludeRefs); const [excludeRefsById, setExcludeRefsById] = useState(state.excludeRefs);
const [excludeTypes, setExcludeTypes] = useState(state.excludeTypes);
const [includeOnlyRefsById, setIncludeOnlyRefsById] = useState(state.includeOnlyRefs); const [includeOnlyRefsById, setIncludeOnlyRefsById] = useState(state.includeOnlyRefs);
const [context, setContext] = useState(state.context); const [context, setContext] = useState(state.context);
const [pagingHasMore, setPagingHasMore] = useState(state.paging?.hasMore ?? false); const [pagingHasMore, setPagingHasMore] = useState(state.paging?.hasMore ?? false);
@ -272,6 +273,7 @@ export function GraphWrapper({
setGraphConfig(state.config); setGraphConfig(state.config);
setSelectedRows(state.selectedRows); setSelectedRows(state.selectedRows);
setExcludeRefsById(state.excludeRefs); setExcludeRefsById(state.excludeRefs);
setExcludeTypes(state.excludeTypes);
setIncludeOnlyRefsById(state.includeOnlyRefs); setIncludeOnlyRefsById(state.includeOnlyRefs);
setContext(state.context); setContext(state.context);
setAvatars(state.avatars ?? {}); setAvatars(state.avatars ?? {});
@ -833,6 +835,7 @@ export function GraphWrapper({
cssVariables={styleProps?.cssVariables} cssVariables={styleProps?.cssVariables}
enableMultiSelection={graphConfig?.enableMultiSelection} enableMultiSelection={graphConfig?.enableMultiSelection}
excludeRefsById={excludeRefsById} excludeRefsById={excludeRefsById}
excludeByType={excludeTypes}
formatCommitDateTime={getGraphDateFormatter(graphConfig)} formatCommitDateTime={getGraphDateFormatter(graphConfig)}
getExternalIcon={getIconElementLibrary} getExternalIcon={getIconElementLibrary}
graphRows={rows} graphRows={rows}

Loading…
Cancel
Save