@atlaskit/link-datasource 1.16.4 → 1.17.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 (38) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/analytics/constants.js +1 -1
  3. package/dist/cjs/hooks/useDatasourceTableState.js +83 -52
  4. package/dist/cjs/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +18 -11
  5. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +62 -17
  6. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.js +26 -3
  7. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/index.js +6 -3
  8. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/menu-list/errorMessage.js +39 -2
  9. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/menu-list/index.js +6 -2
  10. package/dist/es2019/analytics/constants.js +1 -1
  11. package/dist/es2019/hooks/useDatasourceTableState.js +40 -12
  12. package/dist/es2019/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +5 -1
  13. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +45 -18
  14. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.js +23 -3
  15. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/index.js +5 -3
  16. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/menu-list/errorMessage.js +33 -2
  17. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/menu-list/index.js +5 -1
  18. package/dist/esm/analytics/constants.js +1 -1
  19. package/dist/esm/hooks/useDatasourceTableState.js +83 -52
  20. package/dist/esm/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +18 -11
  21. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +63 -18
  22. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.js +26 -3
  23. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/index.js +7 -4
  24. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/menu-list/errorMessage.js +36 -2
  25. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/menu-list/index.js +6 -2
  26. package/dist/types/analytics/generated/analytics.types.d.ts +8 -1
  27. package/dist/types/services/cmdbService.utils.d.ts +1 -1
  28. package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +1 -0
  29. package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.d.ts +2 -1
  30. package/dist/types/ui/jira-issues-modal/basic-filters/ui/menu-list/errorMessage.d.ts +6 -1
  31. package/dist/types/ui/jira-issues-modal/basic-filters/ui/menu-list/index.d.ts +3 -1
  32. package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +8 -1
  33. package/dist/types-ts4.5/services/cmdbService.utils.d.ts +1 -1
  34. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +1 -0
  35. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.d.ts +2 -1
  36. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/menu-list/errorMessage.d.ts +6 -1
  37. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/menu-list/index.d.ts +3 -1
  38. package/package.json +3 -2
@@ -20,10 +20,14 @@ export var useFilterOptions = function useFilterOptions(_ref) {
20
20
  _useState6 = _slicedToArray(_useState5, 2),
21
21
  status = _useState6[0],
22
22
  setStatus = _useState6[1];
23
- var _useState7 = useState(undefined),
23
+ var _useState7 = useState([]),
24
24
  _useState8 = _slicedToArray(_useState7, 2),
25
- nextPageCursor = _useState8[0],
26
- setNextPageCursor = _useState8[1];
25
+ errors = _useState8[0],
26
+ setErrors = _useState8[1];
27
+ var _useState9 = useState(undefined),
28
+ _useState10 = _slicedToArray(_useState9, 2),
29
+ nextPageCursor = _useState10[0],
30
+ setNextPageCursor = _useState10[1];
27
31
  var initialData = useRef();
28
32
  var _useBasicFilterAGG = useBasicFilterAGG(),
29
33
  getFieldValues = _useBasicFilterAGG.getFieldValues;
@@ -66,12 +70,13 @@ export var useFilterOptions = function useFilterOptions(_ref) {
66
70
  case 13:
67
71
  response = _context.t0;
68
72
  if (!(response.errors && response.errors.length > 0)) {
69
- _context.next = 17;
73
+ _context.next = 18;
70
74
  break;
71
75
  }
72
76
  setStatus('rejected');
77
+ setErrors(response.errors);
73
78
  return _context.abrupt("return");
74
- case 17:
79
+ case 18:
75
80
  if (isNewSearch) {
76
81
  setFilterOptions(mapFieldValuesToFilterOptions(response));
77
82
  if (isRequestLikeInitialSearch) {
@@ -87,23 +92,25 @@ export var useFilterOptions = function useFilterOptions(_ref) {
87
92
  setTotalCount(mapFieldValuesToTotalCount(response));
88
93
  setNextPageCursor(mapFieldValuesToPageCursor(response));
89
94
  setStatus('resolved');
90
- _context.next = 26;
95
+ _context.next = 28;
91
96
  break;
92
- case 23:
93
- _context.prev = 23;
97
+ case 24:
98
+ _context.prev = 24;
94
99
  _context.t1 = _context["catch"](5);
100
+ setErrors([_context.t1]);
95
101
  setStatus('rejected');
96
- case 26:
102
+ case 28:
97
103
  case "end":
98
104
  return _context.stop();
99
105
  }
100
- }, _callee, null, [[5, 23]]);
106
+ }, _callee, null, [[5, 24]]);
101
107
  })), [cloudId, filterOptions, filterType, getFieldValues]);
102
108
  return {
103
109
  filterOptions: filterOptions,
104
110
  fetchFilterOptions: fetchFilterOptions,
105
111
  totalCount: totalCount,
106
112
  pageCursor: nextPageCursor,
107
- status: status
113
+ status: status,
114
+ errors: status === 'rejected' ? errors : []
108
115
  };
109
116
  };
@@ -1,10 +1,11 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
4
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
5
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
6
  var _excluded = ["isOpen"];
6
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
- import React, { useCallback, useEffect, useRef, useState } from 'react';
8
+ import React, { useCallback, useEffect, useState } from 'react';
8
9
  import { useIntl } from 'react-intl-next';
9
10
  import { useDebouncedCallback } from 'use-debounce';
10
11
  import { CheckboxOption, PopupSelect } from '@atlaskit/select';
@@ -31,7 +32,6 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
31
32
  isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
32
33
  var _useIntl = useIntl(),
33
34
  formatMessage = _useIntl.formatMessage;
34
- var pickerRef = useRef(null);
35
35
  var _useState = useState(''),
36
36
  _useState2 = _slicedToArray(_useState, 2),
37
37
  searchTerm = _useState2[0],
@@ -40,6 +40,10 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
40
40
  _useState4 = _slicedToArray(_useState3, 2),
41
41
  selectedOptions = _useState4[0],
42
42
  setSelectedOptions = _useState4[1];
43
+ var _useState5 = useState(selectedOptions),
44
+ _useState6 = _slicedToArray(_useState5, 2),
45
+ sortedOptions = _useState6[0],
46
+ setSortedOptions = _useState6[1];
43
47
  var _useFilterOptions = useFilterOptions({
44
48
  filterType: filterType,
45
49
  cloudId: cloudId
@@ -48,7 +52,8 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
48
52
  fetchFilterOptions = _useFilterOptions.fetchFilterOptions,
49
53
  totalCount = _useFilterOptions.totalCount,
50
54
  status = _useFilterOptions.status,
51
- pageCursor = _useFilterOptions.pageCursor;
55
+ pageCursor = _useFilterOptions.pageCursor,
56
+ errors = _useFilterOptions.errors;
52
57
  var _useDebouncedCallback = useDebouncedCallback(function (searchString) {
53
58
  fetchFilterOptions({
54
59
  searchString: searchString
@@ -79,14 +84,46 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
79
84
  setSelectedOptions(newValue);
80
85
  onSelectionChange(newValue);
81
86
  };
82
- var handleOpenPopup = useCallback(function () {
83
- if (status === 'empty' || status === 'rejected') {
84
- // if user searches and gets status as rejected, we want the dropdown to try load the request with searchString when the user reopens the dropdown
85
- fetchFilterOptions({
86
- searchString: searchTerm
87
+ var sortOptionsOnPopupOpen = useCallback(function () {
88
+ if (selectedOptions.length === 0) {
89
+ setSortedOptions(filterOptions);
90
+ return;
91
+ }
92
+ var nonSelectedOptions = filterOptions.filter(function (option) {
93
+ return !selectedOptions.find(function (selectedOption) {
94
+ return selectedOption.value === option.value;
95
+ });
96
+ });
97
+ var newOptions = [].concat(_toConsumableArray(selectedOptions), _toConsumableArray(nonSelectedOptions));
98
+ setSortedOptions(newOptions);
99
+ }, [selectedOptions, filterOptions]);
100
+ var sortOptionsOnResolve = useCallback(function () {
101
+ var newOptions = filterOptions.filter(function (option) {
102
+ return !sortedOptions.find(function (sortedOption) {
103
+ return sortedOption.value === option.value;
104
+ });
105
+ });
106
+ var shouldSetSortOptions = false;
107
+ if (sortedOptions.length !== filterOptions.length) {
108
+ shouldSetSortOptions = true;
109
+ } else {
110
+ sortedOptions.forEach(function (sortedOption) {
111
+ if (!filterOptions.some(function (filterOption) {
112
+ return filterOption.value === sortedOption.value;
113
+ })) {
114
+ shouldSetSortOptions = true;
115
+ }
87
116
  });
88
117
  }
89
- }, [fetchFilterOptions, searchTerm, status]);
118
+ if (shouldSetSortOptions) {
119
+ var sortedOptionsFiltered = sortedOptions.filter(function (sortedOption) {
120
+ return filterOptions.some(function (filterOption) {
121
+ return filterOption.value === sortedOption.value;
122
+ });
123
+ });
124
+ setSortedOptions([].concat(_toConsumableArray(sortedOptionsFiltered), _toConsumableArray(newOptions)));
125
+ }
126
+ }, [filterOptions, sortedOptions]);
90
127
  var handleShowMore = useCallback(function () {
91
128
  if (pageCursor) {
92
129
  fetchFilterOptions({
@@ -95,28 +132,34 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
95
132
  });
96
133
  }
97
134
  }, [fetchFilterOptions, pageCursor, searchTerm]);
135
+ var handleOpenPopup = useCallback(function () {
136
+ if (status === 'empty' || status === 'rejected') {
137
+ // if user searches and gets status as rejected, we want the dropdown to try load the request with searchString when the user reopens the dropdown
138
+ fetchFilterOptions({
139
+ searchString: searchTerm
140
+ });
141
+ } else if (status === 'resolved') {
142
+ sortOptionsOnPopupOpen();
143
+ }
144
+ }, [fetchFilterOptions, searchTerm, sortOptionsOnPopupOpen, status]);
98
145
  useEffect(function () {
99
146
  if (status === 'resolved') {
100
- var _pickerRef$current;
101
- // necessary to refocus the search input after the loading state
102
- pickerRef === null || pickerRef === void 0 || (_pickerRef$current = pickerRef.current) === null || _pickerRef$current === void 0 || (_pickerRef$current = _pickerRef$current.selectRef) === null || _pickerRef$current === void 0 || (_pickerRef$current = _pickerRef$current.inputRef) === null || _pickerRef$current === void 0 || _pickerRef$current.focus();
147
+ sortOptionsOnResolve();
103
148
  }
104
- }, [status]);
149
+ }, [sortOptionsOnResolve, status]);
105
150
  var filterOptionsLength = filterOptions.length;
106
151
  var isError = status === 'rejected';
107
152
  var isLoading = status === 'loading' || status === 'empty';
108
153
  var isLoadingMore = status === 'loadingMore';
109
154
  var isEmpty = status === 'resolved' && filterOptionsLength === 0;
155
+ var popupSelectOptions = isLoading || isError ? [] : sortedOptions; // if not set to [], then on loading, no loading UI will be shown
110
156
  var areAllResultsLoaded = filterOptions.length === totalCount;
111
157
  var shouldShowFooter = (status === 'resolved' || isLoadingMore) && filterOptions.length > 0; // footer should not disappear when there is an inline spinner for loading more data
112
158
  var shouldDisplayShowMoreButton = status === 'resolved' && !!pageCursor && !areAllResultsLoaded;
113
- var options = isLoading || isError ? [] : filterOptions; // if not set to [], for eg: on loading, no loading UI will be shown
114
-
115
159
  return /*#__PURE__*/React.createElement(PopupSelect, {
116
160
  isMulti: true,
117
161
  maxMenuWidth: 300,
118
162
  minMenuWidth: 300,
119
- ref: pickerRef,
120
163
  testId: "jlol-basic-filter-popup-select",
121
164
  inputId: "jlol-basic-filter-popup-select--input"
122
165
  /*
@@ -142,7 +185,8 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
142
185
  isLoading: isLoading,
143
186
  isLoadingMore: isLoadingMore,
144
187
  showMore: shouldDisplayShowMoreButton,
145
- handleShowMore: handleShowMore
188
+ handleShowMore: handleShowMore,
189
+ errors: errors
146
190
  }));
147
191
  },
148
192
  DropdownIndicator: CustomDropdownIndicator,
@@ -151,7 +195,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
151
195
  IndicatorSeparator: undefined // disables the | separator between search input and icon
152
196
  },
153
197
 
154
- options: options,
198
+ options: popupSelectOptions,
155
199
  value: selectedOptions,
156
200
  filterOption: noFilterOptions,
157
201
  formatOptionLabel: formatOptionLabel,
@@ -162,6 +206,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
162
206
  triggerProps = _objectWithoutProperties(_ref3, _excluded);
163
207
  return /*#__PURE__*/React.createElement(PopupTrigger, _extends({}, triggerProps, {
164
208
  filterType: filterType,
209
+ selectedOptions: selectedOptions,
165
210
  isSelected: isOpen,
166
211
  onClick: handleOpenPopup,
167
212
  isDisabled: isDisabled
@@ -1,23 +1,46 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
1
2
  import React, { forwardRef } from 'react';
2
3
  import { FormattedMessage } from 'react-intl-next';
4
+ import Badge from '@atlaskit/badge';
3
5
  import Button from '@atlaskit/button/standard-button';
4
6
  import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
7
+ import { Box, Flex, xcss } from '@atlaskit/primitives';
5
8
  import { asyncPopupSelectMessages } from './messages';
9
+ var triggerButtonLabelStyles = xcss({
10
+ textOverflow: 'ellipsis',
11
+ overflow: 'hidden',
12
+ maxWidth: '150px'
13
+ });
14
+ var badgeStyles = xcss({
15
+ marginLeft: 'space.050'
16
+ });
6
17
  var PopupTrigger = /*#__PURE__*/forwardRef(function (_ref, ref) {
7
18
  var filterType = _ref.filterType,
8
19
  isSelected = _ref.isSelected,
9
20
  isDisabled = _ref.isDisabled,
10
- onClick = _ref.onClick;
21
+ onClick = _ref.onClick,
22
+ selectedOptions = _ref.selectedOptions;
23
+ var _ref2 = selectedOptions || [],
24
+ _ref3 = _slicedToArray(_ref2, 1),
25
+ firstOption = _ref3[0];
26
+ var hasOptions = selectedOptions && selectedOptions.length > 0;
11
27
  return /*#__PURE__*/React.createElement(Button, {
12
28
  ref: ref,
13
29
  appearance: "default",
14
- isSelected: isSelected,
30
+ isSelected: isSelected || hasOptions,
15
31
  isDisabled: isDisabled,
16
32
  onClick: onClick,
17
33
  testId: "jlol-basic-filter-".concat(filterType, "-trigger"),
18
34
  iconAfter: /*#__PURE__*/React.createElement(ChevronDownIcon, {
19
35
  label: ""
20
36
  })
21
- }, /*#__PURE__*/React.createElement(FormattedMessage, asyncPopupSelectMessages["".concat(filterType, "Label")]));
37
+ }, /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(Box, {
38
+ xcss: triggerButtonLabelStyles
39
+ }, /*#__PURE__*/React.createElement(FormattedMessage, asyncPopupSelectMessages["".concat(filterType, "Label")]), firstOption && /*#__PURE__*/React.createElement(React.Fragment, null, ": ", firstOption.label)), selectedOptions && selectedOptions.length > 1 && /*#__PURE__*/React.createElement(Flex, {
40
+ xcss: badgeStyles,
41
+ alignItems: "center"
42
+ }, /*#__PURE__*/React.createElement(Badge, {
43
+ appearance: "primary"
44
+ }, "+", selectedOptions.length - 1))));
22
45
  });
23
46
  export default PopupTrigger;
@@ -1,5 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import React, { useEffect, useState } from 'react';
2
+ import React, { useCallback, useEffect, useState } from 'react';
3
3
  import { Flex, xcss } from '@atlaskit/primitives';
4
4
  import { isValidJql } from '../utils';
5
5
  import AsyncPopupSelect from './async-popup-select';
@@ -11,14 +11,17 @@ var BasicFilterContainer = function BasicFilterContainer(_ref) {
11
11
  var jql = _ref.jql,
12
12
  cloudId = _ref.cloudId;
13
13
  var _useState = useState([]),
14
- _useState2 = _slicedToArray(_useState, 1),
15
- selection = _useState2[0];
14
+ _useState2 = _slicedToArray(_useState, 2),
15
+ selection = _useState2[0],
16
+ setSelection = _useState2[1];
16
17
  useEffect(function () {
17
18
  if (isValidJql(jql)) {
18
19
  // hydrate hook call goes in here
19
20
  }
20
21
  }, [jql]);
21
- var handleSelectionChange = function handleSelectionChange() {};
22
+ var handleSelectionChange = useCallback(function (options) {
23
+ setSelection(options);
24
+ }, [setSelection]);
22
25
  return /*#__PURE__*/React.createElement(Flex, {
23
26
  xcss: basicFilterContainerStyles,
24
27
  gap: "space.100",
@@ -1,9 +1,43 @@
1
- import React from 'react';
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { useEffect } from 'react';
3
+ import { useDebouncedCallback } from 'use-debounce';
2
4
  import ErrorIcon from '@atlaskit/icon/glyph/error';
3
5
  import { N500 } from '@atlaskit/theme/colors';
6
+ import { useDatasourceAnalyticsEvents } from '../../../../../analytics';
7
+ import { SEARCH_DEBOUNCE_MS } from '../async-popup-select';
4
8
  import { asyncPopupSelectMessages } from './messages';
5
9
  import CustomSelectMessage from './selectMessage';
6
- var CustomErrorMessage = function CustomErrorMessage() {
10
+ var getErrorReasonType = function getErrorReasonType(errors) {
11
+ var _ref = errors || [],
12
+ _ref2 = _slicedToArray(_ref, 1),
13
+ error = _ref2[0];
14
+ if (error instanceof Error) {
15
+ return 'network';
16
+ }
17
+ if (errors && errors.length > 0) {
18
+ return 'agg';
19
+ }
20
+ return 'unknown';
21
+ };
22
+ var CustomErrorMessage = function CustomErrorMessage(_ref3) {
23
+ var filterType = _ref3.filterType,
24
+ errors = _ref3.errors;
25
+ var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
26
+ fireEvent = _useDatasourceAnalyti.fireEvent;
27
+
28
+ /**
29
+ * Debounce is required because our search is debounced
30
+ * ref: ./noOptionsMessage.tsx
31
+ */
32
+ var _useDebouncedCallback = useDebouncedCallback(function () {
33
+ fireEvent('ui.error.shown.basicSearchDropdown', {
34
+ filterType: filterType,
35
+ reason: getErrorReasonType(errors)
36
+ });
37
+ }, SEARCH_DEBOUNCE_MS),
38
+ _useDebouncedCallback2 = _slicedToArray(_useDebouncedCallback, 1),
39
+ debouncedAnalyticsCallback = _useDebouncedCallback2[0];
40
+ useEffect(debouncedAnalyticsCallback, [debouncedAnalyticsCallback]);
7
41
  return /*#__PURE__*/React.createElement(CustomSelectMessage, {
8
42
  icon: /*#__PURE__*/React.createElement(ErrorIcon, {
9
43
  primaryColor: "var(--ds-icon, ".concat(N500, ")"),
@@ -1,5 +1,5 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
- var _excluded = ["filterType", "isLoading", "isLoadingMore", "isError", "isEmpty", "showMore", "handleShowMore", "children"];
2
+ var _excluded = ["filterType", "isLoading", "isLoadingMore", "isError", "isEmpty", "errors", "showMore", "handleShowMore", "children"];
3
3
  import React from 'react';
4
4
  import { Flex } from '@atlaskit/primitives';
5
5
  import { components } from '@atlaskit/select';
@@ -14,6 +14,7 @@ var CustomMenuList = function CustomMenuList(_ref) {
14
14
  isLoadingMore = _ref.isLoadingMore,
15
15
  isError = _ref.isError,
16
16
  isEmpty = _ref.isEmpty,
17
+ errors = _ref.errors,
17
18
  showMore = _ref.showMore,
18
19
  handleShowMore = _ref.handleShowMore,
19
20
  children = _ref.children,
@@ -32,7 +33,10 @@ var CustomMenuList = function CustomMenuList(_ref) {
32
33
  return /*#__PURE__*/React.createElement(CustomDropdownLoadingMessage, null);
33
34
  }
34
35
  if (isError) {
35
- return /*#__PURE__*/React.createElement(CustomErrorMessage, null);
36
+ return /*#__PURE__*/React.createElement(CustomErrorMessage, {
37
+ filterType: filterType,
38
+ errors: errors
39
+ });
36
40
  }
37
41
  if (isEmpty) {
38
42
  return /*#__PURE__*/React.createElement(CustomNoOptionsMessage, {
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::ea736210c3d6e0528843ce49cebf0610>>
6
+ * @codegen <<SignedSource::ddaee20abebe8b4891d75f243120dce8>>
7
7
  * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
8
  */
9
9
  export type PackageMetaDataType = {
@@ -85,6 +85,10 @@ export type LinkViewedCountAttributesType = {
85
85
  export type EmptyResultShownBasicSearchDropdownAttributesType = {
86
86
  filterType: 'project' | 'assignee' | 'issuetype' | 'status';
87
87
  };
88
+ export type ErrorShownBasicSearchDropdownAttributesType = {
89
+ filterType: 'project' | 'assignee' | 'issuetype' | 'status';
90
+ reason: 'agg' | 'network' | 'unknown';
91
+ };
88
92
  export type AqlEditorSearchedAttributesType = {};
89
93
  export type AnalyticsEventAttributes = {
90
94
  /**
@@ -138,6 +142,9 @@ export type AnalyticsEventAttributes = {
138
142
  /**
139
143
  * Fired when the basic filter search results are empty */
140
144
  'ui.emptyResult.shown.basicSearchDropdown': EmptyResultShownBasicSearchDropdownAttributesType;
145
+ /**
146
+ * Fired when the basic filter search dropdown shows an error UI */
147
+ 'ui.error.shown.basicSearchDropdown': ErrorShownBasicSearchDropdownAttributesType;
141
148
  /**
142
149
  * Fired when search is initiated via the search icon or enter key press for aql editor input field. */
143
150
  'ui.aqlEditor.searched': AqlEditorSearchedAttributesType;
@@ -1,5 +1,5 @@
1
1
  export declare const mapFetchErrors: (error: any) => Error;
2
- export declare const getStatusCodeGroup: (error: Error) => "1xx" | "3xx" | "4xx" | "5xx" | "unknown";
2
+ export declare const getStatusCodeGroup: (error: Error) => "unknown" | "1xx" | "3xx" | "4xx" | "5xx";
3
3
  export declare class PermissionError extends Error {
4
4
  constructor(message: string);
5
5
  }
@@ -13,6 +13,7 @@ export interface FilterOptionsState {
13
13
  totalCount: number;
14
14
  pageCursor?: string;
15
15
  status: 'empty' | 'loading' | 'resolved' | 'rejected' | 'loadingMore';
16
+ errors: unknown[];
16
17
  }
17
18
  export declare const useFilterOptions: ({ filterType, cloudId, }: FilterOptionsProps) => FilterOptionsState;
18
19
  export {};
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import { BasicFilterFieldType } from '../../types';
2
+ import { BasicFilterFieldType, SelectOption } from '../../types';
3
3
  export interface PopupTriggerProps {
4
4
  filterType: BasicFilterFieldType;
5
+ selectedOptions?: ReadonlyArray<SelectOption>;
5
6
  isSelected?: boolean;
6
7
  isDisabled?: boolean;
7
8
  onClick?: () => void;
@@ -1,3 +1,8 @@
1
1
  /// <reference types="react" />
2
- declare const CustomErrorMessage: () => JSX.Element;
2
+ import { FilterOptionsState } from '../../hooks/useFilterOptions';
3
+ import { BasicFilterFieldType } from '../../types';
4
+ declare const CustomErrorMessage: ({ filterType, errors, }: {
5
+ filterType: BasicFilterFieldType;
6
+ errors?: unknown[] | undefined;
7
+ }) => JSX.Element;
3
8
  export default CustomErrorMessage;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { MenuListComponentProps } from '@atlaskit/select';
3
+ import { FilterOptionsState } from '../../hooks/useFilterOptions';
3
4
  import { BasicFilterFieldType, SelectOption } from '../../types';
4
5
  type CustomProps = {
5
6
  isError?: boolean;
@@ -9,6 +10,7 @@ type CustomProps = {
9
10
  showMore?: boolean;
10
11
  handleShowMore: () => void;
11
12
  filterType: BasicFilterFieldType;
13
+ errors?: FilterOptionsState['errors'];
12
14
  };
13
- declare const CustomMenuList: ({ filterType, isLoading, isLoadingMore, isError, isEmpty, showMore, handleShowMore, children, ...props }: MenuListComponentProps<SelectOption, true> & CustomProps) => JSX.Element;
15
+ declare const CustomMenuList: ({ filterType, isLoading, isLoadingMore, isError, isEmpty, errors, showMore, handleShowMore, children, ...props }: MenuListComponentProps<SelectOption, true> & CustomProps) => JSX.Element;
14
16
  export default CustomMenuList;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::ea736210c3d6e0528843ce49cebf0610>>
6
+ * @codegen <<SignedSource::ddaee20abebe8b4891d75f243120dce8>>
7
7
  * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
8
8
  */
9
9
  export type PackageMetaDataType = {
@@ -85,6 +85,10 @@ export type LinkViewedCountAttributesType = {
85
85
  export type EmptyResultShownBasicSearchDropdownAttributesType = {
86
86
  filterType: 'project' | 'assignee' | 'issuetype' | 'status';
87
87
  };
88
+ export type ErrorShownBasicSearchDropdownAttributesType = {
89
+ filterType: 'project' | 'assignee' | 'issuetype' | 'status';
90
+ reason: 'agg' | 'network' | 'unknown';
91
+ };
88
92
  export type AqlEditorSearchedAttributesType = {};
89
93
  export type AnalyticsEventAttributes = {
90
94
  /**
@@ -138,6 +142,9 @@ export type AnalyticsEventAttributes = {
138
142
  /**
139
143
  * Fired when the basic filter search results are empty */
140
144
  'ui.emptyResult.shown.basicSearchDropdown': EmptyResultShownBasicSearchDropdownAttributesType;
145
+ /**
146
+ * Fired when the basic filter search dropdown shows an error UI */
147
+ 'ui.error.shown.basicSearchDropdown': ErrorShownBasicSearchDropdownAttributesType;
141
148
  /**
142
149
  * Fired when search is initiated via the search icon or enter key press for aql editor input field. */
143
150
  'ui.aqlEditor.searched': AqlEditorSearchedAttributesType;
@@ -1,5 +1,5 @@
1
1
  export declare const mapFetchErrors: (error: any) => Error;
2
- export declare const getStatusCodeGroup: (error: Error) => "1xx" | "3xx" | "4xx" | "5xx" | "unknown";
2
+ export declare const getStatusCodeGroup: (error: Error) => "unknown" | "1xx" | "3xx" | "4xx" | "5xx";
3
3
  export declare class PermissionError extends Error {
4
4
  constructor(message: string);
5
5
  }
@@ -13,6 +13,7 @@ export interface FilterOptionsState {
13
13
  totalCount: number;
14
14
  pageCursor?: string;
15
15
  status: 'empty' | 'loading' | 'resolved' | 'rejected' | 'loadingMore';
16
+ errors: unknown[];
16
17
  }
17
18
  export declare const useFilterOptions: ({ filterType, cloudId, }: FilterOptionsProps) => FilterOptionsState;
18
19
  export {};
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import { BasicFilterFieldType } from '../../types';
2
+ import { BasicFilterFieldType, SelectOption } from '../../types';
3
3
  export interface PopupTriggerProps {
4
4
  filterType: BasicFilterFieldType;
5
+ selectedOptions?: ReadonlyArray<SelectOption>;
5
6
  isSelected?: boolean;
6
7
  isDisabled?: boolean;
7
8
  onClick?: () => void;
@@ -1,3 +1,8 @@
1
1
  /// <reference types="react" />
2
- declare const CustomErrorMessage: () => JSX.Element;
2
+ import { FilterOptionsState } from '../../hooks/useFilterOptions';
3
+ import { BasicFilterFieldType } from '../../types';
4
+ declare const CustomErrorMessage: ({ filterType, errors, }: {
5
+ filterType: BasicFilterFieldType;
6
+ errors?: unknown[] | undefined;
7
+ }) => JSX.Element;
3
8
  export default CustomErrorMessage;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { MenuListComponentProps } from '@atlaskit/select';
3
+ import { FilterOptionsState } from '../../hooks/useFilterOptions';
3
4
  import { BasicFilterFieldType, SelectOption } from '../../types';
4
5
  type CustomProps = {
5
6
  isError?: boolean;
@@ -9,6 +10,7 @@ type CustomProps = {
9
10
  showMore?: boolean;
10
11
  handleShowMore: () => void;
11
12
  filterType: BasicFilterFieldType;
13
+ errors?: FilterOptionsState['errors'];
12
14
  };
13
- declare const CustomMenuList: ({ filterType, isLoading, isLoadingMore, isError, isEmpty, showMore, handleShowMore, children, ...props }: MenuListComponentProps<SelectOption, true> & CustomProps) => JSX.Element;
15
+ declare const CustomMenuList: ({ filterType, isLoading, isLoadingMore, isError, isEmpty, errors, showMore, handleShowMore, children, ...props }: MenuListComponentProps<SelectOption, true> & CustomProps) => JSX.Element;
14
16
  export default CustomMenuList;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.16.4",
3
+ "version": "1.17.0",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -33,6 +33,7 @@
33
33
  "@atlaskit/adf-schema": "^32.0.0",
34
34
  "@atlaskit/analytics-next": "^9.1.3",
35
35
  "@atlaskit/avatar": "^21.4.0",
36
+ "@atlaskit/badge": "^15.1.16",
36
37
  "@atlaskit/button": "^16.16.0",
37
38
  "@atlaskit/editor-prosemirror": "1.1.0",
38
39
  "@atlaskit/empty-state": "^7.5.0",
@@ -46,7 +47,7 @@
46
47
  "@atlaskit/jql-editor-autocomplete-rest": "^2.0.0",
47
48
  "@atlaskit/link-client-extension": "^1.8.0",
48
49
  "@atlaskit/linking-common": "^4.18.0",
49
- "@atlaskit/linking-types": "^8.4.0",
50
+ "@atlaskit/linking-types": "^8.5.0",
50
51
  "@atlaskit/lozenge": "^11.4.0",
51
52
  "@atlaskit/modal-dialog": "^12.8.0",
52
53
  "@atlaskit/platform-feature-flags": "^0.2.4",