Pārlūkot izejas kodu

Moves types from webview to protocol

main
Eric Amodio pirms 1 gada
vecāks
revīzija
1f416604f6
9 mainītis faili ar 100 papildinājumiem un 86 dzēšanām
  1. +1
    -1
      src/env/node/git/localGitProvider.ts
  2. +1
    -1
      src/git/actions/commit.ts
  3. +1
    -1
      src/git/formatters/commitFormatter.ts
  4. +1
    -1
      src/plus/github/githubGitProvider.ts
  5. +13
    -78
      src/plus/webviews/graph/graphWebview.ts
  6. +80
    -0
      src/plus/webviews/graph/protocol.ts
  7. +1
    -2
      src/plus/webviews/graph/registration.ts
  8. +1
    -1
      src/uris/deepLinks/deepLinkService.ts
  9. +1
    -1
      src/webviews/commitDetails/commitDetailsWebview.ts

+ 1
- 1
src/env/node/git/localGitProvider.ts Parādīt failu

@ -136,7 +136,7 @@ import type {
GraphItemRefContext,
GraphItemRefGroupContext,
GraphTagContextValue,
} from '../../../plus/webviews/graph/graphWebview';
} from '../../../plus/webviews/graph/protocol';
import { countStringLength, filterMap } from '../../../system/array';
import { TimedCancellationSource } from '../../../system/cancellation';
import { configuration } from '../../../system/configuration';

+ 1
- 1
src/git/actions/commit.ts Parādīt failu

@ -12,7 +12,7 @@ import type {
import type { FileAnnotationType } from '../../config';
import { Commands } from '../../constants';
import { Container } from '../../container';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/graphWebview';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol';
import { executeCommand, executeEditorCommand } from '../../system/command';
import { findOrOpenEditor, findOrOpenEditors } from '../../system/utils';
import { GitUri } from '../gitUri';

+ 1
- 1
src/git/formatters/commitFormatter.ts Parādīt failu

@ -21,7 +21,7 @@ import { Commands, GlyphChars } from '../../constants';
import { Container } from '../../container';
import { emojify } from '../../emojis';
import { arePlusFeaturesEnabled } from '../../plus/subscription/utils';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/graphWebview';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol';
import { configuration } from '../../system/configuration';
import { join, map } from '../../system/iterable';
import { PromiseCancelledError } from '../../system/promise';

+ 1
- 1
src/plus/github/githubGitProvider.ts Parādīt failu

@ -96,7 +96,7 @@ import type {
GraphItemContext,
GraphItemRefContext,
GraphTagContextValue,
} from '../webviews/graph/graphWebview';
} from '../webviews/graph/protocol';
import type { GitHubApi } from './github';
import { fromCommitFileStatus } from './models';

+ 13
- 78
src/plus/webviews/graph/graphWebview.ts Parādīt failu

@ -67,7 +67,6 @@ import { find, last } from '../../../system/iterable';
import { updateRecordValue } from '../../../system/object';
import { getSettledValue } from '../../../system/promise';
import { isDarkTheme, isLightTheme } from '../../../system/utils';
import type { WebviewItemContext, WebviewItemGroupContext } from '../../../system/webview';
import { isWebviewItemContext, isWebviewItemGroupContext, serializeWebviewItemContext } from '../../../system/webview';
import { RepositoryFolderNode } from '../../../views/nodes/viewNode';
import type { IpcMessage, IpcMessageParams, IpcNotificationType } from '../../../webviews/protocol';
@ -84,23 +83,36 @@ import type {
GetMissingAvatarsParams,
GetMissingRefsMetadataParams,
GetMoreRowsParams,
GraphBranchContextValue,
GraphColumnConfig,
GraphColumnName,
GraphColumnsConfig,
GraphColumnsSettings,
GraphCommitContextValue,
GraphComponentConfig,
GraphContributorContextValue,
GraphExcludedRef,
GraphExcludeRefs,
GraphExcludeTypes,
GraphHostingServiceType,
GraphIncludeOnlyRef,
GraphItemContext,
GraphItemGroupContext,
GraphItemRefContext,
GraphItemRefGroupContext,
GraphItemTypedContext,
GraphItemTypedContextValue,
GraphMissingRefsMetadataType,
GraphPullRequestContextValue,
GraphPullRequestMetadata,
GraphRefMetadata,
GraphRefMetadataType,
GraphRepository,
GraphSelectedRows,
GraphStashContextValue,
GraphTagContextValue,
GraphUpstreamMetadata,
GraphUpstreamStatusContextValue,
GraphWorkingTreeStats,
SearchOpenInViewParams,
SearchParams,
@ -148,15 +160,6 @@ import {
UpdateSelectionCommandType,
} from './protocol';
export interface ShowInCommitGraphCommandArgs {
ref: GitReference;
preserveFocus?: boolean;
}
export interface GraphSelectionChangeEvent {
readonly selection: GitRevisionReference[];
}
const defaultGraphColumnsSettings: GraphColumnsSettings = {
ref: { width: 150, isHidden: false },
graph: { width: 150, isHidden: false },
@ -2501,74 +2504,6 @@ function formatRepositories(repositories: Repository[]): GraphRepository[] {
}));
}
export type GraphItemContext = WebviewItemContext<GraphItemContextValue>;
export type GraphItemContextValue = GraphColumnsContextValue | GraphItemTypedContextValue | GraphItemRefContextValue;
export type GraphItemGroupContext = WebviewItemGroupContext<GraphItemGroupContextValue>;
export type GraphItemGroupContextValue = GraphItemRefGroupContextValue;
export type GraphItemRefContext<T = GraphItemRefContextValue> = WebviewItemContext<T>;
export type GraphItemRefContextValue =
| GraphBranchContextValue
| GraphCommitContextValue
| GraphStashContextValue
| GraphTagContextValue;
export type GraphItemRefGroupContext<T = GraphItemRefGroupContextValue> = WebviewItemGroupContext<T>;
export interface GraphItemRefGroupContextValue {
type: 'refGroup';
refs: (GitBranchReference | GitTagReference)[];
}
export type GraphItemTypedContext<T = GraphItemTypedContextValue> = WebviewItemContext<T>;
export type GraphItemTypedContextValue =
| GraphContributorContextValue
| GraphPullRequestContextValue
| GraphUpstreamStatusContextValue;
export type GraphColumnsContextValue = string;
export interface GraphContributorContextValue {
type: 'contributor';
repoPath: string;
name: string;
email: string | undefined;
current?: boolean;
}
export interface GraphPullRequestContextValue {
type: 'pullrequest';
id: string;
url: string;
}
export interface GraphBranchContextValue {
type: 'branch';
ref: GitBranchReference;
}
export interface GraphCommitContextValue {
type: 'commit';
ref: GitRevisionReference;
}
export interface GraphStashContextValue {
type: 'stash';
ref: GitStashReference;
}
export interface GraphTagContextValue {
type: 'tag';
ref: GitTagReference;
}
export interface GraphUpstreamStatusContextValue {
type: 'upstreamStatus';
ref: GitBranchReference;
ahead: number;
behind: number;
}
function isGraphItemContext(item: unknown): item is GraphItemContext {
if (item == null) return false;

+ 80
- 0
src/plus/webviews/graph/protocol.ts Parādīt failu

@ -23,9 +23,17 @@ import type {
import type { DateStyle } from '../../../config';
import type { RepositoryVisibility } from '../../../git/gitProvider';
import type { GitGraphRowType } from '../../../git/models/graph';
import type {
GitBranchReference,
GitReference,
GitRevisionReference,
GitStashReference,
GitTagReference,
} from '../../../git/models/reference';
import type { GitSearchResultData, SearchQuery } from '../../../git/search';
import type { Subscription } from '../../../subscription';
import type { DateTimeFormat } from '../../../system/date';
import type { WebviewItemContext, WebviewItemGroupContext } from '../../../system/webview';
import { IpcCommandType, IpcNotificationType } from '../../../webviews/protocol';
export type { GraphRefType } from '@gitkraken/gitkraken-components';
@ -405,3 +413,75 @@ export interface DidFetchParams {
lastFetched: Date;
}
export const DidFetchNotificationType = new IpcNotificationType<DidFetchParams>('graph/didFetch', true);
export interface ShowInCommitGraphCommandArgs {
ref: GitReference;
preserveFocus?: boolean;
}
export type GraphItemContext = WebviewItemContext<GraphItemContextValue>;
export type GraphItemContextValue = GraphColumnsContextValue | GraphItemTypedContextValue | GraphItemRefContextValue;
export type GraphItemGroupContext = WebviewItemGroupContext<GraphItemGroupContextValue>;
export type GraphItemGroupContextValue = GraphItemRefGroupContextValue;
export type GraphItemRefContext<T = GraphItemRefContextValue> = WebviewItemContext<T>;
export type GraphItemRefContextValue =
| GraphBranchContextValue
| GraphCommitContextValue
| GraphStashContextValue
| GraphTagContextValue;
export type GraphItemRefGroupContext<T = GraphItemRefGroupContextValue> = WebviewItemGroupContext<T>;
export interface GraphItemRefGroupContextValue {
type: 'refGroup';
refs: (GitBranchReference | GitTagReference)[];
}
export type GraphItemTypedContext<T = GraphItemTypedContextValue> = WebviewItemContext<T>;
export type GraphItemTypedContextValue =
| GraphContributorContextValue
| GraphPullRequestContextValue
| GraphUpstreamStatusContextValue;
export type GraphColumnsContextValue = string;
export interface GraphContributorContextValue {
type: 'contributor';
repoPath: string;
name: string;
email: string | undefined;
current?: boolean;
}
export interface GraphPullRequestContextValue {
type: 'pullrequest';
id: string;
url: string;
}
export interface GraphBranchContextValue {
type: 'branch';
ref: GitBranchReference;
}
export interface GraphCommitContextValue {
type: 'commit';
ref: GitRevisionReference;
}
export interface GraphStashContextValue {
type: 'stash';
ref: GitStashReference;
}
export interface GraphTagContextValue {
type: 'tag';
ref: GitTagReference;
}
export interface GraphUpstreamStatusContextValue {
type: 'upstreamStatus';
ref: GitBranchReference;
ahead: number;
behind: number;
}

+ 1
- 2
src/plus/webviews/graph/registration.ts Parādīt failu

@ -7,8 +7,7 @@ import type { CommitNode } from '../../../views/nodes/commitNode';
import type { StashNode } from '../../../views/nodes/stashNode';
import type { TagNode } from '../../../views/nodes/tagNode';
import type { WebviewPanelProxy, WebviewsController } from '../../../webviews/webviewsController';
import type { ShowInCommitGraphCommandArgs } from './graphWebview';
import type { State } from './protocol';
import type { ShowInCommitGraphCommandArgs, State } from './protocol';
export function registerGraphWebviewPanel(controller: WebviewsController) {
return controller.registerWebviewPanel<State>(Commands.ShowGraphPage, 'gitlens.graph', {

+ 1
- 1
src/uris/deepLinks/deepLinkService.ts Parādīt failu

@ -6,7 +6,7 @@ import type { GitReference } from '../../git/models/reference';
import { createReference } from '../../git/models/reference';
import type { GitRemote } from '../../git/models/remote';
import { parseGitRemoteUrl } from '../../git/parsers/remoteParser';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/graphWebview';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol';
import type { StoredDeepLinkContext } from '../../storage';
import { executeCommand } from '../../system/command';
import { configuration } from '../../system/configuration';

+ 1
- 1
src/webviews/commitDetails/commitDetailsWebview.ts Parādīt failu

@ -26,7 +26,7 @@ import { serializePullRequest } from '../../git/models/pullRequest';
import type { GitRevisionReference } from '../../git/models/reference';
import { getReferenceFromRevision } from '../../git/models/reference';
import type { GitRemote } from '../../git/models/remote';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/graphWebview';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol';
import { executeCommand, executeCoreCommand } from '../../system/command';
import { configuration } from '../../system/configuration';
import type { DateTimeFormat } from '../../system/date';

Notiek ielāde…
Atcelt
Saglabāt