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

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;
@@ -121,17 +205,26 @@ export type OnGraphRefNodeHovered = (event: any, refGroup: GraphRefGroup, graphR
121
205
  export type OnGraphRefNodeUnhovered = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
122
206
  export type OnGraphColumnResized = (graphZoneType: GraphZoneType, columnSettings: GraphColumnSetting) => void;
123
207
  export type OnShowMoreCommits = () => void;
208
+ export type OnEmailsMissingAvatarUrls = (emails: { [email: string]: string }) => void;
209
+ export type OnRefsMissingMetadata = (refs: RefsMissingMetadata) => void;
124
210
 
125
211
  // Main graph component
126
212
  export interface GraphContainerProps {
213
+ avatarUrlByEmail?: AvatarUrlByEmail;
214
+ contexts?: GraphContexts;
127
215
  height?: number;
128
216
  width?: number;
129
217
  platform?: GraphPlatform;
130
218
  cssVariables?: CssVariables;
131
219
  getExternalIcon: GetExternalIcon;
220
+ highlightRowsOnRefHover?: boolean,
221
+ showGhostRefsOnRowHover?: boolean,
222
+ showRemoteNamesOnRefs?: boolean,
132
223
  enableMultiSelection?: boolean,
133
224
  graphRows: GraphRow[];
134
225
  hasMoreCommits?: boolean;
226
+ highlightedShas?: HighlightedShas;
227
+ hiddenRefsById?: HiddenRefsById;
135
228
  // isCommitting: boolean;
136
229
  isSelectedBySha?: IsSelectedBySha;
137
230
  // isInUnsupportedRebase: boolean;
@@ -140,12 +233,14 @@ export interface GraphContainerProps {
140
233
  // pendingCommitMessageSummary: string;
141
234
  // repoPath: string;
142
235
  columnsSettings?: GraphColumnsSettings;
236
+ refMetadataById?: RefMetadataById;
143
237
  themeOpacityFactor?: number;
144
238
  translate?: TranslationFn;
145
239
  useAuthorInitialsForAvatars?: boolean;
146
240
  workDirStats?: WorkDirStats;
147
241
  onRowContextMenu?: OnRowContextMenu;
148
242
  onRefContextMenu?: OnRefContextMenu;
243
+ onToggleRefsVisibilityClick?: OnToggleRefsVisibilityClick,
149
244
  onGraphRowHovered?: OnGraphRowHovered;
150
245
  onGraphRowUnhovered?: OnGraphRowUnhovered;
151
246
  onGraphRefNodeHovered?: OnGraphRefNodeHovered;
@@ -162,6 +257,8 @@ export interface GraphContainerProps {
162
257
  onShowMoreCommits?: OnShowMoreCommits;
163
258
  // onWipNodeInputWillUnmount: OnComponentWillUnmount;
164
259
  // onUpdateGraphWidth: OnUpdateGraphWidth;
260
+ onEmailsMissingAvatarUrls?: OnEmailsMissingAvatarUrls;
261
+ onRefsMissingMetadata?: OnRefsMissingMetadata;
165
262
  formatCommitDateTime?: OnFormatCommitDateTime;
166
263
  shaLength?: number;
167
264
  nonce?: string;
@@ -181,6 +278,7 @@ declare class GraphContainer extends React.PureComponent<GraphContainerProps, an
181
278
  ): void;
182
279
  forceUpdate(callback?: () => void): void;
183
280
  render(): JSX.Element;
281
+ selectCommits(shas: Sha[], includeToPrevSel: boolean): void;
184
282
  }
185
283
 
186
284
  export default GraphContainer;