@atlaskit/link-datasource 1.7.4 → 1.7.5
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/analytics/constants.js +1 -1
- package/dist/cjs/ui/assets-modal/modal/index.js +1 -1
- package/dist/cjs/ui/jira-issues-modal/basic-search-input/messages.js +1 -1
- package/dist/cjs/ui/jira-issues-modal/initial-state-view/index.js +39 -10
- package/dist/cjs/ui/jira-issues-modal/initial-state-view/messages.js +14 -4
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +19 -19
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +18 -9
- package/dist/es2019/analytics/constants.js +1 -1
- package/dist/es2019/ui/assets-modal/modal/index.js +1 -1
- package/dist/es2019/ui/jira-issues-modal/basic-search-input/messages.js +1 -1
- package/dist/es2019/ui/jira-issues-modal/initial-state-view/index.js +47 -21
- package/dist/es2019/ui/jira-issues-modal/initial-state-view/messages.js +14 -4
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +19 -19
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +15 -9
- package/dist/esm/analytics/constants.js +1 -1
- package/dist/esm/ui/assets-modal/modal/index.js +1 -1
- package/dist/esm/ui/jira-issues-modal/basic-search-input/messages.js +1 -1
- package/dist/esm/ui/jira-issues-modal/initial-state-view/index.js +39 -11
- package/dist/esm/ui/jira-issues-modal/initial-state-view/messages.js +14 -4
- package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +19 -19
- package/dist/esm/ui/jira-issues-modal/modal/index.js +18 -9
- package/dist/types/ui/jira-issues-modal/initial-state-view/index.d.ts +6 -1
- package/dist/types/ui/jira-issues-modal/initial-state-view/messages.d.ts +11 -1
- package/dist/types/ui/jira-issues-modal/jira-search-container/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/initial-state-view/index.d.ts +6 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/initial-state-view/messages.d.ts +11 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/index.d.ts +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 1.7.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#40232](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40232) [`b8c29cec088`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b8c29cec088) - [ux] Make JQL mode to be selected by default
|
|
8
|
+
|
|
3
9
|
## 1.7.4
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -234,7 +234,7 @@ var analyticsContextAttributes = {
|
|
|
234
234
|
};
|
|
235
235
|
var analyticsContextData = {
|
|
236
236
|
packageName: "@atlaskit/link-datasource",
|
|
237
|
-
packageVersion: "1.7.
|
|
237
|
+
packageVersion: "1.7.5",
|
|
238
238
|
source: 'datasourceConfigModal'
|
|
239
239
|
};
|
|
240
240
|
var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
|
|
@@ -9,6 +9,6 @@ var basicSearchInputMessages = exports.basicSearchInputMessages = (0, _reactIntl
|
|
|
9
9
|
basicTextSearchLabel: {
|
|
10
10
|
id: 'linkDataSource.jira-issues.configmodal.basicTextSearchPlaceholder',
|
|
11
11
|
description: 'Placeholder text for the search input box',
|
|
12
|
-
defaultMessage: 'Search'
|
|
12
|
+
defaultMessage: 'Search for issues by keyword'
|
|
13
13
|
}
|
|
14
14
|
});
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.InitialStateView = void 0;
|
|
7
8
|
var _react = require("@emotion/react");
|
|
8
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
|
|
11
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
9
12
|
var _initialStateSvg = require("./assets/initial-state-svg");
|
|
10
13
|
var _messages = require("./messages");
|
|
11
14
|
/** @jsx jsx */
|
|
@@ -19,19 +22,38 @@ var svgAndTextsWrapperStyles = (0, _react.css)({
|
|
|
19
22
|
textAlign: 'center',
|
|
20
23
|
alignSelf: 'center',
|
|
21
24
|
paddingTop: "var(--ds-space-600, 48px)",
|
|
22
|
-
paddingBottom: "var(--ds-space-600, 48px)"
|
|
25
|
+
paddingBottom: "var(--ds-space-600, 48px)",
|
|
26
|
+
width: '260px'
|
|
27
|
+
});
|
|
28
|
+
var betaTagStyles = (0, _react.css)({
|
|
29
|
+
display: 'flex'
|
|
23
30
|
});
|
|
24
31
|
var searchTitleStyles = (0, _react.css)({
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
color: "var(--ds-text-subtlest, ".concat(_colors.N300, ")"),
|
|
33
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
34
|
+
fontSize: "var(--ds-font-size-300, 20px)",
|
|
27
35
|
lineHeight: "var(--ds-font-lineHeight-300, 24px)",
|
|
28
36
|
paddingTop: "var(--ds-space-200, 16px)",
|
|
29
|
-
paddingBottom: "var(--ds-space-100, 8px)"
|
|
37
|
+
paddingBottom: "var(--ds-space-100, 8px)",
|
|
38
|
+
display: 'flex',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
gap: "var(--ds-space-100, 8px)"
|
|
42
|
+
});
|
|
43
|
+
var mainTextStyles = (0, _react.css)({
|
|
44
|
+
color: "var(--ds-text-subtlest, ".concat(_colors.N300, ")")
|
|
30
45
|
});
|
|
46
|
+
var learnMoreLinkStyles = (0, _react.css)({
|
|
47
|
+
paddingTop: "var(--ds-space-200, 16px)",
|
|
48
|
+
display: 'inline-block'
|
|
49
|
+
});
|
|
50
|
+
var methodToDescriptionMessage = {
|
|
51
|
+
basic: _messages.initialStateViewMessages.searchDescriptionForBasicSearch,
|
|
52
|
+
jql: _messages.initialStateViewMessages.searchDescriptionForJQLSearch
|
|
53
|
+
};
|
|
31
54
|
var jqlSupportDocumentLink = 'https://support.atlassian.com/jira-service-management-cloud/docs/use-advanced-search-with-jira-query-language-jql/';
|
|
32
|
-
var InitialStateView = exports.InitialStateView = function InitialStateView() {
|
|
33
|
-
var
|
|
34
|
-
formatMessage = _useIntl.formatMessage;
|
|
55
|
+
var InitialStateView = exports.InitialStateView = function InitialStateView(_ref) {
|
|
56
|
+
var searchMethod = _ref.searchMethod;
|
|
35
57
|
return (0, _react.jsx)("div", {
|
|
36
58
|
css: initialStateViewContainerStyles,
|
|
37
59
|
"data-testid": "jlol-datasource-modal--initial-state-view"
|
|
@@ -39,8 +61,15 @@ var InitialStateView = exports.InitialStateView = function InitialStateView() {
|
|
|
39
61
|
css: svgAndTextsWrapperStyles
|
|
40
62
|
}, (0, _react.jsx)(_initialStateSvg.InitialStateSVG, null), (0, _react.jsx)("div", {
|
|
41
63
|
css: searchTitleStyles
|
|
42
|
-
},
|
|
64
|
+
}, (0, _react.jsx)("div", {
|
|
65
|
+
css: betaTagStyles
|
|
66
|
+
}, (0, _react.jsx)(_lozenge.default, {
|
|
67
|
+
appearance: "new"
|
|
68
|
+
}, (0, _react.jsx)(_reactIntlNext.FormattedMessage, _messages.initialStateViewMessages.beta))), (0, _react.jsx)(_reactIntlNext.FormattedMessage, _messages.initialStateViewMessages.searchTitle)), (0, _react.jsx)("div", {
|
|
69
|
+
css: mainTextStyles
|
|
70
|
+
}, (0, _react.jsx)(_reactIntlNext.FormattedMessage, methodToDescriptionMessage[searchMethod])), searchMethod === 'jql' ? (0, _react.jsx)("a", {
|
|
43
71
|
href: jqlSupportDocumentLink,
|
|
44
|
-
target: "_blank"
|
|
45
|
-
|
|
72
|
+
target: "_blank",
|
|
73
|
+
css: learnMoreLinkStyles
|
|
74
|
+
}, (0, _react.jsx)(_reactIntlNext.FormattedMessage, _messages.initialStateViewMessages.learnMoreLink)) : null));
|
|
46
75
|
};
|
|
@@ -11,14 +11,24 @@ var initialStateViewMessages = exports.initialStateViewMessages = (0, _reactIntl
|
|
|
11
11
|
description: 'The initial modal search state title that gives the user some idea about how to get information',
|
|
12
12
|
defaultMessage: 'Search for Jira issues'
|
|
13
13
|
},
|
|
14
|
-
|
|
14
|
+
beta: {
|
|
15
|
+
id: 'linkDataSource.modal-initial-state.beta',
|
|
16
|
+
description: 'Beta lozenge',
|
|
17
|
+
defaultMessage: 'Beta'
|
|
18
|
+
},
|
|
19
|
+
searchDescriptionForBasicSearch: {
|
|
20
|
+
id: 'linkDataSource.modal-initial-state.searchDescription',
|
|
21
|
+
description: 'The initial modal search state helper message displayed under the search title when basic search mode is selected',
|
|
22
|
+
defaultMessage: 'Search by keyword for issues to insert.'
|
|
23
|
+
},
|
|
24
|
+
searchDescriptionForJQLSearch: {
|
|
15
25
|
id: 'linkDataSource.modal-initial-state.searchDescription',
|
|
16
|
-
description: 'The initial modal search state helper message displayed under the search title',
|
|
17
|
-
defaultMessage: '
|
|
26
|
+
description: 'The initial modal search state helper message displayed under the search title when JQL search mode is selected',
|
|
27
|
+
defaultMessage: 'Use JQL (Jira Query Language) to search for issues.'
|
|
18
28
|
},
|
|
19
29
|
learnMoreLink: {
|
|
20
30
|
id: 'linkDataSource.modal-initial-state.learnMoreLink',
|
|
21
31
|
description: 'The link that displays under the search description to help people know more about JQL',
|
|
22
|
-
defaultMessage: 'Learn
|
|
32
|
+
defaultMessage: 'Learn how to search with JQL'
|
|
23
33
|
}
|
|
24
34
|
});
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.JiraSearchContainer = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
@@ -30,13 +30,12 @@ var inputContainerStyles = (0, _react2.css)({
|
|
|
30
30
|
});
|
|
31
31
|
var DEFAULT_JQL_QUERY = 'created >= -30d order by created DESC';
|
|
32
32
|
var JiraSearchMethodSwitcher = _modeSwitcher.ModeSwitcher;
|
|
33
|
-
var getInitialSearchMethod = exports.getInitialSearchMethod = function getInitialSearchMethod(initialJql) {
|
|
34
|
-
return initialJql ? 'jql' : 'basic';
|
|
35
|
-
};
|
|
36
33
|
var JiraSearchContainer = exports.JiraSearchContainer = function JiraSearchContainer(props) {
|
|
37
34
|
var isSearching = props.isSearching,
|
|
38
35
|
parameters = props.parameters,
|
|
39
|
-
onSearch = props.onSearch
|
|
36
|
+
onSearch = props.onSearch,
|
|
37
|
+
onSearchMethodChangeCallback = props.onSearchMethodChange,
|
|
38
|
+
initialSearchMethod = props.initialSearchMethod;
|
|
40
39
|
var _ref = parameters || {},
|
|
41
40
|
cloudId = _ref.cloudId,
|
|
42
41
|
initialJql = _ref.jql;
|
|
@@ -46,7 +45,7 @@ var JiraSearchContainer = exports.JiraSearchContainer = function JiraSearchConta
|
|
|
46
45
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
47
46
|
basicSearchTerm = _useState2[0],
|
|
48
47
|
setBasicSearchTerm = _useState2[1];
|
|
49
|
-
var _useState3 = (0, _react.useState)(
|
|
48
|
+
var _useState3 = (0, _react.useState)(initialSearchMethod),
|
|
50
49
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
51
50
|
currentSearchMethod = _useState4[0],
|
|
52
51
|
setCurrentSearchMethod = _useState4[1];
|
|
@@ -64,10 +63,11 @@ var JiraSearchContainer = exports.JiraSearchContainer = function JiraSearchConta
|
|
|
64
63
|
setOrderDirection = _useState10[1];
|
|
65
64
|
var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
|
|
66
65
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
var onSearchMethodChange = (0, _react.useCallback)(function (searchMethod) {
|
|
67
|
+
onSearchMethodChangeCallback(searchMethod);
|
|
68
|
+
setCurrentSearchMethod(searchMethod);
|
|
69
|
+
}, [onSearchMethodChangeCallback]);
|
|
70
|
+
var handleBasicSearchChange = (0, _react.useCallback)(function (e) {
|
|
71
71
|
var rawSearch = e.currentTarget.value;
|
|
72
72
|
setBasicSearchTerm(rawSearch);
|
|
73
73
|
setJql((0, _buildJQL.buildJQL)({
|
|
@@ -75,8 +75,8 @@ var JiraSearchContainer = exports.JiraSearchContainer = function JiraSearchConta
|
|
|
75
75
|
orderDirection: orderDirection,
|
|
76
76
|
orderKey: orderKey
|
|
77
77
|
}));
|
|
78
|
-
};
|
|
79
|
-
var onQueryChange = function
|
|
78
|
+
}, [orderDirection, orderKey]);
|
|
79
|
+
var onQueryChange = (0, _react.useCallback)(function (query) {
|
|
80
80
|
var _query$split$map$filt, _fragments$at, _fragments$at2, _fragments$at3;
|
|
81
81
|
// determine if order keys have been set so they can be saved and persisted when changes occur in basic search
|
|
82
82
|
var fragments = (_query$split$map$filt = query === null || query === void 0 ? void 0 : query.split(/(^| )(order by)( |$)/i).map(function (item) {
|
|
@@ -92,8 +92,8 @@ var JiraSearchContainer = exports.JiraSearchContainer = function JiraSearchConta
|
|
|
92
92
|
setOrderDirection(order);
|
|
93
93
|
}
|
|
94
94
|
setJql(query);
|
|
95
|
-
};
|
|
96
|
-
var handleSearch = function
|
|
95
|
+
}, []);
|
|
96
|
+
var handleSearch = (0, _react.useCallback)(function () {
|
|
97
97
|
onSearch({
|
|
98
98
|
jql: jql
|
|
99
99
|
}, currentSearchMethod);
|
|
@@ -102,7 +102,7 @@ var JiraSearchContainer = exports.JiraSearchContainer = function JiraSearchConta
|
|
|
102
102
|
} else if (currentSearchMethod === 'jql') {
|
|
103
103
|
fireEvent('ui.jqlEditor.searched', {});
|
|
104
104
|
}
|
|
105
|
-
};
|
|
105
|
+
}, [currentSearchMethod, fireEvent, jql, onSearch]);
|
|
106
106
|
var showBasicFilters = (0, _react.useMemo)(function () {
|
|
107
107
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource.show-jlol-basic-filters')) {
|
|
108
108
|
return true;
|
|
@@ -123,14 +123,14 @@ var JiraSearchContainer = exports.JiraSearchContainer = function JiraSearchConta
|
|
|
123
123
|
onSearch: handleSearch,
|
|
124
124
|
query: jql
|
|
125
125
|
}), (0, _react2.jsx)(JiraSearchMethodSwitcher, {
|
|
126
|
-
onOptionValueChange:
|
|
126
|
+
onOptionValueChange: onSearchMethodChange,
|
|
127
127
|
selectedOptionValue: currentSearchMethod,
|
|
128
128
|
options: [{
|
|
129
|
-
label: formatMessage(_messages.modeSwitcherMessages.basicTextSearchLabel),
|
|
130
|
-
value: 'basic'
|
|
131
|
-
}, {
|
|
132
129
|
label: 'JQL',
|
|
133
130
|
value: 'jql'
|
|
131
|
+
}, {
|
|
132
|
+
label: formatMessage(_messages.modeSwitcherMessages.basicTextSearchLabel),
|
|
133
|
+
value: 'basic'
|
|
134
134
|
}]
|
|
135
135
|
}));
|
|
136
136
|
};
|
|
@@ -122,7 +122,12 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
122
122
|
// analytics related parameters
|
|
123
123
|
var searchCount = (0, _react.useRef)(0);
|
|
124
124
|
var userInteractionActions = (0, _react.useRef)(new Set());
|
|
125
|
-
var
|
|
125
|
+
var initialSearchMethod = 'jql'; // TODO EDM-7688 This where we can add feature that decides if it's basic or jql based on JQL content (Regexp)
|
|
126
|
+
var _useState11 = (0, _react.useState)(initialSearchMethod),
|
|
127
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
128
|
+
currentSearchMethod = _useState12[0],
|
|
129
|
+
setCurrentSearchMethod = _useState12[1];
|
|
130
|
+
var searchMethodSearchedWith = (0, _react.useRef)(null);
|
|
126
131
|
var visibleColumnCount = (0, _react.useRef)((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
|
|
127
132
|
var parameters = (0, _react.useMemo)(function () {
|
|
128
133
|
return !!cloudId ? {
|
|
@@ -239,12 +244,12 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
239
244
|
}, [cloudId, selectedJiraSite]);
|
|
240
245
|
var fireSingleItemViewedEvent = (0, _react.useCallback)(function () {
|
|
241
246
|
fireEvent('ui.link.viewed.singleItem', _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
242
|
-
searchMethod: (0, _utils.mapSearchMethod)(
|
|
247
|
+
searchMethod: (0, _utils.mapSearchMethod)(searchMethodSearchedWith.current)
|
|
243
248
|
}));
|
|
244
249
|
}, [analyticsPayload, fireEvent]);
|
|
245
250
|
var fireCountViewedEvent = (0, _react.useCallback)(function () {
|
|
246
251
|
fireEvent('ui.link.viewed.count', _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
247
|
-
searchMethod: (0, _utils.mapSearchMethod)(
|
|
252
|
+
searchMethod: (0, _utils.mapSearchMethod)(searchMethodSearchedWith.current),
|
|
248
253
|
totalItemCount: totalCount || 0
|
|
249
254
|
}));
|
|
250
255
|
}, [analyticsPayload, fireEvent, totalCount]);
|
|
@@ -252,7 +257,7 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
252
257
|
if (isDataReady) {
|
|
253
258
|
fireEvent('ui.table.viewed.datasourceConfigModal', _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
254
259
|
totalItemCount: totalCount || 0,
|
|
255
|
-
searchMethod: (0, _utils.mapSearchMethod)(
|
|
260
|
+
searchMethod: (0, _utils.mapSearchMethod)(searchMethodSearchedWith.current),
|
|
256
261
|
displayedColumnCount: visibleColumnCount.current
|
|
257
262
|
}));
|
|
258
263
|
}
|
|
@@ -283,7 +288,7 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
283
288
|
(0, _useColumnPickerRenderedFailedUfoExperience.useColumnPickerRenderedFailedUfoExperience)(status, modalRenderInstanceId);
|
|
284
289
|
var onSearch = (0, _react.useCallback)(function (newParameters, searchMethod) {
|
|
285
290
|
searchCount.current++;
|
|
286
|
-
|
|
291
|
+
searchMethodSearchedWith.current = searchMethod;
|
|
287
292
|
if (jql !== newParameters.jql) {
|
|
288
293
|
userInteractionActions.current.add(_types.DatasourceAction.QUERY_UPDATED);
|
|
289
294
|
}
|
|
@@ -329,7 +334,7 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
329
334
|
displayedColumnCount: visibleColumnCount.current,
|
|
330
335
|
display: getDisplayValue(currentViewMode, totalCount || 0),
|
|
331
336
|
searchCount: searchCount.current,
|
|
332
|
-
searchMethod: (0, _utils.mapSearchMethod)(
|
|
337
|
+
searchMethod: (0, _utils.mapSearchMethod)(searchMethodSearchedWith.current),
|
|
333
338
|
actions: Array.from(userInteractionActions.current)
|
|
334
339
|
}),
|
|
335
340
|
eventType: 'ui'
|
|
@@ -450,7 +455,9 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
450
455
|
}, !!jql ? (0, _react2.jsx)(_issueLikeTable.EmptyState, {
|
|
451
456
|
testId: "jira-jql-datasource-modal--empty-state",
|
|
452
457
|
isLoading: true
|
|
453
|
-
}) : (0, _react2.jsx)(_initialStateView.InitialStateView,
|
|
458
|
+
}) : (0, _react2.jsx)(_initialStateView.InitialStateView, {
|
|
459
|
+
searchMethod: currentSearchMethod
|
|
460
|
+
}));
|
|
454
461
|
}
|
|
455
462
|
var firstIssueUrl = retrieveUrlForSmartCardRender();
|
|
456
463
|
if (responseItems.length === 1 && firstIssueUrl) {
|
|
@@ -461,7 +468,7 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
461
468
|
}));
|
|
462
469
|
}
|
|
463
470
|
return issueLikeDataTableView;
|
|
464
|
-
}, [status, jqlUrl, resolvedWithNoResults, columns.length, retrieveUrlForSmartCardRender, responseItems.length, issueLikeDataTableView, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName, jql]);
|
|
471
|
+
}, [status, jqlUrl, resolvedWithNoResults, columns.length, retrieveUrlForSmartCardRender, responseItems.length, issueLikeDataTableView, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName, jql, currentSearchMethod]);
|
|
465
472
|
return (0, _react2.jsx)(_modalDialog.ModalTransition, null, (0, _react2.jsx)(_modalDialog.default, {
|
|
466
473
|
testId: 'jira-jql-datasource-modal',
|
|
467
474
|
onClose: onCancel,
|
|
@@ -492,7 +499,9 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
492
499
|
})), (0, _react2.jsx)(_modalDialog.ModalBody, null, (0, _react2.jsx)(_jiraSearchContainer.JiraSearchContainer, {
|
|
493
500
|
isSearching: status === 'loading',
|
|
494
501
|
parameters: parameters,
|
|
495
|
-
onSearch: onSearch
|
|
502
|
+
onSearch: onSearch,
|
|
503
|
+
initialSearchMethod: initialSearchMethod,
|
|
504
|
+
onSearchMethodChange: setCurrentSearchMethod
|
|
496
505
|
}), currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent()), (0, _react2.jsx)(_modalDialog.ModalFooter, null, shouldShowIssueCount && (0, _react2.jsx)("div", {
|
|
497
506
|
"data-testid": "jira-jql-datasource-modal-total-issues-count",
|
|
498
507
|
css: issueCountStyles
|
|
@@ -3,6 +3,6 @@ export const basicSearchInputMessages = defineMessages({
|
|
|
3
3
|
basicTextSearchLabel: {
|
|
4
4
|
id: 'linkDataSource.jira-issues.configmodal.basicTextSearchPlaceholder',
|
|
5
5
|
description: 'Placeholder text for the search input box',
|
|
6
|
-
defaultMessage: 'Search'
|
|
6
|
+
defaultMessage: 'Search for issues by keyword'
|
|
7
7
|
}
|
|
8
8
|
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import {
|
|
4
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
5
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
6
|
+
import { N300 } from '@atlaskit/theme/colors';
|
|
5
7
|
import { InitialStateSVG } from './assets/initial-state-svg';
|
|
6
8
|
import { initialStateViewMessages } from './messages';
|
|
7
9
|
const initialStateViewContainerStyles = css({
|
|
@@ -13,29 +15,53 @@ const svgAndTextsWrapperStyles = css({
|
|
|
13
15
|
textAlign: 'center',
|
|
14
16
|
alignSelf: 'center',
|
|
15
17
|
paddingTop: "var(--ds-space-600, 48px)",
|
|
16
|
-
paddingBottom: "var(--ds-space-600, 48px)"
|
|
18
|
+
paddingBottom: "var(--ds-space-600, 48px)",
|
|
19
|
+
width: '260px'
|
|
20
|
+
});
|
|
21
|
+
const betaTagStyles = css({
|
|
22
|
+
display: 'flex'
|
|
17
23
|
});
|
|
18
24
|
const searchTitleStyles = css({
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
color: `var(--ds-text-subtlest, ${N300})`,
|
|
26
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
27
|
+
fontSize: "var(--ds-font-size-300, 20px)",
|
|
21
28
|
lineHeight: "var(--ds-font-lineHeight-300, 24px)",
|
|
22
29
|
paddingTop: "var(--ds-space-200, 16px)",
|
|
23
|
-
paddingBottom: "var(--ds-space-100, 8px)"
|
|
30
|
+
paddingBottom: "var(--ds-space-100, 8px)",
|
|
31
|
+
display: 'flex',
|
|
32
|
+
justifyContent: 'center',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
gap: "var(--ds-space-100, 8px)"
|
|
35
|
+
});
|
|
36
|
+
const mainTextStyles = css({
|
|
37
|
+
color: `var(--ds-text-subtlest, ${N300})`
|
|
38
|
+
});
|
|
39
|
+
const learnMoreLinkStyles = css({
|
|
40
|
+
paddingTop: "var(--ds-space-200, 16px)",
|
|
41
|
+
display: 'inline-block'
|
|
24
42
|
});
|
|
43
|
+
const methodToDescriptionMessage = {
|
|
44
|
+
basic: initialStateViewMessages.searchDescriptionForBasicSearch,
|
|
45
|
+
jql: initialStateViewMessages.searchDescriptionForJQLSearch
|
|
46
|
+
};
|
|
25
47
|
const jqlSupportDocumentLink = 'https://support.atlassian.com/jira-service-management-cloud/docs/use-advanced-search-with-jira-query-language-jql/';
|
|
26
|
-
export const InitialStateView = (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
48
|
+
export const InitialStateView = ({
|
|
49
|
+
searchMethod
|
|
50
|
+
}) => jsx("div", {
|
|
51
|
+
css: initialStateViewContainerStyles,
|
|
52
|
+
"data-testid": "jlol-datasource-modal--initial-state-view"
|
|
53
|
+
}, jsx("div", {
|
|
54
|
+
css: svgAndTextsWrapperStyles
|
|
55
|
+
}, jsx(InitialStateSVG, null), jsx("div", {
|
|
56
|
+
css: searchTitleStyles
|
|
57
|
+
}, jsx("div", {
|
|
58
|
+
css: betaTagStyles
|
|
59
|
+
}, jsx(Lozenge, {
|
|
60
|
+
appearance: "new"
|
|
61
|
+
}, jsx(FormattedMessage, initialStateViewMessages.beta))), jsx(FormattedMessage, initialStateViewMessages.searchTitle)), jsx("div", {
|
|
62
|
+
css: mainTextStyles
|
|
63
|
+
}, jsx(FormattedMessage, methodToDescriptionMessage[searchMethod])), searchMethod === 'jql' ? jsx("a", {
|
|
64
|
+
href: jqlSupportDocumentLink,
|
|
65
|
+
target: "_blank",
|
|
66
|
+
css: learnMoreLinkStyles
|
|
67
|
+
}, jsx(FormattedMessage, initialStateViewMessages.learnMoreLink)) : null));
|
|
@@ -5,14 +5,24 @@ export const initialStateViewMessages = defineMessages({
|
|
|
5
5
|
description: 'The initial modal search state title that gives the user some idea about how to get information',
|
|
6
6
|
defaultMessage: 'Search for Jira issues'
|
|
7
7
|
},
|
|
8
|
-
|
|
8
|
+
beta: {
|
|
9
|
+
id: 'linkDataSource.modal-initial-state.beta',
|
|
10
|
+
description: 'Beta lozenge',
|
|
11
|
+
defaultMessage: 'Beta'
|
|
12
|
+
},
|
|
13
|
+
searchDescriptionForBasicSearch: {
|
|
14
|
+
id: 'linkDataSource.modal-initial-state.searchDescription',
|
|
15
|
+
description: 'The initial modal search state helper message displayed under the search title when basic search mode is selected',
|
|
16
|
+
defaultMessage: 'Search by keyword for issues to insert.'
|
|
17
|
+
},
|
|
18
|
+
searchDescriptionForJQLSearch: {
|
|
9
19
|
id: 'linkDataSource.modal-initial-state.searchDescription',
|
|
10
|
-
description: 'The initial modal search state helper message displayed under the search title',
|
|
11
|
-
defaultMessage: '
|
|
20
|
+
description: 'The initial modal search state helper message displayed under the search title when JQL search mode is selected',
|
|
21
|
+
defaultMessage: 'Use JQL (Jira Query Language) to search for issues.'
|
|
12
22
|
},
|
|
13
23
|
learnMoreLink: {
|
|
14
24
|
id: 'linkDataSource.modal-initial-state.learnMoreLink',
|
|
15
25
|
description: 'The link that displays under the search description to help people know more about JQL',
|
|
16
|
-
defaultMessage: 'Learn
|
|
26
|
+
defaultMessage: 'Learn how to search with JQL'
|
|
17
27
|
}
|
|
18
28
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { useIntl } from 'react-intl-next';
|
|
5
5
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -18,14 +18,13 @@ const inputContainerStyles = css({
|
|
|
18
18
|
});
|
|
19
19
|
const DEFAULT_JQL_QUERY = 'created >= -30d order by created DESC';
|
|
20
20
|
const JiraSearchMethodSwitcher = ModeSwitcher;
|
|
21
|
-
export const getInitialSearchMethod = initialJql => {
|
|
22
|
-
return initialJql ? 'jql' : 'basic';
|
|
23
|
-
};
|
|
24
21
|
export const JiraSearchContainer = props => {
|
|
25
22
|
const {
|
|
26
23
|
isSearching,
|
|
27
24
|
parameters,
|
|
28
|
-
onSearch
|
|
25
|
+
onSearch,
|
|
26
|
+
onSearchMethodChange: onSearchMethodChangeCallback,
|
|
27
|
+
initialSearchMethod
|
|
29
28
|
} = props;
|
|
30
29
|
const {
|
|
31
30
|
cloudId,
|
|
@@ -35,17 +34,18 @@ export const JiraSearchContainer = props => {
|
|
|
35
34
|
formatMessage
|
|
36
35
|
} = useIntl();
|
|
37
36
|
const [basicSearchTerm, setBasicSearchTerm] = useState('');
|
|
38
|
-
const [currentSearchMethod, setCurrentSearchMethod] = useState(
|
|
37
|
+
const [currentSearchMethod, setCurrentSearchMethod] = useState(initialSearchMethod);
|
|
39
38
|
const [jql, setJql] = useState(initialJql || DEFAULT_JQL_QUERY);
|
|
40
39
|
const [orderKey, setOrderKey] = useState();
|
|
41
40
|
const [orderDirection, setOrderDirection] = useState();
|
|
42
41
|
const {
|
|
43
42
|
fireEvent
|
|
44
43
|
} = useDatasourceAnalyticsEvents();
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const onSearchMethodChange = useCallback(searchMethod => {
|
|
45
|
+
onSearchMethodChangeCallback(searchMethod);
|
|
46
|
+
setCurrentSearchMethod(searchMethod);
|
|
47
|
+
}, [onSearchMethodChangeCallback]);
|
|
48
|
+
const handleBasicSearchChange = useCallback(e => {
|
|
49
49
|
const rawSearch = e.currentTarget.value;
|
|
50
50
|
setBasicSearchTerm(rawSearch);
|
|
51
51
|
setJql(buildJQL({
|
|
@@ -53,8 +53,8 @@ export const JiraSearchContainer = props => {
|
|
|
53
53
|
orderDirection,
|
|
54
54
|
orderKey
|
|
55
55
|
}));
|
|
56
|
-
};
|
|
57
|
-
const onQueryChange = query => {
|
|
56
|
+
}, [orderDirection, orderKey]);
|
|
57
|
+
const onQueryChange = useCallback(query => {
|
|
58
58
|
var _query$split$map$filt, _fragments$at, _fragments$at2, _fragments$at3;
|
|
59
59
|
// determine if order keys have been set so they can be saved and persisted when changes occur in basic search
|
|
60
60
|
const fragments = (_query$split$map$filt = query === null || query === void 0 ? void 0 : query.split(/(^| )(order by)( |$)/i).map(item => item.trim()).filter(Boolean)) !== null && _query$split$map$filt !== void 0 ? _query$split$map$filt : [];
|
|
@@ -68,8 +68,8 @@ export const JiraSearchContainer = props => {
|
|
|
68
68
|
setOrderDirection(order);
|
|
69
69
|
}
|
|
70
70
|
setJql(query);
|
|
71
|
-
};
|
|
72
|
-
const handleSearch = () => {
|
|
71
|
+
}, []);
|
|
72
|
+
const handleSearch = useCallback(() => {
|
|
73
73
|
onSearch({
|
|
74
74
|
jql
|
|
75
75
|
}, currentSearchMethod);
|
|
@@ -78,7 +78,7 @@ export const JiraSearchContainer = props => {
|
|
|
78
78
|
} else if (currentSearchMethod === 'jql') {
|
|
79
79
|
fireEvent('ui.jqlEditor.searched', {});
|
|
80
80
|
}
|
|
81
|
-
};
|
|
81
|
+
}, [currentSearchMethod, fireEvent, jql, onSearch]);
|
|
82
82
|
const showBasicFilters = useMemo(() => {
|
|
83
83
|
if (getBooleanFF('platform.linking-platform.datasource.show-jlol-basic-filters')) {
|
|
84
84
|
return true;
|
|
@@ -99,14 +99,14 @@ export const JiraSearchContainer = props => {
|
|
|
99
99
|
onSearch: handleSearch,
|
|
100
100
|
query: jql
|
|
101
101
|
}), jsx(JiraSearchMethodSwitcher, {
|
|
102
|
-
onOptionValueChange:
|
|
102
|
+
onOptionValueChange: onSearchMethodChange,
|
|
103
103
|
selectedOptionValue: currentSearchMethod,
|
|
104
104
|
options: [{
|
|
105
|
-
label: formatMessage(modeSwitcherMessages.basicTextSearchLabel),
|
|
106
|
-
value: 'basic'
|
|
107
|
-
}, {
|
|
108
105
|
label: 'JQL',
|
|
109
106
|
value: 'jql'
|
|
107
|
+
}, {
|
|
108
|
+
label: formatMessage(modeSwitcherMessages.basicTextSearchLabel),
|
|
109
|
+
value: 'basic'
|
|
110
110
|
}]
|
|
111
111
|
}));
|
|
112
112
|
};
|
|
@@ -92,7 +92,9 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
92
92
|
// analytics related parameters
|
|
93
93
|
const searchCount = useRef(0);
|
|
94
94
|
const userInteractionActions = useRef(new Set());
|
|
95
|
-
const
|
|
95
|
+
const initialSearchMethod = 'jql'; // TODO EDM-7688 This where we can add feature that decides if it's basic or jql based on JQL content (Regexp)
|
|
96
|
+
const [currentSearchMethod, setCurrentSearchMethod] = useState(initialSearchMethod);
|
|
97
|
+
const searchMethodSearchedWith = useRef(null);
|
|
96
98
|
const visibleColumnCount = useRef((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
|
|
97
99
|
const parameters = useMemo(() => !!cloudId ? {
|
|
98
100
|
cloudId,
|
|
@@ -188,13 +190,13 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
188
190
|
const fireSingleItemViewedEvent = useCallback(() => {
|
|
189
191
|
fireEvent('ui.link.viewed.singleItem', {
|
|
190
192
|
...analyticsPayload,
|
|
191
|
-
searchMethod: mapSearchMethod(
|
|
193
|
+
searchMethod: mapSearchMethod(searchMethodSearchedWith.current)
|
|
192
194
|
});
|
|
193
195
|
}, [analyticsPayload, fireEvent]);
|
|
194
196
|
const fireCountViewedEvent = useCallback(() => {
|
|
195
197
|
fireEvent('ui.link.viewed.count', {
|
|
196
198
|
...analyticsPayload,
|
|
197
|
-
searchMethod: mapSearchMethod(
|
|
199
|
+
searchMethod: mapSearchMethod(searchMethodSearchedWith.current),
|
|
198
200
|
totalItemCount: totalCount || 0
|
|
199
201
|
});
|
|
200
202
|
}, [analyticsPayload, fireEvent, totalCount]);
|
|
@@ -203,7 +205,7 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
203
205
|
fireEvent('ui.table.viewed.datasourceConfigModal', {
|
|
204
206
|
...analyticsPayload,
|
|
205
207
|
totalItemCount: totalCount || 0,
|
|
206
|
-
searchMethod: mapSearchMethod(
|
|
208
|
+
searchMethod: mapSearchMethod(searchMethodSearchedWith.current),
|
|
207
209
|
displayedColumnCount: visibleColumnCount.current
|
|
208
210
|
});
|
|
209
211
|
}
|
|
@@ -234,7 +236,7 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
234
236
|
useColumnPickerRenderedFailedUfoExperience(status, modalRenderInstanceId);
|
|
235
237
|
const onSearch = useCallback((newParameters, searchMethod) => {
|
|
236
238
|
searchCount.current++;
|
|
237
|
-
|
|
239
|
+
searchMethodSearchedWith.current = searchMethod;
|
|
238
240
|
if (jql !== newParameters.jql) {
|
|
239
241
|
userInteractionActions.current.add(DatasourceAction.QUERY_UPDATED);
|
|
240
242
|
}
|
|
@@ -281,7 +283,7 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
281
283
|
displayedColumnCount: visibleColumnCount.current,
|
|
282
284
|
display: getDisplayValue(currentViewMode, totalCount || 0),
|
|
283
285
|
searchCount: searchCount.current,
|
|
284
|
-
searchMethod: mapSearchMethod(
|
|
286
|
+
searchMethod: mapSearchMethod(searchMethodSearchedWith.current),
|
|
285
287
|
actions: Array.from(userInteractionActions.current)
|
|
286
288
|
},
|
|
287
289
|
eventType: 'ui'
|
|
@@ -397,7 +399,9 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
397
399
|
}, !!jql ? jsx(EmptyState, {
|
|
398
400
|
testId: `jira-jql-datasource-modal--empty-state`,
|
|
399
401
|
isLoading: true
|
|
400
|
-
}) : jsx(InitialStateView,
|
|
402
|
+
}) : jsx(InitialStateView, {
|
|
403
|
+
searchMethod: currentSearchMethod
|
|
404
|
+
}));
|
|
401
405
|
}
|
|
402
406
|
const firstIssueUrl = retrieveUrlForSmartCardRender();
|
|
403
407
|
if (responseItems.length === 1 && firstIssueUrl) {
|
|
@@ -408,7 +412,7 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
408
412
|
}));
|
|
409
413
|
}
|
|
410
414
|
return issueLikeDataTableView;
|
|
411
|
-
}, [status, jqlUrl, resolvedWithNoResults, columns.length, retrieveUrlForSmartCardRender, responseItems.length, issueLikeDataTableView, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName, jql]);
|
|
415
|
+
}, [status, jqlUrl, resolvedWithNoResults, columns.length, retrieveUrlForSmartCardRender, responseItems.length, issueLikeDataTableView, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName, jql, currentSearchMethod]);
|
|
412
416
|
return jsx(ModalTransition, null, jsx(Modal, {
|
|
413
417
|
testId: 'jira-jql-datasource-modal',
|
|
414
418
|
onClose: onCancel,
|
|
@@ -439,7 +443,9 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
439
443
|
})), jsx(ModalBody, null, jsx(JiraSearchContainer, {
|
|
440
444
|
isSearching: status === 'loading',
|
|
441
445
|
parameters: parameters,
|
|
442
|
-
onSearch: onSearch
|
|
446
|
+
onSearch: onSearch,
|
|
447
|
+
initialSearchMethod: initialSearchMethod,
|
|
448
|
+
onSearchMethodChange: setCurrentSearchMethod
|
|
443
449
|
}), currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent()), jsx(ModalFooter, null, shouldShowIssueCount && jsx("div", {
|
|
444
450
|
"data-testid": "jira-jql-datasource-modal-total-issues-count",
|
|
445
451
|
css: issueCountStyles
|
|
@@ -225,7 +225,7 @@ var analyticsContextAttributes = {
|
|
|
225
225
|
};
|
|
226
226
|
var analyticsContextData = {
|
|
227
227
|
packageName: "@atlaskit/link-datasource",
|
|
228
|
-
packageVersion: "1.7.
|
|
228
|
+
packageVersion: "1.7.5",
|
|
229
229
|
source: 'datasourceConfigModal'
|
|
230
230
|
};
|
|
231
231
|
var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
|
|
@@ -3,6 +3,6 @@ export var basicSearchInputMessages = defineMessages({
|
|
|
3
3
|
basicTextSearchLabel: {
|
|
4
4
|
id: 'linkDataSource.jira-issues.configmodal.basicTextSearchPlaceholder',
|
|
5
5
|
description: 'Placeholder text for the search input box',
|
|
6
|
-
defaultMessage: 'Search'
|
|
6
|
+
defaultMessage: 'Search for issues by keyword'
|
|
7
7
|
}
|
|
8
8
|
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import {
|
|
4
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
5
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
6
|
+
import { N300 } from '@atlaskit/theme/colors';
|
|
5
7
|
import { InitialStateSVG } from './assets/initial-state-svg';
|
|
6
8
|
import { initialStateViewMessages } from './messages';
|
|
7
9
|
var initialStateViewContainerStyles = css({
|
|
@@ -13,19 +15,38 @@ var svgAndTextsWrapperStyles = css({
|
|
|
13
15
|
textAlign: 'center',
|
|
14
16
|
alignSelf: 'center',
|
|
15
17
|
paddingTop: "var(--ds-space-600, 48px)",
|
|
16
|
-
paddingBottom: "var(--ds-space-600, 48px)"
|
|
18
|
+
paddingBottom: "var(--ds-space-600, 48px)",
|
|
19
|
+
width: '260px'
|
|
20
|
+
});
|
|
21
|
+
var betaTagStyles = css({
|
|
22
|
+
display: 'flex'
|
|
17
23
|
});
|
|
18
24
|
var searchTitleStyles = css({
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
color: "var(--ds-text-subtlest, ".concat(N300, ")"),
|
|
26
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
27
|
+
fontSize: "var(--ds-font-size-300, 20px)",
|
|
21
28
|
lineHeight: "var(--ds-font-lineHeight-300, 24px)",
|
|
22
29
|
paddingTop: "var(--ds-space-200, 16px)",
|
|
23
|
-
paddingBottom: "var(--ds-space-100, 8px)"
|
|
30
|
+
paddingBottom: "var(--ds-space-100, 8px)",
|
|
31
|
+
display: 'flex',
|
|
32
|
+
justifyContent: 'center',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
gap: "var(--ds-space-100, 8px)"
|
|
35
|
+
});
|
|
36
|
+
var mainTextStyles = css({
|
|
37
|
+
color: "var(--ds-text-subtlest, ".concat(N300, ")")
|
|
24
38
|
});
|
|
39
|
+
var learnMoreLinkStyles = css({
|
|
40
|
+
paddingTop: "var(--ds-space-200, 16px)",
|
|
41
|
+
display: 'inline-block'
|
|
42
|
+
});
|
|
43
|
+
var methodToDescriptionMessage = {
|
|
44
|
+
basic: initialStateViewMessages.searchDescriptionForBasicSearch,
|
|
45
|
+
jql: initialStateViewMessages.searchDescriptionForJQLSearch
|
|
46
|
+
};
|
|
25
47
|
var jqlSupportDocumentLink = 'https://support.atlassian.com/jira-service-management-cloud/docs/use-advanced-search-with-jira-query-language-jql/';
|
|
26
|
-
export var InitialStateView = function InitialStateView() {
|
|
27
|
-
var
|
|
28
|
-
formatMessage = _useIntl.formatMessage;
|
|
48
|
+
export var InitialStateView = function InitialStateView(_ref) {
|
|
49
|
+
var searchMethod = _ref.searchMethod;
|
|
29
50
|
return jsx("div", {
|
|
30
51
|
css: initialStateViewContainerStyles,
|
|
31
52
|
"data-testid": "jlol-datasource-modal--initial-state-view"
|
|
@@ -33,8 +54,15 @@ export var InitialStateView = function InitialStateView() {
|
|
|
33
54
|
css: svgAndTextsWrapperStyles
|
|
34
55
|
}, jsx(InitialStateSVG, null), jsx("div", {
|
|
35
56
|
css: searchTitleStyles
|
|
36
|
-
},
|
|
57
|
+
}, jsx("div", {
|
|
58
|
+
css: betaTagStyles
|
|
59
|
+
}, jsx(Lozenge, {
|
|
60
|
+
appearance: "new"
|
|
61
|
+
}, jsx(FormattedMessage, initialStateViewMessages.beta))), jsx(FormattedMessage, initialStateViewMessages.searchTitle)), jsx("div", {
|
|
62
|
+
css: mainTextStyles
|
|
63
|
+
}, jsx(FormattedMessage, methodToDescriptionMessage[searchMethod])), searchMethod === 'jql' ? jsx("a", {
|
|
37
64
|
href: jqlSupportDocumentLink,
|
|
38
|
-
target: "_blank"
|
|
39
|
-
|
|
65
|
+
target: "_blank",
|
|
66
|
+
css: learnMoreLinkStyles
|
|
67
|
+
}, jsx(FormattedMessage, initialStateViewMessages.learnMoreLink)) : null));
|
|
40
68
|
};
|
|
@@ -5,14 +5,24 @@ export var initialStateViewMessages = defineMessages({
|
|
|
5
5
|
description: 'The initial modal search state title that gives the user some idea about how to get information',
|
|
6
6
|
defaultMessage: 'Search for Jira issues'
|
|
7
7
|
},
|
|
8
|
-
|
|
8
|
+
beta: {
|
|
9
|
+
id: 'linkDataSource.modal-initial-state.beta',
|
|
10
|
+
description: 'Beta lozenge',
|
|
11
|
+
defaultMessage: 'Beta'
|
|
12
|
+
},
|
|
13
|
+
searchDescriptionForBasicSearch: {
|
|
14
|
+
id: 'linkDataSource.modal-initial-state.searchDescription',
|
|
15
|
+
description: 'The initial modal search state helper message displayed under the search title when basic search mode is selected',
|
|
16
|
+
defaultMessage: 'Search by keyword for issues to insert.'
|
|
17
|
+
},
|
|
18
|
+
searchDescriptionForJQLSearch: {
|
|
9
19
|
id: 'linkDataSource.modal-initial-state.searchDescription',
|
|
10
|
-
description: 'The initial modal search state helper message displayed under the search title',
|
|
11
|
-
defaultMessage: '
|
|
20
|
+
description: 'The initial modal search state helper message displayed under the search title when JQL search mode is selected',
|
|
21
|
+
defaultMessage: 'Use JQL (Jira Query Language) to search for issues.'
|
|
12
22
|
},
|
|
13
23
|
learnMoreLink: {
|
|
14
24
|
id: 'linkDataSource.modal-initial-state.learnMoreLink',
|
|
15
25
|
description: 'The link that displays under the search description to help people know more about JQL',
|
|
16
|
-
defaultMessage: 'Learn
|
|
26
|
+
defaultMessage: 'Learn how to search with JQL'
|
|
17
27
|
}
|
|
18
28
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import React, { useMemo, useState } from 'react';
|
|
3
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { useIntl } from 'react-intl-next';
|
|
6
6
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -19,13 +19,12 @@ var inputContainerStyles = css({
|
|
|
19
19
|
});
|
|
20
20
|
var DEFAULT_JQL_QUERY = 'created >= -30d order by created DESC';
|
|
21
21
|
var JiraSearchMethodSwitcher = ModeSwitcher;
|
|
22
|
-
export var getInitialSearchMethod = function getInitialSearchMethod(initialJql) {
|
|
23
|
-
return initialJql ? 'jql' : 'basic';
|
|
24
|
-
};
|
|
25
22
|
export var JiraSearchContainer = function JiraSearchContainer(props) {
|
|
26
23
|
var isSearching = props.isSearching,
|
|
27
24
|
parameters = props.parameters,
|
|
28
|
-
onSearch = props.onSearch
|
|
25
|
+
onSearch = props.onSearch,
|
|
26
|
+
onSearchMethodChangeCallback = props.onSearchMethodChange,
|
|
27
|
+
initialSearchMethod = props.initialSearchMethod;
|
|
29
28
|
var _ref = parameters || {},
|
|
30
29
|
cloudId = _ref.cloudId,
|
|
31
30
|
initialJql = _ref.jql;
|
|
@@ -35,7 +34,7 @@ export var JiraSearchContainer = function JiraSearchContainer(props) {
|
|
|
35
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36
35
|
basicSearchTerm = _useState2[0],
|
|
37
36
|
setBasicSearchTerm = _useState2[1];
|
|
38
|
-
var _useState3 = useState(
|
|
37
|
+
var _useState3 = useState(initialSearchMethod),
|
|
39
38
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
40
39
|
currentSearchMethod = _useState4[0],
|
|
41
40
|
setCurrentSearchMethod = _useState4[1];
|
|
@@ -53,10 +52,11 @@ export var JiraSearchContainer = function JiraSearchContainer(props) {
|
|
|
53
52
|
setOrderDirection = _useState10[1];
|
|
54
53
|
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
55
54
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
var onSearchMethodChange = useCallback(function (searchMethod) {
|
|
56
|
+
onSearchMethodChangeCallback(searchMethod);
|
|
57
|
+
setCurrentSearchMethod(searchMethod);
|
|
58
|
+
}, [onSearchMethodChangeCallback]);
|
|
59
|
+
var handleBasicSearchChange = useCallback(function (e) {
|
|
60
60
|
var rawSearch = e.currentTarget.value;
|
|
61
61
|
setBasicSearchTerm(rawSearch);
|
|
62
62
|
setJql(buildJQL({
|
|
@@ -64,8 +64,8 @@ export var JiraSearchContainer = function JiraSearchContainer(props) {
|
|
|
64
64
|
orderDirection: orderDirection,
|
|
65
65
|
orderKey: orderKey
|
|
66
66
|
}));
|
|
67
|
-
};
|
|
68
|
-
var onQueryChange = function
|
|
67
|
+
}, [orderDirection, orderKey]);
|
|
68
|
+
var onQueryChange = useCallback(function (query) {
|
|
69
69
|
var _query$split$map$filt, _fragments$at, _fragments$at2, _fragments$at3;
|
|
70
70
|
// determine if order keys have been set so they can be saved and persisted when changes occur in basic search
|
|
71
71
|
var fragments = (_query$split$map$filt = query === null || query === void 0 ? void 0 : query.split(/(^| )(order by)( |$)/i).map(function (item) {
|
|
@@ -81,8 +81,8 @@ export var JiraSearchContainer = function JiraSearchContainer(props) {
|
|
|
81
81
|
setOrderDirection(order);
|
|
82
82
|
}
|
|
83
83
|
setJql(query);
|
|
84
|
-
};
|
|
85
|
-
var handleSearch = function
|
|
84
|
+
}, []);
|
|
85
|
+
var handleSearch = useCallback(function () {
|
|
86
86
|
onSearch({
|
|
87
87
|
jql: jql
|
|
88
88
|
}, currentSearchMethod);
|
|
@@ -91,7 +91,7 @@ export var JiraSearchContainer = function JiraSearchContainer(props) {
|
|
|
91
91
|
} else if (currentSearchMethod === 'jql') {
|
|
92
92
|
fireEvent('ui.jqlEditor.searched', {});
|
|
93
93
|
}
|
|
94
|
-
};
|
|
94
|
+
}, [currentSearchMethod, fireEvent, jql, onSearch]);
|
|
95
95
|
var showBasicFilters = useMemo(function () {
|
|
96
96
|
if (getBooleanFF('platform.linking-platform.datasource.show-jlol-basic-filters')) {
|
|
97
97
|
return true;
|
|
@@ -112,14 +112,14 @@ export var JiraSearchContainer = function JiraSearchContainer(props) {
|
|
|
112
112
|
onSearch: handleSearch,
|
|
113
113
|
query: jql
|
|
114
114
|
}), jsx(JiraSearchMethodSwitcher, {
|
|
115
|
-
onOptionValueChange:
|
|
115
|
+
onOptionValueChange: onSearchMethodChange,
|
|
116
116
|
selectedOptionValue: currentSearchMethod,
|
|
117
117
|
options: [{
|
|
118
|
-
label: formatMessage(modeSwitcherMessages.basicTextSearchLabel),
|
|
119
|
-
value: 'basic'
|
|
120
|
-
}, {
|
|
121
118
|
label: 'JQL',
|
|
122
119
|
value: 'jql'
|
|
120
|
+
}, {
|
|
121
|
+
label: formatMessage(modeSwitcherMessages.basicTextSearchLabel),
|
|
122
|
+
value: 'basic'
|
|
123
123
|
}]
|
|
124
124
|
}));
|
|
125
125
|
};
|
|
@@ -113,7 +113,12 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
113
113
|
// analytics related parameters
|
|
114
114
|
var searchCount = useRef(0);
|
|
115
115
|
var userInteractionActions = useRef(new Set());
|
|
116
|
-
var
|
|
116
|
+
var initialSearchMethod = 'jql'; // TODO EDM-7688 This where we can add feature that decides if it's basic or jql based on JQL content (Regexp)
|
|
117
|
+
var _useState11 = useState(initialSearchMethod),
|
|
118
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
119
|
+
currentSearchMethod = _useState12[0],
|
|
120
|
+
setCurrentSearchMethod = _useState12[1];
|
|
121
|
+
var searchMethodSearchedWith = useRef(null);
|
|
117
122
|
var visibleColumnCount = useRef((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
|
|
118
123
|
var parameters = useMemo(function () {
|
|
119
124
|
return !!cloudId ? {
|
|
@@ -230,12 +235,12 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
230
235
|
}, [cloudId, selectedJiraSite]);
|
|
231
236
|
var fireSingleItemViewedEvent = useCallback(function () {
|
|
232
237
|
fireEvent('ui.link.viewed.singleItem', _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
233
|
-
searchMethod: mapSearchMethod(
|
|
238
|
+
searchMethod: mapSearchMethod(searchMethodSearchedWith.current)
|
|
234
239
|
}));
|
|
235
240
|
}, [analyticsPayload, fireEvent]);
|
|
236
241
|
var fireCountViewedEvent = useCallback(function () {
|
|
237
242
|
fireEvent('ui.link.viewed.count', _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
238
|
-
searchMethod: mapSearchMethod(
|
|
243
|
+
searchMethod: mapSearchMethod(searchMethodSearchedWith.current),
|
|
239
244
|
totalItemCount: totalCount || 0
|
|
240
245
|
}));
|
|
241
246
|
}, [analyticsPayload, fireEvent, totalCount]);
|
|
@@ -243,7 +248,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
243
248
|
if (isDataReady) {
|
|
244
249
|
fireEvent('ui.table.viewed.datasourceConfigModal', _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
245
250
|
totalItemCount: totalCount || 0,
|
|
246
|
-
searchMethod: mapSearchMethod(
|
|
251
|
+
searchMethod: mapSearchMethod(searchMethodSearchedWith.current),
|
|
247
252
|
displayedColumnCount: visibleColumnCount.current
|
|
248
253
|
}));
|
|
249
254
|
}
|
|
@@ -274,7 +279,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
274
279
|
useColumnPickerRenderedFailedUfoExperience(status, modalRenderInstanceId);
|
|
275
280
|
var onSearch = useCallback(function (newParameters, searchMethod) {
|
|
276
281
|
searchCount.current++;
|
|
277
|
-
|
|
282
|
+
searchMethodSearchedWith.current = searchMethod;
|
|
278
283
|
if (jql !== newParameters.jql) {
|
|
279
284
|
userInteractionActions.current.add(DatasourceAction.QUERY_UPDATED);
|
|
280
285
|
}
|
|
@@ -320,7 +325,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
320
325
|
displayedColumnCount: visibleColumnCount.current,
|
|
321
326
|
display: getDisplayValue(currentViewMode, totalCount || 0),
|
|
322
327
|
searchCount: searchCount.current,
|
|
323
|
-
searchMethod: mapSearchMethod(
|
|
328
|
+
searchMethod: mapSearchMethod(searchMethodSearchedWith.current),
|
|
324
329
|
actions: Array.from(userInteractionActions.current)
|
|
325
330
|
}),
|
|
326
331
|
eventType: 'ui'
|
|
@@ -441,7 +446,9 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
441
446
|
}, !!jql ? jsx(EmptyState, {
|
|
442
447
|
testId: "jira-jql-datasource-modal--empty-state",
|
|
443
448
|
isLoading: true
|
|
444
|
-
}) : jsx(InitialStateView,
|
|
449
|
+
}) : jsx(InitialStateView, {
|
|
450
|
+
searchMethod: currentSearchMethod
|
|
451
|
+
}));
|
|
445
452
|
}
|
|
446
453
|
var firstIssueUrl = retrieveUrlForSmartCardRender();
|
|
447
454
|
if (responseItems.length === 1 && firstIssueUrl) {
|
|
@@ -452,7 +459,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
452
459
|
}));
|
|
453
460
|
}
|
|
454
461
|
return issueLikeDataTableView;
|
|
455
|
-
}, [status, jqlUrl, resolvedWithNoResults, columns.length, retrieveUrlForSmartCardRender, responseItems.length, issueLikeDataTableView, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName, jql]);
|
|
462
|
+
}, [status, jqlUrl, resolvedWithNoResults, columns.length, retrieveUrlForSmartCardRender, responseItems.length, issueLikeDataTableView, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName, jql, currentSearchMethod]);
|
|
456
463
|
return jsx(ModalTransition, null, jsx(Modal, {
|
|
457
464
|
testId: 'jira-jql-datasource-modal',
|
|
458
465
|
onClose: onCancel,
|
|
@@ -483,7 +490,9 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
483
490
|
})), jsx(ModalBody, null, jsx(JiraSearchContainer, {
|
|
484
491
|
isSearching: status === 'loading',
|
|
485
492
|
parameters: parameters,
|
|
486
|
-
onSearch: onSearch
|
|
493
|
+
onSearch: onSearch,
|
|
494
|
+
initialSearchMethod: initialSearchMethod,
|
|
495
|
+
onSearchMethodChange: setCurrentSearchMethod
|
|
487
496
|
}), currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent()), jsx(ModalFooter, null, shouldShowIssueCount && jsx("div", {
|
|
488
497
|
"data-testid": "jira-jql-datasource-modal-total-issues-count",
|
|
489
498
|
css: issueCountStyles
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
|
|
3
|
+
import { JiraSearchMethod } from '../../../common/types';
|
|
4
|
+
interface InitialStateViewProps {
|
|
5
|
+
searchMethod: JiraSearchMethod;
|
|
6
|
+
}
|
|
7
|
+
export declare const InitialStateView: ({ searchMethod }: InitialStateViewProps) => jsx.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -4,7 +4,17 @@ export declare const initialStateViewMessages: {
|
|
|
4
4
|
description: string;
|
|
5
5
|
defaultMessage: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
beta: {
|
|
8
|
+
id: string;
|
|
9
|
+
description: string;
|
|
10
|
+
defaultMessage: string;
|
|
11
|
+
};
|
|
12
|
+
searchDescriptionForBasicSearch: {
|
|
13
|
+
id: string;
|
|
14
|
+
description: string;
|
|
15
|
+
defaultMessage: string;
|
|
16
|
+
};
|
|
17
|
+
searchDescriptionForJQLSearch: {
|
|
8
18
|
id: string;
|
|
9
19
|
description: string;
|
|
10
20
|
defaultMessage: string;
|
|
@@ -4,7 +4,8 @@ import { JiraIssueDatasourceParameters, JiraIssueDatasourceParametersQuery } fro
|
|
|
4
4
|
export interface SearchContainerProps {
|
|
5
5
|
isSearching?: boolean;
|
|
6
6
|
onSearch: (query: JiraIssueDatasourceParametersQuery, searchMethod: JiraSearchMethod) => void;
|
|
7
|
+
initialSearchMethod: JiraSearchMethod;
|
|
8
|
+
onSearchMethodChange: (searchMethod: JiraSearchMethod) => void;
|
|
7
9
|
parameters?: JiraIssueDatasourceParameters;
|
|
8
10
|
}
|
|
9
|
-
export declare const getInitialSearchMethod: (initialJql?: string) => JiraSearchMethod;
|
|
10
11
|
export declare const JiraSearchContainer: (props: SearchContainerProps) => jsx.JSX.Element;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
|
|
3
|
+
import { JiraSearchMethod } from '../../../common/types';
|
|
4
|
+
interface InitialStateViewProps {
|
|
5
|
+
searchMethod: JiraSearchMethod;
|
|
6
|
+
}
|
|
7
|
+
export declare const InitialStateView: ({ searchMethod }: InitialStateViewProps) => jsx.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -4,7 +4,17 @@ export declare const initialStateViewMessages: {
|
|
|
4
4
|
description: string;
|
|
5
5
|
defaultMessage: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
beta: {
|
|
8
|
+
id: string;
|
|
9
|
+
description: string;
|
|
10
|
+
defaultMessage: string;
|
|
11
|
+
};
|
|
12
|
+
searchDescriptionForBasicSearch: {
|
|
13
|
+
id: string;
|
|
14
|
+
description: string;
|
|
15
|
+
defaultMessage: string;
|
|
16
|
+
};
|
|
17
|
+
searchDescriptionForJQLSearch: {
|
|
8
18
|
id: string;
|
|
9
19
|
description: string;
|
|
10
20
|
defaultMessage: string;
|
|
@@ -4,7 +4,8 @@ import { JiraIssueDatasourceParameters, JiraIssueDatasourceParametersQuery } fro
|
|
|
4
4
|
export interface SearchContainerProps {
|
|
5
5
|
isSearching?: boolean;
|
|
6
6
|
onSearch: (query: JiraIssueDatasourceParametersQuery, searchMethod: JiraSearchMethod) => void;
|
|
7
|
+
initialSearchMethod: JiraSearchMethod;
|
|
8
|
+
onSearchMethodChange: (searchMethod: JiraSearchMethod) => void;
|
|
7
9
|
parameters?: JiraIssueDatasourceParameters;
|
|
8
10
|
}
|
|
9
|
-
export declare const getInitialSearchMethod: (initialJql?: string) => JiraSearchMethod;
|
|
10
11
|
export declare const JiraSearchContainer: (props: SearchContainerProps) => jsx.JSX.Element;
|