@atlaskit/link-datasource 0.15.0 → 0.15.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 0.15.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3d4e152483b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3d4e152483b) - Move all the mocking outside into link-test-helpers and use it.
8
+
3
9
  ## 0.15.0
4
10
 
5
11
  ### Minor Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "sideEffects": false
5
5
  }
@@ -6,14 +6,16 @@ import styled from '@emotion/styled';
6
6
  import { IntlProvider } from 'react-intl-next';
7
7
 
8
8
  import { SmartCardProvider } from '@atlaskit/link-provider';
9
+ import { mockDatasourceFetchRequests } from '@atlaskit/link-test-helpers/datasource';
9
10
 
10
11
  import { useDatasourceTableState } from '../src/hooks/useDatasourceTableState';
11
12
  import { IssueLikeDataTableView } from '../src/ui/issue-like-table';
12
13
  import { JiraIssueDatasourceParameters } from '../src/ui/jira-issues/types';
13
14
 
14
- import { MOCK_DATASOURCE_ID } from './setupDatasourcesMocks';
15
15
  import SmartLinkClient from './smartLinkCustomClient';
16
16
 
17
+ mockDatasourceFetchRequests();
18
+
17
19
  interface Props {
18
20
  isReadonly?: boolean;
19
21
  }
@@ -43,7 +45,7 @@ const ExampleBody = ({ isReadonly }: Props) => {
43
45
  hasNextPage,
44
46
  defaultVisibleColumnKeys,
45
47
  columns,
46
- } = useDatasourceTableState(MOCK_DATASOURCE_ID, parameters);
48
+ } = useDatasourceTableState('some-datasource-id', parameters);
47
49
 
48
50
  const [visibleColumnKeys, setVisibleColumnKeys] = useState<string[]>(
49
51
  defaultVisibleColumnKeys,
@@ -1,9 +1,11 @@
1
1
  import React, { useMemo, useState } from 'react';
2
2
 
3
+ import { mockDatasourceFetchRequests } from '@atlaskit/link-test-helpers/datasource';
4
+
3
5
  import { JiraIssuesTableView } from '../src/ui/jira-issues/tableView';
4
6
  import { JiraIssueDatasourceParameters } from '../src/ui/jira-issues/types';
5
7
 
6
- import { MOCK_DATASOURCE_ID } from './setupDatasourcesMocks';
8
+ mockDatasourceFetchRequests();
7
9
 
8
10
  export const ExampleJiraIssuesTableView = () => {
9
11
  const cloudId = 'some-cloud-id';
@@ -22,7 +24,7 @@ export const ExampleJiraIssuesTableView = () => {
22
24
 
23
25
  return (
24
26
  <JiraIssuesTableView
25
- datasourceId={MOCK_DATASOURCE_ID}
27
+ datasourceId={'some-datasource-id'}
26
28
  parameters={parameters}
27
29
  visibleColumnKeys={visibleColumnKeys}
28
30
  onVisibleColumnKeysChange={setVisibleColumnKeys}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/icon-object": "^6.3.0",
36
36
  "@atlaskit/image": "^1.1.0",
37
37
  "@atlaskit/link-client-extension": "^1.1.0",
38
- "@atlaskit/linking-common": "^2.11.0",
38
+ "@atlaskit/linking-common": "^2.12.0",
39
39
  "@atlaskit/linking-types": "^1.6.0",
40
40
  "@atlaskit/lozenge": "^11.4.0",
41
41
  "@atlaskit/modal-dialog": "^12.5.0",
@@ -66,7 +66,7 @@
66
66
  "@atlaskit/code": "^14.6.0",
67
67
  "@atlaskit/docs": "*",
68
68
  "@atlaskit/link-provider": "^1.6.0",
69
- "@atlaskit/link-test-helpers": "^2.3.0",
69
+ "@atlaskit/link-test-helpers": "^2.4.0",
70
70
  "@atlaskit/ssr": "*",
71
71
  "@atlaskit/visual-regression": "*",
72
72
  "@atlaskit/webdriver-runner": "*",
@@ -1,54 +0,0 @@
1
- // https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jql/#api-rest-api-3-jql-autocompletedata-post
2
- export const mockAutoCompleteData = {
3
- visibleFieldNames: [
4
- {
5
- value: 'status',
6
- displayName: 'status',
7
- operators: ['=', '!=', 'in', 'not in', 'is', 'is not'],
8
- searchable: 'true',
9
- auto: 'true',
10
- orderable: 'true',
11
- types: ['com.atlassian.jira.issue.status.Status'],
12
- },
13
- {
14
- value: 'issuetype',
15
- displayName: 'issuetype',
16
- operators: ['=', '!=', 'in', 'not in', 'is', 'is not'],
17
- searchable: 'true',
18
- auto: 'true',
19
- orderable: 'true',
20
- types: ['com.atlassian.jira.issue.issuetype.IssueType'],
21
- },
22
- {
23
- value: 'cf[10062]',
24
- displayName: 'Component - cf[10062]',
25
- orderable: 'true',
26
- auto: 'true',
27
- cfid: 'cf[10062]',
28
- operators: ['=', '!=', 'in', 'not in', 'is', 'is not'],
29
- types: ['com.atlassian.jira.issue.customfields.option.Option'],
30
- },
31
- {
32
- value: '"Component[Dropdown]"',
33
- displayName: 'Component - Component[Dropdown]',
34
- searchable: 'true',
35
- auto: 'true',
36
- operators: ['=', '!=', 'in', 'not in', 'is', 'is not'],
37
- types: ['com.atlassian.jira.issue.customfields.option.Option'],
38
- },
39
- ],
40
- visibleFunctionNames: [
41
- {
42
- value: 'standardIssueTypes()',
43
- displayName: 'standardIssueTypes()',
44
- isList: 'true',
45
- types: ['com.atlassian.jira.issue.issuetype.IssueType'],
46
- },
47
- {
48
- value: 'currentUser()',
49
- displayName: 'currentUser()',
50
- types: ['com.atlassian.jira.user.ApplicationUser'],
51
- },
52
- ],
53
- jqlReservedWords: ['empty', 'and', 'or', 'in', 'distinct'],
54
- };
@@ -1,27 +0,0 @@
1
- export const mockSiteData = [
2
- {
3
- cloudId: '12345',
4
- url: 'https://test1.atlassian.net',
5
- displayName: 'test1',
6
- },
7
- {
8
- cloudId: '45678',
9
- url: 'https://test2.atlassian.net',
10
- displayName: 'test2',
11
- },
12
- {
13
- cloudId: '67899',
14
- url: 'https://hello.atlassian.net',
15
- displayName: 'hello',
16
- },
17
- {
18
- cloudId: '78911',
19
- url: 'https://test4.atlassian.net',
20
- displayName: 'test4',
21
- },
22
- {
23
- cloudId: '11111',
24
- url: 'https://test5.atlassian.net',
25
- displayName: 'testSingleIssue',
26
- },
27
- ];
@@ -1,575 +0,0 @@
1
- // not sure what BE schema looks like so just using my mock schema for now
2
- export const mockJiraData = {
3
- nextPageCursor: 'c3RhcnRBdD01',
4
- totalIssues: 1357,
5
- data: [
6
- {
7
- type: {
8
- label: 'task',
9
- source:
10
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium',
11
- },
12
- issueNumber: 'DONUT-1172',
13
- summary: 'FIRST! This level contains five Dragon coins',
14
- assignee: {
15
- displayName: 'Scott Farquhar',
16
- source:
17
- 'https://pbs.twimg.com/profile_images/803832195970433027/aaoG6PJI_400x400.jpg',
18
- },
19
- priority: {
20
- label: 'major',
21
- source:
22
- 'https://product-fabric.atlassian.net/images/icons/priorities/major.svg',
23
- },
24
- status: {
25
- text: 'To do',
26
- status: 'new',
27
- },
28
- resolution: 'Unresolved',
29
- created: '23/Jul/20',
30
- updated: '23/Jul/20',
31
- due: '24/Jul/20',
32
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
33
- labels: ['label', 'another', 'third'],
34
- },
35
- {
36
- type: {
37
- label: 'story',
38
- source:
39
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium',
40
- },
41
- issueNumber: 'DONUT-1173',
42
- summary: "Audio in meeting room K909 doesn't work",
43
- assignee: undefined,
44
- priority: {
45
- label: 'high',
46
- source:
47
- 'https://product-fabric.atlassian.net/images/icons/priorities/high.svg',
48
- },
49
- status: {
50
- text: 'In progress',
51
- status: 'inprogress',
52
- },
53
- resolution: 'Unresolved',
54
- created: '23/Jul/20',
55
- updated: '23/Jul/20',
56
- due: '24/Jul/20',
57
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
58
- },
59
- {
60
- type: {
61
- label: 'bug',
62
- source:
63
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10303?size=medium',
64
- },
65
- issueNumber: 'DONUT-1174',
66
- summary: 'In the underground area, under three Rotating spheres',
67
- assignee: undefined,
68
- priority: {
69
- label: 'medium',
70
- source:
71
- 'https://product-fabric.atlassian.net/images/icons/priorities/medium.svg',
72
- },
73
- status: {
74
- text: 'Done',
75
- status: 'success',
76
- },
77
- resolution: 'Done',
78
- created: '23/Jul/20',
79
- updated: '23/Jul/20',
80
- due: '24/Jul/20',
81
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
82
- },
83
- {
84
- type: {
85
- label: 'task',
86
- source:
87
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium',
88
- },
89
- issueNumber: 'DONUT-1175',
90
- summary: 'This level is hard',
91
- assignee: undefined,
92
- priority: {
93
- label: 'low',
94
- source:
95
- 'https://product-fabric.atlassian.net/images/icons/priorities/low.svg',
96
- },
97
- status: {
98
- text: 'Closed',
99
- status: 'removed',
100
- },
101
- resolution: 'Unresolved',
102
- created: '23/Jul/20',
103
- updated: '23/Jul/20',
104
- due: '24/Jul/20',
105
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
106
- },
107
- {
108
- type: {
109
- label: 'story',
110
- source:
111
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium',
112
- },
113
- issueNumber: 'DONUT-1176',
114
- summary:
115
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ultricies accumsan justo, eget pretium quam aliquet semper.',
116
- assignee: {
117
- displayName: 'Scott Farquhar',
118
- source:
119
- 'https://pbs.twimg.com/profile_images/803832195970433027/aaoG6PJI_400x400.jpg',
120
- },
121
- priority: {
122
- label: 'trivial',
123
- source:
124
- 'https://product-fabric.atlassian.net/images/icons/priorities/trivial.svg',
125
- },
126
- status: {
127
- text: 'To do',
128
- status: 'default',
129
- },
130
- resolution: 'Unresolved',
131
- created: '23/Jul/20',
132
- updated: '23/Jul/20',
133
- due: '24/Jul/20',
134
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
135
- },
136
- {
137
- type: {
138
- label: 'story',
139
- source:
140
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium',
141
- },
142
- issueNumber: 'DONUT-1176',
143
- summary:
144
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ultricies accumsan justo, eget pretium quam aliquet semper.',
145
- assignee: {
146
- displayName: 'Scott Farquhar',
147
- source:
148
- 'https://pbs.twimg.com/profile_images/803832195970433027/aaoG6PJI_400x400.jpg',
149
- },
150
- priority: {
151
- label: 'trivial',
152
- source:
153
- 'https://product-fabric.atlassian.net/images/icons/priorities/trivial.svg',
154
- },
155
- status: {
156
- text: 'To do',
157
- status: 'default',
158
- },
159
- resolution: 'Unresolved',
160
- created: '23/Jul/20',
161
- updated: '23/Jul/20',
162
- due: '24/Jul/20',
163
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
164
- },
165
- {
166
- type: {
167
- label: 'epic',
168
- source:
169
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10307?size=medium',
170
- },
171
- issueNumber: 'DONUT-1177',
172
- summary: 'This level is hard',
173
- assignee: undefined,
174
- priority: {
175
- label: 'blocker',
176
- source:
177
- 'https://product-fabric.atlassian.net/images/icons/priorities/blocker.svg',
178
- },
179
- status: {
180
- text: 'To do',
181
- status: 'default',
182
- },
183
- resolution: 'Unresolved',
184
- created: '23/Jul/20',
185
- updated: '23/Jul/20',
186
- due: '24/Jul/20',
187
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
188
- },
189
- {
190
- type: {
191
- label: 'task',
192
- source:
193
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium',
194
- },
195
- issueNumber: 'DONUT-1178',
196
- summary: 'This level is hard',
197
- assignee: undefined,
198
- priority: {
199
- label: 'high',
200
- source:
201
- 'https://product-fabric.atlassian.net/images/icons/priorities/high.svg',
202
- },
203
- status: {
204
- text: 'To do',
205
- status: 'default',
206
- },
207
- resolution: 'Unresolved',
208
- created: '23/Jul/20',
209
- updated: '23/Jul/20',
210
- due: '24/Jul/20',
211
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
212
- },
213
- {
214
- type: {
215
- label: 'epic',
216
- source:
217
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10307?size=medium',
218
- },
219
- issueNumber: 'DONUT-1179',
220
- summary: 'This level is hard',
221
- assignee: {
222
- displayName: 'Scott Farquhar',
223
- source:
224
- 'https://pbs.twimg.com/profile_images/803832195970433027/aaoG6PJI_400x400.jpg',
225
- },
226
- priority: {
227
- label: 'high',
228
- source:
229
- 'https://product-fabric.atlassian.net/images/icons/priorities/high.svg',
230
- },
231
- status: {
232
- text: 'To do',
233
- status: 'default',
234
- },
235
- resolution: 'Unresolved',
236
- created: '23/Jul/20',
237
- updated: '23/Jul/20',
238
- due: '24/Jul/20',
239
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
240
- },
241
- {
242
- type: {
243
- label: 'story',
244
- source:
245
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium',
246
- },
247
- issueNumber: 'DONUT-1180',
248
- summary: 'This level is hard',
249
- assignee: undefined,
250
- priority: {
251
- label: 'high',
252
- source:
253
- 'https://product-fabric.atlassian.net/images/icons/priorities/high.svg',
254
- },
255
- status: {
256
- text: 'To do',
257
- status: 'default',
258
- },
259
- resolution: 'Unresolved',
260
- created: '23/Jul/20',
261
- updated: '23/Jul/20',
262
- due: '24/Jul/20',
263
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
264
- },
265
- {
266
- type: {
267
- label: 'task',
268
- source:
269
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium',
270
- },
271
- issueNumber: 'DONUT-1181',
272
- summary: 'This level is hard',
273
- assignee: undefined,
274
- priority: {
275
- label: 'high',
276
- source:
277
- 'https://product-fabric.atlassian.net/images/icons/priorities/high.svg',
278
- },
279
- status: {
280
- text: 'To do',
281
- status: 'default',
282
- },
283
- resolution: 'Unresolved',
284
- created: '23/Jul/20',
285
- updated: '23/Jul/20',
286
- due: '24/Jul/20',
287
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
288
- },
289
- {
290
- type: {
291
- label: 'task',
292
- source:
293
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium',
294
- },
295
- issueNumber: 'DONUT-1182',
296
- summary: 'This level is hard',
297
- assignee: {
298
- displayName: 'Scott Farquhar',
299
- source:
300
- 'https://pbs.twimg.com/profile_images/803832195970433027/aaoG6PJI_400x400.jpg',
301
- },
302
- priority: {
303
- label: 'high',
304
- source:
305
- 'https://product-fabric.atlassian.net/images/icons/priorities/high.svg',
306
- },
307
- status: {
308
- text: 'Closed',
309
- status: 'removed',
310
- },
311
- resolution: 'Unresolved',
312
- created: '23/Jul/20',
313
- updated: '23/Jul/20',
314
- due: '24/Jul/20',
315
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
316
- },
317
- {
318
- type: {
319
- label: 'task',
320
- source:
321
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium',
322
- },
323
- issueNumber: 'DONUT-1183',
324
- summary: 'This level contains five Dragon coins',
325
- assignee: {
326
- displayName: 'Scott Farquhar',
327
- source:
328
- 'https://pbs.twimg.com/profile_images/803832195970433027/aaoG6PJI_400x400.jpg',
329
- },
330
- priority: {
331
- label: 'major',
332
- source:
333
- 'https://product-fabric.atlassian.net/images/icons/priorities/major.svg',
334
- },
335
- status: {
336
- text: 'To do',
337
- status: 'new',
338
- },
339
- resolution: 'Unresolved',
340
- created: '23/Jul/20',
341
- updated: '23/Jul/20',
342
- due: '24/Jul/20',
343
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
344
- },
345
- {
346
- type: {
347
- label: 'story',
348
- source:
349
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium',
350
- },
351
- issueNumber: 'DONUT-1184',
352
- summary: "Audio in meeting room K909 doesn't work",
353
- assignee: undefined,
354
- priority: {
355
- label: 'high',
356
- source:
357
- 'https://product-fabric.atlassian.net/images/icons/priorities/high.svg',
358
- },
359
- status: {
360
- text: 'In progress',
361
- status: 'inprogress',
362
- },
363
- resolution: 'Unresolved',
364
- created: '23/Jul/20',
365
- updated: '23/Jul/20',
366
- due: '24/Jul/20',
367
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
368
- },
369
- {
370
- type: {
371
- label: 'task',
372
- source:
373
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium',
374
- },
375
- issueNumber: 'DONUT-1185',
376
- summary: 'This level is hard',
377
- assignee: undefined,
378
- priority: {
379
- label: 'low',
380
- source:
381
- 'https://product-fabric.atlassian.net/images/icons/priorities/low.svg',
382
- },
383
- status: {
384
- text: 'Closed',
385
- status: 'removed',
386
- },
387
- resolution: 'Unresolved',
388
- created: '23/Jul/20',
389
- updated: '23/Jul/20',
390
- due: '24/Jul/20',
391
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
392
- },
393
- {
394
- type: {
395
- label: 'story',
396
- source:
397
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium',
398
- },
399
- issueNumber: 'DONUT-1186',
400
- summary:
401
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ultricies accumsan justo, eget pretium quam aliquet semper.',
402
- assignee: {
403
- displayName: 'Scott Farquhar',
404
- source:
405
- 'https://pbs.twimg.com/profile_images/803832195970433027/aaoG6PJI_400x400.jpg',
406
- },
407
- priority: {
408
- label: 'trivial',
409
- source:
410
- 'https://product-fabric.atlassian.net/images/icons/priorities/trivial.svg',
411
- },
412
- status: {
413
- text: 'To do',
414
- status: 'new',
415
- },
416
- resolution: 'Unresolved',
417
- created: '23/Jul/20',
418
- updated: '23/Jul/20',
419
- due: '24/Jul/20',
420
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
421
- },
422
- {
423
- type: {
424
- label: 'task',
425
- source:
426
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium',
427
- },
428
- issueNumber: 'DONUT-1187',
429
- summary: 'This level is hard',
430
- assignee: undefined,
431
- priority: {
432
- label: 'blocker',
433
- source:
434
- 'https://product-fabric.atlassian.net/images/icons/priorities/blocker.svg',
435
- },
436
- status: {
437
- text: 'To do',
438
- status: 'new',
439
- },
440
- resolution: 'Unresolved',
441
- created: '23/Jul/20',
442
- updated: '23/Jul/20',
443
- due: '24/Jul/20',
444
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
445
- },
446
- {
447
- type: {
448
- label: 'task',
449
- source:
450
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium',
451
- },
452
- issueNumber: 'DONUT-1188',
453
- summary: 'This level is hard',
454
- assignee: undefined,
455
- priority: {
456
- label: 'high',
457
- source:
458
- 'https://product-fabric.atlassian.net/images/icons/priorities/high.svg',
459
- },
460
- status: {
461
- text: 'To do',
462
- status: 'new',
463
- },
464
- resolution: 'Unresolved',
465
- created: '23/Jul/20',
466
- updated: '23/Jul/20',
467
- due: '24/Jul/20',
468
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
469
- },
470
- {
471
- type: {
472
- label: 'task',
473
- source:
474
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium',
475
- },
476
- issueNumber: 'DONUT-1189',
477
- summary: 'This level is hard',
478
- assignee: {
479
- displayName: 'Scott Farquhar',
480
- source:
481
- 'https://pbs.twimg.com/profile_images/803832195970433027/aaoG6PJI_400x400.jpg',
482
- },
483
- priority: {
484
- label: 'high',
485
- source:
486
- 'https://product-fabric.atlassian.net/images/icons/priorities/high.svg',
487
- },
488
- status: {
489
- text: 'To do',
490
- status: 'new',
491
- },
492
- resolution: 'Unresolved',
493
- created: '23/Jul/20',
494
- updated: '23/Jul/20',
495
- due: '24/Jul/20',
496
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
497
- },
498
- {
499
- type: {
500
- label: 'story',
501
- source:
502
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium',
503
- },
504
- issueNumber: 'DONUT-1190',
505
- summary: 'This level is hard',
506
- assignee: undefined,
507
- priority: {
508
- label: 'high',
509
- source:
510
- 'https://product-fabric.atlassian.net/images/icons/priorities/high.svg',
511
- },
512
- status: {
513
- text: 'To do',
514
- status: 'new',
515
- },
516
- resolution: 'Unresolved',
517
- created: '23/Jul/20',
518
- updated: '23/Jul/20',
519
- due: '24/Jul/20',
520
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
521
- },
522
- {
523
- type: {
524
- label: 'epic',
525
- source:
526
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10307?size=medium',
527
- },
528
- issueNumber: 'DONUT-1191',
529
- summary: 'This level is hard',
530
- assignee: undefined,
531
- priority: {
532
- label: 'high',
533
- source:
534
- 'https://product-fabric.atlassian.net/images/icons/priorities/high.svg',
535
- },
536
- status: {
537
- text: 'To do',
538
- status: 'new',
539
- },
540
- resolution: 'Unresolved',
541
- created: '23/Jul/20',
542
- updated: '23/Jul/20',
543
- due: '24/Jul/20',
544
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
545
- },
546
- {
547
- type: {
548
- label: 'task',
549
- source:
550
- 'https://product-fabric.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium',
551
- },
552
- issueNumber: 'DONUT-1192',
553
- summary: 'This level is hard',
554
- assignee: {
555
- displayName: 'Scott Farquhar',
556
- source:
557
- 'https://pbs.twimg.com/profile_images/803832195970433027/aaoG6PJI_400x400.jpg',
558
- },
559
- priority: {
560
- label: 'high',
561
- source:
562
- 'https://product-fabric.atlassian.net/images/icons/priorities/high.svg',
563
- },
564
- status: {
565
- text: 'Closed',
566
- status: 'removed',
567
- },
568
- resolution: 'Unresolved',
569
- created: '23/Jul/20',
570
- updated: '23/Jul/20',
571
- due: '24/Jul/20',
572
- link: 'https://product-fabric.atlassian.net/browse/EDM-5591',
573
- },
574
- ],
575
- };
@@ -1,17 +0,0 @@
1
- // https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jql/#api-rest-api-3-jql-autocompletedata-suggestions-get
2
- export const mockSuggestionData = {
3
- results: [
4
- {
5
- value: '"0. On Hold"',
6
- displayName: '0. On Hold',
7
- },
8
- {
9
- value: '"0. Parking Lot"',
10
- displayName: '0. Parking Lot',
11
- },
12
- {
13
- value: '"0 - Paused"',
14
- displayName: '0 - Paused',
15
- },
16
- ],
17
- };
@@ -1,199 +0,0 @@
1
- import fetchMock from 'fetch-mock/cjs/client';
2
-
3
- import {
4
- DatasourceDataResponseItem,
5
- DatasourceResponseSchemaProperty,
6
- IconType,
7
- LinkType,
8
- StatusType,
9
- StringType,
10
- TagType,
11
- UserType,
12
- } from '@atlaskit/linking-types';
13
-
14
- import { mockJiraData } from './mockJiraData';
15
-
16
- const columns: DatasourceResponseSchemaProperty[] = [
17
- {
18
- key: 'id',
19
- title: '',
20
- type: 'string',
21
- isIdentity: true,
22
- },
23
- {
24
- key: 'key',
25
- title: 'Key',
26
- type: 'link',
27
- },
28
- {
29
- key: 'type',
30
- type: 'icon',
31
- title: 'Type',
32
- },
33
- {
34
- key: 'summary',
35
- title: 'Summary',
36
- type: 'link',
37
- },
38
- {
39
- key: 'assignee',
40
- title: 'Assignee',
41
- type: 'user',
42
- },
43
- {
44
- key: 'priority',
45
- title: 'P',
46
- type: 'icon',
47
- },
48
- {
49
- key: 'labels',
50
- title: 'Labels',
51
- type: 'tag',
52
- isList: true,
53
- },
54
- {
55
- key: 'status',
56
- title: 'Status for the each issue',
57
- type: 'status',
58
- },
59
- {
60
- key: 'created',
61
- title: 'Date of Creation for each issue',
62
- type: 'string',
63
- },
64
- {
65
- key: 'due',
66
- title: 'Due Date',
67
- type: 'string',
68
- },
69
- ...new Array<DatasourceResponseSchemaProperty>(100)
70
- .fill({
71
- key: 'due',
72
- title: 'Due Date',
73
- type: 'string',
74
- })
75
- .map((prop, i) => ({ ...prop, key: prop.key + i, title: prop.title + i })),
76
- ];
77
-
78
- const initialVisibleColumnKeys: string[] = [
79
- // Order of actual columns is in different order is on purpose
80
- // To demonstrate that this list is a king
81
- 'type',
82
- 'key',
83
- 'summary',
84
- 'assignee',
85
- 'priority',
86
- 'labels',
87
- 'status',
88
- 'created',
89
- ];
90
-
91
- export const MOCK_DATASOURCE_ID = 'some-datasource-id';
92
-
93
- interface FetchMockRequestDetails {
94
- body: string;
95
- credentials: string;
96
- headers: object;
97
- method: string;
98
- }
99
-
100
- export const setupDatasourcesMocks = (
101
- datasourceId: string = MOCK_DATASOURCE_ID,
102
- ) => {
103
- fetchMock.post(
104
- `/gateway/api/object-resolver/datasource/${datasourceId}/fetch/details`,
105
- async () =>
106
- new Promise(resolve => {
107
- setTimeout(() => {
108
- resolve({
109
- ari: 'ari:cloud:linking-platform:datasource/12e74246-a3f1-46c1-9fd9-8d952aa9f12f',
110
- id: '12e74246-a3f1-46c1-9fd9-8d952aa9f12f',
111
- name: 'JQL Datasource',
112
- description: 'Fetches Issues using JQL',
113
- parameters: [
114
- {
115
- key: 'cloudId',
116
- type: 'string',
117
- description: 'Cloud Id',
118
- },
119
- {
120
- key: 'jql',
121
- type: 'string',
122
- description: 'JQL query to retrieve list of issues',
123
- },
124
- ],
125
- schema: {
126
- properties: columns,
127
- defaultProperties: initialVisibleColumnKeys,
128
- },
129
- });
130
- }, 300);
131
- }),
132
- );
133
-
134
- let numberOfLoads = 0;
135
- const getItems = (cloudId: string = '', maxItems = 99) => ({
136
- data: mockJiraData.data
137
- .slice(0, maxItems)
138
- .map((item): DatasourceDataResponseItem => {
139
- return {
140
- // Fake identifier attribute that needs to be flat primitive value.
141
- // Adding number of pages to make all issueNumbers unique
142
- id: (item.issueNumber + numberOfLoads) as StringType['value'],
143
- type: {
144
- source: item.type.source,
145
- label: item.type.label,
146
- } as IconType['value'],
147
- key: {
148
- url: item.link,
149
- text: item.issueNumber + numberOfLoads,
150
- linkType: 'key',
151
- } as LinkType['value'],
152
- summary: {
153
- url: item.link,
154
- text: `[${cloudId}] ${item.summary}`,
155
- } as LinkType['value'],
156
- assignee: {
157
- displayName: item.assignee?.displayName,
158
- avatarSource: item.assignee?.source,
159
- } as UserType['value'],
160
- priority: {
161
- source: item.priority.source,
162
- label: item.priority.label,
163
- } as IconType['value'],
164
- status: {
165
- text: item.status.text,
166
- status: item.status.status,
167
- } as StatusType['value'],
168
- created: item.created as StringType['value'],
169
- due: item.due as StringType['value'],
170
- labels: item.labels as TagType['value'][],
171
- };
172
- }),
173
- totalIssues: mockJiraData.totalIssues,
174
- nextPageCursor:
175
- numberOfLoads < 4 && maxItems > 1 ? 'c3RhcnRBdD01' : undefined,
176
- });
177
-
178
- fetchMock.post(
179
- `/gateway/api/object-resolver/datasource/${datasourceId}/fetch/data`,
180
- async (url: string, details: FetchMockRequestDetails) => {
181
- const requestBody = JSON.parse(details.body);
182
- const {
183
- parameters: { cloudId },
184
- } = requestBody;
185
- return new Promise(resolve => {
186
- setTimeout(() => {
187
- // special case to return only one item to show smart-card rendering path
188
- if (cloudId === '11111') {
189
- resolve(getItems(cloudId, 1));
190
- return;
191
- }
192
- resolve(getItems(cloudId));
193
- }, numberOfLoads++ * 1000);
194
- });
195
- },
196
- );
197
- };
198
-
199
- setupDatasourcesMocks();
@@ -1,32 +0,0 @@
1
- import fetchMock from 'fetch-mock/cjs/client';
2
-
3
- import { mockAutoCompleteData } from './mockAutocompleteData';
4
- import { mockSiteData } from './mockJiraAvailableSites';
5
- import { mockSuggestionData } from './mockSuggestionData';
6
-
7
- export const setupModalExampleMocks = () => {
8
- fetchMock.mock('/gateway/api/available-sites', async () =>
9
- Promise.resolve({ sites: mockSiteData }),
10
- );
11
-
12
- // /gateway/api/ex/jira/:cloudId//rest/api/latest/jql/autocompletedata
13
- fetchMock.mock(
14
- /\/gateway\/api\/ex\/jira\/.+\/\/rest\/api\/latest\/jql\/autocompletedata/g,
15
- async () =>
16
- new Promise(resolve => {
17
- setTimeout(() => resolve(mockAutoCompleteData), 150);
18
- }),
19
- );
20
-
21
- // /gateway/api/ex/jira/:cloudId//rest/api/latest/jql/autocompletedata/suggestions?fieldName=:fieldName&fieldValue=:fieldValue
22
- fetchMock.mock(
23
- /\/gateway\/api\/ex\/jira\/.+\/\/rest\/api\/latest\/jql\/autocompletedata\/suggestions\?.+/g,
24
- async () =>
25
- new Promise(resolve => {
26
- setTimeout(() => resolve(mockSuggestionData), 150);
27
- }),
28
- );
29
- };
30
-
31
- // Calling it on module level once for any number of imports
32
- setupModalExampleMocks();