@gitkraken/gitkraken-components 1.0.0-rc.9 → 1.1.0-rc.1

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,7 +12,9 @@ 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
@@ -42,22 +44,51 @@ export type GraphPlatform = 'aix'
42
44
  | 'win32'
43
45
  | 'cygwin';
44
46
 
45
- 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,
46
69
  name: string;
47
70
  isCurrentHead?: boolean;
48
- };
71
+ context?: GraphItemContext;
72
+ contextGroup?: GraphItemContext;
73
+ }
49
74
 
50
- export type Remote = {
75
+ export interface Remote {
76
+ id?: string,
51
77
  name: string;
52
78
  owner?: string;
53
79
  avatarUrl?: string;
54
80
  url?: string;
55
- };
81
+ context?: GraphItemContext;
82
+ contextGroup?: GraphItemContext;
83
+ }
56
84
 
57
- export type Tag = {
85
+ export interface Tag {
86
+ id?: string,
58
87
  name: string;
59
88
  annotated?: boolean;
60
- };
89
+ context?: GraphItemContext;
90
+ contextGroup?: GraphItemContext;
91
+ }
61
92
 
62
93
  export type GraphRow = {
63
94
  sha: Sha;
@@ -70,19 +101,22 @@ export type GraphRow = {
70
101
  heads?: Head[];
71
102
  remotes?: Remote[];
72
103
  tags?: Tag[];
73
- avatarUrl?: string;
104
+ contexts?: RowContexts;
74
105
  };
75
106
 
76
107
  export type GraphColumnSetting = {
77
- width: number
108
+ width: number,
109
+ isHidden: boolean
78
110
  };
79
111
 
80
- export const REF_ZONE_TYPE = 'refZone';
81
- export const GRAPH_ZONE_TYPE = 'commitZone';
82
- export const MESSAGE_ZONE_TYPE = 'commitMessageZone';
83
- export const AUTHOR_ZONE_TYPE = 'commitAuthorZone';
84
- export const DATE_TIME_ZONE_TYPE = 'commitDateTimeZone';
85
- 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';
86
120
 
87
121
  export type GraphZoneType = typeof REF_ZONE_TYPE
88
122
  | typeof GRAPH_ZONE_TYPE
@@ -93,23 +127,73 @@ export type GraphZoneType = typeof REF_ZONE_TYPE
93
127
 
94
128
  export type GraphColumnsSettings = { [graphZoneType: string]: GraphColumnSetting };
95
129
 
96
- export type GraphRef = Head
97
- | Remote
98
- | Tag
99
- | {
100
- refType: string
101
- };
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
+ };
102
145
 
103
146
  export type GraphRefGroup = Array<GraphRef>;
104
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
+
105
188
  // Callbacks
106
- export type GetExternalIcon = (key: string) => ReactElement<*>;
189
+ export type GetExternalIcon = (key: string) => React.ReactElement<any>;
107
190
  export type TranslationFn = (key: string, ...formatArgs: any) => string;
108
191
  export type OnFormatCommitDateTime = (commitDateTime: number) => string;
109
192
 
110
193
  // Events
111
194
  export type OnRowContextMenu = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
112
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;
113
197
  export type OnClickGraphRow = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
114
198
  export type OnClickGraphRef = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
115
199
  export type OnDoubleClickGraphRow = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
@@ -120,18 +204,26 @@ export type OnGraphRowUnhovered = (event: any, graphZoneType: GraphZoneType, gra
120
204
  export type OnGraphRefNodeHovered = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
121
205
  export type OnGraphRefNodeUnhovered = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
122
206
  export type OnGraphColumnResized = (graphZoneType: GraphZoneType, columnSettings: GraphColumnSetting) => void;
207
+ export type OnGraphResized = (width: number, height: number) => void;
123
208
  export type OnShowMoreCommits = () => void;
209
+ export type OnEmailsMissingAvatarUrls = (emails: { [email: string]: string }) => void;
210
+ export type OnRefsMissingMetadata = (refs: RefsMissingMetadata) => void;
124
211
 
125
212
  // Main graph component
126
213
  export interface GraphContainerProps {
127
- height?: number;
128
- width?: number;
214
+ avatarUrlByEmail?: AvatarUrlByEmail;
215
+ contexts?: GraphContexts;
129
216
  platform?: GraphPlatform;
130
217
  cssVariables?: CssVariables;
131
218
  getExternalIcon: GetExternalIcon;
219
+ highlightRowsOnRefHover?: boolean,
220
+ showGhostRefsOnRowHover?: boolean,
221
+ showRemoteNamesOnRefs?: boolean,
132
222
  enableMultiSelection?: boolean,
133
223
  graphRows: GraphRow[];
134
224
  hasMoreCommits?: boolean;
225
+ highlightedShas?: HighlightedShas;
226
+ hiddenRefsById?: HiddenRefsById;
135
227
  // isCommitting: boolean;
136
228
  isSelectedBySha?: IsSelectedBySha;
137
229
  // isInUnsupportedRebase: boolean;
@@ -140,12 +232,14 @@ export interface GraphContainerProps {
140
232
  // pendingCommitMessageSummary: string;
141
233
  // repoPath: string;
142
234
  columnsSettings?: GraphColumnsSettings;
235
+ refMetadataById?: RefMetadataById;
143
236
  themeOpacityFactor?: number;
144
237
  translate?: TranslationFn;
145
238
  useAuthorInitialsForAvatars?: boolean;
146
239
  workDirStats?: WorkDirStats;
147
240
  onRowContextMenu?: OnRowContextMenu;
148
241
  onRefContextMenu?: OnRefContextMenu;
242
+ onToggleRefsVisibilityClick?: OnToggleRefsVisibilityClick,
149
243
  onGraphRowHovered?: OnGraphRowHovered;
150
244
  onGraphRowUnhovered?: OnGraphRowUnhovered;
151
245
  onGraphRefNodeHovered?: OnGraphRefNodeHovered;
@@ -161,7 +255,9 @@ export interface GraphContainerProps {
161
255
  onSelectGraphRows?: OnSelectGraphRows;
162
256
  onShowMoreCommits?: OnShowMoreCommits;
163
257
  // onWipNodeInputWillUnmount: OnComponentWillUnmount;
164
- // onUpdateGraphWidth: OnUpdateGraphWidth;
258
+ onGraphResized?: OnGraphResized;
259
+ onEmailsMissingAvatarUrls?: OnEmailsMissingAvatarUrls;
260
+ onRefsMissingMetadata?: OnRefsMissingMetadata;
165
261
  formatCommitDateTime?: OnFormatCommitDateTime;
166
262
  shaLength?: number;
167
263
  nonce?: string;
@@ -181,6 +277,7 @@ declare class GraphContainer extends React.PureComponent<GraphContainerProps, an
181
277
  ): void;
182
278
  forceUpdate(callback?: () => void): void;
183
279
  render(): JSX.Element;
280
+ selectCommits(shas: Sha[], includeToPrevSel: boolean): void;
184
281
  }
185
282
 
186
283
  export default GraphContainer;