@atlaskit/link-datasource 1.7.6 → 1.9.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics/constants.js +1 -1
  3. package/dist/cjs/common/zindex.js +8 -0
  4. package/dist/cjs/hooks/useDatasourceTableState.js +0 -1
  5. package/dist/cjs/ui/assets-modal/modal/index.js +1 -1
  6. package/dist/cjs/ui/common/error-state/access-required.js +42 -8
  7. package/dist/cjs/ui/common/error-state/messages.js +4 -4
  8. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +6 -4
  9. package/dist/cjs/ui/issue-like-table/empty-state/index.js +71 -86
  10. package/dist/cjs/ui/issue-like-table/empty-state/type.js +1 -1
  11. package/dist/cjs/ui/issue-like-table/index.js +37 -11
  12. package/dist/cjs/ui/issue-like-table/styled.js +4 -4
  13. package/dist/cjs/ui/jira-issues-modal/modal/index.js +25 -27
  14. package/dist/cjs/ui/jira-issues-modal/modal/messages.js +2 -2
  15. package/dist/cjs/ui/jira-issues-modal/site-selector/index.js +59 -37
  16. package/dist/cjs/ui/jira-issues-modal/site-selector/messages.js +4 -9
  17. package/dist/es2019/analytics/constants.js +1 -1
  18. package/dist/es2019/common/zindex.js +2 -0
  19. package/dist/es2019/hooks/useDatasourceTableState.js +0 -1
  20. package/dist/es2019/ui/assets-modal/modal/index.js +1 -1
  21. package/dist/es2019/ui/common/error-state/access-required.js +41 -6
  22. package/dist/es2019/ui/common/error-state/messages.js +4 -4
  23. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +6 -4
  24. package/dist/es2019/ui/issue-like-table/empty-state/index.js +61 -75
  25. package/dist/es2019/ui/issue-like-table/empty-state/type.js +1 -1
  26. package/dist/es2019/ui/issue-like-table/index.js +45 -14
  27. package/dist/es2019/ui/issue-like-table/styled.js +1 -5
  28. package/dist/es2019/ui/jira-issues-modal/modal/index.js +26 -28
  29. package/dist/es2019/ui/jira-issues-modal/modal/messages.js +2 -2
  30. package/dist/es2019/ui/jira-issues-modal/site-selector/index.js +50 -32
  31. package/dist/es2019/ui/jira-issues-modal/site-selector/messages.js +4 -9
  32. package/dist/esm/analytics/constants.js +1 -1
  33. package/dist/esm/common/zindex.js +2 -0
  34. package/dist/esm/hooks/useDatasourceTableState.js +0 -1
  35. package/dist/esm/ui/assets-modal/modal/index.js +1 -1
  36. package/dist/esm/ui/common/error-state/access-required.js +43 -9
  37. package/dist/esm/ui/common/error-state/messages.js +4 -4
  38. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +6 -4
  39. package/dist/esm/ui/issue-like-table/empty-state/index.js +72 -86
  40. package/dist/esm/ui/issue-like-table/empty-state/type.js +1 -1
  41. package/dist/esm/ui/issue-like-table/index.js +37 -11
  42. package/dist/esm/ui/issue-like-table/styled.js +3 -3
  43. package/dist/esm/ui/jira-issues-modal/modal/index.js +26 -28
  44. package/dist/esm/ui/jira-issues-modal/modal/messages.js +2 -2
  45. package/dist/esm/ui/jira-issues-modal/site-selector/index.js +59 -34
  46. package/dist/esm/ui/jira-issues-modal/site-selector/messages.js +4 -9
  47. package/dist/types/common/zindex.d.ts +2 -0
  48. package/dist/types/ui/common/error-state/access-required.d.ts +2 -2
  49. package/dist/types/ui/issue-like-table/empty-state/index.d.ts +1 -2
  50. package/dist/types/ui/issue-like-table/index.d.ts +1 -1
  51. package/dist/types/ui/issue-like-table/styled.d.ts +1 -8
  52. package/dist/types/ui/jira-issues-modal/site-selector/index.d.ts +0 -1
  53. package/dist/types/ui/jira-issues-modal/site-selector/messages.d.ts +1 -6
  54. package/dist/types/ui/jira-issues-modal/types.d.ts +2 -0
  55. package/dist/types-ts4.5/common/zindex.d.ts +2 -0
  56. package/dist/types-ts4.5/ui/common/error-state/access-required.d.ts +2 -2
  57. package/dist/types-ts4.5/ui/issue-like-table/empty-state/index.d.ts +1 -2
  58. package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
  59. package/dist/types-ts4.5/ui/issue-like-table/styled.d.ts +1 -8
  60. package/dist/types-ts4.5/ui/jira-issues-modal/site-selector/index.d.ts +0 -1
  61. package/dist/types-ts4.5/ui/jira-issues-modal/site-selector/messages.d.ts +1 -6
  62. package/dist/types-ts4.5/ui/jira-issues-modal/types.d.ts +2 -0
  63. package/package.json +2 -3
  64. package/report.api.md +1 -0
  65. package/tmp/api-report-tmp.d.ts +1 -0
@@ -1,25 +1,39 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/react';
3
3
  import { Skeleton } from '@atlaskit/linking-common';
4
- import UserType from '../render-type/user';
5
- import { EmptyStateTableHeading } from '../styled';
6
- import Priority from './priority';
7
- import Type from './type';
4
+ import { ScrollableContainerHeight, TableHeading } from '../styled';
5
+ var SkeletonComponent = function SkeletonComponent(_ref) {
6
+ var width = _ref.width,
7
+ itemName = _ref.itemName;
8
+ return jsx(Skeleton, {
9
+ borderRadius: 8,
10
+ testId: "".concat(itemName, "-empty-state-skeleton"),
11
+ height: 14,
12
+ width: width
13
+ });
14
+ };
15
+ var tableSidePadding = "var(--ds-space-200, 16px)";
8
16
  var tableBodyStyles = css({
9
17
  borderBottom: 0
10
18
  });
19
+ var cellStyles = css({
20
+ paddingBlock: "var(--ds-space-100, 12px)",
21
+ '&:last-child': {
22
+ paddingRight: "var(--ds-space-100, 8px)"
23
+ }
24
+ });
11
25
  var baseColumns = [{
12
26
  key: 'type',
13
- width: 50
27
+ width: 35
14
28
  }, {
15
29
  key: 'issue',
16
30
  width: 50
17
31
  }, {
18
32
  key: 'summary',
19
- width: 70
33
+ width: 100
20
34
  }, {
21
35
  key: 'assignee',
22
- width: 100
36
+ width: 70
23
37
  }, {
24
38
  key: 'priority',
25
39
  width: 60
@@ -36,91 +50,64 @@ var baseColumns = [{
36
50
  key: 'due',
37
51
  width: 50
38
52
  }];
39
- var priorities = ['low', 'medium', 'high', 'medium', 'low', 'blocker', 'medium', 'blocker', 'high', 'low'];
40
- var types = ['task', 'story', 'commit', 'epic', 'bug', 'task', 'story', 'commit', 'issue', 'epic'];
41
- var summaryColumnWidths = [141, 208, 186, 212, 212, 151, 212, 182, 180, 147];
42
- var statusColumnWidths = [75, 54, 66, 73, 52, 73, 55, 80, 66, 59];
43
- var rows = new Array(10).fill(null).map(function (_, index) {
44
- return {
45
- id: index,
46
- priority: priorities[index],
47
- type: types[index],
48
- summaryWidth: summaryColumnWidths[index],
49
- statusWidth: statusColumnWidths[index]
50
- };
51
- });
52
- var cellStyles = css({
53
- '&:first-child': {
54
- paddingLeft: "var(--ds-space-100, 8px)"
55
- },
56
- '&:last-child': {
57
- paddingRight: "var(--ds-space-100, 8px)"
58
- }
59
- });
60
- var renderItem = function renderItem(_ref, _ref2, isShimmering) {
61
- var key = _ref.key,
62
- width = _ref.width;
63
- var priority = _ref2.priority,
64
- type = _ref2.type,
65
- summaryWidth = _ref2.summaryWidth,
66
- statusWidth = _ref2.statusWidth;
53
+ var longColumnWidths = [141, 208, 186, 212, 212, 151, 212, 182, 180, 163, 172, 211, 145, 190];
54
+ var shortColumnWidths = [75, 54, 66, 73, 52, 73, 55, 80, 67, 76, 58, 65, 56, 76];
55
+ var renderItem = function renderItem(_ref2, _ref3) {
56
+ var key = _ref2.key,
57
+ width = _ref2.width;
58
+ var longWidth = _ref3.longWidth,
59
+ shortWidth = _ref3.shortWidth;
67
60
  switch (key) {
68
- case 'assignee':
69
- return jsx(UserType, null, jsx(Skeleton, {
70
- borderRadius: 8,
71
- testId: "empty-state-skeleton",
72
- height: 13,
73
- isShimmering: isShimmering,
74
- width: width
75
- }));
76
- case 'priority':
77
- return jsx(Priority, {
78
- priority: priority
79
- });
80
- case 'type':
81
- return jsx(Type, {
82
- type: type
61
+ case 'status':
62
+ return jsx(SkeletonComponent, {
63
+ width: shortWidth,
64
+ itemName: key
83
65
  });
84
66
  case 'summary':
85
- return jsx(Skeleton, {
86
- appearance: "blue",
87
- borderRadius: 10,
88
- testId: "empty-state-skeleton",
89
- height: 13,
90
- isShimmering: isShimmering,
91
- width: summaryWidth
92
- });
93
- case 'status':
94
- return jsx(Skeleton, {
95
- appearance: "blue",
96
- borderRadius: 3,
97
- testId: "empty-state-skeleton",
98
- height: 16,
99
- isShimmering: isShimmering,
100
- width: statusWidth
67
+ return jsx(SkeletonComponent, {
68
+ width: longWidth,
69
+ itemName: key
101
70
  });
102
71
  default:
103
- return jsx(Skeleton, {
104
- borderRadius: 8,
105
- testId: "empty-state-skeleton",
106
- height: 13,
107
- isShimmering: isShimmering,
108
- width: width
72
+ return jsx(SkeletonComponent, {
73
+ width: width,
74
+ itemName: key
109
75
  });
110
76
  }
111
77
  };
112
- export default (function (_ref3) {
113
- var isCompact = _ref3.isCompact,
114
- _ref3$isLoading = _ref3.isLoading,
115
- isLoading = _ref3$isLoading === void 0 ? false : _ref3$isLoading,
116
- testId = _ref3.testId;
78
+ export default (function (_ref4) {
79
+ var isCompact = _ref4.isCompact,
80
+ testId = _ref4.testId;
117
81
  var columnsToRender = isCompact ? baseColumns.slice(0, 6) : baseColumns;
118
- return jsx("table", {
82
+ // if it is compact (non-modal), there is room for 14 rows
83
+ // if it is modal (not compact), there is only room for 10 rows
84
+ var rowsNumber = isCompact ? 14 : 10;
85
+ var rows = new Array(rowsNumber).fill(null).map(function (_, index) {
86
+ return {
87
+ id: index,
88
+ longWidth: longColumnWidths[index],
89
+ shortWidth: shortColumnWidths[index]
90
+ };
91
+ });
92
+ return jsx("div", {
93
+ style: {
94
+ // the IssueLikeDataTableView wraps the table in a container with the styling below while modal doesn't
95
+ // the isCompact prop is applied to non-modal empty states which require additional padding
96
+ // this maxHeight comes from scrollableContainerHeight
97
+ maxHeight: ScrollableContainerHeight,
98
+ padding: isCompact ? "0 ".concat(tableSidePadding, " 0 ").concat(tableSidePadding) : '0',
99
+ boxSizing: 'border-box'
100
+ }
101
+ }, jsx("table", {
119
102
  "data-testid": testId
120
- }, jsx("thead", null, jsx("tr", null, columnsToRender.map(function (_ref4) {
121
- var key = _ref4.key,
122
- width = _ref4.width;
123
- return jsx(EmptyStateTableHeading, {
103
+ }, jsx("thead", {
104
+ style: {
105
+ borderBottom: 0
106
+ }
107
+ }, jsx("tr", null, columnsToRender.map(function (_ref5) {
108
+ var key = _ref5.key,
109
+ width = _ref5.width;
110
+ return jsx(TableHeading, {
124
111
  key: key,
125
112
  style: {
126
113
  width: width
@@ -129,8 +116,7 @@ export default (function (_ref3) {
129
116
  appearance: "darkGray",
130
117
  borderRadius: 8,
131
118
  testId: "empty-state-skeleton",
132
- isShimmering: isLoading,
133
- height: 13,
119
+ height: 12,
134
120
  width: width
135
121
  }));
136
122
  }))), jsx("tbody", {
@@ -142,7 +128,7 @@ export default (function (_ref3) {
142
128
  return jsx("td", {
143
129
  css: cellStyles,
144
130
  key: column.key
145
- }, renderItem(column, row, isLoading));
131
+ }, renderItem(column, row));
146
132
  }));
147
- })));
133
+ }))));
148
134
  });
@@ -8,7 +8,7 @@ import Epic16Icon from '@atlaskit/icon-object/glyph/epic/16';
8
8
  import Issue16Icon from '@atlaskit/icon-object/glyph/issue/16';
9
9
  import Story16Icon from '@atlaskit/icon-object/glyph/story/16';
10
10
  import Task16Icon from '@atlaskit/icon-object/glyph/task/16';
11
- var IconWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n"])));
11
+ var IconWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: left;\n"])));
12
12
  export default (function (_ref) {
13
13
  var type = _ref.type;
14
14
  var TypeIcon = function TypeIcon() {
@@ -22,6 +22,7 @@ import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
22
22
  import { N40 } from '@atlaskit/theme/colors';
23
23
  import Tooltip from '@atlaskit/tooltip';
24
24
  import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExperiences';
25
+ import { stickyTableHeadersIndex } from '../../common/zindex';
25
26
  import { ColumnPicker } from './column-picker';
26
27
  import { DragColumnPreview } from './drag-column-preview';
27
28
  import { DraggableTableHeading } from './draggable-table-heading';
@@ -34,7 +35,7 @@ var tableHeadStyles = css({
34
35
  background: "var(--ds-surface, #FFF)",
35
36
  position: 'sticky',
36
37
  top: 0,
37
- zIndex: 10
38
+ zIndex: stickyTableHeadersIndex
38
39
  });
39
40
  var ColumnPickerHeader = styled.th(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 40px;\n position: sticky;\n right: calc(-1 * ", ");\n background-color: ", ";\n border-bottom: 2px solid ", "; /* It is required to have solid (not half-transparent) color because of this gradient business bellow */\n background: linear-gradient(\n 90deg,\n rgba(255, 255, 255, 0) 0%,\n ", " 10%\n );\n vertical-align: middle; /* Keeps dropdown button in the middle */\n &:last-of-type {\n padding-right: ", ";\n }\n"])), tableSidePadding, "var(--ds-surface, #FFF)", "var(--ds-background-accent-gray-subtler, ".concat(N40, ")"), "var(--ds-surface, #FFF)", tableSidePadding);
40
41
  var truncatedCellStyles = css({
@@ -86,8 +87,7 @@ function getColumnWidth(key, type) {
86
87
  priority: BASE_WIDTH * 8,
87
88
  status: BASE_WIDTH * 18,
88
89
  summary: BASE_WIDTH * 45,
89
- description: BASE_WIDTH * 31.25,
90
- type: BASE_WIDTH * 8
90
+ description: BASE_WIDTH * 31.25
91
91
  };
92
92
  if (keyBasedWidth[key]) {
93
93
  return keyBasedWidth[key];
@@ -167,9 +167,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
167
167
  cells: visibleSortedColumns.map(function (_ref3) {
168
168
  var key = _ref3.key;
169
169
  var content = jsx(Skeleton, {
170
- borderRadius: "var(--ds-border-radius-100, 3px)",
171
- width: '100%',
172
- height: '20px'
170
+ borderRadius: 8,
171
+ width: "100%",
172
+ height: 14,
173
+ testId: "issues-table-row-loading"
173
174
  });
174
175
  return {
175
176
  key: key,
@@ -295,8 +296,24 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
295
296
  });
296
297
  }, [identityColumnKey, renderItem, items, visibleSortedColumns]);
297
298
  var rows = useMemo(function () {
298
- return [].concat(_toConsumableArray(tableRows), _toConsumableArray(status === 'loading' ? [loadingRow] : []));
299
- }, [loadingRow, status, tableRows]);
299
+ if (status !== 'loading') {
300
+ return tableRows;
301
+ }
302
+ // if there are table rows, only add 1 loading row
303
+ if (tableRows.length > 0) {
304
+ return [].concat(_toConsumableArray(tableRows), [_objectSpread(_objectSpread({}, loadingRow), {}, {
305
+ key: "loading-".concat(tableRows.length)
306
+ })]);
307
+ }
308
+ // if there are no table rows add 14 rows if it is compact (has scrollableContainerHeight or non-modal)
309
+ // add 10 rows if it is modal (no scrollableContainerHeight)
310
+ var loadingRowsCount = scrollableContainerHeight ? 14 : 10;
311
+ return _toConsumableArray(Array(loadingRowsCount)).map(function (_, index) {
312
+ return _objectSpread(_objectSpread({}, loadingRow), {}, {
313
+ key: "loading-".concat(index)
314
+ });
315
+ });
316
+ }, [loadingRow, status, tableRows, scrollableContainerHeight]);
300
317
  var onSelectedColumnKeysChange = useCallback(function (newSelectedColumnKeys) {
301
318
  onVisibleColumnKeysChange === null || onVisibleColumnKeysChange === void 0 || onVisibleColumnKeysChange(newSelectedColumnKeys);
302
319
  }, [onVisibleColumnKeysChange]);
@@ -389,6 +406,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
389
406
  key: key,
390
407
  "data-testid": "".concat(key, "-column-heading"),
391
408
  style: {
409
+ // this keeps the column headers from collapsing horizontally during loading states
410
+ minWidth: maxWidth,
392
411
  maxWidth: maxWidth
393
412
  }
394
413
  }, heading);
@@ -414,14 +433,21 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
414
433
  var cellKey = _ref14.key,
415
434
  content = _ref14.content,
416
435
  maxWidth = _ref14.maxWidth;
436
+ var loadingRowStyle = {
437
+ maxWidth: maxWidth
438
+ };
439
+ // extra padding is required around skeleton loader to avoid vertical jumps when data loads
440
+ if (key !== null && key !== void 0 && key.includes('loading')) {
441
+ loadingRowStyle = _objectSpread(_objectSpread({}, loadingRowStyle), {}, {
442
+ paddingBlock: "var(--ds-space-100, 12px)"
443
+ });
444
+ }
417
445
  return jsx("td", {
418
446
  key: cellKey,
419
447
  "data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
420
448
  colSpan: cellIndex + 1 === cells.length ? 2 : undefined,
421
449
  css: truncatedCellStyles,
422
- style: {
423
- maxWidth: maxWidth
424
- }
450
+ style: loadingRowStyle
425
451
  }, content);
426
452
  }));
427
453
  }))));
@@ -1,8 +1,8 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3;
2
+ var _templateObject, _templateObject2;
3
3
  import styled from '@emotion/styled';
4
4
  import { N40 } from '@atlaskit/theme/colors';
5
+ export var ScrollableContainerHeight = 590;
5
6
  export var FieldTextFontSize = '14px';
6
7
  export var Table = styled.table(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n"])));
7
- export var TableHeading = styled.th(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n padding-block: ", " ", ";\n line-height: ", ";\n border-bottom: 2px solid ", ";\n & [data-testid='datasource-header-content--container'] {\n margin-top: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"])), "var(--ds-space-300, 24px)", "var(--ds-space-100, 8px)", "var(--ds-font-lineHeight-300, 16px)", "var(--ds-background-accent-gray-subtler, ".concat(N40, ")"));
8
- export var EmptyStateTableHeading = styled(TableHeading)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:first-child {\n padding-left: ", ";\n }\n"])), "var(--ds-space-100, 8px)");
8
+ export var TableHeading = styled.th(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n padding-block: ", " ", ";\n line-height: ", ";\n border-bottom: 2px solid ", ";\n & [data-testid='datasource-header-content--container'] {\n margin-top: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"])), "var(--ds-space-300, 24px)", "var(--ds-space-100, 8px)", "var(--ds-font-lineHeight-300, 16px)", "var(--ds-background-accent-gray-subtler, ".concat(N40, ")"));
@@ -7,7 +7,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
7
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  /** @jsx jsx */
10
- import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
10
+ import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
11
11
  import { css, jsx } from '@emotion/react';
12
12
  import { FormattedMessage, FormattedNumber, useIntl } from 'react-intl-next';
13
13
  import { v4 as uuidv4 } from 'uuid';
@@ -37,8 +37,11 @@ import { JiraSiteSelector } from '../site-selector';
37
37
  import { modalMessages } from './messages';
38
38
  var dropdownContainerStyles = css({
39
39
  display: 'flex',
40
- gap: "var(--ds-space-100, 0.5rem)"
40
+ alignItems: 'center',
41
+ gap: "var(--ds-space-100, 0.5rem)",
42
+ minHeight: '40px' // to prevent vertical shifting when site selector pops in
41
43
  });
44
+
42
45
  var contentContainerStyles = css({
43
46
  display: 'grid',
44
47
  maxHeight: '420px',
@@ -83,12 +86,13 @@ export var getColumnAction = function getColumnAction(oldVisibleColumnKeys, newV
83
86
  };
84
87
  export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
85
88
  var datasourceId = props.datasourceId,
86
- initialParameters = props.parameters,
87
- initialVisibleColumnKeys = props.visibleColumnKeys,
88
89
  onCancel = props.onCancel,
89
90
  onInsert = props.onInsert,
90
91
  _props$viewMode = props.viewMode,
91
- viewMode = _props$viewMode === void 0 ? 'issue' : _props$viewMode;
92
+ viewMode = _props$viewMode === void 0 ? 'issue' : _props$viewMode,
93
+ initialParameters = props.parameters,
94
+ urlBeingEdited = props.url,
95
+ initialVisibleColumnKeys = props.visibleColumnKeys;
92
96
  var _useState = useState([]),
93
97
  _useState2 = _slicedToArray(_useState, 2),
94
98
  availableSites = _useState2[0],
@@ -152,11 +156,9 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
152
156
  modalRenderInstanceId = _useRef.current;
153
157
  var selectedJiraSite = useMemo(function () {
154
158
  if (cloudId) {
155
- // if the cloud id we're editing isn't in available sites then user is likely unauthorized for that site
156
- // TODO: unauthorized to edit flow https://product-fabric.atlassian.net/browse/EDM-7216
157
159
  return availableSites.find(function (jiraSite) {
158
160
  return jiraSite.cloudId === cloudId;
159
- }) || availableSites[0];
161
+ });
160
162
  } else {
161
163
  var currentlyLoggedInSiteUrl = window.location.origin;
162
164
  return availableSites.find(function (jiraSite) {
@@ -408,12 +410,12 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
408
410
  }));
409
411
  }, [columns, defaultVisibleColumnKeys, handleOnNextPage, handleVisibleColumnKeysChange, hasNextPage, loadDatasourceDetails, modalRenderInstanceId, responseItems, status, visibleColumnKeys, extensionKey]);
410
412
  var renderCountModeContent = useCallback(function () {
411
- var url = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
413
+ var selectedJiraSiteUrl = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
412
414
  if (status === 'unauthorized') {
413
415
  return jsx(AccessRequired, {
414
- siteName: selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName
416
+ url: selectedJiraSiteUrl || urlBeingEdited
415
417
  });
416
- } else if (status === 'empty' || !jql || !url) {
418
+ } else if (status === 'empty' || !jql || !selectedJiraSiteUrl) {
417
419
  return jsx("div", {
418
420
  css: smartLinkContainerStyles
419
421
  }, jsx("span", {
@@ -421,22 +423,23 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
421
423
  css: placeholderSmartLinkStyles
422
424
  }, jsx(FormattedMessage, modalMessages.issuesCountSmartCardPlaceholderText)));
423
425
  } else {
424
- var urlWithEncodedJql = "".concat(url, "/issues/?jql=").concat(encodeURI(jql));
426
+ var urlWithEncodedJql = "".concat(selectedJiraSiteUrl, "/issues/?jql=").concat(encodeURI(jql));
425
427
  return jsx("div", {
426
428
  css: smartLinkContainerStyles
427
429
  }, jsx(LinkRenderType, {
428
430
  url: urlWithEncodedJql
429
431
  }));
430
432
  }
431
- }, [jql, selectedJiraSite, status]);
433
+ }, [jql, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited]);
432
434
  var renderIssuesModeContent = useCallback(function () {
435
+ var selectedJiraSiteUrl = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
433
436
  if (status === 'rejected' && jqlUrl) {
434
437
  return jsx(ModalLoadingError, {
435
438
  url: jqlUrl
436
439
  });
437
440
  } else if (status === 'unauthorized') {
438
441
  return jsx(AccessRequired, {
439
- siteName: selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName
442
+ url: selectedJiraSiteUrl || urlBeingEdited
440
443
  });
441
444
  } else if (resolvedWithNoResults) {
442
445
  return jsx(NoResults, null);
@@ -445,8 +448,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
445
448
  return jsx("div", {
446
449
  css: contentContainerStyles
447
450
  }, !!jql ? jsx(EmptyState, {
448
- testId: "jira-jql-datasource-modal--empty-state",
449
- isLoading: true
451
+ testId: "jira-jql-datasource-modal--empty-state"
450
452
  }) : jsx(InitialStateView, {
451
453
  searchMethod: currentSearchMethod
452
454
  }));
@@ -460,24 +462,20 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
460
462
  }));
461
463
  }
462
464
  return issueLikeDataTableView;
463
- }, [status, jqlUrl, resolvedWithNoResults, columns.length, retrieveUrlForSmartCardRender, responseItems.length, issueLikeDataTableView, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName, jql, currentSearchMethod]);
465
+ }, [columns.length, currentSearchMethod, issueLikeDataTableView, jql, jqlUrl, resolvedWithNoResults, responseItems.length, retrieveUrlForSmartCardRender, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited]);
464
466
  return jsx(ModalTransition, null, jsx(Modal, {
465
- testId: 'jira-jql-datasource-modal',
467
+ testId: "jira-jql-datasource-modal",
466
468
  onClose: onCancel,
467
469
  width: "calc(100% - 80px)",
468
470
  shouldScrollInViewport: true
469
- }, jsx(ModalHeader, null, jsx(ModalTitle, null, availableSites.length < 2 ? jsx(FormattedMessage, modalMessages.insertIssuesTitle) : jsx("div", {
471
+ }, jsx(ModalHeader, null, jsx(ModalTitle, null, jsx("div", {
470
472
  css: dropdownContainerStyles
471
- }, jsx(FormattedMessage, _extends({}, modalMessages.insertIssuesTitleManySites, {
472
- values: {
473
- siteName: selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName
474
- }
475
- })), jsx(JiraSiteSelector, {
476
- testId: "jira-jql-datasource-modal--site-selector",
473
+ }, availableSites.length < 2 ? jsx(FormattedMessage, modalMessages.insertIssuesTitle) : jsx(Fragment, null, jsx(FormattedMessage, modalMessages.insertIssuesTitleManySites), jsx(JiraSiteSelector, {
477
474
  availableSites: availableSites,
478
475
  onSiteSelection: onSiteSelection,
479
- selectedJiraSite: selectedJiraSite
480
- }))), jsx(ModeSwitcher, {
476
+ selectedJiraSite: selectedJiraSite,
477
+ testId: "jira-jql-datasource-modal--site-selector"
478
+ })))), jsx(ModeSwitcher, {
481
479
  isCompact: true,
482
480
  options: [{
483
481
  label: formatMessage(modalMessages.issueViewModeLabel),
@@ -517,7 +515,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
517
515
  appearance: "primary",
518
516
  onClick: onInsertPressed,
519
517
  isDisabled: isInsertDisabled,
520
- testId: 'jira-jql-datasource-modal--insert-button'
518
+ testId: "jira-jql-datasource-modal--insert-button"
521
519
  }, jsx(FormattedMessage, modalMessages.insertIssuesButtonText)))));
522
520
  };
523
521
  var analyticsContextAttributes = {
@@ -17,8 +17,8 @@ export var modalMessages = defineMessages({
17
17
  },
18
18
  insertIssuesTitleManySites: {
19
19
  id: 'linkDataSource.jira-issues.configmodal.insertIssuesTitleManySites',
20
- description: 'Title for the Jira Issues Datasource config modal when multiple sites are available',
21
- defaultMessage: 'Insert Jira issues from {siteName}'
20
+ description: 'Title for the Jira Issues modal when a user has to select a site to inserting issues from',
21
+ defaultMessage: 'Insert Jira issues from'
22
22
  },
23
23
  issueViewModeLabel: {
24
24
  id: 'linkDataSource.jira-issues.configmodal.issueViewModeLabel',
@@ -1,45 +1,70 @@
1
- import _extends from "@babel/runtime/helpers/extends";
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["triggerRef"];
3
+ var _excluded = ["width"];
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
6
  /** @jsx jsx */
5
- import { jsx } from '@emotion/react';
7
+ import { useMemo } from 'react';
8
+ import { css, jsx } from '@emotion/react';
6
9
  import { useIntl } from 'react-intl-next';
7
- import Button from '@atlaskit/button/standard-button';
8
- import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
9
- import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
10
+ import Select from '@atlaskit/select';
11
+ import { siteSelectorIndex } from '../../../common/zindex';
10
12
  import { siteSelectorMessages } from './messages';
13
+ var selectStyles = css({
14
+ fontSize: "var(--ds-font-size-100, 14px)",
15
+ fontWeight: "var(--ds-font-weight-medium, 500)",
16
+ lineHeight: "var(--ds-font-lineHeight-200, 20px)",
17
+ zIndex: siteSelectorIndex
18
+ });
11
19
  export var JiraSiteSelector = function JiraSiteSelector(props) {
12
20
  var availableSites = props.availableSites,
13
21
  onSiteSelection = props.onSiteSelection,
14
22
  selectedJiraSite = props.selectedJiraSite,
15
23
  testId = props.testId;
16
- var intl = useIntl();
17
- return jsx(DropdownMenu, {
18
- spacing: "compact",
19
- testId: testId,
20
- trigger: function trigger(_ref) {
21
- var triggerRef = _ref.triggerRef,
22
- props = _objectWithoutProperties(_ref, _excluded);
23
- return jsx(Button, _extends({}, props, {
24
- testId: "".concat(testId, "--trigger"),
25
- spacing: "none",
26
- iconBefore: jsx(ChevronDownIcon, {
27
- label: intl.formatMessage(siteSelectorMessages.dropdownChevronLabel)
28
- }),
29
- ref: triggerRef
30
- }));
24
+ var _useIntl = useIntl(),
25
+ formatMessage = _useIntl.formatMessage;
26
+ var onChange = function onChange(newValue) {
27
+ var selectedSite = availableSites.find(function (site) {
28
+ return site.cloudId === (newValue === null || newValue === void 0 ? void 0 : newValue.value);
29
+ });
30
+ if (selectedSite) {
31
+ onSiteSelection(selectedSite);
31
32
  }
32
- }, jsx(DropdownItemGroup, null, availableSites.map(function (availableSite) {
33
- var displayName = availableSite.displayName,
34
- cloudId = availableSite.cloudId;
35
- var isSelected = displayName === (selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName);
36
- return jsx(DropdownItem, {
37
- isSelected: isSelected,
38
- key: cloudId,
39
- onClick: function onClick() {
40
- return onSiteSelection(availableSite);
41
- },
42
- testId: testId && "".concat(testId, "--dropdown-item").concat(isSelected ? '__selected' : '')
43
- }, displayName);
44
- })));
33
+ };
34
+ var availableSitesOptions = useMemo(function () {
35
+ return availableSites.map(function (site) {
36
+ return {
37
+ label: site.displayName,
38
+ value: site.cloudId
39
+ };
40
+ });
41
+ }, [availableSites]);
42
+ var selectedSiteOption = selectedJiraSite && {
43
+ label: selectedJiraSite.displayName,
44
+ value: selectedJiraSite.cloudId
45
+ };
46
+ return jsx("span", {
47
+ "data-testid": "".concat(testId, "--trigger")
48
+ }, jsx(Select, {
49
+ css: selectStyles,
50
+ classNamePrefix: testId,
51
+ isLoading: availableSites.length === 0,
52
+ onChange: onChange,
53
+ options: availableSitesOptions,
54
+ placeholder: formatMessage(siteSelectorMessages.chooseSite),
55
+ styles: {
56
+ // prevents the popup menu with available sites from being too narrow
57
+ // if the selected site is much shorter than the other options
58
+ menu: function menu(_ref) {
59
+ var width = _ref.width,
60
+ css = _objectWithoutProperties(_ref, _excluded);
61
+ return _objectSpread(_objectSpread({}, css), {}, {
62
+ minWidth: '100%',
63
+ width: 'max-content'
64
+ });
65
+ }
66
+ },
67
+ testId: testId,
68
+ value: selectedSiteOption
69
+ }));
45
70
  };
@@ -1,13 +1,8 @@
1
1
  import { defineMessages } from 'react-intl-next';
2
2
  export var siteSelectorMessages = defineMessages({
3
- dropdownChevronLabel: {
4
- id: 'linkDataSource.jira-issues.configmodal.dropdownChevronLabel',
5
- description: 'Label for button that reveals more available site options to choose from',
6
- defaultMessage: 'Pick jira site'
7
- },
8
- selectedJiraSiteLabel: {
9
- id: 'linkDataSource.jira-issues.configmodal.selectedJiraSiteLabel',
10
- description: 'Label for a check icon declaring which option is selected',
11
- defaultMessage: '{siteName} is selected'
3
+ chooseSite: {
4
+ id: 'linkDataSource.jira-issues.configmodal.chooseSite',
5
+ description: 'Label for input letting user know they have to choose a site',
6
+ defaultMessage: 'Choose site'
12
7
  }
13
8
  });
@@ -0,0 +1,2 @@
1
+ export declare const stickyTableHeadersIndex = 10;
2
+ export declare const siteSelectorIndex: number;
@@ -1,6 +1,6 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  interface AccessRequiredProps {
3
- siteName?: string;
3
+ url?: string;
4
4
  }
5
- export declare const AccessRequired: ({ siteName }: AccessRequiredProps) => jsx.JSX.Element;
5
+ export declare const AccessRequired: ({ url }: AccessRequiredProps) => jsx.JSX.Element;
6
6
  export {};
@@ -2,8 +2,7 @@
2
2
  import { jsx } from '@emotion/react';
3
3
  export interface Props {
4
4
  isCompact?: boolean;
5
- isLoading?: boolean;
6
5
  testId?: string;
7
6
  }
8
- declare const _default: ({ isCompact, isLoading, testId }: Props) => jsx.JSX.Element;
7
+ declare const _default: ({ isCompact, testId }: Props) => jsx.JSX.Element;
9
8
  export default _default;
@@ -15,4 +15,4 @@ export interface RowCellType {
15
15
  }
16
16
  export declare const orderColumns: (columns: DatasourceResponseSchemaProperty[], visibleColumnKeys: string[]) => DatasourceResponseSchemaProperty[];
17
17
  export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, status, hasNextPage, scrollableContainerHeight, parentContainerRenderInstanceId, extensionKey, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
18
- export declare const EmptyState: ({ isCompact, isLoading, testId }: import("./empty-state").Props) => jsx.JSX.Element;
18
+ export declare const EmptyState: ({ isCompact, testId }: import("./empty-state").Props) => jsx.JSX.Element;