@atlaskit/link-datasource 1.7.4 → 1.7.6
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 +12 -0
- package/dist/cjs/analytics/constants.js +1 -1
- package/dist/cjs/hooks/useDatasourceTableState.js +12 -15
- 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 +20 -10
- package/dist/es2019/analytics/constants.js +1 -1
- package/dist/es2019/hooks/useDatasourceTableState.js +1 -4
- 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 +17 -11
- package/dist/esm/analytics/constants.js +1 -1
- package/dist/esm/hooks/useDatasourceTableState.js +12 -15
- 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 +20 -10
- 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
|
@@ -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'
|
|
@@ -332,9 +334,9 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
332
334
|
userInteractionActions.current.add(DatasourceAction.DISPLAY_VIEW_CHANGED);
|
|
333
335
|
setCurrentViewMode(selectedMode);
|
|
334
336
|
};
|
|
335
|
-
const handleOnNextPage = useCallback(() => {
|
|
337
|
+
const handleOnNextPage = useCallback((onNextPageProps = {}) => {
|
|
336
338
|
userInteractionActions.current.add(DatasourceAction.NEXT_PAGE_SCROLLED);
|
|
337
|
-
onNextPage();
|
|
339
|
+
onNextPage(onNextPageProps);
|
|
338
340
|
}, [onNextPage]);
|
|
339
341
|
const handleVisibleColumnKeysChange = useCallback((newVisibleColumnKeys = []) => {
|
|
340
342
|
const columnAction = getColumnAction(visibleColumnKeys || [], newVisibleColumnKeys);
|
|
@@ -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
|
|
@@ -131,7 +131,6 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
131
131
|
shouldRequestFirstPage,
|
|
132
132
|
_requestInfo$shouldFo,
|
|
133
133
|
shouldForceRequest,
|
|
134
|
-
sortedFieldKeys,
|
|
135
134
|
datasourceDataRequest,
|
|
136
135
|
_yield$getDatasourceD2,
|
|
137
136
|
_yield$getDatasourceD3,
|
|
@@ -158,20 +157,18 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
158
157
|
return _context2.abrupt("return");
|
|
159
158
|
case 3:
|
|
160
159
|
_requestInfo$isSchema = requestInfo.isSchemaFromData, isSchemaFromData = _requestInfo$isSchema === void 0 ? true : _requestInfo$isSchema, shouldRequestFirstPage = requestInfo.shouldRequestFirstPage, _requestInfo$shouldFo = requestInfo.shouldForceRequest, shouldForceRequest = _requestInfo$shouldFo === void 0 ? false : _requestInfo$shouldFo;
|
|
161
|
-
sortedFieldKeys = _toConsumableArray(fieldKeys); // Sort keys to use cached version of response regardless of the order
|
|
162
|
-
sortedFieldKeys.sort();
|
|
163
160
|
datasourceDataRequest = {
|
|
164
161
|
parameters: parameters,
|
|
165
162
|
pageSize: DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE,
|
|
166
163
|
pageCursor: shouldRequestFirstPage ? undefined : nextCursor,
|
|
167
|
-
fields:
|
|
164
|
+
fields: fieldKeys,
|
|
168
165
|
includeSchema: isSchemaFromData
|
|
169
166
|
};
|
|
170
167
|
setStatus('loading');
|
|
171
|
-
_context2.prev =
|
|
172
|
-
_context2.next =
|
|
168
|
+
_context2.prev = 6;
|
|
169
|
+
_context2.next = 9;
|
|
173
170
|
return getDatasourceData(datasourceId, datasourceDataRequest, shouldForceRequest);
|
|
174
|
-
case
|
|
171
|
+
case 9:
|
|
175
172
|
_yield$getDatasourceD2 = _context2.sent;
|
|
176
173
|
_yield$getDatasourceD3 = _yield$getDatasourceD2.meta;
|
|
177
174
|
access = _yield$getDatasourceD3.access;
|
|
@@ -183,12 +180,12 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
183
180
|
_totalCount = _yield$getDatasourceD4.totalCount;
|
|
184
181
|
schema = _yield$getDatasourceD4.schema;
|
|
185
182
|
if (!(access === 'forbidden' || access === 'unauthorized')) {
|
|
186
|
-
_context2.next =
|
|
183
|
+
_context2.next = 22;
|
|
187
184
|
break;
|
|
188
185
|
}
|
|
189
186
|
setStatus('unauthorized');
|
|
190
187
|
return _context2.abrupt("return");
|
|
191
|
-
case
|
|
188
|
+
case 22:
|
|
192
189
|
setExtensionKey(_extensionKey);
|
|
193
190
|
setDestinationObjectTypes(_destinationObjectTypes);
|
|
194
191
|
setTotalCount(_totalCount);
|
|
@@ -217,17 +214,17 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
217
214
|
});
|
|
218
215
|
}
|
|
219
216
|
setStatus('resolved');
|
|
220
|
-
_context2.next =
|
|
217
|
+
_context2.next = 38;
|
|
221
218
|
break;
|
|
222
|
-
case
|
|
223
|
-
_context2.prev =
|
|
224
|
-
_context2.t0 = _context2["catch"](
|
|
219
|
+
case 35:
|
|
220
|
+
_context2.prev = 35;
|
|
221
|
+
_context2.t0 = _context2["catch"](6);
|
|
225
222
|
setStatus('rejected');
|
|
226
|
-
case
|
|
223
|
+
case 38:
|
|
227
224
|
case "end":
|
|
228
225
|
return _context2.stop();
|
|
229
226
|
}
|
|
230
|
-
}, _callee2, null, [[
|
|
227
|
+
}, _callee2, null, [[6, 35]]);
|
|
231
228
|
})), [parameters, fieldKeys, nextCursor, getDatasourceData, datasourceId, responseItems === null || responseItems === void 0 ? void 0 : responseItems.length, applySchemaProperties, fireEvent]);
|
|
232
229
|
var reset = useCallback(function (options) {
|
|
233
230
|
setStatus('empty');
|
|
@@ -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.6",
|
|
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'
|
|
@@ -374,8 +379,9 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
374
379
|
setCurrentViewMode(selectedMode);
|
|
375
380
|
};
|
|
376
381
|
var handleOnNextPage = useCallback(function () {
|
|
382
|
+
var onNextPageProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
377
383
|
userInteractionActions.current.add(DatasourceAction.NEXT_PAGE_SCROLLED);
|
|
378
|
-
onNextPage();
|
|
384
|
+
onNextPage(onNextPageProps);
|
|
379
385
|
}, [onNextPage]);
|
|
380
386
|
var handleVisibleColumnKeysChange = useCallback(function () {
|
|
381
387
|
var newVisibleColumnKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
@@ -441,7 +447,9 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
441
447
|
}, !!jql ? jsx(EmptyState, {
|
|
442
448
|
testId: "jira-jql-datasource-modal--empty-state",
|
|
443
449
|
isLoading: true
|
|
444
|
-
}) : jsx(InitialStateView,
|
|
450
|
+
}) : jsx(InitialStateView, {
|
|
451
|
+
searchMethod: currentSearchMethod
|
|
452
|
+
}));
|
|
445
453
|
}
|
|
446
454
|
var firstIssueUrl = retrieveUrlForSmartCardRender();
|
|
447
455
|
if (responseItems.length === 1 && firstIssueUrl) {
|
|
@@ -452,7 +460,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
452
460
|
}));
|
|
453
461
|
}
|
|
454
462
|
return issueLikeDataTableView;
|
|
455
|
-
}, [status, jqlUrl, resolvedWithNoResults, columns.length, retrieveUrlForSmartCardRender, responseItems.length, issueLikeDataTableView, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName, jql]);
|
|
463
|
+
}, [status, jqlUrl, resolvedWithNoResults, columns.length, retrieveUrlForSmartCardRender, responseItems.length, issueLikeDataTableView, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName, jql, currentSearchMethod]);
|
|
456
464
|
return jsx(ModalTransition, null, jsx(Modal, {
|
|
457
465
|
testId: 'jira-jql-datasource-modal',
|
|
458
466
|
onClose: onCancel,
|
|
@@ -483,7 +491,9 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
483
491
|
})), jsx(ModalBody, null, jsx(JiraSearchContainer, {
|
|
484
492
|
isSearching: status === 'loading',
|
|
485
493
|
parameters: parameters,
|
|
486
|
-
onSearch: onSearch
|
|
494
|
+
onSearch: onSearch,
|
|
495
|
+
initialSearchMethod: initialSearchMethod,
|
|
496
|
+
onSearchMethodChange: setCurrentSearchMethod
|
|
487
497
|
}), currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent()), jsx(ModalFooter, null, shouldShowIssueCount && jsx("div", {
|
|
488
498
|
"data-testid": "jira-jql-datasource-modal-total-issues-count",
|
|
489
499
|
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 {};
|