瀏覽代碼

Add type exclusion (WIP)

main
Ramin Tadayon 1 年之前
committed by Keith Daulton
父節點
當前提交
0732f3c0e4
共有 3 個檔案被更改,包括 19 行新增0 行删除
  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 查看文件

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

+ 3
- 0
src/plus/webviews/graph/protocol.ts 查看文件

@ -1,5 +1,6 @@
import type {
CssVariables,
ExcludeByType,
ExcludeRefsById,
GraphColumnSetting,
GraphContexts,
@ -61,6 +62,7 @@ export interface State {
workingTreeStats?: GraphWorkingTreeStats;
searchResults?: DidSearchParams['results'];
excludeRefs?: GraphExcludeRefs;
excludeTypes?: GraphExcludeTypes;
includeOnlyRefs?: GraphIncludeOnlyRefs;
// 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 GraphExcludedRef = GraphRefOptData;
export type GraphExcludeTypes = ExcludeByType;
export type GraphIncludeOnlyRefs = IncludeOnlyRefsById;
export type GraphIncludeOnlyRef = GraphRefOptData;

+ 3
- 0
src/webviews/apps/plus/graph/GraphWrapper.tsx 查看文件

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

Loading…
取消
儲存