@atlaskit/link-datasource 0.31.2 → 0.32.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 (94) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics/constants.js +8 -0
  3. package/dist/cjs/analytics/generated/analytics.types.js +5 -0
  4. package/dist/cjs/analytics/generated/create-event-payload.js +46 -0
  5. package/dist/cjs/analytics/generated/use-analytics-events.js +32 -0
  6. package/dist/cjs/analytics/index.js +18 -0
  7. package/dist/cjs/ui/common/error-state/access-required.js +12 -3
  8. package/dist/cjs/ui/common/error-state/loading-error.js +20 -11
  9. package/dist/cjs/ui/common/error-state/modal-loading-error.js +21 -12
  10. package/dist/cjs/ui/common/error-state/no-results.js +48 -41
  11. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +7 -19
  12. package/dist/cjs/ui/issue-like-table/column-picker/index.js +2 -4
  13. package/dist/cjs/ui/issue-like-table/drag-column-preview.js +37 -0
  14. package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +60 -25
  15. package/dist/cjs/ui/issue-like-table/empty-state/index.js +6 -1
  16. package/dist/cjs/ui/issue-like-table/index.js +102 -71
  17. package/dist/cjs/ui/issue-like-table/styled.js +2 -1
  18. package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +8 -0
  19. package/dist/cjs/ui/jira-issues-modal/modal/index.js +43 -15
  20. package/dist/cjs/ui/table-footer/index.js +10 -7
  21. package/dist/cjs/version.json +1 -1
  22. package/dist/es2019/analytics/constants.js +1 -0
  23. package/dist/es2019/analytics/generated/analytics.types.js +1 -0
  24. package/dist/es2019/analytics/generated/create-event-payload.js +28 -0
  25. package/dist/es2019/analytics/generated/use-analytics-events.js +24 -0
  26. package/dist/es2019/analytics/index.js +3 -0
  27. package/dist/es2019/ui/common/error-state/access-required.js +10 -0
  28. package/dist/es2019/ui/common/error-state/loading-error.js +10 -0
  29. package/dist/es2019/ui/common/error-state/modal-loading-error.js +10 -0
  30. package/dist/es2019/ui/common/error-state/no-results.js +8 -0
  31. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +8 -20
  32. package/dist/es2019/ui/issue-like-table/column-picker/index.js +1 -3
  33. package/dist/es2019/ui/issue-like-table/drag-column-preview.js +46 -0
  34. package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +53 -18
  35. package/dist/es2019/ui/issue-like-table/empty-state/index.js +6 -1
  36. package/dist/es2019/ui/issue-like-table/index.js +86 -43
  37. package/dist/es2019/ui/issue-like-table/styled.js +18 -0
  38. package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +9 -0
  39. package/dist/es2019/ui/jira-issues-modal/modal/index.js +43 -13
  40. package/dist/es2019/ui/table-footer/index.js +11 -11
  41. package/dist/es2019/version.json +1 -1
  42. package/dist/esm/analytics/constants.js +1 -0
  43. package/dist/esm/analytics/generated/analytics.types.js +1 -0
  44. package/dist/esm/analytics/generated/create-event-payload.js +38 -0
  45. package/dist/esm/analytics/generated/use-analytics-events.js +23 -0
  46. package/dist/esm/analytics/index.js +5 -0
  47. package/dist/esm/ui/common/error-state/access-required.js +9 -0
  48. package/dist/esm/ui/common/error-state/loading-error.js +9 -0
  49. package/dist/esm/ui/common/error-state/modal-loading-error.js +9 -0
  50. package/dist/esm/ui/common/error-state/no-results.js +7 -0
  51. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +8 -20
  52. package/dist/esm/ui/issue-like-table/column-picker/index.js +2 -4
  53. package/dist/esm/ui/issue-like-table/drag-column-preview.js +29 -0
  54. package/dist/esm/ui/issue-like-table/draggable-table-heading.js +60 -25
  55. package/dist/esm/ui/issue-like-table/empty-state/index.js +6 -1
  56. package/dist/esm/ui/issue-like-table/index.js +102 -71
  57. package/dist/esm/ui/issue-like-table/styled.js +2 -1
  58. package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +8 -0
  59. package/dist/esm/ui/jira-issues-modal/modal/index.js +43 -14
  60. package/dist/esm/ui/table-footer/index.js +10 -7
  61. package/dist/esm/version.json +1 -1
  62. package/dist/types/analytics/constants.d.ts +1 -0
  63. package/dist/types/analytics/generated/analytics.types.d.ts +49 -0
  64. package/dist/types/analytics/generated/create-event-payload.d.ts +27 -0
  65. package/dist/types/analytics/generated/use-analytics-events.d.ts +3 -0
  66. package/dist/types/analytics/index.d.ts +4 -0
  67. package/dist/types/ui/common/error-state/access-required.d.ts +0 -1
  68. package/dist/types/ui/common/error-state/loading-error.d.ts +0 -1
  69. package/dist/types/ui/common/error-state/modal-loading-error.d.ts +0 -1
  70. package/dist/types/ui/common/error-state/no-results.d.ts +0 -1
  71. package/dist/types/ui/issue-like-table/column-picker/index.d.ts +1 -1
  72. package/dist/types/ui/issue-like-table/column-picker/types.d.ts +0 -1
  73. package/dist/types/ui/issue-like-table/drag-column-preview.d.ts +7 -0
  74. package/dist/types/ui/issue-like-table/draggable-table-heading.d.ts +2 -3
  75. package/dist/types/ui/issue-like-table/index.d.ts +1 -1
  76. package/dist/types/ui/issue-like-table/types.d.ts +5 -0
  77. package/dist/types/ui/jira-issues-modal/modal/index.d.ts +3 -1
  78. package/dist/types-ts4.5/analytics/constants.d.ts +1 -0
  79. package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +49 -0
  80. package/dist/types-ts4.5/analytics/generated/create-event-payload.d.ts +31 -0
  81. package/dist/types-ts4.5/analytics/generated/use-analytics-events.d.ts +7 -0
  82. package/dist/types-ts4.5/analytics/index.d.ts +8 -0
  83. package/dist/types-ts4.5/ui/common/error-state/access-required.d.ts +0 -1
  84. package/dist/types-ts4.5/ui/common/error-state/loading-error.d.ts +0 -1
  85. package/dist/types-ts4.5/ui/common/error-state/modal-loading-error.d.ts +0 -1
  86. package/dist/types-ts4.5/ui/common/error-state/no-results.d.ts +0 -1
  87. package/dist/types-ts4.5/ui/issue-like-table/column-picker/index.d.ts +1 -1
  88. package/dist/types-ts4.5/ui/issue-like-table/column-picker/types.d.ts +0 -1
  89. package/dist/types-ts4.5/ui/issue-like-table/drag-column-preview.d.ts +7 -0
  90. package/dist/types-ts4.5/ui/issue-like-table/draggable-table-heading.d.ts +2 -3
  91. package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
  92. package/dist/types-ts4.5/ui/issue-like-table/types.d.ts +5 -0
  93. package/dist/types-ts4.5/ui/jira-issues-modal/modal/index.d.ts +3 -1
  94. package/package.json +7 -2
@@ -5,19 +5,23 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.JiraIssuesConfigModal = void 0;
8
+ exports.PlainJiraIssuesConfigModal = exports.JiraIssuesConfigModal = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
13
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
14
  var _react = require("react");
14
15
  var _react2 = require("@emotion/react");
15
16
  var _reactIntlNext = require("react-intl-next");
17
+ var _analyticsNext = require("@atlaskit/analytics-next");
16
18
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
17
19
  var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
18
20
  var _colors = require("@atlaskit/theme/colors");
21
+ var _analytics = require("../../../analytics");
19
22
  var _useDatasourceTableState = require("../../../hooks/useDatasourceTableState");
20
23
  var _getAvailableJiraSites = require("../../../services/getAvailableJiraSites");
24
+ var _version = require("../../../version.json");
21
25
  var _accessRequired = require("../../common/error-state/access-required");
22
26
  var _modalLoadingError = require("../../common/error-state/modal-loading-error");
23
27
  var _noResults = require("../../common/error-state/no-results");
@@ -29,16 +33,17 @@ var _siteSelector = require("../site-selector");
29
33
  var _messages = require("./messages");
30
34
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
35
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
32
- /** @jsx jsx */
33
-
36
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
37
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /** @jsx jsx */
34
38
  var dropdownContainerStyles = (0, _react2.css)({
35
39
  display: 'flex',
36
40
  gap: "var(--ds-space-100, 0.5rem)"
37
41
  });
38
42
  var contentContainerStyles = (0, _react2.css)({
39
43
  display: 'grid',
40
- height: '420px',
41
- overflow: 'auto'
44
+ maxHeight: '420px',
45
+ overflow: 'auto',
46
+ borderBottom: "2px solid ".concat("var(--ds-background-accent-gray-subtler, ".concat(_colors.N40, ")"))
42
47
  });
43
48
  var placeholderSmartLinkStyles = (0, _react2.css)({
44
49
  backgroundColor: "var(--ds-surface-raised, ".concat(_colors.N0, ")"),
@@ -55,7 +60,7 @@ var issueCountStyles = (0, _react2.css)({
55
60
  var smartLinkContainerStyles = (0, _react2.css)({
56
61
  paddingLeft: '1px'
57
62
  });
58
- var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
63
+ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
59
64
  var datasourceId = props.datasourceId,
60
65
  initialParameters = props.parameters,
61
66
  initialVisibleColumnKeys = props.visibleColumnKeys,
@@ -104,6 +109,8 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
104
109
  totalCount = _useDatasourceTableSt.totalCount;
105
110
  var _useIntl = (0, _reactIntlNext.useIntl)(),
106
111
  formatMessage = _useIntl.formatMessage;
112
+ var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
113
+ fireEvent = _useDatasourceAnalyti.fireEvent;
107
114
  var selectedJiraSite = (0, _react.useMemo)(function () {
108
115
  return availableSites.find(function (jiraSite) {
109
116
  return jiraSite.cloudId === cloudId;
@@ -113,6 +120,9 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
113
120
  var jqlUrl = selectedJiraSite && jql && "".concat(selectedJiraSite.url, "/issues/?jql=").concat(encodeURI(jql));
114
121
  var isInsertDisabled = !isParametersSet || status === 'rejected' || status === 'unauthorized' || status === 'loading' || resolvedWithNoResults;
115
122
  var shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'issue';
123
+ (0, _react.useEffect)(function () {
124
+ fireEvent('screen.datasourceModalDialog.viewed', {});
125
+ }, [fireEvent]);
116
126
  (0, _react.useEffect)(function () {
117
127
  var newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
118
128
  setVisibleColumnKeys(newVisibleColumnKeys);
@@ -129,7 +139,10 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
129
139
  case 2:
130
140
  jiraSites = _context.sent;
131
141
  setAvailableSites(jiraSites);
132
- case 4:
142
+ fireEvent('ui.modal.ready.datasource', {
143
+ instancesCount: jiraSites.length
144
+ });
145
+ case 5:
133
146
  case "end":
134
147
  return _context.stop();
135
148
  }
@@ -140,7 +153,7 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
140
153
  };
141
154
  }();
142
155
  void fetchSiteDisplayNames();
143
- }, []);
156
+ }, [fireEvent]);
144
157
  (0, _react.useEffect)(function () {
145
158
  if (!cloudId && selectedJiraSite) {
146
159
  setCloudId(selectedJiraSite.cloudId);
@@ -211,7 +224,9 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
211
224
  setCurrentViewMode(selectedMode);
212
225
  };
213
226
  var issueLikeDataTableView = (0, _react.useMemo)(function () {
214
- return (0, _react2.jsx)(_issueLikeTable.IssueLikeDataTableView, {
227
+ return (0, _react2.jsx)("div", {
228
+ css: contentContainerStyles
229
+ }, (0, _react2.jsx)(_issueLikeTable.IssueLikeDataTableView, {
215
230
  testId: "jira-jql-datasource-table",
216
231
  status: status,
217
232
  columns: columns,
@@ -221,7 +236,7 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
221
236
  onNextPage: onNextPage,
222
237
  onLoadDatasourceDetails: loadDatasourceDetails,
223
238
  onVisibleColumnKeysChange: setVisibleColumnKeys
224
- });
239
+ }));
225
240
  }, [columns, defaultVisibleColumnKeys, hasNextPage, loadDatasourceDetails, onNextPage, responseItems, status, visibleColumnKeys]);
226
241
  var renderCountModeContent = (0, _react.useCallback)(function () {
227
242
  var url = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
@@ -258,9 +273,11 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
258
273
  return (0, _react2.jsx)(_noResults.NoResults, null);
259
274
  } else if (status === 'empty' || !columns.length) {
260
275
  // persist the empty state when making the initial /data request which contains the columns
261
- return (0, _react2.jsx)(_issueLikeTable.EmptyState, {
276
+ return (0, _react2.jsx)("div", {
277
+ css: contentContainerStyles
278
+ }, (0, _react2.jsx)(_issueLikeTable.EmptyState, {
262
279
  testId: "jira-jql-datasource-modal--empty-state"
263
- });
280
+ }));
264
281
  }
265
282
  var firstIssueUrl = retrieveUrlForSmartCardRender();
266
283
  if (responseItems.length === 1 && firstIssueUrl) {
@@ -303,9 +320,7 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
303
320
  isSearching: status === 'loading',
304
321
  parameters: parameters,
305
322
  onSearch: onSearch
306
- }), (0, _react2.jsx)("div", {
307
- css: contentContainerStyles
308
- }, currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent())), (0, _react2.jsx)(_modalDialog.ModalFooter, null, shouldShowIssueCount && (0, _react2.jsx)("div", {
323
+ }), currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent()), (0, _react2.jsx)(_modalDialog.ModalFooter, null, shouldShowIssueCount && (0, _react2.jsx)("div", {
309
324
  "data-testid": "jira-jql-datasource-modal-total-issues-count",
310
325
  css: issueCountStyles
311
326
  }, (0, _react2.jsx)(_reactIntlNext.FormattedNumber, {
@@ -324,4 +339,17 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
324
339
  testId: 'jira-jql-datasource-modal--insert-button'
325
340
  }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.modalMessages.insertIssuesButtonText)))));
326
341
  };
342
+ exports.PlainJiraIssuesConfigModal = PlainJiraIssuesConfigModal;
343
+ var analyticsContextAttributes = {
344
+ dataProvider: 'jira-issues'
345
+ };
346
+ var analyticsContextData = {
347
+ packageName: _version.name,
348
+ packageVersion: _version.version,
349
+ source: 'datasourceConfigModal'
350
+ };
351
+ var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
352
+ attributes: _objectSpread({}, analyticsContextAttributes)
353
+ });
354
+ var JiraIssuesConfigModal = (0, _analyticsNext.withAnalyticsContext)(contextData)(PlainJiraIssuesConfigModal);
327
355
  exports.JiraIssuesConfigModal = JiraIssuesConfigModal;
@@ -18,12 +18,13 @@ var _refresh = _interopRequireDefault(require("@atlaskit/icon/glyph/refresh"));
18
18
  var _colors = require("@atlaskit/theme/colors");
19
19
  var _messages = require("./messages");
20
20
  var _syncInfo = require("./sync-info");
21
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
21
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
22
22
  /** @jsx jsx */
23
- var FooterWrapper = _styled.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n padding: ", " 0;\n position: sticky;\n bottom: 0;\n background: ", ";\n border-top-style: solid;\n border-top-color: ", ";\n margin-top: -2px;\n align-self: center;\n"])), "var(--ds-space-250, 20px)", "var(--ds-background-input, ".concat(_colors.N0, ")"), "var(--ds-background-neutral, ".concat(_colors.N40, ")"));
24
- var IssueCounterWrapper = _styled.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: 10px;\n display: flex;\n align-self: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(_colors.N800, ")"));
25
- var SyncWrapper = _styled.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(_colors.N90, ")"));
26
- var SyncTextWrapper = _styled.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n margin-right: 5px;\n"])));
23
+ var FooterWrapper = _styled.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n padding: 0 ", ";\n box-sizing: border-box;\n background: ", ";\n"])), "var(--ds-space-200, 16px)", "var(--ds-background-input, ".concat(_colors.N0, ")"));
24
+ var TopBorderWrapper = _styled.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n box-sizing: border-box;\n justify-content: space-between;\n padding: ", " 0;\n border-top: 2px solid ", ";\n"])), "var(--ds-space-250, 20px)", "var(--ds-background-accent-gray-subtler, ".concat(_colors.N40, ")"));
25
+ var IssueCounterWrapper = _styled.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-self: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(_colors.N800, ")"));
26
+ var SyncWrapper = _styled.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n color: ", ";\n"])), "var(--ds-text-accent-gray, ".concat(_colors.N90, ")"));
27
+ var SyncTextWrapper = _styled.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin-right: 5px;\n"])));
27
28
  var TableFooter = function TableFooter(_ref) {
28
29
  var issueCount = _ref.issueCount,
29
30
  onRefresh = _ref.onRefresh,
@@ -44,7 +45,9 @@ var TableFooter = function TableFooter(_ref) {
44
45
  // ensure correct positioning since 'justify-content: space-between' is used).
45
46
  return onRefresh || showIssueCount ? (0, _react2.jsx)(FooterWrapper, {
46
47
  "data-testid": "table-footer"
47
- }, (0, _react2.jsx)(IssueCounterWrapper, null, showIssueCount && (0, _react2.jsx)(_heading.default, {
48
+ }, (0, _react2.jsx)(TopBorderWrapper, null, (0, _react2.jsx)(IssueCounterWrapper, {
49
+ "data-testid": 'issue-count-wrapper'
50
+ }, showIssueCount && (0, _react2.jsx)(_heading.default, {
48
51
  testId: "issue-count",
49
52
  level: "h400"
50
53
  }, (0, _react2.jsx)(_reactIntlNext.FormattedNumber, {
@@ -65,6 +68,6 @@ var TableFooter = function TableFooter(_ref) {
65
68
  }),
66
69
  isDisabled: isLoading,
67
70
  testId: "refresh-button"
68
- })))) : null;
71
+ }))))) : null;
69
72
  };
70
73
  exports.TableFooter = TableFooter;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.31.2",
3
+ "version": "0.32.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export const EVENT_CHANNEL = 'media';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ *
4
+ * Generates Typescript types for analytics events from analytics.spec.yaml
5
+ *
6
+ * @codegen <<SignedSource::819168596ba17484cadda969f8ecf82d>>
7
+ * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
+ */
9
+
10
+ const createEventPayload = (eventKey, ...[attributes]) => {
11
+ const [eventType, actionSubject, action, actionSubjectId] = eventKey.split('.');
12
+ if (eventType === 'screen') {
13
+ return {
14
+ eventType,
15
+ name: actionSubject,
16
+ action: 'viewed',
17
+ attributes: attributes
18
+ };
19
+ }
20
+ return {
21
+ eventType,
22
+ actionSubject,
23
+ action,
24
+ actionSubjectId,
25
+ attributes: attributes
26
+ };
27
+ };
28
+ export default createEventPayload;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ *
4
+ * Generates Typescript types for analytics events from analytics.spec.yaml
5
+ *
6
+ * @codegen <<SignedSource::415836762b378b7d79f3aff4ba051c14>>
7
+ * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
+ */
9
+ import { useCallback } from 'react';
10
+ import { useAnalyticsEvents as useAnalyticsNextEvents } from '@atlaskit/analytics-next';
11
+ import { EVENT_CHANNEL } from '../constants';
12
+ import createEventPayload from './create-event-payload';
13
+ export const useAnalyticsEvents = () => {
14
+ const {
15
+ createAnalyticsEvent
16
+ } = useAnalyticsNextEvents();
17
+ const fireEvent = useCallback((...params) => {
18
+ const event = createAnalyticsEvent(createEventPayload(...params));
19
+ event.fire(EVENT_CHANNEL);
20
+ }, [createAnalyticsEvent]);
21
+ return {
22
+ fireEvent
23
+ };
24
+ };
@@ -0,0 +1,3 @@
1
+ export { EVENT_CHANNEL } from './constants';
2
+ import { useAnalyticsEvents } from './generated/use-analytics-events';
3
+ export const useDatasourceAnalyticsEvents = () => useAnalyticsEvents();
@@ -1,7 +1,9 @@
1
1
  /** @jsx jsx */
2
+ import { useEffect } from 'react';
2
3
  import { jsx } from '@emotion/react';
3
4
  import { useIntl } from 'react-intl-next';
4
5
  import EmptyState from '@atlaskit/empty-state';
6
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
5
7
  import { AccessRequiredSVG } from './access-required-svg';
6
8
  import { loadingErrorMessages } from './messages';
7
9
  export const AccessRequired = ({
@@ -10,6 +12,14 @@ export const AccessRequired = ({
10
12
  const {
11
13
  formatMessage
12
14
  } = useIntl();
15
+ const {
16
+ fireEvent
17
+ } = useDatasourceAnalyticsEvents();
18
+ useEffect(() => {
19
+ fireEvent('ui.error.shown', {
20
+ reason: 'access'
21
+ });
22
+ }, [fireEvent]);
13
23
  return jsx(EmptyState, {
14
24
  header: siteName ? formatMessage(loadingErrorMessages.accessRequiredWithSite, {
15
25
  siteName
@@ -1,7 +1,9 @@
1
1
  /** @jsx jsx */
2
+ import { useEffect } from 'react';
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { FormattedMessage } from 'react-intl-next';
4
5
  import Button from '@atlaskit/button/standard-button';
6
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
5
7
  import { LoadingErrorSVG } from './loading-error-svg';
6
8
  import { loadingErrorMessages } from './messages';
7
9
  const errorContainerStyles = css({
@@ -25,6 +27,14 @@ const errorDescriptionStyles = css({
25
27
  export const LoadingError = ({
26
28
  onRefresh
27
29
  }) => {
30
+ const {
31
+ fireEvent
32
+ } = useDatasourceAnalyticsEvents();
33
+ useEffect(() => {
34
+ fireEvent('ui.error.shown', {
35
+ reason: 'network'
36
+ });
37
+ }, [fireEvent]);
28
38
  return jsx("div", {
29
39
  css: errorContainerStyles,
30
40
  "data-testid": "jira-jql-datasource--loading-error"
@@ -1,7 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
+ import { useEffect } from 'react';
3
4
  import { css, jsx } from '@emotion/react';
4
5
  import { FormattedMessage } from 'react-intl-next';
6
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
5
7
  import { LoadingErrorSVG } from './loading-error-svg';
6
8
  import { loadingErrorMessages } from './messages';
7
9
  const errorContainerStyles = css({
@@ -25,6 +27,14 @@ const errorDescriptionStyles = css({
25
27
  export const ModalLoadingError = ({
26
28
  url
27
29
  }) => {
30
+ const {
31
+ fireEvent
32
+ } = useDatasourceAnalyticsEvents();
33
+ useEffect(() => {
34
+ fireEvent('ui.error.shown', {
35
+ reason: 'network'
36
+ });
37
+ }, [fireEvent]);
28
38
  return jsx("div", {
29
39
  css: errorContainerStyles,
30
40
  "data-testid": "jira-jql-datasource-modal--loading-error"
@@ -1,7 +1,9 @@
1
1
  /** @jsx jsx */
2
+ import { useEffect } from 'react';
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { FormattedMessage } from 'react-intl-next';
4
5
  import Button from '@atlaskit/button/standard-button';
6
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
5
7
  import { loadingErrorMessages } from './messages';
6
8
  const noResultsContainerStyles = css({
7
9
  display: 'grid',
@@ -21,6 +23,12 @@ const noResultsMessageStyles = css({
21
23
  export const NoResults = ({
22
24
  onRefresh
23
25
  }) => {
26
+ const {
27
+ fireEvent
28
+ } = useDatasourceAnalyticsEvents();
29
+ useEffect(() => {
30
+ fireEvent('ui.emptyResult.shown.datasource', {});
31
+ }, [fireEvent]);
24
32
  return jsx("div", {
25
33
  css: noResultsContainerStyles,
26
34
  "data-testid": "jira-jql-datasource-modal--no-results"
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { useEffect } from 'react';
3
- import { css, jsx } from '@emotion/react';
3
+ import { jsx } from '@emotion/react';
4
4
  import { useDatasourceTableState } from '../../hooks/useDatasourceTableState';
5
5
  import { AccessRequired } from '../common/error-state/access-required';
6
6
  import { LoadingError } from '../common/error-state/loading-error';
@@ -8,13 +8,6 @@ import { NoResults } from '../common/error-state/no-results';
8
8
  import { IssueLikeDataTableView } from '../issue-like-table';
9
9
  import EmptyState from '../issue-like-table/empty-state';
10
10
  import { TableFooter } from '../table-footer';
11
- const TableViewWrapperStyles = css({
12
- display: 'grid',
13
- position: 'relative',
14
- padding: "var(--ds-space-200, 16px)",
15
- paddingBottom: 0,
16
- boxSizing: 'border-box'
17
- });
18
11
  export const DatasourceTableView = ({
19
12
  datasourceId,
20
13
  parameters,
@@ -59,9 +52,8 @@ export const DatasourceTableView = ({
59
52
  onRefresh: reset
60
53
  });
61
54
  }
62
- return columns.length > 0 ? jsx("div", {
63
- css: TableViewWrapperStyles
64
- }, jsx(IssueLikeDataTableView, {
55
+ const isDataReady = columns.length > 0;
56
+ return jsx("div", null, isDataReady ? jsx(IssueLikeDataTableView, {
65
57
  testId: 'datasource-table-view',
66
58
  hasNextPage: hasNextPage,
67
59
  items: responseItems,
@@ -70,18 +62,14 @@ export const DatasourceTableView = ({
70
62
  status: status,
71
63
  columns: columns,
72
64
  visibleColumnKeys: visibleColumnKeys || defaultVisibleColumnKeys,
73
- onVisibleColumnKeysChange: onVisibleColumnKeysChange
74
- }), jsx(TableFooter, {
75
- issueCount: totalCount,
76
- onRefresh: reset,
77
- isLoading: status === 'loading'
78
- })) : jsx("div", {
79
- css: TableViewWrapperStyles
80
- }, jsx(EmptyState, {
65
+ onVisibleColumnKeysChange: onVisibleColumnKeysChange,
66
+ scrollableContainerHeight: 590
67
+ }) : jsx(EmptyState, {
81
68
  testId: "datasource-table-view-skeleton",
82
69
  isCompact: true
83
70
  }), jsx(TableFooter, {
71
+ issueCount: isDataReady ? totalCount : undefined,
84
72
  onRefresh: reset,
85
- isLoading: true
73
+ isLoading: !isDataReady || status === 'loading'
86
74
  }));
87
75
  };
@@ -9,7 +9,6 @@ import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
9
9
  import { CheckboxOption, PopupSelect } from '@atlaskit/select';
10
10
  import { columnPickerMessages } from './messages';
11
11
  export const ColumnPicker = ({
12
- isDatasourceLoading,
13
12
  columns,
14
13
  selectedColumnKeys,
15
14
  onSelectedColumnKeysChange,
@@ -102,8 +101,7 @@ export const ColumnPicker = ({
102
101
  })),
103
102
  spacing: "compact",
104
103
  appearance: "subtle",
105
- testId: "column-picker-trigger-button",
106
- isDisabled: isDatasourceLoading
104
+ testId: "column-picker-trigger-button"
107
105
  }))
108
106
  });
109
107
  };
@@ -0,0 +1,46 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ import { css, jsx } from '@emotion/react';
4
+ import styled from '@emotion/styled';
5
+ import { TableHeading } from './styled';
6
+ const maxWidth = '200px';
7
+ const firstLastChildOverride = `
8
+ &:first-of-type, &:last-of-type {
9
+ padding-left: ${"var(--ds-space-100, 8px)"};
10
+ padding-right: ${"var(--ds-space-100, 8px)"};
11
+ }
12
+ `;
13
+ const TablePreviewHeading = styled(TableHeading)`
14
+ overflow: hidden;
15
+ text-overflow: ellipsis;
16
+ white-space: nowrap;
17
+ background: ${"var(--ds-background-disabled, #091E4224)"};
18
+ color: ${"var(--ds-text-disabled, #091E424F)"};
19
+ max-width: ${maxWidth};
20
+ ${firstLastChildOverride}
21
+ `;
22
+ const TablePreviewCell = styled.td`
23
+ overflow: hidden;
24
+ text-overflow: ellipsis;
25
+ white-space: nowrap;
26
+ max-width: ${maxWidth};
27
+ padding: ${"var(--ds-space-050, 4px)"} ${"var(--ds-space-100, 8px)"};
28
+ ${firstLastChildOverride}
29
+ `;
30
+ const tableStyles = css({
31
+ background: "var(--ds-surface, #FFF)",
32
+ borderCollapse: 'separate',
33
+ borderSpacing: 0,
34
+ fontSize: "var(--ds-font-size-200, 16px)",
35
+ maxWidth
36
+ });
37
+ export const DragColumnPreview = ({
38
+ title,
39
+ rows
40
+ }) => {
41
+ return jsx("table", {
42
+ css: tableStyles
43
+ }, jsx("thead", null, jsx("tr", null, jsx(TablePreviewHeading, null, title))), jsx("tbody", null, rows.map((data, i) => jsx("tr", {
44
+ key: i
45
+ }, jsx(TablePreviewCell, null, data))), jsx("tr", null, jsx(TablePreviewCell, null, "..."))));
46
+ };
@@ -1,16 +1,16 @@
1
1
  /** @jsx jsx */
2
2
  import { useEffect, useRef, useState } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
+ import ReactDOM from 'react-dom';
4
5
  import invariant from 'tiny-invariant';
5
6
  import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
6
7
  import { attachClosestEdge, extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
7
8
  import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-indicator/box-without-terminal';
8
9
  import { draggable, dropTargetForElements, monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
9
10
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
11
+ import { offsetFromPointer } from '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer';
12
+ import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
10
13
  import { TableHeading } from './styled';
11
- const tableHeadingStyles = css({
12
- cursor: 'grab'
13
- });
14
14
  const tableHeadingStatusStyles = {
15
15
  idle: css({
16
16
  ':hover': {
@@ -30,7 +30,14 @@ const verticallyAlignedStyles = css({
30
30
  const dragHandleStyles = css({
31
31
  position: 'relative',
32
32
  display: 'flex',
33
- alignItems: 'center'
33
+ alignItems: 'center',
34
+ overflow: 'hidden',
35
+ width: 0,
36
+ transition: 'width 0.5s'
37
+ });
38
+ const dragHandleSpacerStyles = css({
39
+ width: 24,
40
+ transition: 'width 0.5s'
34
41
  });
35
42
  const dropTargetStyles = css({
36
43
  position: 'absolute',
@@ -41,18 +48,23 @@ const dropTargetStyles = css({
41
48
  const noPointerEventsStyles = css({
42
49
  pointerEvents: 'none'
43
50
  });
51
+ const idleState = {
52
+ type: 'idle'
53
+ };
54
+ const draggingState = {
55
+ type: 'dragging'
56
+ };
44
57
  export const DraggableTableHeading = ({
45
58
  children,
46
59
  id,
47
60
  index,
48
61
  tableId,
49
62
  dndPreviewHeight,
50
- maxWidth,
51
- onDragPreviewStart,
52
- onDragPreviewEnd
63
+ dragPreview,
64
+ maxWidth
53
65
  }) => {
54
66
  const ref = useRef(null);
55
- const [status, setStatus] = useState('idle');
67
+ const [state, setState] = useState(idleState);
56
68
  const [isDraggingAnyColumn, setIsDraggingAnyColumn] = useState(false);
57
69
  const [closestEdge, setClosestEdge] = useState(null);
58
70
  const dropTargetRef = useRef(null);
@@ -69,19 +81,38 @@ export const DraggableTableHeading = ({
69
81
  tableId
70
82
  };
71
83
  },
72
- onGenerateDragPreview() {
73
- setStatus('preview');
74
- onDragPreviewStart();
84
+ onGenerateDragPreview({
85
+ nativeSetDragImage
86
+ }) {
87
+ setCustomNativeDragPreview({
88
+ getOffset: offsetFromPointer({
89
+ x: '18px',
90
+ y: '18px'
91
+ }),
92
+ render: ({
93
+ container
94
+ }) => {
95
+ // Cause a `react` re-render to create your portal synchronously
96
+ setState({
97
+ type: 'preview',
98
+ container
99
+ });
100
+ // In our cleanup function: cause a `react` re-render to create remove your portal
101
+ // Note: you can also remove the portal in `onDragStart`,
102
+ // which is when the cleanup function is called
103
+ return () => setState(draggingState);
104
+ },
105
+ nativeSetDragImage
106
+ });
75
107
  },
76
108
  onDragStart() {
77
- setStatus('dragging');
78
- onDragPreviewEnd();
109
+ setState(draggingState);
79
110
  },
80
111
  onDrop() {
81
- setStatus('idle');
112
+ setState(idleState);
82
113
  }
83
114
  }));
84
- }, [id, index, onDragPreviewEnd, onDragPreviewStart, tableId]);
115
+ }, [id, index, tableId]);
85
116
 
86
117
  // Here we handle drop target, that in our case is absolutely positioned div that covers full width and height
87
118
  // of this column (has height of whole table). It sits on top of everything, but has `pointerEvents: 'none'` by default
@@ -145,7 +176,7 @@ export const DraggableTableHeading = ({
145
176
  }, [tableId]);
146
177
  return jsx(TableHeading, {
147
178
  ref: ref,
148
- css: [tableHeadingStyles, tableHeadingStatusStyles[status]],
179
+ css: [tableHeadingStatusStyles[state.type]],
149
180
  "data-testid": `${id}-column-heading`,
150
181
  style: {
151
182
  maxWidth
@@ -162,9 +193,13 @@ export const DraggableTableHeading = ({
162
193
  })), jsx("div", {
163
194
  css: verticallyAlignedStyles
164
195
  }, jsx("div", {
165
- css: dragHandleStyles
196
+ css: dragHandleStyles,
197
+ className: "issue-like-table-drag-handle"
166
198
  }, jsx(DragHandlerIcon, {
167
199
  label: `${id}-drag-icon`,
168
200
  size: "medium"
169
- })), children));
201
+ })), children, jsx("div", {
202
+ css: dragHandleSpacerStyles,
203
+ className: "issue-like-table-drag-handle-spacer"
204
+ })), state.type === 'preview' ? /*#__PURE__*/ReactDOM.createPortal(dragPreview, state.container) : null);
170
205
  };
@@ -5,6 +5,9 @@ import UserType from '../render-type/user';
5
5
  import { EmptyStateTableHeading } from '../styled';
6
6
  import Priority from './priority';
7
7
  import Type from './type';
8
+ const tableBodyStyles = css({
9
+ borderBottom: 0
10
+ });
8
11
  const baseColumns = [{
9
12
  key: 'type',
10
13
  width: 50
@@ -118,7 +121,9 @@ export default (({
118
121
  width: width,
119
122
  height: 13,
120
123
  borderRadius: 8
121
- }))))), jsx("tbody", null, rows.map(row => jsx("tr", {
124
+ }))))), jsx("tbody", {
125
+ css: tableBodyStyles
126
+ }, rows.map(row => jsx("tr", {
122
127
  key: row.id
123
128
  }, columnsToRender.map(column => jsx("td", {
124
129
  css: cellStyles,