@atlaskit/link-datasource 1.27.4 → 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.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/ui/common/modal/popup-select/formatOptionLabel.js +7 -1
- package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.js +19 -0
- package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.js +89 -0
- package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js +49 -0
- package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.js +75 -0
- package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.js +32 -0
- package/dist/cjs/ui/confluence-search-modal/basic-filters/index.js +5 -3
- package/dist/cjs/ui/confluence-search-modal/basic-filters/types.js +11 -0
- package/dist/cjs/ui/confluence-search-modal/confluence-search-container/index.js +16 -1
- package/dist/cjs/ui/confluence-search-modal/modal/index.js +22 -10
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +1 -0
- package/dist/cjs/ui/table-footer/index.js +8 -2
- package/dist/cjs/ui/table-footer/messages.js +5 -0
- package/dist/cjs/ui/table-footer/powered-by-jsm-assets/index.js +53 -0
- package/dist/es2019/ui/common/modal/popup-select/formatOptionLabel.js +4 -1
- package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.js +7 -0
- package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.js +68 -0
- package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js +43 -0
- package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.js +66 -0
- package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.js +26 -0
- package/dist/es2019/ui/confluence-search-modal/basic-filters/index.js +7 -2
- package/dist/es2019/ui/confluence-search-modal/basic-filters/types.js +5 -0
- package/dist/es2019/ui/confluence-search-modal/confluence-search-container/index.js +13 -1
- package/dist/es2019/ui/confluence-search-modal/modal/index.js +11 -3
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +1 -0
- package/dist/es2019/ui/table-footer/index.js +7 -1
- package/dist/es2019/ui/table-footer/messages.js +5 -0
- package/dist/es2019/ui/table-footer/powered-by-jsm-assets/index.js +45 -0
- package/dist/esm/ui/common/modal/popup-select/formatOptionLabel.js +4 -1
- package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.js +9 -0
- package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.js +79 -0
- package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js +43 -0
- package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.js +68 -0
- package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.js +25 -0
- package/dist/esm/ui/confluence-search-modal/basic-filters/index.js +5 -3
- package/dist/esm/ui/confluence-search-modal/basic-filters/types.js +5 -0
- package/dist/esm/ui/confluence-search-modal/confluence-search-container/index.js +16 -1
- package/dist/esm/ui/confluence-search-modal/modal/index.js +22 -10
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +1 -0
- package/dist/esm/ui/table-footer/index.js +8 -2
- package/dist/esm/ui/table-footer/messages.js +5 -0
- package/dist/esm/ui/table-footer/powered-by-jsm-assets/index.js +46 -0
- package/dist/types/analytics/generated/analytics.types.d.ts +7 -0
- package/dist/types/ui/common/modal/popup-select/types.d.ts +6 -1
- package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.d.ts +3 -0
- package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.d.ts +8 -0
- package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.d.ts +42 -0
- package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.d.ts +31 -0
- package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.d.ts +10 -0
- package/dist/types/ui/confluence-search-modal/basic-filters/index.d.ts +4 -1
- package/dist/types/ui/confluence-search-modal/basic-filters/types.d.ts +20 -0
- package/dist/types/ui/confluence-search-modal/confluence-search-container/index.d.ts +2 -1
- package/dist/types/ui/confluence-search-modal/types.d.ts +2 -1
- package/dist/types/ui/table-footer/index.d.ts +2 -1
- package/dist/types/ui/table-footer/messages.d.ts +5 -0
- package/dist/types/ui/table-footer/powered-by-jsm-assets/index.d.ts +4 -0
- package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +7 -0
- package/dist/types-ts4.5/ui/common/modal/popup-select/types.d.ts +6 -1
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.d.ts +3 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.d.ts +8 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.d.ts +42 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.d.ts +31 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.d.ts +10 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/index.d.ts +4 -1
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/types.d.ts +20 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/confluence-search-container/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/confluence-search-modal/types.d.ts +2 -1
- package/dist/types-ts4.5/ui/table-footer/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/table-footer/messages.d.ts +5 -0
- package/dist/types-ts4.5/ui/table-footer/powered-by-jsm-assets/index.d.ts +4 -0
- package/examples-helpers/buildAssetsIssuesTable.tsx +71 -0
- package/examples-helpers/useAssetsTableProps.tsx +57 -0
- package/package.json +6 -1
package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import { FormattedMessage, useIntl } from 'react-intl-next';
|
|
3
|
+
import Popup from '@atlaskit/popup';
|
|
4
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
5
|
+
import { CLOLBasicFilters } from '../../types';
|
|
6
|
+
import { dateRangeMessages } from './messages';
|
|
7
|
+
import { PopupComponent } from './PopupComponent';
|
|
8
|
+
import { CustomDropdown, CustomDropdownItem } from './styled';
|
|
9
|
+
import { PopupTrigger } from './trigger';
|
|
10
|
+
const lastModifiedValues = ['anyTime', 'today', 'yesterday', 'past7Days', 'past30Days', 'pastYear', 'custom'];
|
|
11
|
+
const defaultOptionValue = 'anyTime';
|
|
12
|
+
const filterName = CLOLBasicFilters.lastModified;
|
|
13
|
+
export const DateRangePicker = ({
|
|
14
|
+
onSelectionChange
|
|
15
|
+
}) => {
|
|
16
|
+
const [currentOption, setCurrentOption] = useState(null);
|
|
17
|
+
const [isPickerOpen, setIsPickerOpen] = useState(false);
|
|
18
|
+
const {
|
|
19
|
+
formatMessage
|
|
20
|
+
} = useIntl();
|
|
21
|
+
const onClickFilterOption = useCallback(option => {
|
|
22
|
+
setCurrentOption(option);
|
|
23
|
+
setIsPickerOpen(false);
|
|
24
|
+
onSelectionChange(filterName, [{
|
|
25
|
+
optionType: 'defaultOption',
|
|
26
|
+
label: option,
|
|
27
|
+
value: option
|
|
28
|
+
}]);
|
|
29
|
+
}, [onSelectionChange]);
|
|
30
|
+
const handleTogglePopup = useCallback(() => {
|
|
31
|
+
setIsPickerOpen(!isPickerOpen);
|
|
32
|
+
}, [isPickerOpen]);
|
|
33
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
34
|
+
isOpen: isPickerOpen,
|
|
35
|
+
onClose: handleTogglePopup,
|
|
36
|
+
popupComponent: PopupComponent,
|
|
37
|
+
zIndex: layers.modal(),
|
|
38
|
+
content: () => {
|
|
39
|
+
return /*#__PURE__*/React.createElement(CustomDropdown, null, lastModifiedValues.map(option => /*#__PURE__*/React.createElement(CustomDropdownItem, {
|
|
40
|
+
key: option
|
|
41
|
+
//want to show Anytime as selected if none of the other options are selected
|
|
42
|
+
,
|
|
43
|
+
isSelected: currentOption ? option === currentOption : option === defaultOptionValue,
|
|
44
|
+
onClick: () => onClickFilterOption(option)
|
|
45
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, getCurrentOptionLabel(option)))));
|
|
46
|
+
},
|
|
47
|
+
placement: "bottom-start",
|
|
48
|
+
trigger: triggerProps => /*#__PURE__*/React.createElement(PopupTrigger, {
|
|
49
|
+
triggerProps: triggerProps,
|
|
50
|
+
optionSelected: !!currentOption,
|
|
51
|
+
label: formatMessage(dateRangeMessages.dateRangeTitle),
|
|
52
|
+
selectedLabel: formatMessage(getCurrentOptionLabel(currentOption)),
|
|
53
|
+
onClickButton: handleTogglePopup
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const getCurrentOptionLabel = option => {
|
|
58
|
+
const mapping = {
|
|
59
|
+
anyTime: 'dateRangeAnyTime',
|
|
60
|
+
today: 'dateRangeToday',
|
|
61
|
+
yesterday: 'dateRangeYesterday',
|
|
62
|
+
past7Days: 'dateRangeLastWeek',
|
|
63
|
+
past30Days: 'dateRangeLastMonth',
|
|
64
|
+
pastYear: 'dateRangeLastYear',
|
|
65
|
+
custom: 'dateRangeCustom'
|
|
66
|
+
};
|
|
67
|
+
return option ? dateRangeMessages[mapping[option]] : dateRangeMessages[mapping['anyTime']];
|
|
68
|
+
};
|
package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
export const dateRangeMessages = defineMessages({
|
|
3
|
+
dateRangeTitle: {
|
|
4
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.title',
|
|
5
|
+
defaultMessage: 'Last updated',
|
|
6
|
+
description: 'Filter by the date content was modified'
|
|
7
|
+
},
|
|
8
|
+
dateRangeAnyTime: {
|
|
9
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.any.time',
|
|
10
|
+
defaultMessage: 'Anytime',
|
|
11
|
+
description: 'Option to show content from any time'
|
|
12
|
+
},
|
|
13
|
+
dateRangeToday: {
|
|
14
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.today',
|
|
15
|
+
defaultMessage: 'Today',
|
|
16
|
+
description: 'Date range of content modified today'
|
|
17
|
+
},
|
|
18
|
+
dateRangeYesterday: {
|
|
19
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.yesterday',
|
|
20
|
+
defaultMessage: 'Yesterday',
|
|
21
|
+
description: 'Date range of content modified yesterday'
|
|
22
|
+
},
|
|
23
|
+
dateRangeLastWeek: {
|
|
24
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.last.week',
|
|
25
|
+
defaultMessage: 'Past 7 days',
|
|
26
|
+
description: 'Date range of content modified in the last 7 days'
|
|
27
|
+
},
|
|
28
|
+
dateRangeLastMonth: {
|
|
29
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.last.month',
|
|
30
|
+
defaultMessage: 'Past 30 days',
|
|
31
|
+
description: 'Date range of content modified in the last 30 days'
|
|
32
|
+
},
|
|
33
|
+
dateRangeLastYear: {
|
|
34
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.last.year',
|
|
35
|
+
defaultMessage: 'Past year',
|
|
36
|
+
description: 'Date range of content modified in the last 365 days'
|
|
37
|
+
},
|
|
38
|
+
dateRangeCustom: {
|
|
39
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.custom',
|
|
40
|
+
defaultMessage: 'Custom',
|
|
41
|
+
description: 'Custom date range'
|
|
42
|
+
}
|
|
43
|
+
});
|
package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.js
ADDED
|
@@ -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
|
+
});
|
package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.js
ADDED
|
@@ -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(
|
|
14
|
+
}, /*#__PURE__*/React.createElement(DateRangePicker, {
|
|
15
|
+
onSelectionChange: onChange
|
|
16
|
+
}), /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
12
17
|
};
|
|
13
18
|
export default BasicFilterContainer;
|
|
@@ -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,
|
|
58
|
+
}), showBasicFilters && /*#__PURE__*/React.createElement(BasicFilters, {
|
|
59
|
+
onChange: handleBasicFilterSelectionChange
|
|
60
|
+
}));
|
|
49
61
|
};
|
|
50
62
|
export default ConfluenceSearchContainer;
|
|
@@ -78,6 +78,7 @@ export const PlainConfluenceSearchConfigModal = props => {
|
|
|
78
78
|
const [cloudId, setCloudId] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId);
|
|
79
79
|
const [searchString, setSearchString] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.searchString);
|
|
80
80
|
const [visibleColumnKeys, setVisibleColumnKeys] = useState(initialVisibleColumnKeys);
|
|
81
|
+
const [lastModified, setLastModified] = useState();
|
|
81
82
|
|
|
82
83
|
// analytics related parameters
|
|
83
84
|
const searchCount = useRef(0);
|
|
@@ -89,8 +90,11 @@ export const PlainConfluenceSearchConfigModal = props => {
|
|
|
89
90
|
const parameters = useMemo(() => ({
|
|
90
91
|
...initialParameters,
|
|
91
92
|
cloudId,
|
|
92
|
-
searchString
|
|
93
|
-
|
|
93
|
+
searchString,
|
|
94
|
+
...(lastModified && {
|
|
95
|
+
lastModified
|
|
96
|
+
})
|
|
97
|
+
}), [cloudId, lastModified, initialParameters, searchString /** Add more parameters when more filters are added */]);
|
|
94
98
|
const isParametersSet = useMemo(() => !!cloudId && Object.values(parameters !== null && parameters !== void 0 ? parameters : {}).filter(v => v !== undefined).length > 1, [cloudId, parameters]);
|
|
95
99
|
const parametersToSend = useMemo(() => {
|
|
96
100
|
if (!isParametersSet) {
|
|
@@ -360,9 +364,13 @@ export const PlainConfluenceSearchConfigModal = props => {
|
|
|
360
364
|
userInteractionActions.current.add(DatasourceAction.DISPLAY_VIEW_CHANGED);
|
|
361
365
|
setCurrentViewMode(selectedMode);
|
|
362
366
|
};
|
|
363
|
-
const onSearch = useCallback(newSearchString => {
|
|
367
|
+
const onSearch = useCallback((newSearchString, filters) => {
|
|
364
368
|
searchCount.current++;
|
|
365
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
|
+
}
|
|
366
374
|
setSearchString(newSearchString);
|
|
367
375
|
reset({
|
|
368
376
|
shouldForceRequest: true
|
|
@@ -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',
|
|
@@ -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
|
-
}))))),
|
|
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
|
+
};
|
|
@@ -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';
|
|
@@ -63,6 +63,9 @@ var AvatarOptionLabel = function AvatarOptionLabel(_ref3) {
|
|
|
63
63
|
}, data.label));
|
|
64
64
|
};
|
|
65
65
|
var formatOptionLabel = function formatOptionLabel(data) {
|
|
66
|
+
if (data.optionType === 'defaultOption') {
|
|
67
|
+
return /*#__PURE__*/React.createElement(Fragment, null);
|
|
68
|
+
}
|
|
66
69
|
if (data.optionType === 'lozengeLabel') {
|
|
67
70
|
return /*#__PURE__*/React.createElement(LozengeOptionLabel, {
|
|
68
71
|
data: data
|
|
@@ -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
|
+
};
|
package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
export var dateRangeMessages = defineMessages({
|
|
3
|
+
dateRangeTitle: {
|
|
4
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.title',
|
|
5
|
+
defaultMessage: 'Last updated',
|
|
6
|
+
description: 'Filter by the date content was modified'
|
|
7
|
+
},
|
|
8
|
+
dateRangeAnyTime: {
|
|
9
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.any.time',
|
|
10
|
+
defaultMessage: 'Anytime',
|
|
11
|
+
description: 'Option to show content from any time'
|
|
12
|
+
},
|
|
13
|
+
dateRangeToday: {
|
|
14
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.today',
|
|
15
|
+
defaultMessage: 'Today',
|
|
16
|
+
description: 'Date range of content modified today'
|
|
17
|
+
},
|
|
18
|
+
dateRangeYesterday: {
|
|
19
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.yesterday',
|
|
20
|
+
defaultMessage: 'Yesterday',
|
|
21
|
+
description: 'Date range of content modified yesterday'
|
|
22
|
+
},
|
|
23
|
+
dateRangeLastWeek: {
|
|
24
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.last.week',
|
|
25
|
+
defaultMessage: 'Past 7 days',
|
|
26
|
+
description: 'Date range of content modified in the last 7 days'
|
|
27
|
+
},
|
|
28
|
+
dateRangeLastMonth: {
|
|
29
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.last.month',
|
|
30
|
+
defaultMessage: 'Past 30 days',
|
|
31
|
+
description: 'Date range of content modified in the last 30 days'
|
|
32
|
+
},
|
|
33
|
+
dateRangeLastYear: {
|
|
34
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.last.year',
|
|
35
|
+
defaultMessage: 'Past year',
|
|
36
|
+
description: 'Date range of content modified in the last 365 days'
|
|
37
|
+
},
|
|
38
|
+
dateRangeCustom: {
|
|
39
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.custom',
|
|
40
|
+
defaultMessage: 'Custom',
|
|
41
|
+
description: 'Custom date range'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import { B400, B50, N0, N20, N30, R400 } from '@atlaskit/theme/colors';
|
|
3
|
+
export var PopupComponentContainer = styled.div({
|
|
4
|
+
boxSizing: 'border-box',
|
|
5
|
+
display: 'block',
|
|
6
|
+
flex: '1 1 auto',
|
|
7
|
+
overflow: 'visible',
|
|
8
|
+
background: "var(--ds-background-input, ".concat(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 var CustomDropdown = styled.div({
|
|
15
|
+
width: '360px',
|
|
16
|
+
background: "var(--ds-background-input, ".concat(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 var CustomDropdownItem = styled.div(function (props) {
|
|
22
|
+
return {
|
|
23
|
+
height: '36px',
|
|
24
|
+
width: '100%',
|
|
25
|
+
display: 'flex',
|
|
26
|
+
justifyContent: 'flex-start',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
paddingLeft: props.isSelected ? '15px' : '16px',
|
|
29
|
+
boxSizing: 'border-box',
|
|
30
|
+
color: props.isSelected ? "var(--ds-text-selected, ".concat(B400, ")") : 'inherit',
|
|
31
|
+
background: props.isSelected ? "var(--ds-background-accent-blue-subtlest, ".concat(B50, ")") : 'transparent',
|
|
32
|
+
borderLeft: props.isSelected ? "2px solid ".concat("var(--ds-text-selected, ".concat(B400, ")")) : 'none',
|
|
33
|
+
'&:hover': {
|
|
34
|
+
background: props.isSelected ? "var(--ds-background-accent-blue-subtlest, ".concat(B50, ")") : "var(--ds-background-input-hovered, ".concat(N20, ")"),
|
|
35
|
+
cursor: 'default'
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
export var CustomDateWrapper = styled.div({
|
|
40
|
+
padding: "var(--ds-space-150, 12px)",
|
|
41
|
+
boxSizing: 'border-box'
|
|
42
|
+
});
|
|
43
|
+
export var DatePickersWrapper = styled.div({
|
|
44
|
+
display: 'flex',
|
|
45
|
+
justifyContent: 'space-between',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
width: '100%'
|
|
48
|
+
});
|
|
49
|
+
export var SelectDateRangeButton = styled.button({
|
|
50
|
+
background: "var(--ds-background-accent-gray-subtler, ".concat(N20, ")"),
|
|
51
|
+
border: 'none',
|
|
52
|
+
font: 'inherit',
|
|
53
|
+
width: '70px',
|
|
54
|
+
height: '40px',
|
|
55
|
+
marginTop: "var(--ds-space-150, 12px)",
|
|
56
|
+
borderRadius: '3px',
|
|
57
|
+
'&:hover': {
|
|
58
|
+
background: "var(--ds-background-accent-gray-subtler, ".concat(N30, ")"),
|
|
59
|
+
cursor: 'pointer'
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
export var DateRangeErrorMessage = styled.div({
|
|
63
|
+
display: 'flex',
|
|
64
|
+
lineHeight: 1.3333,
|
|
65
|
+
marginTop: "var(--ds-space-050, 4px)",
|
|
66
|
+
fontSize: '12px',
|
|
67
|
+
color: "var(--ds-text-danger, ".concat(R400, ")")
|
|
68
|
+
});
|
package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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 var PopupTrigger = function PopupTrigger(_ref) {
|
|
6
|
+
var triggerProps = _ref.triggerProps,
|
|
7
|
+
optionSelected = _ref.optionSelected,
|
|
8
|
+
label = _ref.label,
|
|
9
|
+
selectedLabel = _ref.selectedLabel,
|
|
10
|
+
onClickButton = _ref.onClickButton;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Button, _extends({}, triggerProps, {
|
|
12
|
+
testId: 'confluence-search-modal--date-range-button',
|
|
13
|
+
onClick: onClickButton,
|
|
14
|
+
isSelected: optionSelected,
|
|
15
|
+
iconAfter: /*#__PURE__*/React.createElement("span", {
|
|
16
|
+
style: {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center'
|
|
19
|
+
}
|
|
20
|
+
}, /*#__PURE__*/React.createElement(ChevronDownIcon, {
|
|
21
|
+
size: "medium",
|
|
22
|
+
label: ""
|
|
23
|
+
}))
|
|
24
|
+
}), label, selectedLabel ? ": ".concat(selectedLabel) : '');
|
|
25
|
+
};
|