@atlaskit/link-datasource 3.9.0 → 3.10.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 (51) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/hooks/useDatasourceTableFlag.js +12 -3
  3. package/dist/cjs/state/actions/index.js +7 -4
  4. package/dist/cjs/ui/issue-like-table/edit-type/icon/index.js +134 -0
  5. package/dist/cjs/ui/issue-like-table/edit-type/index.js +25 -8
  6. package/dist/cjs/ui/issue-like-table/edit-type/status/index.js +34 -17
  7. package/dist/cjs/ui/issue-like-table/messages.js +10 -0
  8. package/dist/cjs/ui/issue-like-table/render-type/icon/index.js +5 -0
  9. package/dist/cjs/ui/issue-like-table/render-type/index.js +5 -1
  10. package/dist/cjs/ui/issue-like-table/render-type/new-icon/index.js +25 -0
  11. package/dist/cjs/ui/issue-like-table/shared-components/icon/index.js +42 -0
  12. package/dist/cjs/ui/table-footer/index.js +1 -2
  13. package/dist/es2019/hooks/useDatasourceTableFlag.js +12 -3
  14. package/dist/es2019/state/actions/index.js +6 -5
  15. package/dist/es2019/ui/issue-like-table/edit-type/icon/index.js +94 -0
  16. package/dist/es2019/ui/issue-like-table/edit-type/index.js +19 -6
  17. package/dist/es2019/ui/issue-like-table/edit-type/status/index.js +18 -6
  18. package/dist/es2019/ui/issue-like-table/messages.js +10 -0
  19. package/dist/es2019/ui/issue-like-table/render-type/icon/index.js +5 -0
  20. package/dist/es2019/ui/issue-like-table/render-type/index.js +3 -1
  21. package/dist/es2019/ui/issue-like-table/render-type/new-icon/index.js +18 -0
  22. package/dist/es2019/ui/issue-like-table/shared-components/icon/index.js +36 -0
  23. package/dist/es2019/ui/table-footer/index.js +1 -2
  24. package/dist/esm/hooks/useDatasourceTableFlag.js +12 -3
  25. package/dist/esm/state/actions/index.js +7 -4
  26. package/dist/esm/ui/issue-like-table/edit-type/icon/index.js +124 -0
  27. package/dist/esm/ui/issue-like-table/edit-type/index.js +25 -8
  28. package/dist/esm/ui/issue-like-table/edit-type/status/index.js +34 -17
  29. package/dist/esm/ui/issue-like-table/messages.js +10 -0
  30. package/dist/esm/ui/issue-like-table/render-type/icon/index.js +5 -0
  31. package/dist/esm/ui/issue-like-table/render-type/index.js +5 -1
  32. package/dist/esm/ui/issue-like-table/render-type/new-icon/index.js +18 -0
  33. package/dist/esm/ui/issue-like-table/shared-components/icon/index.js +35 -0
  34. package/dist/esm/ui/table-footer/index.js +1 -2
  35. package/dist/types/hooks/useDatasourceTableFlag.d.ts +1 -0
  36. package/dist/types/ui/issue-like-table/edit-type/icon/index.d.ts +14 -0
  37. package/dist/types/ui/issue-like-table/edit-type/index.d.ts +2 -1
  38. package/dist/types/ui/issue-like-table/messages.d.ts +10 -0
  39. package/dist/types/ui/issue-like-table/render-type/icon/index.d.ts +4 -0
  40. package/dist/types/ui/issue-like-table/render-type/new-icon/index.d.ts +9 -0
  41. package/dist/types/ui/issue-like-table/shared-components/icon/index.d.ts +23 -0
  42. package/dist/types/ui/issue-like-table/types.d.ts +7 -0
  43. package/dist/types-ts4.5/hooks/useDatasourceTableFlag.d.ts +1 -0
  44. package/dist/types-ts4.5/ui/issue-like-table/edit-type/icon/index.d.ts +14 -0
  45. package/dist/types-ts4.5/ui/issue-like-table/edit-type/index.d.ts +2 -1
  46. package/dist/types-ts4.5/ui/issue-like-table/messages.d.ts +10 -0
  47. package/dist/types-ts4.5/ui/issue-like-table/render-type/icon/index.d.ts +4 -0
  48. package/dist/types-ts4.5/ui/issue-like-table/render-type/new-icon/index.d.ts +9 -0
  49. package/dist/types-ts4.5/ui/issue-like-table/shared-components/icon/index.d.ts +23 -0
  50. package/dist/types-ts4.5/ui/issue-like-table/types.d.ts +7 -0
  51. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 3.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#161781](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/161781)
8
+ [`86ee3866560f2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/86ee3866560f2) -
9
+ [ux] EDM-10114 Add support for priority dropdown in datasources
10
+ - [#163853](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/163853)
11
+ [`726e9811f22b4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/726e9811f22b4) -
12
+ [ux] Adding error flag when `executeFetch` request fails
13
+
14
+ ## 3.9.1
15
+
16
+ ### Patch Changes
17
+
18
+ - [#164965](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/164965)
19
+ [`99d00d17f1e68`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/99d00d17f1e68) -
20
+ Internal refactor behind ff - Fixes `executeFetch` being fired after selecting item from dropdpwn
21
+ list
22
+ - [#164465](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/164465)
23
+ [`ef019ecbcb056`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ef019ecbcb056) -
24
+ Feature flag removed - platform.linking-platform.datasource.limit-total-results_8wqcd
25
+ - Updated dependencies
26
+
3
27
  ## 3.9.0
4
28
 
5
29
  ### Minor Changes
@@ -26,7 +26,7 @@ var getErrorReason = function getErrorReason(status) {
26
26
  return 'request_failed';
27
27
  }
28
28
  };
29
- var getGenericErrorMessage = function getGenericErrorMessage(status) {
29
+ var getExecuteActionErrorMessage = function getExecuteActionErrorMessage(status) {
30
30
  switch (status) {
31
31
  case 403:
32
32
  return {
@@ -40,6 +40,15 @@ var getGenericErrorMessage = function getGenericErrorMessage(status) {
40
40
  };
41
41
  }
42
42
  };
43
+ var getFetchActionErrorMessage = function getFetchActionErrorMessage(status) {
44
+ switch (status) {
45
+ default:
46
+ return {
47
+ title: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.fetchActionErrorGenericTitle),
48
+ description: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.fetchActionErrorGenericDescription)
49
+ };
50
+ }
51
+ };
43
52
  var useDatasourceTableFlag = exports.useDatasourceTableFlag = function useDatasourceTableFlag(options) {
44
53
  var _useFlags = (0, _flag.useFlags)(),
45
54
  showFlag = _useFlags.showFlag;
@@ -55,11 +64,11 @@ var useDatasourceTableFlag = exports.useDatasourceTableFlag = function useDataso
55
64
  }),
56
65
  id: (0, _uuid.default)(),
57
66
  isAutoDismiss: true
58
- }, getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status)), args));
67
+ }, options !== null && options !== void 0 && options.isFetchAction ? getFetchActionErrorMessage(args === null || args === void 0 ? void 0 : args.status) : getExecuteActionErrorMessage(args === null || args === void 0 ? void 0 : args.status)), args));
59
68
  fireEvent('ui.error.shown.inlineEdit', {
60
69
  reason: getErrorReason(args === null || args === void 0 ? void 0 : args.status)
61
70
  });
62
- }, [fireEvent, showFlag]);
71
+ }, [fireEvent, options === null || options === void 0 ? void 0 : options.isFetchAction, showFlag]);
63
72
  return {
64
73
  showErrorFlag: showErrorFlag
65
74
  };
@@ -206,12 +206,15 @@ var useExecuteAtomicAction = exports.useExecuteAtomicAction = function useExecut
206
206
  var _useDatasourceClientE2 = (0, _linkClientExtension.useDatasourceClientExtension)(),
207
207
  executeAction = _useDatasourceClientE2.executeAtomicAction,
208
208
  invalidateDatasourceDataCacheByAri = _useDatasourceClientE2.invalidateDatasourceDataCacheByAri;
209
- var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
210
- fireEvent = _useDatasourceAnalyti.fireEvent;
211
- var _useErrorLogger = (0, _useErrorLogger2.default)({
209
+ var loggerProps = (0, _react.useMemo)(function () {
210
+ return {
212
211
  integrationKey: integrationKey
213
- }),
212
+ };
213
+ }, [integrationKey]);
214
+ var _useErrorLogger = (0, _useErrorLogger2.default)(loggerProps),
214
215
  captureError = _useErrorLogger.captureError;
216
+ var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
217
+ fireEvent = _useDatasourceAnalyti.fireEvent;
215
218
  var execute = (0, _react.useCallback)(function (value) {
216
219
  if (!schema) {
217
220
  throw new Error('No action schema found.');
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+ var _react = _interopRequireWildcard(require("react"));
14
+ var _linkingTypes = require("@atlaskit/linking-types");
15
+ var _select = _interopRequireDefault(require("@atlaskit/select"));
16
+ var _icon = require("../../shared-components/icon");
17
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
18
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
+ // FilterOptionOption is used in the filterOption function which is part of the public API, but the type itself is not exported
20
+ // eslint-disable-next-line import/no-extraneous-dependencies,no-restricted-imports
21
+
22
+ /**
23
+ * Should be gated by FF rollout of platform-datasources-enable-two-way-sync-priority
24
+ */
25
+ var PriorityEditType = function PriorityEditType(props) {
26
+ var _currentValue$values;
27
+ var currentValue = props.currentValue,
28
+ executeFetch = props.executeFetch;
29
+ var _usePriorityOptions = usePriorityOptions(currentValue, executeFetch),
30
+ options = _usePriorityOptions.options,
31
+ isLoading = _usePriorityOptions.isLoading;
32
+ return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({}, props, {
33
+ testId: "inline-edit-priority",
34
+ autoFocus: true,
35
+ defaultMenuIsOpen: true,
36
+ blurInputOnSelect: true,
37
+ getOptionValue: function getOptionValue(option) {
38
+ return option.label || '';
39
+ },
40
+ options: options,
41
+ isLoading: isLoading,
42
+ defaultValue: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
43
+ filterOption: filterOption,
44
+ formatOptionLabel: function formatOptionLabel(_ref) {
45
+ var source = _ref.source,
46
+ label = _ref.label,
47
+ text = _ref.text;
48
+ return /*#__PURE__*/_react.default.createElement(_icon.SharedIconComponent, {
49
+ iconUrl: source,
50
+ text: text,
51
+ label: label,
52
+ testId: "inline-edit-priority-option-".concat(label)
53
+ });
54
+ },
55
+ onChange: function onChange(e) {
56
+ return props.setEditValues({
57
+ type: 'icon',
58
+ values: e ? [e] : []
59
+ });
60
+ }
61
+ })));
62
+ };
63
+ var filterOption = function filterOption(option, inputValue) {
64
+ return option.label.toLowerCase().includes(inputValue.toLowerCase());
65
+ };
66
+ var usePriorityOptions = function usePriorityOptions(currentValue, executeFetch) {
67
+ var _useState = (0, _react.useState)({
68
+ isLoading: true,
69
+ options: []
70
+ }),
71
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
72
+ _useState2$ = _useState2[0],
73
+ options = _useState2$.options,
74
+ isLoading = _useState2$.isLoading,
75
+ setOptions = _useState2[1];
76
+ (0, _react.useEffect)(function () {
77
+ var isMounted = true;
78
+ loadOptions(currentValue, executeFetch).then(function (options) {
79
+ if (isMounted) {
80
+ setOptions({
81
+ isLoading: false,
82
+ options: options
83
+ });
84
+ }
85
+ });
86
+ return function () {
87
+ isMounted = false;
88
+ };
89
+ }, [currentValue, executeFetch]);
90
+ return {
91
+ options: options,
92
+ isLoading: isLoading
93
+ };
94
+ };
95
+
96
+ /**
97
+ * Load options for the select
98
+ */
99
+ var loadOptions = /*#__PURE__*/function () {
100
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_currentValue, executeFetch) {
101
+ var _yield$executeFetch, operationStatus, entities;
102
+ return _regenerator.default.wrap(function _callee$(_context) {
103
+ while (1) switch (_context.prev = _context.next) {
104
+ case 0:
105
+ if (executeFetch) {
106
+ _context.next = 2;
107
+ break;
108
+ }
109
+ return _context.abrupt("return", []);
110
+ case 2:
111
+ _context.next = 4;
112
+ return executeFetch({});
113
+ case 4:
114
+ _yield$executeFetch = _context.sent;
115
+ operationStatus = _yield$executeFetch.operationStatus;
116
+ entities = _yield$executeFetch.entities;
117
+ if (!(operationStatus === _linkingTypes.ActionOperationStatus.SUCCESS && entities)) {
118
+ _context.next = 9;
119
+ break;
120
+ }
121
+ return _context.abrupt("return", entities);
122
+ case 9:
123
+ return _context.abrupt("return", []);
124
+ case 10:
125
+ case "end":
126
+ return _context.stop();
127
+ }
128
+ }, _callee);
129
+ }));
130
+ return function loadOptions(_x, _x2) {
131
+ return _ref2.apply(this, arguments);
132
+ };
133
+ }();
134
+ var _default = exports.default = PriorityEditType;
@@ -6,12 +6,16 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.isEditTypeSupported = exports.isEditTypeSelectable = exports.editType = void 0;
9
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
11
  var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
10
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
13
  var _react = _interopRequireDefault(require("react"));
12
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
+ var _icon = _interopRequireDefault(require("./icon"));
13
16
  var _status = _interopRequireDefault(require("./status"));
14
17
  var _text = _interopRequireWildcard(require("./text"));
18
+ var _excluded = ["value"];
15
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
21
  // This is used in editor-card-plugin to identify if any type of inline edit is active.
@@ -34,12 +38,13 @@ var editType = exports.editType = function editType(_ref) {
34
38
  }));
35
39
  }
36
40
  };
37
- case 'status':
41
+ case 'icon':
38
42
  return {
39
43
  defaultValue: (0, _text.toTextValue)(defaultValue),
40
44
  editView: function editView(_ref3) {
41
- var fieldProps = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(_ref3), _ref3));
42
- return /*#__PURE__*/_react.default.createElement(_status.default, (0, _extends2.default)({}, fieldProps, {
45
+ var value = _ref3.value,
46
+ fieldProps = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
47
+ return /*#__PURE__*/_react.default.createElement(_icon.default, (0, _extends2.default)({}, fieldProps, {
43
48
  currentValue: currentValue,
44
49
  setEditValues: setEditValues,
45
50
  id: ACTIVE_INLINE_EDIT_ID,
@@ -47,17 +52,29 @@ var editType = exports.editType = function editType(_ref) {
47
52
  }));
48
53
  }
49
54
  };
50
- default:
55
+ case 'status':
51
56
  return {
52
- defaultValue: '',
53
- editView: function editView() {
54
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
57
+ defaultValue: (0, _text.toTextValue)(defaultValue),
58
+ editView: function editView(_ref4) {
59
+ var fieldProps = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(_ref4), _ref4));
60
+ return /*#__PURE__*/_react.default.createElement(_status.default, (0, _extends2.default)({}, fieldProps, {
61
+ currentValue: currentValue,
62
+ setEditValues: setEditValues,
63
+ id: ACTIVE_INLINE_EDIT_ID,
64
+ executeFetch: executeFetch
65
+ }));
55
66
  }
56
67
  };
57
68
  }
69
+ return {
70
+ defaultValue: '',
71
+ editView: function editView() {
72
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
73
+ }
74
+ };
58
75
  };
59
76
  var isEditTypeSupported = exports.isEditTypeSupported = function isEditTypeSupported(type) {
60
- var supportedEditType = (0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync-statuses') ? ['string', 'status'] : ['string'];
77
+ var supportedEditType = ['string'].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync-statuses') ? ['status'] : []), (0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync-priority') ? ['icon'] : []));
61
78
  return supportedEditType.includes(type);
62
79
  };
63
80
  var isEditTypeSelectable = exports.isEditTypeSelectable = function isEditTypeSelectable(type) {
@@ -16,6 +16,7 @@ var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
16
16
  var _select = _interopRequireDefault(require("@atlaskit/select"));
17
17
  var _ufoExperiences = require("../../../../analytics/ufoExperiences");
18
18
  var _datasourceExperienceId = require("../../../../contexts/datasource-experience-id");
19
+ var _useDatasourceTableFlag = require("../../../../hooks/useDatasourceTableFlag");
19
20
  var _inlineEdit = require("../../table-cell-content/inline-edit");
20
21
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
21
22
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -23,7 +24,9 @@ var StatusEditType = function StatusEditType(props) {
23
24
  var _currentValue$values;
24
25
  var currentValue = props.currentValue,
25
26
  executeFetch = props.executeFetch;
26
- var _useStatusOptions = useStatusOptions(currentValue, executeFetch),
27
+ var _useStatusOptions = useStatusOptions({
28
+ executeFetch: executeFetch
29
+ }),
27
30
  options = _useStatusOptions.options,
28
31
  isLoading = _useStatusOptions.isLoading,
29
32
  hasFailed = _useStatusOptions.hasFailed;
@@ -71,7 +74,9 @@ var StatusEditType = function StatusEditType(props) {
71
74
  var filterOption = function filterOption(option, inputValue) {
72
75
  return option.data.text.toLowerCase().includes(inputValue.toLowerCase());
73
76
  };
74
- var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
77
+ var useStatusOptions = function useStatusOptions(_ref) {
78
+ var fetchInputs = _ref.fetchInputs,
79
+ executeFetch = _ref.executeFetch;
75
80
  var _useState = (0, _react.useState)({
76
81
  isLoading: true,
77
82
  options: [],
@@ -83,9 +88,13 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
83
88
  isLoading = _useState2$.isLoading,
84
89
  hasFailed = _useState2$.hasFailed,
85
90
  setOptions = _useState2[1];
91
+ var _useDatasourceTableFl = (0, _useDatasourceTableFlag.useDatasourceTableFlag)({
92
+ isFetchAction: true
93
+ }),
94
+ showErrorFlag = _useDatasourceTableFl.showErrorFlag;
86
95
  (0, _react.useEffect)(function () {
87
96
  var isMounted = true;
88
- loadOptions(currentValue, executeFetch).then(function (options) {
97
+ loadOptions(fetchInputs, executeFetch).then(function (options) {
89
98
  if (isMounted) {
90
99
  setOptions({
91
100
  isLoading: false,
@@ -94,6 +103,7 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
94
103
  });
95
104
  }
96
105
  }).catch(function (err) {
106
+ showErrorFlag();
97
107
  setOptions({
98
108
  isLoading: false,
99
109
  options: [],
@@ -103,7 +113,7 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
103
113
  return function () {
104
114
  isMounted = false;
105
115
  };
106
- }, [currentValue, executeFetch]);
116
+ }, [fetchInputs, executeFetch, showErrorFlag]);
107
117
  return {
108
118
  options: options,
109
119
  isLoading: isLoading,
@@ -111,28 +121,35 @@ var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
111
121
  };
112
122
  };
113
123
  var loadOptions = /*#__PURE__*/function () {
114
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(currentValue, executeFetch) {
115
- var result, operationStatus, entities;
124
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
125
+ var fetchInputs,
126
+ executeFetch,
127
+ result,
128
+ operationStatus,
129
+ entities,
130
+ _args = arguments;
116
131
  return _regenerator.default.wrap(function _callee$(_context) {
117
132
  while (1) switch (_context.prev = _context.next) {
118
133
  case 0:
134
+ fetchInputs = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
135
+ executeFetch = _args.length > 1 ? _args[1] : undefined;
119
136
  if (!executeFetch) {
120
- _context.next = 9;
137
+ _context.next = 11;
121
138
  break;
122
139
  }
123
- _context.next = 3;
124
- return executeFetch({});
125
- case 3:
140
+ _context.next = 5;
141
+ return executeFetch(fetchInputs);
142
+ case 5:
126
143
  result = _context.sent;
127
144
  operationStatus = result.operationStatus, entities = result.entities;
128
145
  if (!(operationStatus === _linkingTypes.ActionOperationStatus.FAILURE)) {
129
- _context.next = 7;
146
+ _context.next = 9;
130
147
  break;
131
148
  }
132
149
  throw new Error('Failed to fetch status options');
133
- case 7:
150
+ case 9:
134
151
  if (!entities) {
135
- _context.next = 9;
152
+ _context.next = 11;
136
153
  break;
137
154
  }
138
155
  return _context.abrupt("return", entities.map(function (entity) {
@@ -143,16 +160,16 @@ var loadOptions = /*#__PURE__*/function () {
143
160
  transitionId: entity.transitionId
144
161
  };
145
162
  }));
146
- case 9:
163
+ case 11:
147
164
  return _context.abrupt("return", []);
148
- case 10:
165
+ case 12:
149
166
  case "end":
150
167
  return _context.stop();
151
168
  }
152
169
  }, _callee);
153
170
  }));
154
- return function loadOptions(_x, _x2) {
155
- return _ref.apply(this, arguments);
171
+ return function loadOptions() {
172
+ return _ref2.apply(this, arguments);
156
173
  };
157
174
  }();
158
175
  var _default = exports.default = StatusEditType;
@@ -26,6 +26,16 @@ var issueLikeTableMessages = exports.issueLikeTableMessages = (0, _reactIntlNext
26
26
  description: 'Generic error message title shown when updating issue field fails',
27
27
  defaultMessage: 'Something went wrong'
28
28
  },
29
+ fetchActionErrorGenericDescription: {
30
+ id: 'linkDataSource.issue-line-table.fetch-action-error-generic-description',
31
+ description: 'Generic error message description shown when fetching inline edit dropdown field fails',
32
+ defaultMessage: 'Wait a few minutes, then try again. Check your project settings or contact support if this keeps happening.'
33
+ },
34
+ fetchActionErrorGenericTitle: {
35
+ id: 'linkDataSource.issue-line-table.fetch-action-error-generic-title',
36
+ description: 'Generic error message title shown when fetching inline edit dropdown field fails',
37
+ defaultMessage: 'We’re having trouble fetching options'
38
+ },
29
39
  wrapText: {
30
40
  id: 'linkDataSource.issue-line-table.wrap-text',
31
41
  description: 'Table header Dropdown item for making whole column to wrap text',
@@ -25,6 +25,11 @@ var textWrapperStyles = (0, _primitives.xcss)({
25
25
  });
26
26
  var ICON_TYPE_TEST_ID = exports.ICON_TYPE_TEST_ID = 'link-datasource-render-type--icon';
27
27
  var ICON_TYPE_TEXT_TEST_ID = exports.ICON_TYPE_TEXT_TEST_ID = "".concat(ICON_TYPE_TEST_ID, "-text");
28
+
29
+ /**
30
+ * @deprecated: To be cleaned up and replaced with new-icon after
31
+ * `platform-datasources-enable-two-way-sync-priority` rollout.
32
+ */
28
33
  var IconRenderType = function IconRenderType(_ref) {
29
34
  var label = _ref.label,
30
35
  text = _ref.text,
@@ -8,10 +8,12 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.stringifyType = exports.renderType = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _boolean = _interopRequireDefault(require("./boolean"));
12
13
  var _dateTime = _interopRequireWildcard(require("./date-time"));
13
14
  var _icon = _interopRequireDefault(require("./icon"));
14
15
  var _link = _interopRequireDefault(require("./link"));
16
+ var _newIcon = _interopRequireDefault(require("./new-icon"));
15
17
  var _number = _interopRequireDefault(require("./number"));
16
18
  var _richtext = _interopRequireWildcard(require("./richtext"));
17
19
  var _status = _interopRequireDefault(require("./status"));
@@ -75,7 +77,9 @@ var renderType = exports.renderType = function renderType(item) {
75
77
  });
76
78
  });
77
79
  case 'icon':
78
- return item.values.map(function (iconValue) {
80
+ return (0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync-priority') ? item.values.map(function (iconValue) {
81
+ return /*#__PURE__*/_react.default.createElement(_newIcon.default, iconValue);
82
+ }) : item.values.map(function (iconValue) {
79
83
  return /*#__PURE__*/_react.default.createElement(_icon.default, iconValue);
80
84
  });
81
85
  case 'link':
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = exports.ICON_TYPE_TEXT_TEST_ID = exports.ICON_TYPE_TEST_ID = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _icon = require("../../shared-components/icon");
10
+ var ICON_TYPE_TEST_ID = exports.ICON_TYPE_TEST_ID = 'link-datasource-render-type--icon';
11
+ var ICON_TYPE_TEXT_TEST_ID = exports.ICON_TYPE_TEXT_TEST_ID = "".concat(ICON_TYPE_TEST_ID, "-text");
12
+ var IconRenderType = function IconRenderType(_ref) {
13
+ var label = _ref.label,
14
+ text = _ref.text,
15
+ source = _ref.source,
16
+ _ref$testId = _ref.testId,
17
+ testId = _ref$testId === void 0 ? ICON_TYPE_TEST_ID : _ref$testId;
18
+ return /*#__PURE__*/_react.default.createElement(_icon.SharedIconComponent, {
19
+ testId: testId,
20
+ iconUrl: source,
21
+ label: label,
22
+ text: text
23
+ });
24
+ };
25
+ var _default = exports.default = IconRenderType;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.SharedIconComponent = SharedIconComponent;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _primitives = require("@atlaskit/primitives");
10
+ var labelStyles = (0, _primitives.xcss)({
11
+ overflow: 'hidden',
12
+ textOverflow: 'ellipsis',
13
+ width: '100%'
14
+ });
15
+ /**
16
+ * Renders a icon and label.
17
+ * If the text is undefined, render the capitalised label.
18
+ */
19
+ function SharedIconComponent(_ref) {
20
+ var iconUrl = _ref.iconUrl,
21
+ label = _ref.label,
22
+ text = _ref.text,
23
+ testId = _ref.testId;
24
+ var displayText = text === undefined || text === '' ? label ? label.charAt(0).toUpperCase() + label.slice(1) : undefined : text;
25
+ return /*#__PURE__*/_react.default.createElement(_primitives.Flex, {
26
+ gap: "space.100",
27
+ alignItems: "center",
28
+ testId: testId
29
+ }, /*#__PURE__*/_react.default.createElement(_primitives.Inline, null, /*#__PURE__*/_react.default.createElement("img", {
30
+ src: iconUrl,
31
+ alt: label
32
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
33
+ ,
34
+ style: {
35
+ minWidth: '24px',
36
+ maxWidth: '24px'
37
+ } // having just width: '24px' shrinks it when table width is reduced
38
+ })), displayText && /*#__PURE__*/_react.default.createElement(_primitives.Box, {
39
+ xcss: labelStyles,
40
+ testId: "".concat(testId, "-text")
41
+ }, displayText));
42
+ }
@@ -13,7 +13,6 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
13
13
  var _reactIntlNext = require("react-intl-next");
14
14
  var _button = _interopRequireDefault(require("@atlaskit/button"));
15
15
  var _refresh = _interopRequireDefault(require("@atlaskit/icon/core/migration/refresh"));
16
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
16
  var _primitives = require("@atlaskit/primitives");
18
17
  var _colors = require("@atlaskit/theme/colors");
19
18
  var _assetsModal = require("../assets-modal");
@@ -85,7 +84,7 @@ var TableFooter = exports.TableFooter = function TableFooter(_ref) {
85
84
  // ensure correct positioning since 'justify-content: space-between' is used).
86
85
  return onRefresh || showItemCount ? (0, _react2.jsx)(FooterWrapper, {
87
86
  "data-testid": "table-footer"
88
- }, (0, _react2.jsx)(TopBorderWrapper, null, showItemCount && (0, _react2.jsx)(_primitives.Flex, null, datasourceId === _assetsModal.ASSETS_LIST_OF_LINKS_DATASOURCE_ID && (0, _platformFeatureFlags.fg)('platform.linking-platform.datasource.limit-total-results_8wqcd') ? (0, _react2.jsx)(_searchCount.AssetsItemCount, {
87
+ }, (0, _react2.jsx)(TopBorderWrapper, null, showItemCount && (0, _react2.jsx)(_primitives.Flex, null, datasourceId === _assetsModal.ASSETS_LIST_OF_LINKS_DATASOURCE_ID ? (0, _react2.jsx)(_searchCount.AssetsItemCount, {
89
88
  searchCount: itemCount,
90
89
  url: url,
91
90
  testId: "item-count"
@@ -13,7 +13,7 @@ const getErrorReason = status => {
13
13
  return 'request_failed';
14
14
  }
15
15
  };
16
- const getGenericErrorMessage = status => {
16
+ const getExecuteActionErrorMessage = status => {
17
17
  switch (status) {
18
18
  case 403:
19
19
  return {
@@ -27,6 +27,15 @@ const getGenericErrorMessage = status => {
27
27
  };
28
28
  }
29
29
  };
30
+ const getFetchActionErrorMessage = status => {
31
+ switch (status) {
32
+ default:
33
+ return {
34
+ title: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.fetchActionErrorGenericTitle),
35
+ description: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.fetchActionErrorGenericDescription)
36
+ };
37
+ }
38
+ };
30
39
  export const useDatasourceTableFlag = options => {
31
40
  const {
32
41
  showFlag
@@ -44,13 +53,13 @@ export const useDatasourceTableFlag = options => {
44
53
  }),
45
54
  id: uuid(),
46
55
  isAutoDismiss: true,
47
- ...getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status),
56
+ ...(options !== null && options !== void 0 && options.isFetchAction ? getFetchActionErrorMessage(args === null || args === void 0 ? void 0 : args.status) : getExecuteActionErrorMessage(args === null || args === void 0 ? void 0 : args.status)),
48
57
  ...args
49
58
  });
50
59
  fireEvent('ui.error.shown.inlineEdit', {
51
60
  reason: getErrorReason(args === null || args === void 0 ? void 0 : args.status)
52
61
  });
53
- }, [fireEvent, showFlag]);
62
+ }, [fireEvent, options === null || options === void 0 ? void 0 : options.isFetchAction, showFlag]);
54
63
  return {
55
64
  showErrorFlag
56
65
  };
@@ -189,14 +189,15 @@ export const useExecuteAtomicAction = ({
189
189
  executeAtomicAction: executeAction,
190
190
  invalidateDatasourceDataCacheByAri
191
191
  } = useDatasourceClientExtension();
192
+ const loggerProps = useMemo(() => ({
193
+ integrationKey
194
+ }), [integrationKey]);
195
+ const {
196
+ captureError
197
+ } = useErrorLogger(loggerProps);
192
198
  const {
193
199
  fireEvent
194
200
  } = useDatasourceAnalyticsEvents();
195
- const {
196
- captureError
197
- } = useErrorLogger({
198
- integrationKey
199
- });
200
201
  const execute = useCallback(value => {
201
202
  if (!schema) {
202
203
  throw new Error('No action schema found.');