@gitkraken/gitkraken-components 1.0.0-rc.3 → 1.0.0-rc.31

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.
@@ -12,12 +12,22 @@ import {
12
12
  // Input variables
13
13
  export type Sha = string;
14
14
  export type CssVariables = {[variable: string]: string};
15
+ export type HiddenRefsById = {[refId: string]: GraphRefOptData};
15
16
  export type IsSelectedBySha = {[sha: Sha]: boolean};
17
+ export type HighlightedShas = {[sha: Sha]: boolean};
16
18
 
17
19
  export type WorkDirType = typeof mergeConflictNodeType
18
20
  | typeof unsupportedRebaseWarningNodeType
19
21
  | typeof workDirType;
20
22
 
23
+ export type WorkDirStats = {
24
+ added: number,
25
+ deleted: number,
26
+ modified: number
27
+ // TODO: Add renamed once available in GitLens from provider
28
+ // renamed: number
29
+ };
30
+
21
31
  export type CommitType = typeof commitNodeType
22
32
  | typeof mergeNodeType
23
33
  | typeof mergeConflictNodeType
@@ -34,21 +44,51 @@ export type GraphPlatform = 'aix'
34
44
  | 'win32'
35
45
  | 'cygwin';
36
46
 
37
- export type Head = {
47
+ export type GraphItemContext = string | object;
48
+ export type RefGroupContexts = { [name: string]: GraphItemContext };
49
+
50
+ export type RowContexts = {
51
+ row?: GraphItemContext;
52
+ ref?: GraphItemContext;
53
+ refGroups?: RefGroupContexts;
54
+ graph?: GraphItemContext;
55
+ avatar?: GraphItemContext;
56
+ message?: GraphItemContext;
57
+ author?: GraphItemContext;
58
+ date?: GraphItemContext;
59
+ sha?: GraphItemContext;
60
+ };
61
+
62
+ export type GraphContexts = {
63
+ graph?: GraphItemContext;
64
+ header?: GraphItemContext;
65
+ };
66
+
67
+ export interface Head {
68
+ id?: string,
38
69
  name: string;
39
70
  isCurrentHead?: boolean;
40
- };
71
+ context?: GraphItemContext;
72
+ contextGroup?: GraphItemContext;
73
+ }
41
74
 
42
- export type Remote = {
75
+ export interface Remote {
76
+ id?: string,
43
77
  name: string;
78
+ owner?: string;
44
79
  avatarUrl?: string;
45
80
  url?: string;
46
- };
81
+ context?: GraphItemContext;
82
+ contextGroup?: GraphItemContext;
83
+ }
47
84
 
48
- export type Tag = {
85
+ export interface Tag {
86
+ id?: string,
49
87
  name: string;
50
88
  annotated?: boolean;
51
- };
89
+ context?: GraphItemContext;
90
+ contextGroup?: GraphItemContext;
91
+ }
52
92
 
53
93
  export type GraphRow = {
54
94
  sha: Sha;
@@ -61,20 +101,22 @@ export type GraphRow = {
61
101
  heads?: Head[];
62
102
  remotes?: Remote[];
63
103
  tags?: Tag[];
64
- avatarUrl?: string;
104
+ contexts?: RowContexts;
65
105
  };
66
106
 
67
107
  export type GraphColumnSetting = {
68
108
  width: number,
69
- preferredWidth?: number
109
+ isHidden: boolean
70
110
  };
71
111
 
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';
112
+ export type AvatarUrlByEmail = { [email: string]: string };
113
+
114
+ export const REF_ZONE_TYPE = 'ref';
115
+ export const GRAPH_ZONE_TYPE = 'graph';
116
+ export const MESSAGE_ZONE_TYPE = 'message';
117
+ export const AUTHOR_ZONE_TYPE = 'author';
118
+ export const DATE_TIME_ZONE_TYPE = 'datetime';
119
+ export const SHA_ZONE_TYPE = 'sha';
78
120
 
79
121
  export type GraphZoneType = typeof REF_ZONE_TYPE
80
122
  | typeof GRAPH_ZONE_TYPE
@@ -85,23 +127,73 @@ export type GraphZoneType = typeof REF_ZONE_TYPE
85
127
 
86
128
  export type GraphColumnsSettings = { [graphZoneType: string]: GraphColumnSetting };
87
129
 
88
- export type GraphRef = Head
89
- | Remote
90
- | Tag
91
- | {
92
- refType: string
93
- };
130
+ export type GraphRefType = 'head'
131
+ | 'remote'
132
+ | 'tag';
133
+
134
+ export interface GraphRef extends Head, Remote, Tag {
135
+ refType: GraphRefType;
136
+ }
137
+
138
+ export type GraphRefOptData = {
139
+ id: string;
140
+ name: string;
141
+ type: GraphRefType;
142
+ owner?: string;
143
+ avatarUrl?: string;
144
+ };
94
145
 
95
146
  export type GraphRefGroup = Array<GraphRef>;
96
147
 
148
+ export type RefMetadataById = { [id: string]: RefMetadata | null | undefined } | null;
149
+ export type RefMetadata = {
150
+ pullRequests?: PullRequestMetadata[] | null;
151
+ };
152
+
153
+ export type PullRequestMetadata = {
154
+ hostingServiceType: HostingServiceType;
155
+ id: number;
156
+ title: string;
157
+ author?: string;
158
+ date?: number;
159
+ state?: string;
160
+ url?: string;
161
+ context?: GraphItemContext;
162
+ };
163
+
164
+ // Hosting service types for pull request metadata
165
+ export const gitHubDotComHostingServiceType = 'github';
166
+ export const githubEnterpriseHostingServiceType = 'githubEnterprise';
167
+ export const gitLabHostingServiceType = 'gitlab';
168
+ export const gitLabSelfHostingServiceType = 'gitlabSelfHosted';
169
+ export const azureDevopsHostingServiceType = 'azureDevops';
170
+ export const bitBucketHostingServiceType = 'bitbucket';
171
+ export const bitBucketServerHostingServiceType = 'bitbucketServer';
172
+ export type HostingServiceType =
173
+ typeof gitHubDotComHostingServiceType |
174
+ typeof githubEnterpriseHostingServiceType |
175
+ typeof bitBucketHostingServiceType |
176
+ typeof bitBucketServerHostingServiceType |
177
+ typeof gitLabHostingServiceType |
178
+ typeof gitLabSelfHostingServiceType |
179
+ typeof azureDevopsHostingServiceType;
180
+
181
+ export type RefsMissingMetadata = {
182
+ [refId: string]: RefMetadataType[]
183
+ }
184
+ export const pullRequestMetadataType = 'pullRequests';
185
+ // Expand this as we add more types to RefMetadata
186
+ export type RefMetadataType = typeof pullRequestMetadataType;
187
+
97
188
  // Callbacks
98
- export type GetExternalIcon = (key: string) => ReactElement<*>;
189
+ export type GetExternalIcon = (key: string) => React.ReactElement<any>;
99
190
  export type TranslationFn = (key: string, ...formatArgs: any) => string;
100
191
  export type OnFormatCommitDateTime = (commitDateTime: number) => string;
101
192
 
102
193
  // Events
103
194
  export type OnRowContextMenu = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
104
195
  export type OnRefContextMenu = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
196
+ export type OnToggleRefsVisibilityClick = (event: React.MouseEvent, refs: GraphRefOptData[], visible: boolean, graphRow?: GraphRow) => void;
105
197
  export type OnClickGraphRow = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
106
198
  export type OnClickGraphRef = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
107
199
  export type OnDoubleClickGraphRow = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
@@ -113,17 +205,26 @@ export type OnGraphRefNodeHovered = (event: any, refGroup: GraphRefGroup, graphR
113
205
  export type OnGraphRefNodeUnhovered = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
114
206
  export type OnGraphColumnResized = (graphZoneType: GraphZoneType, columnSettings: GraphColumnSetting) => void;
115
207
  export type OnShowMoreCommits = () => void;
208
+ export type OnEmailsMissingAvatarUrls = (emails: { [email: string]: string }) => void;
209
+ export type OnRefsMissingMetadata = (refs: RefsMissingMetadata) => void;
116
210
 
117
211
  // Main graph component
118
212
  export interface GraphContainerProps {
213
+ avatarUrlByEmail?: AvatarUrlByEmail;
214
+ contexts?: GraphContexts;
119
215
  height?: number;
120
216
  width?: number;
121
217
  platform?: GraphPlatform;
122
218
  cssVariables?: CssVariables;
123
219
  getExternalIcon: GetExternalIcon;
220
+ highlightRowsOnRefHover?: boolean,
221
+ showGhostRefsOnRowHover?: boolean,
222
+ showRemoteNamesOnRefs?: boolean,
124
223
  enableMultiSelection?: boolean,
125
224
  graphRows: GraphRow[];
126
225
  hasMoreCommits?: boolean;
226
+ highlightedShas?: HighlightedShas;
227
+ hiddenRefsById?: HiddenRefsById;
127
228
  // isCommitting: boolean;
128
229
  isSelectedBySha?: IsSelectedBySha;
129
230
  // isInUnsupportedRebase: boolean;
@@ -132,12 +233,14 @@ export interface GraphContainerProps {
132
233
  // pendingCommitMessageSummary: string;
133
234
  // repoPath: string;
134
235
  columnsSettings?: GraphColumnsSettings;
236
+ refMetadataById?: RefMetadataById;
135
237
  themeOpacityFactor?: number;
136
238
  translate?: TranslationFn;
137
239
  useAuthorInitialsForAvatars?: boolean;
138
- // workDirStats: WorkDirStats;
240
+ workDirStats?: WorkDirStats;
139
241
  onRowContextMenu?: OnRowContextMenu;
140
242
  onRefContextMenu?: OnRefContextMenu;
243
+ onToggleRefsVisibilityClick?: OnToggleRefsVisibilityClick,
141
244
  onGraphRowHovered?: OnGraphRowHovered;
142
245
  onGraphRowUnhovered?: OnGraphRowUnhovered;
143
246
  onGraphRefNodeHovered?: OnGraphRefNodeHovered;
@@ -154,6 +257,8 @@ export interface GraphContainerProps {
154
257
  onShowMoreCommits?: OnShowMoreCommits;
155
258
  // onWipNodeInputWillUnmount: OnComponentWillUnmount;
156
259
  // onUpdateGraphWidth: OnUpdateGraphWidth;
260
+ onEmailsMissingAvatarUrls?: OnEmailsMissingAvatarUrls;
261
+ onRefsMissingMetadata?: OnRefsMissingMetadata;
157
262
  formatCommitDateTime?: OnFormatCommitDateTime;
158
263
  shaLength?: number;
159
264
  nonce?: string;
@@ -173,6 +278,7 @@ declare class GraphContainer extends React.PureComponent<GraphContainerProps, an
173
278
  ): void;
174
279
  forceUpdate(callback?: () => void): void;
175
280
  render(): JSX.Element;
281
+ selectCommits(shas: Sha[], includeToPrevSel: boolean): void;
176
282
  }
177
283
 
178
284
  export default GraphContainer;