@atlaskit/link-datasource 1.19.16 → 1.19.18
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 +46 -18
- package/dist/cjs/ui/assets-modal/modal/render-assets-content/index.js +1 -1
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +1 -1
- package/dist/cjs/ui/issue-like-table/empty-state/index.js +4 -0
- package/dist/cjs/ui/issue-like-table/index.js +81 -67
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +34 -36
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +29 -17
- package/dist/es2019/analytics/constants.js +1 -1
- package/dist/es2019/hooks/useDatasourceTableState.js +20 -4
- package/dist/es2019/ui/assets-modal/modal/render-assets-content/index.js +1 -1
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +1 -1
- package/dist/es2019/ui/issue-like-table/empty-state/index.js +4 -0
- package/dist/es2019/ui/issue-like-table/index.js +33 -20
- 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 -6
- package/dist/esm/analytics/constants.js +1 -1
- package/dist/esm/hooks/useDatasourceTableState.js +46 -18
- package/dist/esm/ui/assets-modal/modal/render-assets-content/index.js +1 -1
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +1 -1
- package/dist/esm/ui/issue-like-table/empty-state/index.js +4 -0
- package/dist/esm/ui/issue-like-table/index.js +81 -67
- package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +34 -36
- package/dist/esm/ui/jira-issues-modal/modal/index.js +29 -17
- package/dist/types/ui/issue-like-table/index.d.ts +2 -1
- package/dist/types/ui/jira-issues-modal/jira-search-container/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/index.d.ts +2 -0
- package/examples-helpers/hoverableContainer.tsx +26 -0
- package/package.json +1 -1
|
@@ -65,7 +65,8 @@ var contentContainerStyles = (0, _react2.css)({
|
|
|
65
65
|
maxHeight: '420px',
|
|
66
66
|
overflow: 'auto',
|
|
67
67
|
borderBottom: "2px solid ".concat("var(--ds-background-accent-gray-subtler, ".concat(_colors.N40, ")")),
|
|
68
|
-
|
|
68
|
+
backgroundImage: _issueLikeTable.scrollableContainerShadowsCssComponents.backgroundImage,
|
|
69
|
+
backgroundPosition: _issueLikeTable.scrollableContainerShadowsCssComponents.backgroundPosition,
|
|
69
70
|
backgroundRepeat: _issueLikeTable.scrollableContainerShadowsCssComponents.backgroundRepeat,
|
|
70
71
|
backgroundSize: _issueLikeTable.scrollableContainerShadowsCssComponents.backgroundSize,
|
|
71
72
|
backgroundAttachment: _issueLikeTable.scrollableContainerShadowsCssComponents.backgroundAttachment
|
|
@@ -132,19 +133,23 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
132
133
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
133
134
|
jql = _useState8[0],
|
|
134
135
|
setJql = _useState8[1];
|
|
135
|
-
var _useState9 = (0, _react.useState)(
|
|
136
|
+
var _useState9 = (0, _react.useState)(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql),
|
|
136
137
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
searchBarJql = _useState10[0],
|
|
139
|
+
setSearchBarJql = _useState10[1];
|
|
140
|
+
var _useState11 = (0, _react.useState)(initialVisibleColumnKeys),
|
|
141
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
142
|
+
visibleColumnKeys = _useState12[0],
|
|
143
|
+
setVisibleColumnKeys = _useState12[1];
|
|
139
144
|
|
|
140
145
|
// analytics related parameters
|
|
141
146
|
var searchCount = (0, _react.useRef)(0);
|
|
142
147
|
var userInteractionActions = (0, _react.useRef)(new Set());
|
|
143
148
|
var initialSearchMethod = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource.show-jlol-basic-filters') && !(0, _isQueryTooComplex.isQueryTooComplex)((initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql) || '') ? 'basic' : 'jql';
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
currentSearchMethod =
|
|
147
|
-
setCurrentSearchMethod =
|
|
149
|
+
var _useState13 = (0, _react.useState)(initialSearchMethod),
|
|
150
|
+
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
151
|
+
currentSearchMethod = _useState14[0],
|
|
152
|
+
setCurrentSearchMethod = _useState14[1];
|
|
148
153
|
var searchMethodSearchedWith = (0, _react.useRef)(null);
|
|
149
154
|
var visibleColumnCount = (0, _react.useRef)((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
|
|
150
155
|
var basicFilterSelectionsSearchedWith = (0, _react.useRef)({});
|
|
@@ -156,10 +161,10 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
156
161
|
} : undefined;
|
|
157
162
|
}, [cloudId, jql]);
|
|
158
163
|
var isParametersSet = !!(jql && cloudId);
|
|
159
|
-
var
|
|
160
|
-
|
|
161
|
-
columnCustomSizes =
|
|
162
|
-
setColumnCustomSizes =
|
|
164
|
+
var _useState15 = (0, _react.useState)(initialColumnCustomSizes),
|
|
165
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
166
|
+
columnCustomSizes = _useState16[0],
|
|
167
|
+
setColumnCustomSizes = _useState16[1];
|
|
163
168
|
var onColumnResize = (0, _react.useCallback)(function (key, width) {
|
|
164
169
|
setColumnCustomSizes(_objectSpread(_objectSpread({}, columnCustomSizes), {}, (0, _defineProperty2.default)({}, key, width)));
|
|
165
170
|
}, [columnCustomSizes]);
|
|
@@ -360,6 +365,11 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
360
365
|
if (!isParametersSet || !jql || !selectedJiraSite) {
|
|
361
366
|
return;
|
|
362
367
|
}
|
|
368
|
+
|
|
369
|
+
// During insertion, we want the JQL of the datasource to be whatever is in the search bar,
|
|
370
|
+
// even if the user didn't previously click search
|
|
371
|
+
var upToDateJql = searchBarJql !== null && searchBarJql !== void 0 ? searchBarJql : jql;
|
|
372
|
+
var upToDateJqlUrl = selectedJiraSite && jql && "".concat(selectedJiraSite.url, "/issues/?jql=").concat(encodeURI(upToDateJql));
|
|
363
373
|
var filterSelectionCount = _ui.availableBasicFilterTypes.reduce(function (current, filter) {
|
|
364
374
|
var _basicFilterSelection;
|
|
365
375
|
return _objectSpread(_objectSpread({}, current), {}, (0, _defineProperty2.default)({}, "".concat(filter, "BasicFilterSelectionCount"), ((_basicFilterSelection = basicFilterSelectionsSearchedWith.current[filter]) === null || _basicFilterSelection === void 0 ? void 0 : _basicFilterSelection.length) || 0));
|
|
@@ -402,7 +412,7 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
402
412
|
onInsert({
|
|
403
413
|
type: 'inlineCard',
|
|
404
414
|
attrs: {
|
|
405
|
-
url:
|
|
415
|
+
url: upToDateJqlUrl
|
|
406
416
|
}
|
|
407
417
|
}, consumerEvent);
|
|
408
418
|
} else if (responseItems.length === 1 && firstIssueUrl) {
|
|
@@ -417,12 +427,12 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
417
427
|
onInsert({
|
|
418
428
|
type: 'blockCard',
|
|
419
429
|
attrs: {
|
|
420
|
-
url:
|
|
430
|
+
url: upToDateJqlUrl,
|
|
421
431
|
datasource: {
|
|
422
432
|
id: datasourceId,
|
|
423
433
|
parameters: {
|
|
424
434
|
cloudId: cloudId,
|
|
425
|
-
jql:
|
|
435
|
+
jql: upToDateJql // TODO support non JQL type
|
|
426
436
|
},
|
|
427
437
|
|
|
428
438
|
views: [{
|
|
@@ -440,7 +450,7 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
440
450
|
}
|
|
441
451
|
}, consumerEvent);
|
|
442
452
|
}
|
|
443
|
-
}, [isParametersSet, jql, selectedJiraSite, analyticsPayload, totalCount, visibleColumnKeys, currentViewMode, retrieveUrlForSmartCardRender, responseItems.length, onInsert,
|
|
453
|
+
}, [isParametersSet, jql, selectedJiraSite, analyticsPayload, totalCount, visibleColumnKeys, currentViewMode, retrieveUrlForSmartCardRender, responseItems.length, onInsert, datasourceId, cloudId, columnCustomSizes, searchBarJql]);
|
|
444
454
|
var handleViewModeChange = function handleViewModeChange(selectedMode) {
|
|
445
455
|
userInteractionActions.current.add(_types.DatasourceAction.DISPLAY_VIEW_CHANGED);
|
|
446
456
|
setCurrentViewMode(selectedMode);
|
|
@@ -508,7 +518,7 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
508
518
|
return (0, _react2.jsx)(_accessRequired.AccessRequired, {
|
|
509
519
|
url: selectedJiraSiteUrl || urlBeingEdited
|
|
510
520
|
});
|
|
511
|
-
} else if (resolvedWithNoResults) {
|
|
521
|
+
} else if (resolvedWithNoResults || status === 'forbidden') {
|
|
512
522
|
return (0, _react2.jsx)(_noResults.NoResults, null);
|
|
513
523
|
} else if (status === 'empty' || !columns.length) {
|
|
514
524
|
// persist the empty state when making the initial /data request which contains the columns
|
|
@@ -554,6 +564,8 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
554
564
|
onOptionValueChange: handleViewModeChange,
|
|
555
565
|
selectedOptionValue: currentViewMode
|
|
556
566
|
})), (0, _react2.jsx)(_modalDialog.ModalBody, null, !hasNoJiraSites ? (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_jiraSearchContainer.JiraSearchContainer, {
|
|
567
|
+
setSearchBarJql: setSearchBarJql,
|
|
568
|
+
searchBarJql: searchBarJql,
|
|
557
569
|
isSearching: status === 'loading',
|
|
558
570
|
parameters: parameters,
|
|
559
571
|
onSearch: onSearch,
|
|
@@ -49,20 +49,28 @@ export const useDatasourceTableState = ({
|
|
|
49
49
|
} = await getDatasourceDetails(datasourceId, {
|
|
50
50
|
parameters
|
|
51
51
|
});
|
|
52
|
-
if (access === '
|
|
52
|
+
if (access === 'unauthorized') {
|
|
53
53
|
setStatus('unauthorized');
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
+
if (access === 'forbidden') {
|
|
57
|
+
setStatus('forbidden');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
56
60
|
const isColumnNotPresentInCurrentColumnsList = col => !columns.find(column => column.key === col.key);
|
|
57
61
|
const allColumns = schema.properties;
|
|
58
62
|
const newColumns = allColumns.filter(isColumnNotPresentInCurrentColumnsList);
|
|
59
63
|
newColumns.length > 0 && setColumns([...columns, ...newColumns]);
|
|
60
64
|
} catch (e) {
|
|
61
65
|
captureError('loadDatasourceDetails', e);
|
|
62
|
-
if (e instanceof Response &&
|
|
66
|
+
if (e instanceof Response && e.status === 401) {
|
|
63
67
|
setStatus('unauthorized');
|
|
64
68
|
return;
|
|
65
69
|
}
|
|
70
|
+
if (e instanceof Response && e.status === 403) {
|
|
71
|
+
setStatus('forbidden');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
66
74
|
setStatus('rejected');
|
|
67
75
|
}
|
|
68
76
|
}, [captureError, columns, datasourceId, getDatasourceDetails, parameters]);
|
|
@@ -132,10 +140,14 @@ export const useDatasourceTableState = ({
|
|
|
132
140
|
schema
|
|
133
141
|
}
|
|
134
142
|
} = await getDatasourceData(datasourceId, datasourceDataRequest, shouldForceRequest);
|
|
135
|
-
if (access === '
|
|
143
|
+
if (access === 'unauthorized') {
|
|
136
144
|
setStatus('unauthorized');
|
|
137
145
|
return;
|
|
138
146
|
}
|
|
147
|
+
if (access === 'forbidden') {
|
|
148
|
+
setStatus('forbidden');
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
139
151
|
setExtensionKey(extensionKey);
|
|
140
152
|
setDestinationObjectTypes(destinationObjectTypes);
|
|
141
153
|
setTotalCount(totalCount);
|
|
@@ -166,10 +178,14 @@ export const useDatasourceTableState = ({
|
|
|
166
178
|
setStatus('resolved');
|
|
167
179
|
} catch (e) {
|
|
168
180
|
captureError('onNextPage', e);
|
|
169
|
-
if (e instanceof Response &&
|
|
181
|
+
if (e instanceof Response && e.status === 401) {
|
|
170
182
|
setStatus('unauthorized');
|
|
171
183
|
return;
|
|
172
184
|
}
|
|
185
|
+
if (e instanceof Response && e.status === 403) {
|
|
186
|
+
setStatus('forbidden');
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
173
189
|
setStatus('rejected');
|
|
174
190
|
}
|
|
175
191
|
}, [captureError, parameters, fieldKeys, nextCursor, getDatasourceData, datasourceId, responseItems === null || responseItems === void 0 ? void 0 : responseItems.length, applySchemaProperties, fireEvent, fullSchema]);
|
|
@@ -23,7 +23,7 @@ const tableBordersStyles = css({
|
|
|
23
23
|
borderTopLeftRadius: "var(--ds-border-radius-200, 8px)",
|
|
24
24
|
borderTopRightRadius: "var(--ds-border-radius-200, 8px)",
|
|
25
25
|
borderBottom: `2px solid ${`var(--ds-background-accent-gray-subtler, ${N40})`}`,
|
|
26
|
-
|
|
26
|
+
backgroundImage: scrollableContainerShadowsCssComponents.backgroundImage,
|
|
27
27
|
backgroundRepeat: scrollableContainerShadowsCssComponents.backgroundRepeat,
|
|
28
28
|
backgroundSize: scrollableContainerShadowsCssComponents.backgroundSize,
|
|
29
29
|
backgroundAttachment: scrollableContainerShadowsCssComponents.backgroundAttachment
|
|
@@ -108,7 +108,7 @@ const DatasourceTableViewWithoutAnalytics = ({
|
|
|
108
108
|
shouldForceRequest: true
|
|
109
109
|
});
|
|
110
110
|
}, [destinationObjectTypes, extensionKey, fireEvent, reset]);
|
|
111
|
-
if (status === 'resolved' && !responseItems.length) {
|
|
111
|
+
if (status === 'resolved' && !responseItems.length || status === 'forbidden') {
|
|
112
112
|
return jsx(NoResults, {
|
|
113
113
|
onRefresh: reset
|
|
114
114
|
});
|
|
@@ -15,6 +15,9 @@ const SkeletonComponent = ({
|
|
|
15
15
|
const tableBodyStyles = css({
|
|
16
16
|
borderBottom: 0
|
|
17
17
|
});
|
|
18
|
+
const tableStyles = css({
|
|
19
|
+
background: "var(--ds-elevation-surface-current, #FFF)"
|
|
20
|
+
});
|
|
18
21
|
const padding = `${"var(--ds-space-100, 8px)"} ${"var(--ds-space-100, 8px)"}`;
|
|
19
22
|
const cellStyles = css({
|
|
20
23
|
padding,
|
|
@@ -105,6 +108,7 @@ export default (({
|
|
|
105
108
|
boxSizing: 'border-box'
|
|
106
109
|
}
|
|
107
110
|
}, jsx("table", {
|
|
111
|
+
css: tableStyles,
|
|
108
112
|
"data-testid": testId
|
|
109
113
|
}, jsx("thead", {
|
|
110
114
|
style: {
|
|
@@ -82,90 +82,101 @@ const tableContainerStyles = css({
|
|
|
82
82
|
const shadowColor = "var(--ds-shadow-overflow-perimeter, rgba(0, 0, 0, 0.1))";
|
|
83
83
|
const shadowColorLight = "var(--ds-shadow-overflow-perimeter, rgba(0, 0, 0, 0.05))";
|
|
84
84
|
const leftWhiteOverrideGradient = {
|
|
85
|
-
|
|
85
|
+
backgroundImage: `
|
|
86
86
|
linear-gradient(
|
|
87
87
|
90deg,
|
|
88
88
|
${"var(--ds-elevation-surface-current, #FFF)"} 30%,
|
|
89
89
|
rgba(255, 255, 255, 0)
|
|
90
|
-
)
|
|
90
|
+
)`,
|
|
91
|
+
backgroundPosition: 'left center',
|
|
91
92
|
size: `40px 100%`,
|
|
92
93
|
attachment: `local`
|
|
93
94
|
};
|
|
94
95
|
const topWhiteOverrideGradient = {
|
|
95
|
-
|
|
96
|
+
backgroundImage: `
|
|
96
97
|
linear-gradient(
|
|
97
98
|
0deg,
|
|
98
99
|
rgba(255, 255, 255, 0),
|
|
99
100
|
${"var(--ds-elevation-surface-current, #FFF)"} 30%
|
|
100
|
-
)
|
|
101
|
+
)`,
|
|
102
|
+
backgroundPosition: 'top center',
|
|
101
103
|
size: `100% 100px`,
|
|
102
104
|
attachment: `local`
|
|
103
105
|
};
|
|
104
106
|
const rightWhiteOverrideGradient = {
|
|
105
|
-
|
|
107
|
+
backgroundImage: `
|
|
106
108
|
linear-gradient(
|
|
107
109
|
90deg,
|
|
108
110
|
rgba(255, 255, 255, 0),
|
|
109
111
|
${"var(--ds-elevation-surface-current, #FFF)"} 70%
|
|
110
|
-
)
|
|
112
|
+
)`,
|
|
113
|
+
backgroundPosition: 'right center',
|
|
111
114
|
size: `40px 100%`,
|
|
112
115
|
attachment: `local`
|
|
113
116
|
};
|
|
114
117
|
const bottomWhiteOverride = {
|
|
115
|
-
|
|
118
|
+
backgroundImage: `
|
|
116
119
|
linear-gradient(
|
|
117
120
|
0deg,
|
|
118
121
|
${"var(--ds-elevation-surface-current, #FFF)"} 30%,
|
|
119
122
|
rgba(255, 255, 255, 0)
|
|
120
|
-
)
|
|
123
|
+
)`,
|
|
124
|
+
backgroundPosition: 'bottom center',
|
|
121
125
|
size: `100% 40px`,
|
|
122
126
|
attachment: `local`
|
|
123
127
|
};
|
|
124
128
|
const leftShadowGradient = {
|
|
125
|
-
|
|
129
|
+
backgroundImage: `
|
|
126
130
|
linear-gradient(
|
|
127
131
|
90deg,
|
|
128
132
|
${shadowColor},
|
|
129
133
|
rgba(0, 0, 0, 0)
|
|
130
|
-
)
|
|
134
|
+
)`,
|
|
135
|
+
backgroundPosition: 'left center',
|
|
131
136
|
size: `14px 100%`,
|
|
132
137
|
attachment: `scroll`
|
|
133
138
|
};
|
|
134
139
|
const topShadowGradient = {
|
|
135
|
-
|
|
140
|
+
backgroundImage: `
|
|
136
141
|
linear-gradient(
|
|
137
142
|
0deg,
|
|
138
143
|
rgba(0, 0, 0, 0),
|
|
139
144
|
${shadowColorLight}
|
|
140
|
-
)
|
|
145
|
+
)`,
|
|
146
|
+
backgroundPosition: '0 52px',
|
|
141
147
|
size: `100% 14px`,
|
|
142
148
|
attachment: `scroll`
|
|
143
149
|
};
|
|
144
150
|
const rightShadowGradient = {
|
|
145
|
-
|
|
151
|
+
backgroundImage: `
|
|
146
152
|
linear-gradient(
|
|
147
153
|
90deg,
|
|
148
154
|
rgba(0, 0, 0, 0),
|
|
149
155
|
${shadowColor}
|
|
150
|
-
)
|
|
156
|
+
)`,
|
|
157
|
+
backgroundPosition: 'right center',
|
|
151
158
|
size: `14px 100%`,
|
|
152
159
|
attachment: `scroll`
|
|
153
160
|
};
|
|
154
161
|
const bottomShadowGradient = {
|
|
155
|
-
|
|
162
|
+
backgroundImage: `
|
|
156
163
|
linear-gradient(
|
|
157
164
|
0deg,
|
|
158
165
|
${shadowColorLight},
|
|
159
166
|
rgba(0, 0, 0, 0)
|
|
160
|
-
)
|
|
167
|
+
)`,
|
|
168
|
+
backgroundPosition: 'bottom center',
|
|
161
169
|
size: `100% 10px`,
|
|
162
170
|
attachment: `scroll`
|
|
163
171
|
};
|
|
164
172
|
const shadows = [leftWhiteOverrideGradient, leftShadowGradient, rightWhiteOverrideGradient, rightShadowGradient, topWhiteOverrideGradient, topShadowGradient, bottomWhiteOverride, bottomShadowGradient];
|
|
165
173
|
export const scrollableContainerShadowsCssComponents = {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}) =>
|
|
174
|
+
backgroundImage: shadows.map(({
|
|
175
|
+
backgroundImage
|
|
176
|
+
}) => backgroundImage).join(','),
|
|
177
|
+
backgroundPosition: shadows.map(({
|
|
178
|
+
backgroundPosition
|
|
179
|
+
}) => backgroundPosition).join(','),
|
|
169
180
|
backgroundRepeat: 'no-repeat',
|
|
170
181
|
backgroundSize: shadows.map(({
|
|
171
182
|
size
|
|
@@ -177,7 +188,9 @@ export const scrollableContainerShadowsCssComponents = {
|
|
|
177
188
|
const scrollableContainerStyles = css({
|
|
178
189
|
overflow: 'auto',
|
|
179
190
|
boxSizing: 'border-box',
|
|
180
|
-
|
|
191
|
+
backgroundColor: "var(--ds-elevation-surface-current, #FFF)",
|
|
192
|
+
backgroundImage: scrollableContainerShadowsCssComponents.backgroundImage,
|
|
193
|
+
backgroundPosition: scrollableContainerShadowsCssComponents.backgroundPosition,
|
|
181
194
|
backgroundRepeat: scrollableContainerShadowsCssComponents.backgroundRepeat,
|
|
182
195
|
backgroundSize: scrollableContainerShadowsCssComponents.backgroundSize,
|
|
183
196
|
backgroundAttachment: scrollableContainerShadowsCssComponents.backgroundAttachment
|
|
@@ -31,11 +31,12 @@ export const JiraSearchContainer = props => {
|
|
|
31
31
|
parameters,
|
|
32
32
|
onSearch,
|
|
33
33
|
onSearchMethodChange: onSearchMethodChangeCallback,
|
|
34
|
-
initialSearchMethod
|
|
34
|
+
initialSearchMethod,
|
|
35
|
+
setSearchBarJql,
|
|
36
|
+
searchBarJql = DEFAULT_JQL_QUERY
|
|
35
37
|
} = props;
|
|
36
38
|
const {
|
|
37
|
-
cloudId: currentCloudId
|
|
38
|
-
jql: initialJql
|
|
39
|
+
cloudId: currentCloudId
|
|
39
40
|
} = parameters || {};
|
|
40
41
|
const {
|
|
41
42
|
formatMessage
|
|
@@ -45,7 +46,6 @@ export const JiraSearchContainer = props => {
|
|
|
45
46
|
} = useDatasourceAnalyticsEvents();
|
|
46
47
|
const [basicSearchTerm, setBasicSearchTerm] = useState('');
|
|
47
48
|
const [currentSearchMethod, setCurrentSearchMethod] = useState(initialSearchMethod);
|
|
48
|
-
const [jql, setJql] = useState(initialJql || DEFAULT_JQL_QUERY);
|
|
49
49
|
const [cloudId, setCloudId] = useState(currentCloudId);
|
|
50
50
|
const [isComplexQuery, setIsComplexQuery] = useState(false);
|
|
51
51
|
const [orderKey, setOrderKey] = useState();
|
|
@@ -61,7 +61,7 @@ export const JiraSearchContainer = props => {
|
|
|
61
61
|
hydratedOptions,
|
|
62
62
|
fetchHydratedJqlOptions,
|
|
63
63
|
status: basicFilterHydrationStatus
|
|
64
|
-
} = useHydrateJqlQuery(cloudId || '',
|
|
64
|
+
} = useHydrateJqlQuery(cloudId || '', searchBarJql);
|
|
65
65
|
const onSearchMethodChange = useCallback(searchMethod => {
|
|
66
66
|
onSearchMethodChangeCallback(searchMethod);
|
|
67
67
|
setCurrentSearchMethod(searchMethod);
|
|
@@ -69,13 +69,13 @@ export const JiraSearchContainer = props => {
|
|
|
69
69
|
const handleBasicSearchChange = useCallback(e => {
|
|
70
70
|
const rawSearch = e.currentTarget.value;
|
|
71
71
|
setBasicSearchTerm(rawSearch);
|
|
72
|
-
|
|
72
|
+
setSearchBarJql(buildJQL({
|
|
73
73
|
rawSearch,
|
|
74
74
|
filterValues: filterSelections,
|
|
75
75
|
orderDirection,
|
|
76
76
|
orderKey
|
|
77
77
|
}));
|
|
78
|
-
}, [filterSelections, orderDirection, orderKey]);
|
|
78
|
+
}, [setSearchBarJql, filterSelections, orderDirection, orderKey]);
|
|
79
79
|
const onQueryChange = useCallback(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
|
|
@@ -89,12 +89,12 @@ export const JiraSearchContainer = props => {
|
|
|
89
89
|
setOrderKey(key);
|
|
90
90
|
setOrderDirection(order);
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
}, []);
|
|
92
|
+
setSearchBarJql(query);
|
|
93
|
+
}, [setSearchBarJql]);
|
|
94
94
|
const handleSearch = useCallback(() => {
|
|
95
|
-
const isCurrentQueryComplex = isQueryTooComplex(
|
|
95
|
+
const isCurrentQueryComplex = isQueryTooComplex(searchBarJql);
|
|
96
96
|
onSearch({
|
|
97
|
-
jql
|
|
97
|
+
jql: searchBarJql
|
|
98
98
|
}, {
|
|
99
99
|
searchMethod: currentSearchMethod,
|
|
100
100
|
basicFilterSelections: filterSelections,
|
|
@@ -111,7 +111,7 @@ export const JiraSearchContainer = props => {
|
|
|
111
111
|
fetchHydratedJqlOptions();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
}, [currentSearchMethod, fetchHydratedJqlOptions, filterSelections, fireEvent,
|
|
114
|
+
}, [currentSearchMethod, fetchHydratedJqlOptions, filterSelections, fireEvent, searchBarJql, onSearch, showBasicFilters]);
|
|
115
115
|
const [debouncedBasicFilterSelectionChange] = useDebouncedCallback(filterValues => {
|
|
116
116
|
const jqlWithFilterValues = buildJQL({
|
|
117
117
|
rawSearch: basicSearchTerm,
|
|
@@ -119,7 +119,7 @@ export const JiraSearchContainer = props => {
|
|
|
119
119
|
orderDirection,
|
|
120
120
|
orderKey
|
|
121
121
|
});
|
|
122
|
-
|
|
122
|
+
setSearchBarJql(jqlWithFilterValues);
|
|
123
123
|
const isCurrentQueryComplex = isQueryTooComplex(jqlWithFilterValues);
|
|
124
124
|
onSearch({
|
|
125
125
|
jql: jqlWithFilterValues
|
|
@@ -138,9 +138,9 @@ export const JiraSearchContainer = props => {
|
|
|
138
138
|
debouncedBasicFilterSelectionChange(updatedSelection);
|
|
139
139
|
}, [debouncedBasicFilterSelectionChange, filterSelections]);
|
|
140
140
|
useEffect(() => {
|
|
141
|
-
const isCurrentQueryComplex = isQueryTooComplex(
|
|
141
|
+
const isCurrentQueryComplex = isQueryTooComplex(searchBarJql);
|
|
142
142
|
setIsComplexQuery(isCurrentQueryComplex);
|
|
143
|
-
if (showBasicFilters && !isCurrentQueryComplex &&
|
|
143
|
+
if (showBasicFilters && !isCurrentQueryComplex && searchBarJql !== DEFAULT_JQL_QUERY) {
|
|
144
144
|
fetchHydratedJqlOptions();
|
|
145
145
|
}
|
|
146
146
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -160,14 +160,14 @@ export const JiraSearchContainer = props => {
|
|
|
160
160
|
useEffect(() => {
|
|
161
161
|
if (currentCloudId !== cloudId) {
|
|
162
162
|
setBasicSearchTerm('');
|
|
163
|
-
|
|
163
|
+
setSearchBarJql(DEFAULT_JQL_QUERY);
|
|
164
164
|
setIsComplexQuery(false);
|
|
165
165
|
setOrderKey(undefined);
|
|
166
166
|
setOrderDirection(undefined);
|
|
167
167
|
setFilterSelections({});
|
|
168
168
|
setCloudId(currentCloudId);
|
|
169
169
|
}
|
|
170
|
-
}, [currentCloudId, cloudId]);
|
|
170
|
+
}, [currentCloudId, cloudId, setSearchBarJql]);
|
|
171
171
|
return jsx("div", {
|
|
172
172
|
css: inputContainerStyles,
|
|
173
173
|
"data-testid": "jira-search-container"
|
|
@@ -180,7 +180,7 @@ export const JiraSearchContainer = props => {
|
|
|
180
180
|
onSearch: handleSearch,
|
|
181
181
|
searchTerm: basicSearchTerm
|
|
182
182
|
}), showBasicFilters && jsx(BasicFilters, {
|
|
183
|
-
jql:
|
|
183
|
+
jql: searchBarJql,
|
|
184
184
|
cloudId: cloudId || '',
|
|
185
185
|
onChange: handleBasicFilterSelectionChange,
|
|
186
186
|
selections: filterSelections,
|
|
@@ -190,7 +190,7 @@ export const JiraSearchContainer = props => {
|
|
|
190
190
|
isSearching: isSearching,
|
|
191
191
|
onChange: onQueryChange,
|
|
192
192
|
onSearch: handleSearch,
|
|
193
|
-
query:
|
|
193
|
+
query: searchBarJql
|
|
194
194
|
}), jsx(ModeSwitcher, {
|
|
195
195
|
onOptionValueChange: onSearchMethodChange,
|
|
196
196
|
selectedOptionValue: currentSearchMethod,
|
|
@@ -49,7 +49,8 @@ const contentContainerStyles = css({
|
|
|
49
49
|
maxHeight: '420px',
|
|
50
50
|
overflow: 'auto',
|
|
51
51
|
borderBottom: `2px solid ${`var(--ds-background-accent-gray-subtler, ${N40})`}`,
|
|
52
|
-
|
|
52
|
+
backgroundImage: scrollableContainerShadowsCssComponents.backgroundImage,
|
|
53
|
+
backgroundPosition: scrollableContainerShadowsCssComponents.backgroundPosition,
|
|
53
54
|
backgroundRepeat: scrollableContainerShadowsCssComponents.backgroundRepeat,
|
|
54
55
|
backgroundSize: scrollableContainerShadowsCssComponents.backgroundSize,
|
|
55
56
|
backgroundAttachment: scrollableContainerShadowsCssComponents.backgroundAttachment
|
|
@@ -105,6 +106,7 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
105
106
|
const [currentViewMode, setCurrentViewMode] = useState(viewMode);
|
|
106
107
|
const [cloudId, setCloudId] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId);
|
|
107
108
|
const [jql, setJql] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql);
|
|
109
|
+
const [searchBarJql, setSearchBarJql] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql);
|
|
108
110
|
const [visibleColumnKeys, setVisibleColumnKeys] = useState(initialVisibleColumnKeys);
|
|
109
111
|
|
|
110
112
|
// analytics related parameters
|
|
@@ -309,6 +311,11 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
309
311
|
if (!isParametersSet || !jql || !selectedJiraSite) {
|
|
310
312
|
return;
|
|
311
313
|
}
|
|
314
|
+
|
|
315
|
+
// During insertion, we want the JQL of the datasource to be whatever is in the search bar,
|
|
316
|
+
// even if the user didn't previously click search
|
|
317
|
+
const upToDateJql = searchBarJql !== null && searchBarJql !== void 0 ? searchBarJql : jql;
|
|
318
|
+
const upToDateJqlUrl = selectedJiraSite && jql && `${selectedJiraSite.url}/issues/?jql=${encodeURI(upToDateJql)}`;
|
|
312
319
|
const filterSelectionCount = availableBasicFilterTypes.reduce((current, filter) => {
|
|
313
320
|
var _basicFilterSelection;
|
|
314
321
|
return {
|
|
@@ -359,7 +366,7 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
359
366
|
onInsert({
|
|
360
367
|
type: 'inlineCard',
|
|
361
368
|
attrs: {
|
|
362
|
-
url:
|
|
369
|
+
url: upToDateJqlUrl
|
|
363
370
|
}
|
|
364
371
|
}, consumerEvent);
|
|
365
372
|
} else if (responseItems.length === 1 && firstIssueUrl) {
|
|
@@ -374,12 +381,12 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
374
381
|
onInsert({
|
|
375
382
|
type: 'blockCard',
|
|
376
383
|
attrs: {
|
|
377
|
-
url:
|
|
384
|
+
url: upToDateJqlUrl,
|
|
378
385
|
datasource: {
|
|
379
386
|
id: datasourceId,
|
|
380
387
|
parameters: {
|
|
381
388
|
cloudId,
|
|
382
|
-
jql // TODO support non JQL type
|
|
389
|
+
jql: upToDateJql // TODO support non JQL type
|
|
383
390
|
},
|
|
384
391
|
|
|
385
392
|
views: [{
|
|
@@ -395,7 +402,7 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
395
402
|
}
|
|
396
403
|
}, consumerEvent);
|
|
397
404
|
}
|
|
398
|
-
}, [isParametersSet, jql, selectedJiraSite, analyticsPayload, totalCount, visibleColumnKeys, currentViewMode, retrieveUrlForSmartCardRender, responseItems.length, onInsert,
|
|
405
|
+
}, [isParametersSet, jql, selectedJiraSite, analyticsPayload, totalCount, visibleColumnKeys, currentViewMode, retrieveUrlForSmartCardRender, responseItems.length, onInsert, datasourceId, cloudId, columnCustomSizes, searchBarJql]);
|
|
399
406
|
const handleViewModeChange = selectedMode => {
|
|
400
407
|
userInteractionActions.current.add(DatasourceAction.DISPLAY_VIEW_CHANGED);
|
|
401
408
|
setCurrentViewMode(selectedMode);
|
|
@@ -459,7 +466,7 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
459
466
|
return jsx(AccessRequired, {
|
|
460
467
|
url: selectedJiraSiteUrl || urlBeingEdited
|
|
461
468
|
});
|
|
462
|
-
} else if (resolvedWithNoResults) {
|
|
469
|
+
} else if (resolvedWithNoResults || status === 'forbidden') {
|
|
463
470
|
return jsx(NoResults, null);
|
|
464
471
|
} else if (status === 'empty' || !columns.length) {
|
|
465
472
|
// persist the empty state when making the initial /data request which contains the columns
|
|
@@ -505,6 +512,8 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
505
512
|
onOptionValueChange: handleViewModeChange,
|
|
506
513
|
selectedOptionValue: currentViewMode
|
|
507
514
|
})), jsx(ModalBody, null, !hasNoJiraSites ? jsx(Fragment, null, jsx(JiraSearchContainer, {
|
|
515
|
+
setSearchBarJql: setSearchBarJql,
|
|
516
|
+
searchBarJql: searchBarJql,
|
|
508
517
|
isSearching: status === 'loading',
|
|
509
518
|
parameters: parameters,
|
|
510
519
|
onSearch: onSearch,
|