@atlaskit/link-datasource 1.27.3 → 1.28.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 (126) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/ui/common/modal/popup-select/constants.js +8 -0
  3. package/dist/cjs/ui/common/modal/popup-select/footer.js +3 -2
  4. package/dist/cjs/ui/common/modal/popup-select/formatOptionLabel.js +11 -6
  5. package/dist/cjs/ui/common/modal/popup-select/index.js +2 -1
  6. package/dist/cjs/ui/common/modal/popup-select/menu-list/errorMessage.js +3 -3
  7. package/dist/cjs/ui/common/modal/popup-select/menu-list/index.js +4 -2
  8. package/dist/cjs/ui/common/modal/popup-select/menu-list/loadingMessage.js +3 -2
  9. package/dist/cjs/ui/common/modal/popup-select/menu-list/noOptionsMessage.js +3 -3
  10. package/dist/cjs/ui/common/modal/popup-select/menu-list/showMoreButton.js +1 -1
  11. package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.js +19 -0
  12. package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.js +89 -0
  13. package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js +49 -0
  14. package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.js +75 -0
  15. package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.js +32 -0
  16. package/dist/cjs/ui/confluence-search-modal/basic-filters/index.js +5 -3
  17. package/dist/cjs/ui/confluence-search-modal/basic-filters/types.js +11 -0
  18. package/dist/cjs/ui/confluence-search-modal/confluence-search-container/index.js +16 -1
  19. package/dist/cjs/ui/confluence-search-modal/modal/index.js +36 -15
  20. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +1 -0
  21. package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +6 -5
  22. package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +3 -3
  23. package/dist/cjs/ui/table-footer/index.js +8 -2
  24. package/dist/cjs/ui/table-footer/messages.js +5 -0
  25. package/dist/cjs/ui/table-footer/powered-by-jsm-assets/index.js +53 -0
  26. package/dist/es2019/ui/common/modal/popup-select/constants.js +2 -0
  27. package/dist/es2019/ui/common/modal/popup-select/footer.js +3 -2
  28. package/dist/es2019/ui/common/modal/popup-select/formatOptionLabel.js +8 -6
  29. package/dist/es2019/ui/common/modal/popup-select/index.js +2 -1
  30. package/dist/es2019/ui/common/modal/popup-select/menu-list/errorMessage.js +2 -2
  31. package/dist/es2019/ui/common/modal/popup-select/menu-list/index.js +4 -2
  32. package/dist/es2019/ui/common/modal/popup-select/menu-list/loadingMessage.js +4 -2
  33. package/dist/es2019/ui/common/modal/popup-select/menu-list/noOptionsMessage.js +2 -2
  34. package/dist/es2019/ui/common/modal/popup-select/menu-list/showMoreButton.js +1 -1
  35. package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.js +7 -0
  36. package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.js +68 -0
  37. package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js +43 -0
  38. package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.js +66 -0
  39. package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.js +26 -0
  40. package/dist/es2019/ui/confluence-search-modal/basic-filters/index.js +7 -2
  41. package/dist/es2019/ui/confluence-search-modal/basic-filters/types.js +5 -0
  42. package/dist/es2019/ui/confluence-search-modal/confluence-search-container/index.js +13 -1
  43. package/dist/es2019/ui/confluence-search-modal/modal/index.js +27 -8
  44. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +1 -0
  45. package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +4 -3
  46. package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +1 -1
  47. package/dist/es2019/ui/table-footer/index.js +7 -1
  48. package/dist/es2019/ui/table-footer/messages.js +5 -0
  49. package/dist/es2019/ui/table-footer/powered-by-jsm-assets/index.js +45 -0
  50. package/dist/esm/ui/common/modal/popup-select/constants.js +2 -0
  51. package/dist/esm/ui/common/modal/popup-select/footer.js +3 -2
  52. package/dist/esm/ui/common/modal/popup-select/formatOptionLabel.js +8 -6
  53. package/dist/esm/ui/common/modal/popup-select/index.js +2 -1
  54. package/dist/esm/ui/common/modal/popup-select/menu-list/errorMessage.js +2 -2
  55. package/dist/esm/ui/common/modal/popup-select/menu-list/index.js +4 -2
  56. package/dist/esm/ui/common/modal/popup-select/menu-list/loadingMessage.js +3 -2
  57. package/dist/esm/ui/common/modal/popup-select/menu-list/noOptionsMessage.js +2 -2
  58. package/dist/esm/ui/common/modal/popup-select/menu-list/showMoreButton.js +1 -1
  59. package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.js +9 -0
  60. package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.js +79 -0
  61. package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js +43 -0
  62. package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.js +68 -0
  63. package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.js +25 -0
  64. package/dist/esm/ui/confluence-search-modal/basic-filters/index.js +5 -3
  65. package/dist/esm/ui/confluence-search-modal/basic-filters/types.js +5 -0
  66. package/dist/esm/ui/confluence-search-modal/confluence-search-container/index.js +16 -1
  67. package/dist/esm/ui/confluence-search-modal/modal/index.js +36 -15
  68. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +1 -0
  69. package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +4 -3
  70. package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +1 -1
  71. package/dist/esm/ui/table-footer/index.js +8 -2
  72. package/dist/esm/ui/table-footer/messages.js +5 -0
  73. package/dist/esm/ui/table-footer/powered-by-jsm-assets/index.js +46 -0
  74. package/dist/types/analytics/generated/analytics.types.d.ts +7 -0
  75. package/dist/types/ui/common/modal/popup-select/constants.d.ts +2 -0
  76. package/dist/types/ui/common/modal/popup-select/footer.d.ts +2 -1
  77. package/dist/types/ui/common/modal/popup-select/index.d.ts +5 -4
  78. package/dist/types/ui/common/modal/popup-select/menu-list/index.d.ts +1 -1
  79. package/dist/types/ui/common/modal/popup-select/menu-list/loadingMessage.d.ts +3 -1
  80. package/dist/types/ui/common/modal/popup-select/types.d.ts +6 -1
  81. package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.d.ts +3 -0
  82. package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.d.ts +8 -0
  83. package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.d.ts +42 -0
  84. package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.d.ts +31 -0
  85. package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.d.ts +10 -0
  86. package/dist/types/ui/confluence-search-modal/basic-filters/index.d.ts +4 -1
  87. package/dist/types/ui/confluence-search-modal/basic-filters/types.d.ts +20 -0
  88. package/dist/types/ui/confluence-search-modal/confluence-search-container/index.d.ts +2 -1
  89. package/dist/types/ui/confluence-search-modal/types.d.ts +4 -1
  90. package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +2 -1
  91. package/dist/types/ui/jira-issues-modal/basic-filters/types.d.ts +1 -20
  92. package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +2 -2
  93. package/dist/types/ui/jira-issues-modal/basic-filters/ui/index.d.ts +2 -1
  94. package/dist/types/ui/jira-issues-modal/basic-filters/utils/transformers.d.ts +2 -1
  95. package/dist/types/ui/jira-issues-modal/jira-search-container/index.d.ts +0 -1
  96. package/dist/types/ui/table-footer/index.d.ts +2 -1
  97. package/dist/types/ui/table-footer/messages.d.ts +5 -0
  98. package/dist/types/ui/table-footer/powered-by-jsm-assets/index.d.ts +4 -0
  99. package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +7 -0
  100. package/dist/types-ts4.5/ui/common/modal/popup-select/constants.d.ts +2 -0
  101. package/dist/types-ts4.5/ui/common/modal/popup-select/footer.d.ts +2 -1
  102. package/dist/types-ts4.5/ui/common/modal/popup-select/index.d.ts +5 -4
  103. package/dist/types-ts4.5/ui/common/modal/popup-select/menu-list/index.d.ts +1 -1
  104. package/dist/types-ts4.5/ui/common/modal/popup-select/menu-list/loadingMessage.d.ts +3 -1
  105. package/dist/types-ts4.5/ui/common/modal/popup-select/types.d.ts +6 -1
  106. package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.d.ts +3 -0
  107. package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.d.ts +8 -0
  108. package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.d.ts +42 -0
  109. package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.d.ts +31 -0
  110. package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.d.ts +10 -0
  111. package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/index.d.ts +4 -1
  112. package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/types.d.ts +20 -0
  113. package/dist/types-ts4.5/ui/confluence-search-modal/confluence-search-container/index.d.ts +2 -1
  114. package/dist/types-ts4.5/ui/confluence-search-modal/types.d.ts +4 -1
  115. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +2 -1
  116. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/types.d.ts +1 -20
  117. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +2 -2
  118. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/index.d.ts +2 -1
  119. package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/utils/transformers.d.ts +2 -1
  120. package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/index.d.ts +0 -1
  121. package/dist/types-ts4.5/ui/table-footer/index.d.ts +2 -1
  122. package/dist/types-ts4.5/ui/table-footer/messages.d.ts +5 -0
  123. package/dist/types-ts4.5/ui/table-footer/powered-by-jsm-assets/index.d.ts +4 -0
  124. package/examples-helpers/buildAssetsIssuesTable.tsx +71 -0
  125. package/examples-helpers/useAssetsTableProps.tsx +57 -0
  126. package/package.json +10 -5
@@ -0,0 +1,66 @@
1
+ import styled from '@emotion/styled';
2
+ import { B400, B50, N0, N20, N30, R400 } from '@atlaskit/theme/colors';
3
+ export const PopupComponentContainer = styled.div({
4
+ boxSizing: 'border-box',
5
+ display: 'block',
6
+ flex: '1 1 auto',
7
+ overflow: 'visible',
8
+ background: `var(--ds-background-input, ${N0})`,
9
+ ':focus': {
10
+ outline: 'none'
11
+ },
12
+ boxShadow: "var(--ds-shadow-overlay, 0px 0px 1px 0px rgba(9, 30, 66, 0.31), 0px 3px 5px 0px rgba(9, 30, 66, 0.20))"
13
+ });
14
+ export const CustomDropdown = styled.div({
15
+ width: '360px',
16
+ background: `var(--ds-background-input, ${N0})`,
17
+ borderRadius: '3px',
18
+ boxShadow: "var(--ds-shadow-overlay, 0px 0px 1px 0px rgba(9, 30, 66, 0.31), 0px 3px 5px 0px rgba(9, 30, 66, 0.20))",
19
+ zIndex: '900'
20
+ });
21
+ export const CustomDropdownItem = styled.div(props => ({
22
+ height: '36px',
23
+ width: '100%',
24
+ display: 'flex',
25
+ justifyContent: 'flex-start',
26
+ alignItems: 'center',
27
+ paddingLeft: props.isSelected ? '15px' : '16px',
28
+ boxSizing: 'border-box',
29
+ color: props.isSelected ? `var(--ds-text-selected, ${B400})` : 'inherit',
30
+ background: props.isSelected ? `var(--ds-background-accent-blue-subtlest, ${B50})` : 'transparent',
31
+ borderLeft: props.isSelected ? `2px solid ${`var(--ds-text-selected, ${B400})`}` : 'none',
32
+ '&:hover': {
33
+ background: props.isSelected ? `var(--ds-background-accent-blue-subtlest, ${B50})` : `var(--ds-background-input-hovered, ${N20})`,
34
+ cursor: 'default'
35
+ }
36
+ }));
37
+ export const CustomDateWrapper = styled.div({
38
+ padding: "var(--ds-space-150, 12px)",
39
+ boxSizing: 'border-box'
40
+ });
41
+ export const DatePickersWrapper = styled.div({
42
+ display: 'flex',
43
+ justifyContent: 'space-between',
44
+ alignItems: 'center',
45
+ width: '100%'
46
+ });
47
+ export const SelectDateRangeButton = styled.button({
48
+ background: `var(--ds-background-accent-gray-subtler, ${N20})`,
49
+ border: 'none',
50
+ font: 'inherit',
51
+ width: '70px',
52
+ height: '40px',
53
+ marginTop: "var(--ds-space-150, 12px)",
54
+ borderRadius: '3px',
55
+ '&:hover': {
56
+ background: `var(--ds-background-accent-gray-subtler, ${N30})`,
57
+ cursor: 'pointer'
58
+ }
59
+ });
60
+ export const DateRangeErrorMessage = styled.div({
61
+ display: 'flex',
62
+ lineHeight: 1.3333,
63
+ marginTop: "var(--ds-space-050, 4px)",
64
+ fontSize: '12px',
65
+ color: `var(--ds-text-danger, ${R400})`
66
+ });
@@ -0,0 +1,26 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import Button from '@atlaskit/button/standard-button';
4
+ import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
5
+ export const PopupTrigger = ({
6
+ triggerProps,
7
+ optionSelected,
8
+ label,
9
+ selectedLabel,
10
+ onClickButton
11
+ }) => {
12
+ return /*#__PURE__*/React.createElement(Button, _extends({}, triggerProps, {
13
+ testId: 'confluence-search-modal--date-range-button',
14
+ onClick: onClickButton,
15
+ isSelected: optionSelected,
16
+ iconAfter: /*#__PURE__*/React.createElement("span", {
17
+ style: {
18
+ display: 'flex',
19
+ alignItems: 'center'
20
+ }
21
+ }, /*#__PURE__*/React.createElement(ChevronDownIcon, {
22
+ size: "medium",
23
+ label: ""
24
+ }))
25
+ }), label, selectedLabel ? `: ${selectedLabel}` : '');
26
+ };
@@ -1,13 +1,18 @@
1
1
  import React from 'react';
2
2
  import { Flex, xcss } from '@atlaskit/primitives';
3
+ import { DateRangePicker } from './filters/date-range-picker';
3
4
  const basicFilterContainerStyles = xcss({
4
5
  paddingLeft: 'space.100'
5
6
  });
6
- const BasicFilterContainer = ({}) => {
7
+ const BasicFilterContainer = ({
8
+ onChange
9
+ }) => {
7
10
  return /*#__PURE__*/React.createElement(Flex, {
8
11
  xcss: basicFilterContainerStyles,
9
12
  gap: "space.100",
10
13
  testId: "clol-basic-filter-container"
11
- }, /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(React.Fragment, null));
14
+ }, /*#__PURE__*/React.createElement(DateRangePicker, {
15
+ onSelectionChange: onChange
16
+ }), /*#__PURE__*/React.createElement(React.Fragment, null));
12
17
  };
13
18
  export default BasicFilterContainer;
@@ -0,0 +1,5 @@
1
+ export let CLOLBasicFilters = /*#__PURE__*/function (CLOLBasicFilters) {
2
+ CLOLBasicFilters["editedOrCreatedBy"] = "editedOrCreatedBy";
3
+ CLOLBasicFilters["lastModified"] = "lastModified";
4
+ return CLOLBasicFilters;
5
+ }({});
@@ -15,6 +15,7 @@ const ConfluenceSearchContainer = ({
15
15
  }) => {
16
16
  const currentCloudId = useRef(cloudId);
17
17
  const [searchBarSearchString, setSearchBarSearchString] = useState(initialSearchValue !== null && initialSearchValue !== void 0 ? initialSearchValue : '');
18
+ const [filterSelections, setFilterSelections] = useState({});
18
19
  const handleSearchChange = useCallback(e => {
19
20
  const rawSearch = e.currentTarget.value;
20
21
  setSearchBarSearchString(rawSearch);
@@ -28,6 +29,15 @@ const ConfluenceSearchContainer = ({
28
29
  currentCloudId.current = cloudId;
29
30
  }
30
31
  }, [cloudId]);
32
+ const handleBasicFilterSelectionChange = useCallback((filterType, options) => {
33
+ const updatedSelection = {
34
+ ...filterSelections,
35
+ [filterType]: options
36
+ };
37
+ setFilterSelections(updatedSelection);
38
+ //TODO: move to debounce fn in https://product-fabric.atlassian.net/browse/EDM-9485
39
+ onSearch(searchBarSearchString, updatedSelection);
40
+ }, [filterSelections, onSearch, searchBarSearchString]);
31
41
  const showBasicFilters = useMemo(() => {
32
42
  if (getBooleanFF('platform.linking-platform.datasource.show-clol-basic-filters')) {
33
43
  return true;
@@ -45,6 +55,8 @@ const ConfluenceSearchContainer = ({
45
55
  searchTerm: searchBarSearchString,
46
56
  placeholder: searchMessages.searchLabel,
47
57
  fullWidth: !showBasicFilters
48
- }), showBasicFilters && /*#__PURE__*/React.createElement(BasicFilters, null));
58
+ }), showBasicFilters && /*#__PURE__*/React.createElement(BasicFilters, {
59
+ onChange: handleBasicFilterSelectionChange
60
+ }));
49
61
  };
50
62
  export default ConfluenceSearchContainer;
@@ -69,13 +69,16 @@ export const PlainConfluenceSearchConfigModal = props => {
69
69
  viewMode = 'table',
70
70
  parameters: initialParameters,
71
71
  url: urlBeingEdited,
72
- visibleColumnKeys: initialVisibleColumnKeys
72
+ visibleColumnKeys: initialVisibleColumnKeys,
73
+ disableDisplayDropdown = false,
74
+ overrideParameters
73
75
  } = props;
74
76
  const [availableSites, setAvailableSites] = useState(undefined);
75
77
  const [currentViewMode, setCurrentViewMode] = useState(viewMode);
76
78
  const [cloudId, setCloudId] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId);
77
79
  const [searchString, setSearchString] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.searchString);
78
80
  const [visibleColumnKeys, setVisibleColumnKeys] = useState(initialVisibleColumnKeys);
81
+ const [lastModified, setLastModified] = useState();
79
82
 
80
83
  // analytics related parameters
81
84
  const searchCount = useRef(0);
@@ -87,9 +90,21 @@ export const PlainConfluenceSearchConfigModal = props => {
87
90
  const parameters = useMemo(() => ({
88
91
  ...initialParameters,
89
92
  cloudId,
90
- searchString
91
- }), [cloudId, initialParameters, searchString /** Add more parameters when more filters are added */]);
93
+ searchString,
94
+ ...(lastModified && {
95
+ lastModified
96
+ })
97
+ }), [cloudId, lastModified, initialParameters, searchString /** Add more parameters when more filters are added */]);
92
98
  const isParametersSet = useMemo(() => !!cloudId && Object.values(parameters !== null && parameters !== void 0 ? parameters : {}).filter(v => v !== undefined).length > 1, [cloudId, parameters]);
99
+ const parametersToSend = useMemo(() => {
100
+ if (!isParametersSet) {
101
+ return undefined;
102
+ }
103
+ return {
104
+ ...parameters,
105
+ ...(overrideParameters !== null && overrideParameters !== void 0 ? overrideParameters : {})
106
+ };
107
+ }, [parameters, overrideParameters, isParametersSet]);
93
108
  const {
94
109
  reset,
95
110
  status,
@@ -104,7 +119,7 @@ export const PlainConfluenceSearchConfigModal = props => {
104
119
  destinationObjectTypes
105
120
  } = useDatasourceTableState({
106
121
  datasourceId,
107
- parameters: isParametersSet ? parameters : undefined,
122
+ parameters: parametersToSend,
108
123
  fieldKeys: visibleColumnKeys
109
124
  });
110
125
  const {
@@ -321,7 +336,7 @@ export const PlainConfluenceSearchConfigModal = props => {
321
336
  onInsert(buildDatasourceAdf({
322
337
  id: datasourceId,
323
338
  parameters: {
324
- ...parameters,
339
+ ...parametersToSend,
325
340
  cloudId
326
341
  },
327
342
  views: [{
@@ -344,14 +359,18 @@ export const PlainConfluenceSearchConfigModal = props => {
344
359
  }]
345
360
  }, confluenceSearchUrl), consumerEvent);
346
361
  }
347
- }, [isParametersSet, cloudId, analyticsPayload, totalCount, currentViewMode, onInsert, confluenceSearchUrl, datasourceId, parameters, visibleColumnKeys, columnCustomSizes, wrappedColumnKeys]);
362
+ }, [isParametersSet, cloudId, analyticsPayload, totalCount, currentViewMode, onInsert, confluenceSearchUrl, datasourceId, parametersToSend, visibleColumnKeys, columnCustomSizes, wrappedColumnKeys]);
348
363
  const handleViewModeChange = selectedMode => {
349
364
  userInteractionActions.current.add(DatasourceAction.DISPLAY_VIEW_CHANGED);
350
365
  setCurrentViewMode(selectedMode);
351
366
  };
352
- const onSearch = useCallback(newSearchString => {
367
+ const onSearch = useCallback((newSearchString, filters) => {
353
368
  searchCount.current++;
354
369
  userInteractionActions.current.add(DatasourceAction.QUERY_UPDATED);
370
+ if (filters !== null && filters !== void 0 && filters.lastModified) {
371
+ const lastModifiedValue = filters.lastModified.find(range => range.value);
372
+ setLastModified(lastModifiedValue === null || lastModifiedValue === void 0 ? void 0 : lastModifiedValue.value);
373
+ }
355
374
  setSearchString(newSearchString);
356
375
  reset({
357
376
  shouldForceRequest: true
@@ -380,7 +399,7 @@ export const PlainConfluenceSearchConfigModal = props => {
380
399
  selectedSite: selectedConfluenceSite,
381
400
  testId: "confluence-search-datasource-modal--site-selector",
382
401
  label: siteSelectorLabel
383
- })), !hasNoConfluenceSites && jsx(DisplayViewDropDown, {
402
+ })), !hasNoConfluenceSites && !disableDisplayDropdown && jsx(DisplayViewDropDown, {
384
403
  onViewModeChange: handleViewModeChange,
385
404
  viewMode: currentViewMode
386
405
  })), jsx(ModalBody, null, !hasNoConfluenceSites ? jsx(Fragment, null, jsx(Box, {
@@ -173,6 +173,7 @@ const DatasourceTableViewWithoutAnalytics = ({
173
173
  testId: "datasource-table-view-skeleton",
174
174
  isCompact: true
175
175
  }), jsx(TableFooter, {
176
+ datasourceId: datasourceId,
176
177
  itemCount: isDataReady ? totalCount : undefined,
177
178
  onRefresh: onRefresh,
178
179
  isLoading: !isDataReady || status === 'loading',
@@ -3,9 +3,9 @@ import isEqual from 'lodash/isEqual';
3
3
  import { useIntl } from 'react-intl-next';
4
4
  import { useDebouncedCallback } from 'use-debounce';
5
5
  import { FilterPopupSelect } from '../../../../common/modal/popup-select';
6
+ import { SEARCH_DEBOUNCE_MS } from '../../../../common/modal/popup-select/constants';
6
7
  import { useFilterOptions } from '../../hooks/useFilterOptions';
7
8
  import { asyncPopupSelectMessages } from './messages';
8
- export const SEARCH_DEBOUNCE_MS = 350;
9
9
  const AsyncPopupSelect = ({
10
10
  filterType,
11
11
  site,
@@ -82,11 +82,12 @@ const AsyncPopupSelect = ({
82
82
  const isEmpty = status === 'resolved' && filterOptionsLength === 0;
83
83
  const popupSelectOptions = isLoading || isError ? [] : filterOptions; // if not set to [], then on loading, no loading UI will be shown
84
84
  const areAllResultsLoaded = filterOptionsLength === totalCount;
85
+ const filterName = `jlol-basic-filter-${filterType}`;
85
86
  const shouldShowFooter = (status === 'resolved' || isLoadingMore) && filterOptionsLength > 0; // footer should not disappear when there is an inline spinner for loading more data
86
87
  const shouldDisplayShowMoreButton = status === 'resolved' && !!pageCursor && !areAllResultsLoaded;
87
88
  const triggerButtonLabel = formatMessage(asyncPopupSelectMessages[`${filterType}Label`]);
88
89
  return /*#__PURE__*/React.createElement(FilterPopupSelect, {
89
- filterName: `jlol-basic-filter-${filterType}`,
90
+ filterName: filterName,
90
91
  status: status,
91
92
  showLoading: isLoading,
92
93
  showHydrating: isJQLHydrating,
@@ -100,7 +101,7 @@ const AsyncPopupSelect = ({
100
101
  onSelectionChange: handleOptionSelection,
101
102
  onMenuOpen: handleMenuOpen,
102
103
  menuListProps: {
103
- filterName: filterType,
104
+ filterName,
104
105
  isError,
105
106
  isEmpty,
106
107
  isLoading,
@@ -8,6 +8,7 @@ import { Flex, xcss } from '@atlaskit/primitives';
8
8
  import { useDatasourceAnalyticsEvents } from '../../../analytics';
9
9
  import { BasicSearchInput } from '../../common/modal/basic-search-input';
10
10
  import { basicSearchInputMessages } from '../../common/modal/basic-search-input/messages';
11
+ import { FILTER_SELECTION_DEBOUNCE_MS } from '../../common/modal/popup-select/constants';
11
12
  import { BasicFilters } from '../basic-filters';
12
13
  import { useHydrateJqlQuery } from '../basic-filters/hooks/useHydrateJqlQuery';
13
14
  import { isQueryTooComplex } from '../basic-filters/utils/isQueryTooComplex';
@@ -25,7 +26,6 @@ const basicSearchInputContainerStyles = xcss({
25
26
  });
26
27
  export const DEFAULT_JQL_QUERY = 'ORDER BY created DESC';
27
28
  export const ALLOWED_ORDER_BY_KEYS = ['key', 'summary', 'assignee', 'status', 'created'];
28
- export const FILTER_SELECTION_DEBOUNCE_MS = 500;
29
29
  export const JiraSearchContainer = props => {
30
30
  const {
31
31
  isSearching,
@@ -7,9 +7,12 @@ import { FormattedMessage, FormattedNumber, useIntl } from 'react-intl-next';
7
7
  import Button from '@atlaskit/button';
8
8
  import Heading from '@atlaskit/heading';
9
9
  import RefreshIcon from '@atlaskit/icon/glyph/refresh';
10
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
11
  import LinkUrl from '@atlaskit/smart-card/link-url';
11
12
  import { N0, N40, N800, N90 } from '@atlaskit/theme/colors';
13
+ import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID } from '../assets-modal';
12
14
  import { footerMessages } from './messages';
15
+ import { PoweredByJSMAssets } from './powered-by-jsm-assets';
13
16
  import { SyncInfo } from './sync-info';
14
17
  const FooterWrapper = styled.div({
15
18
  padding: `${"var(--ds-space-0, 0px)"} ${"var(--ds-space-200, 16px)"}`,
@@ -40,6 +43,7 @@ const SyncTextWrapper = styled.div({
40
43
  fontSize: '12px'
41
44
  });
42
45
  export const TableFooter = ({
46
+ datasourceId,
43
47
  itemCount,
44
48
  onRefresh,
45
49
  isLoading,
@@ -77,7 +81,9 @@ export const TableFooter = ({
77
81
  values: {
78
82
  itemCount
79
83
  }
80
- }))))), jsx(SyncWrapper, null, onRefresh && jsx(Fragment, null, jsx(SyncTextWrapper, {
84
+ }))))), getBooleanFF('platform.linking-platform.datasource-assets_objects_add_jsm_promotional_tag') && datasourceId === ASSETS_LIST_OF_LINKS_DATASOURCE_ID ? jsx(PoweredByJSMAssets, {
85
+ text: intl.formatMessage(footerMessages.powerByJSM)
86
+ }) : null, jsx(SyncWrapper, null, onRefresh && jsx(Fragment, null, jsx(SyncTextWrapper, {
81
87
  "data-testid": "sync-text"
82
88
  }, isLoading ? jsx(FormattedMessage, footerMessages.loadingText) : jsx(SyncInfo, {
83
89
  lastSyncTime: lastSyncTime
@@ -14,5 +14,10 @@ export const footerMessages = defineMessages({
14
14
  id: 'linkDataSource.table-footer.refresh',
15
15
  description: 'Label for refresh icon',
16
16
  defaultMessage: 'Refresh'
17
+ },
18
+ powerByJSM: {
19
+ id: 'linkDataSource.table-footer.power-by-jsm',
20
+ description: 'Displayed on the issue like table footer to increase JSM Assets visibility',
21
+ defaultMessage: 'Powered by Assets in Jira Service Management'
17
22
  }
18
23
  });
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { JiraServiceManagementIcon } from '@atlaskit/logo';
3
+ import { Box, xcss } from '@atlaskit/primitives';
4
+ import { useDatasourceAnalyticsEvents } from '../../../analytics';
5
+ const jsmTextStyles = xcss({
6
+ fontSize: 'small',
7
+ color: 'color.text.subtle',
8
+ marginLeft: "var(--ds-space-075, 6px)",
9
+ ':hover': {
10
+ color: 'color.link.pressed'
11
+ }
12
+ });
13
+ const jsmContainerStyles = xcss({
14
+ display: 'flex',
15
+ flexDirection: 'row-reverse'
16
+ });
17
+ export const PoweredByJSMAssets = props => {
18
+ const ASSETS_LINK = '/jira/servicedesk/assets';
19
+ const {
20
+ fireEvent
21
+ } = useDatasourceAnalyticsEvents();
22
+ return /*#__PURE__*/React.createElement(Box, {
23
+ xcss: jsmContainerStyles,
24
+ padding: "space.150"
25
+ }, /*#__PURE__*/React.createElement("a", {
26
+ "data-testid": 'powered-by-jsm-assets-link',
27
+ onClick: () => fireEvent('ui.link.clicked.poweredBy', {
28
+ componentHierarchy: 'datasourceTable',
29
+ extensionKey: 'jsm-cmdb-gateway'
30
+ }),
31
+ href: ASSETS_LINK,
32
+ rel: "noreferrer",
33
+ target: "_blank",
34
+ style: {
35
+ display: 'inline-flex',
36
+ alignItems: 'center'
37
+ }
38
+ }, /*#__PURE__*/React.createElement(JiraServiceManagementIcon, {
39
+ size: "xsmall",
40
+ appearance: "brand",
41
+ label: props.text
42
+ }), /*#__PURE__*/React.createElement(Box, {
43
+ xcss: jsmTextStyles
44
+ }, props.text)));
45
+ };
@@ -0,0 +1,2 @@
1
+ export var FILTER_SELECTION_DEBOUNCE_MS = 500;
2
+ export var SEARCH_DEBOUNCE_MS = 350;
@@ -16,9 +16,10 @@ var footerPaginationInfoStyles = xcss({
16
16
  });
17
17
  var PopupFooter = function PopupFooter(_ref) {
18
18
  var currentDisplayCount = _ref.currentDisplayCount,
19
- totalCount = _ref.totalCount;
19
+ totalCount = _ref.totalCount,
20
+ filterName = _ref.filterName;
20
21
  return /*#__PURE__*/React.createElement(Flex, {
21
- testId: "jlol-basic-filter-popup-select--footer",
22
+ testId: "".concat(filterName, "--footer"),
22
23
  direction: "row",
23
24
  alignItems: "center",
24
25
  justifyContent: "end",
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { Fragment } from 'react';
2
2
  import Avatar from '@atlaskit/avatar';
3
3
  import PeopleGroupIcon from '@atlaskit/icon/glyph/people-group';
4
4
  import Lozenge from '@atlaskit/lozenge';
@@ -29,14 +29,14 @@ var IconOptionLabel = function IconOptionLabel(_ref) {
29
29
  };
30
30
  return /*#__PURE__*/React.createElement(AvatarOptionLabel, {
31
31
  data: avatarOptionLabelData,
32
- testId: "jlol-basic-filter-popup-select-option--icon-label"
32
+ testId: "basic-filter-popup-select-option--icon-label"
33
33
  });
34
34
  };
35
35
  var LozengeOptionLabel = function LozengeOptionLabel(_ref2) {
36
36
  var data = _ref2.data;
37
37
  return /*#__PURE__*/React.createElement(Lozenge, {
38
38
  appearance: data.appearance,
39
- testId: "jlol-basic-filter-popup-select-option--lozenge"
39
+ testId: "basic-filter-popup-select-option--lozenge"
40
40
  }, /*#__PURE__*/React.createElement(Box, {
41
41
  xcss: [commonLabelStyles]
42
42
  }, data.label));
@@ -46,7 +46,7 @@ var AvatarOptionLabel = function AvatarOptionLabel(_ref3) {
46
46
  testId = _ref3.testId;
47
47
  return /*#__PURE__*/React.createElement(Flex, {
48
48
  alignItems: "center",
49
- testId: testId || 'jlol-basic-filter-popup-select-option--avatar'
49
+ testId: testId || 'basic-filter-popup-select-option--avatar'
50
50
  }, data.isGroup ? /*#__PURE__*/React.createElement(Flex, {
51
51
  alignItems: "center",
52
52
  justifyContent: "center",
@@ -59,11 +59,13 @@ var AvatarOptionLabel = function AvatarOptionLabel(_ref3) {
59
59
  src: data.avatar,
60
60
  size: "xsmall"
61
61
  }), /*#__PURE__*/React.createElement(Box, {
62
- xcss: [commonLabelStyles, avatarOptionLabelStyles],
63
- testId: "nidhin"
62
+ xcss: [commonLabelStyles, avatarOptionLabelStyles]
64
63
  }, data.label));
65
64
  };
66
65
  var formatOptionLabel = function formatOptionLabel(data) {
66
+ if (data.optionType === 'defaultOption') {
67
+ return /*#__PURE__*/React.createElement(Fragment, null);
68
+ }
67
69
  if (data.optionType === 'lozengeLabel') {
68
70
  return /*#__PURE__*/React.createElement(LozengeOptionLabel, {
69
71
  data: data
@@ -205,7 +205,8 @@ export var FilterPopupSelect = function FilterPopupSelect(_ref) {
205
205
  },
206
206
  footer: shouldShowFooter && /*#__PURE__*/React.createElement(PopupFooter, {
207
207
  currentDisplayCount: options.length,
208
- totalCount: totalCount
208
+ totalCount: totalCount,
209
+ filterName: filterName
209
210
  })
210
211
  });
211
212
  };
@@ -4,7 +4,7 @@ import { useDebouncedCallback } from 'use-debounce';
4
4
  import ErrorIcon from '@atlaskit/icon/glyph/error';
5
5
  import { N500 } from '@atlaskit/theme/colors';
6
6
  import { useDatasourceAnalyticsEvents } from '../../../../../analytics';
7
- import { SEARCH_DEBOUNCE_MS } from '../../../../jira-issues-modal/basic-filters/ui/async-popup-select';
7
+ import { SEARCH_DEBOUNCE_MS } from '../constants';
8
8
  import { asyncPopupSelectMessages } from './messages';
9
9
  import CustomSelectMessage from './selectMessage';
10
10
  var getErrorReasonType = function getErrorReasonType(errors) {
@@ -45,7 +45,7 @@ var CustomErrorMessage = function CustomErrorMessage(_ref3) {
45
45
  size: "xlarge"
46
46
  }),
47
47
  message: asyncPopupSelectMessages.errorMessage,
48
- testId: "jlol-basic-filter-popup-select--error-message"
48
+ testId: "".concat(filterName, "--error-message")
49
49
  });
50
50
  };
51
51
  export default CustomErrorMessage;
@@ -39,7 +39,9 @@ var CustomMenuList = function CustomMenuList(_ref) {
39
39
  };
40
40
  var renderChildren = function renderChildren() {
41
41
  if (isLoading) {
42
- return /*#__PURE__*/React.createElement(CustomDropdownLoadingMessage, null);
42
+ return /*#__PURE__*/React.createElement(CustomDropdownLoadingMessage, {
43
+ filterName: filterName
44
+ });
43
45
  }
44
46
  if (isError) {
45
47
  return /*#__PURE__*/React.createElement(CustomErrorMessage, {
@@ -52,7 +54,7 @@ var CustomMenuList = function CustomMenuList(_ref) {
52
54
  filterName: filterName
53
55
  });
54
56
  }
55
- return /*#__PURE__*/React.createElement(React.Fragment, null, children, shouldDisplayShowMore && /*#__PURE__*/React.createElement(Box, {
57
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children, shouldDisplayShowMore && handleShowMore && /*#__PURE__*/React.createElement(Box, {
56
58
  xcss: showMoreButtonBoxStyles
57
59
  }, /*#__PURE__*/React.createElement(ShowMoreButton, {
58
60
  onShowMore: handleShowMore,
@@ -2,13 +2,14 @@ import React from 'react';
2
2
  import Spinner from '@atlaskit/spinner';
3
3
  import { asyncPopupSelectMessages } from './messages';
4
4
  import CustomSelectMessage from './selectMessage';
5
- var CustomDropdownLoadingMessage = function CustomDropdownLoadingMessage() {
5
+ var CustomDropdownLoadingMessage = function CustomDropdownLoadingMessage(_ref) {
6
+ var filterName = _ref.filterName;
6
7
  return /*#__PURE__*/React.createElement(CustomSelectMessage, {
7
8
  icon: /*#__PURE__*/React.createElement(Spinner, {
8
9
  size: "large"
9
10
  }),
10
11
  message: asyncPopupSelectMessages.loadingMessage,
11
- testId: "jlol-basic-filter-popup-select--loading-message"
12
+ testId: "".concat(filterName, "--loading-message")
12
13
  });
13
14
  };
14
15
  export default CustomDropdownLoadingMessage;
@@ -4,7 +4,7 @@ import { useDebouncedCallback } from 'use-debounce';
4
4
  import QuestionCircleIcon from '@atlaskit/icon/glyph/question-circle';
5
5
  import { N500 } from '@atlaskit/theme/colors';
6
6
  import { useDatasourceAnalyticsEvents } from '../../../../../analytics';
7
- import { SEARCH_DEBOUNCE_MS } from '../../../../jira-issues-modal/basic-filters/ui/async-popup-select';
7
+ import { SEARCH_DEBOUNCE_MS } from '../constants';
8
8
  import { asyncPopupSelectMessages } from './messages';
9
9
  import CustomSelectMessage from './selectMessage';
10
10
  var CustomNoOptionsMessage = function CustomNoOptionsMessage(_ref) {
@@ -33,7 +33,7 @@ var CustomNoOptionsMessage = function CustomNoOptionsMessage(_ref) {
33
33
  label: ""
34
34
  }),
35
35
  message: asyncPopupSelectMessages.noOptionsMessage,
36
- testId: "jlol-basic-filter-popup-select--no-options-message"
36
+ testId: "".concat(filterName, "--no-options-message")
37
37
  });
38
38
  };
39
39
  export default CustomNoOptionsMessage;
@@ -20,7 +20,7 @@ var ShowMoreButton = function ShowMoreButton(_ref) {
20
20
  return /*#__PURE__*/React.createElement(Button, {
21
21
  onClick: handleShowMore,
22
22
  appearance: "link",
23
- testId: "jlol-basic-filter-popup-select--show-more-button"
23
+ testId: "".concat(filterName, "--show-more-button")
24
24
  }, formatMessage(asyncPopupSelectMessages.showMoreMessage));
25
25
  };
26
26
  export default ShowMoreButton;
@@ -0,0 +1,9 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { forwardRef } from 'react';
3
+ import { PopupComponentContainer } from './styled';
4
+ export var PopupComponent = /*#__PURE__*/forwardRef(function (props, ref) {
5
+ return /*#__PURE__*/React.createElement(PopupComponentContainer, _extends({}, props, {
6
+ "data-testId": 'confluence-search-datasource-popup-container',
7
+ ref: ref
8
+ }));
9
+ });
@@ -0,0 +1,79 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { useCallback, useState } from 'react';
3
+ import { FormattedMessage, useIntl } from 'react-intl-next';
4
+ import Popup from '@atlaskit/popup';
5
+ import { layers } from '@atlaskit/theme/constants';
6
+ import { CLOLBasicFilters } from '../../types';
7
+ import { dateRangeMessages } from './messages';
8
+ import { PopupComponent } from './PopupComponent';
9
+ import { CustomDropdown, CustomDropdownItem } from './styled';
10
+ import { PopupTrigger } from './trigger';
11
+ var lastModifiedValues = ['anyTime', 'today', 'yesterday', 'past7Days', 'past30Days', 'pastYear', 'custom'];
12
+ var defaultOptionValue = 'anyTime';
13
+ var filterName = CLOLBasicFilters.lastModified;
14
+ export var DateRangePicker = function DateRangePicker(_ref) {
15
+ var onSelectionChange = _ref.onSelectionChange;
16
+ var _useState = useState(null),
17
+ _useState2 = _slicedToArray(_useState, 2),
18
+ currentOption = _useState2[0],
19
+ setCurrentOption = _useState2[1];
20
+ var _useState3 = useState(false),
21
+ _useState4 = _slicedToArray(_useState3, 2),
22
+ isPickerOpen = _useState4[0],
23
+ setIsPickerOpen = _useState4[1];
24
+ var _useIntl = useIntl(),
25
+ formatMessage = _useIntl.formatMessage;
26
+ var onClickFilterOption = useCallback(function (option) {
27
+ setCurrentOption(option);
28
+ setIsPickerOpen(false);
29
+ onSelectionChange(filterName, [{
30
+ optionType: 'defaultOption',
31
+ label: option,
32
+ value: option
33
+ }]);
34
+ }, [onSelectionChange]);
35
+ var handleTogglePopup = useCallback(function () {
36
+ setIsPickerOpen(!isPickerOpen);
37
+ }, [isPickerOpen]);
38
+ return /*#__PURE__*/React.createElement(Popup, {
39
+ isOpen: isPickerOpen,
40
+ onClose: handleTogglePopup,
41
+ popupComponent: PopupComponent,
42
+ zIndex: layers.modal(),
43
+ content: function content() {
44
+ return /*#__PURE__*/React.createElement(CustomDropdown, null, lastModifiedValues.map(function (option) {
45
+ return /*#__PURE__*/React.createElement(CustomDropdownItem, {
46
+ key: option
47
+ //want to show Anytime as selected if none of the other options are selected
48
+ ,
49
+ isSelected: currentOption ? option === currentOption : option === defaultOptionValue,
50
+ onClick: function onClick() {
51
+ return onClickFilterOption(option);
52
+ }
53
+ }, /*#__PURE__*/React.createElement(FormattedMessage, getCurrentOptionLabel(option)));
54
+ }));
55
+ },
56
+ placement: "bottom-start",
57
+ trigger: function trigger(triggerProps) {
58
+ return /*#__PURE__*/React.createElement(PopupTrigger, {
59
+ triggerProps: triggerProps,
60
+ optionSelected: !!currentOption,
61
+ label: formatMessage(dateRangeMessages.dateRangeTitle),
62
+ selectedLabel: formatMessage(getCurrentOptionLabel(currentOption)),
63
+ onClickButton: handleTogglePopup
64
+ });
65
+ }
66
+ });
67
+ };
68
+ var getCurrentOptionLabel = function getCurrentOptionLabel(option) {
69
+ var mapping = {
70
+ anyTime: 'dateRangeAnyTime',
71
+ today: 'dateRangeToday',
72
+ yesterday: 'dateRangeYesterday',
73
+ past7Days: 'dateRangeLastWeek',
74
+ past30Days: 'dateRangeLastMonth',
75
+ pastYear: 'dateRangeLastYear',
76
+ custom: 'dateRangeCustom'
77
+ };
78
+ return option ? dateRangeMessages[mapping[option]] : dateRangeMessages[mapping['anyTime']];
79
+ };