@gitkraken/gitkraken-components 1.0.0-rc.2 → 1.0.0-rc.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,11 +13,20 @@ import {
13
13
  export type Sha = string;
14
14
  export type CssVariables = {[variable: string]: string};
15
15
  export type IsSelectedBySha = {[sha: Sha]: boolean};
16
+ export type HighlightedShas = {[sha: Sha]: boolean};
16
17
 
17
18
  export type WorkDirType = typeof mergeConflictNodeType
18
19
  | typeof unsupportedRebaseWarningNodeType
19
20
  | typeof workDirType;
20
21
 
22
+ export type WorkDirStats = {
23
+ added: number,
24
+ deleted: number,
25
+ modified: number
26
+ // TODO: Add renamed once available in GitLens from provider
27
+ // renamed: number
28
+ };
29
+
21
30
  export type CommitType = typeof commitNodeType
22
31
  | typeof mergeNodeType
23
32
  | typeof mergeConflictNodeType
@@ -34,20 +43,43 @@ export type GraphPlatform = 'aix'
34
43
  | 'win32'
35
44
  | 'cygwin';
36
45
 
46
+ export type RowContexts = {
47
+ row?: string;
48
+ ref?: string;
49
+ graph?: string;
50
+ avatar?: string;
51
+ message?: string;
52
+ author?: string;
53
+ date?: string;
54
+ sha?: string;
55
+ };
56
+
57
+ export type GraphContexts = {
58
+ graph?: string;
59
+ header?: string;
60
+ };
61
+
37
62
  export type Head = {
63
+ id?: string,
38
64
  name: string;
39
65
  isCurrentHead?: boolean;
66
+ context?: string;
40
67
  };
41
68
 
42
69
  export type Remote = {
70
+ id?: string,
43
71
  name: string;
72
+ owner?: string;
44
73
  avatarUrl?: string;
45
74
  url?: string;
75
+ context?: string;
46
76
  };
47
77
 
48
78
  export type Tag = {
79
+ id?: string,
49
80
  name: string;
50
81
  annotated?: boolean;
82
+ context?: string;
51
83
  };
52
84
 
53
85
  export type GraphRow = {
@@ -61,20 +93,22 @@ export type GraphRow = {
61
93
  heads?: Head[];
62
94
  remotes?: Remote[];
63
95
  tags?: Tag[];
64
- avatarUrl?: string;
96
+ contexts?: RowContexts;
65
97
  };
66
98
 
67
99
  export type GraphColumnSetting = {
68
100
  width: number,
69
- preferredWidth?: number
101
+ isHidden: boolean
70
102
  };
71
103
 
72
- export const REF_ZONE_TYPE = 'refZone';
73
- export const GRAPH_ZONE_TYPE = 'commitZone';
74
- export const MESSAGE_ZONE_TYPE = 'commitMessageZone';
75
- export const AUTHOR_ZONE_TYPE = 'commitAuthorZone';
76
- export const DATE_TIME_ZONE_TYPE = 'commitDateTimeZone';
77
- export const SHA_ZONE_TYPE = 'commitShaZone';
104
+ export type AvatarUrlByEmail = { [email: string]: string };
105
+
106
+ export const REF_ZONE_TYPE = 'ref';
107
+ export const GRAPH_ZONE_TYPE = 'graph';
108
+ export const MESSAGE_ZONE_TYPE = 'message';
109
+ export const AUTHOR_ZONE_TYPE = 'author';
110
+ export const DATE_TIME_ZONE_TYPE = 'datetime';
111
+ export const SHA_ZONE_TYPE = 'sha';
78
112
 
79
113
  export type GraphZoneType = typeof REF_ZONE_TYPE
80
114
  | typeof GRAPH_ZONE_TYPE
@@ -94,8 +128,48 @@ export type GraphRef = Head
94
128
 
95
129
  export type GraphRefGroup = Array<GraphRef>;
96
130
 
131
+ export type RefMetadataById = { [id: string]: RefMetadata | null | undefined };
132
+ export type RefMetadata = {
133
+ pullRequests?: PullRequestMetadata[];
134
+ };
135
+
136
+ export type PullRequestMetadata = {
137
+ hostingServiceType: HostingServiceType;
138
+ id: number;
139
+ title: string;
140
+ author?: string;
141
+ date?: number;
142
+ state?: string;
143
+ url?: string;
144
+ context?: string;
145
+ };
146
+
147
+ // Hosting service types for pull request metadata
148
+ export const gitHubDotComHostingServiceType = 'github';
149
+ export const githubEnterpriseHostingServiceType = 'githubEnterprise';
150
+ export const gitLabHostingServiceType = 'gitlab';
151
+ export const gitLabSelfHostingServiceType = 'gitlabSelfHosted';
152
+ export const azureDevopsHostingServiceType = 'azureDevops';
153
+ export const bitBucketHostingServiceType = 'bitbucket';
154
+ export const bitBucketServerHostingServiceType = 'bitbucketServer';
155
+ export type HostingServiceType =
156
+ typeof GitHubDotComHostingServiceType |
157
+ typeof GithubEnterpriseHostingServiceType |
158
+ typeof BitBucketHostingServiceType |
159
+ typeof BitBucketServerHostingServiceType |
160
+ typeof GitLabHostingServiceType |
161
+ typeof GitLabSelfHostingServiceType |
162
+ typeof AzureDevopsHostingServiceType;
163
+
164
+ export type RefsMissingMetadata = {
165
+ [refId: string]: MissingRefMetadataType[]
166
+ }
167
+ export const missingPullRequestMetadataType = 'pullRequests';
168
+ // Expand this as we add more types to RefMetadata
169
+ export type MissingRefMetadataType = typeof missingPullRequestMetadataType;
170
+
97
171
  // Callbacks
98
- export type GetExternalIcon = (key: string) => ReactElement<*>;
172
+ export type GetExternalIcon = (key: string) => React.ReactElement<any>;
99
173
  export type TranslationFn = (key: string, ...formatArgs: any) => string;
100
174
  export type OnFormatCommitDateTime = (commitDateTime: number) => string;
101
175
 
@@ -113,17 +187,24 @@ export type OnGraphRefNodeHovered = (event: any, refGroup: GraphRefGroup, graphR
113
187
  export type OnGraphRefNodeUnhovered = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
114
188
  export type OnGraphColumnResized = (graphZoneType: GraphZoneType, columnSettings: GraphColumnSetting) => void;
115
189
  export type OnShowMoreCommits = () => void;
190
+ export type OnEmailsMissingAvatarUrls = (emails: { [email: string]: string }) => void;
191
+ export type OnRefsMissingMetadata = (refs: RefsMissingMetadata) => void;
116
192
 
117
193
  // Main graph component
118
194
  export interface GraphContainerProps {
195
+ avatarUrlByEmail?: AvatarUrlByEmail;
196
+ contexts?: GraphContexts;
119
197
  height?: number;
120
198
  width?: number;
121
199
  platform?: GraphPlatform;
122
200
  cssVariables?: CssVariables;
123
201
  getExternalIcon: GetExternalIcon;
202
+ highlightRowsOnRefHover?: boolean,
203
+ showGhostRefsOnRowHover?: boolean,
124
204
  enableMultiSelection?: boolean,
125
205
  graphRows: GraphRow[];
126
206
  hasMoreCommits?: boolean;
207
+ highlightedShas?: HighlightedShas;
127
208
  // isCommitting: boolean;
128
209
  isSelectedBySha?: IsSelectedBySha;
129
210
  // isInUnsupportedRebase: boolean;
@@ -132,10 +213,11 @@ export interface GraphContainerProps {
132
213
  // pendingCommitMessageSummary: string;
133
214
  // repoPath: string;
134
215
  columnsSettings?: GraphColumnsSettings;
216
+ refMetadataById?: RefMetadataById;
135
217
  themeOpacityFactor?: number;
136
218
  translate?: TranslationFn;
137
219
  useAuthorInitialsForAvatars?: boolean;
138
- // workDirStats: WorkDirStats;
220
+ workDirStats?: WorkDirStats;
139
221
  onRowContextMenu?: OnRowContextMenu;
140
222
  onRefContextMenu?: OnRefContextMenu;
141
223
  onGraphRowHovered?: OnGraphRowHovered;
@@ -154,6 +236,8 @@ export interface GraphContainerProps {
154
236
  onShowMoreCommits?: OnShowMoreCommits;
155
237
  // onWipNodeInputWillUnmount: OnComponentWillUnmount;
156
238
  // onUpdateGraphWidth: OnUpdateGraphWidth;
239
+ onEmailsMissingAvatarUrls?: OnEmailsMissingAvatarUrls;
240
+ onRefsMissingMetadata?: OnRefsMissingMetadata;
157
241
  formatCommitDateTime?: OnFormatCommitDateTime;
158
242
  shaLength?: number;
159
243
  nonce?: string;
@@ -173,6 +257,7 @@ declare class GraphContainer extends React.PureComponent<GraphContainerProps, an
173
257
  ): void;
174
258
  forceUpdate(callback?: () => void): void;
175
259
  render(): JSX.Element;
260
+ selectCommits(shas: Sha[], includeToPrevSel: boolean): void;
176
261
  }
177
262
 
178
263
  export default GraphContainer;