@atlaskit/link-datasource 3.0.3 → 3.0.4
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 +9 -0
- package/dist/cjs/ui/confluence-search-modal/modal/index.js +97 -83
- package/dist/es2019/hooks/useDatasourceTableState.js +1 -0
- package/dist/es2019/ui/confluence-search-modal/modal/index.js +86 -65
- package/dist/esm/ui/confluence-search-modal/modal/index.js +98 -84
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 3.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#142151](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/142151)
|
|
8
|
+
[`3f0c2aaf2773b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3f0c2aaf2773b) -
|
|
9
|
+
Adds a bugfix for feature flag platform-datasources-use-refactored-config-modal for the confluence
|
|
10
|
+
search modal
|
|
11
|
+
|
|
3
12
|
## 3.0.3
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.PlainConfluenceSearchConfigModal = exports.ConfluenceSearchConfigModal = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
@@ -57,24 +57,9 @@ var inputContainerStyles = (0, _primitives.xcss)({
|
|
|
57
57
|
minHeight: '72px'
|
|
58
58
|
});
|
|
59
59
|
var isValidParameters = function isValidParameters(parameters) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
var useUpdateParametersOnFormUpdate = function useUpdateParametersOnFormUpdate(cloudId, searchString, lastModified, contributorAccountIds, overrideParameters) {
|
|
64
|
-
var _useDatasourceContext = (0, _datasourceContext.useDatasourceContext)(),
|
|
65
|
-
setParameters = _useDatasourceContext.setParameters;
|
|
66
|
-
(0, _react.useEffect)(function () {
|
|
67
|
-
setParameters(function (parameters) {
|
|
68
|
-
return _objectSpread(_objectSpread({}, parameters), {}, {
|
|
69
|
-
cloudId: cloudId || '',
|
|
70
|
-
searchString: searchString,
|
|
71
|
-
lastModified: lastModified === null || lastModified === void 0 ? void 0 : lastModified.value,
|
|
72
|
-
lastModifiedFrom: lastModified === null || lastModified === void 0 ? void 0 : lastModified.from,
|
|
73
|
-
lastModifiedTo: lastModified === null || lastModified === void 0 ? void 0 : lastModified.to,
|
|
74
|
-
contributorAccountIds: contributorAccountIds.length > 0 ? contributorAccountIds : undefined
|
|
75
|
-
}, overrideParameters !== null && overrideParameters !== void 0 ? overrideParameters : {});
|
|
76
|
-
});
|
|
77
|
-
}, [cloudId, searchString, lastModified, contributorAccountIds, setParameters, overrideParameters]);
|
|
60
|
+
return !!(parameters && parameters.cloudId && Object.values(parameters).filter(function (v) {
|
|
61
|
+
return v !== undefined;
|
|
62
|
+
}).length > 1);
|
|
78
63
|
};
|
|
79
64
|
var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConfigModal(props) {
|
|
80
65
|
var onCancel = props.onCancel,
|
|
@@ -82,47 +67,40 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
82
67
|
overrideParameters = props.overrideParameters;
|
|
83
68
|
var _useViewModeContext = (0, _useViewModeContext2.useViewModeContext)(),
|
|
84
69
|
currentViewMode = _useViewModeContext.currentViewMode;
|
|
85
|
-
var
|
|
86
|
-
visibleColumnKeys =
|
|
87
|
-
|
|
88
|
-
reset =
|
|
89
|
-
status =
|
|
90
|
-
responseItems =
|
|
91
|
-
|
|
92
|
-
extensionKey =
|
|
93
|
-
destinationObjectTypes =
|
|
94
|
-
totalCount =
|
|
95
|
-
columns =
|
|
96
|
-
visibleColumnCount =
|
|
97
|
-
parameters =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
cloudId = _useState2[0],
|
|
101
|
-
setCloudId = _useState2[1];
|
|
102
|
-
var _useAvailableSites = (0, _useAvailableSites2.useAvailableSites)('confluence', cloudId),
|
|
70
|
+
var _useDatasourceContext = (0, _datasourceContext.useDatasourceContext)(),
|
|
71
|
+
visibleColumnKeys = _useDatasourceContext.visibleColumnKeys,
|
|
72
|
+
_useDatasourceContext2 = _useDatasourceContext.tableState,
|
|
73
|
+
reset = _useDatasourceContext2.reset,
|
|
74
|
+
status = _useDatasourceContext2.status,
|
|
75
|
+
responseItems = _useDatasourceContext2.responseItems,
|
|
76
|
+
_useDatasourceContext3 = _useDatasourceContext2.extensionKey,
|
|
77
|
+
extensionKey = _useDatasourceContext3 === void 0 ? null : _useDatasourceContext3,
|
|
78
|
+
destinationObjectTypes = _useDatasourceContext2.destinationObjectTypes,
|
|
79
|
+
totalCount = _useDatasourceContext2.totalCount,
|
|
80
|
+
columns = _useDatasourceContext2.columns,
|
|
81
|
+
visibleColumnCount = _useDatasourceContext.visibleColumnCount,
|
|
82
|
+
parameters = _useDatasourceContext.parameters,
|
|
83
|
+
setParameters = _useDatasourceContext.setParameters;
|
|
84
|
+
var _useAvailableSites = (0, _useAvailableSites2.useAvailableSites)('confluence', parameters === null || parameters === void 0 ? void 0 : parameters.cloudId),
|
|
103
85
|
availableSites = _useAvailableSites.availableSites,
|
|
104
86
|
selectedConfluenceSite = _useAvailableSites.selectedSite;
|
|
105
|
-
var _useState3 = (0, _react.useState)(parameters === null || parameters === void 0 ? void 0 : parameters.searchString),
|
|
106
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
107
|
-
searchString = _useState4[0],
|
|
108
|
-
setSearchString = _useState4[1];
|
|
109
|
-
var _useState5 = (0, _react.useState)((parameters === null || parameters === void 0 ? void 0 : parameters.contributorAccountIds) || []),
|
|
110
|
-
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
111
|
-
contributorAccountIds = _useState6[0],
|
|
112
|
-
setContributorAccountIds = _useState6[1];
|
|
113
|
-
var _useState7 = (0, _react.useState)(parameters !== null && parameters !== void 0 && parameters.lastModified ? {
|
|
114
|
-
value: parameters === null || parameters === void 0 ? void 0 : parameters.lastModified,
|
|
115
|
-
from: parameters === null || parameters === void 0 ? void 0 : parameters.lastModifiedFrom,
|
|
116
|
-
to: parameters === null || parameters === void 0 ? void 0 : parameters.lastModifiedTo
|
|
117
|
-
} : undefined),
|
|
118
|
-
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
119
|
-
lastModified = _useState8[0],
|
|
120
|
-
setLastModified = _useState8[1];
|
|
121
87
|
|
|
122
88
|
// analytics related parameters
|
|
123
89
|
var searchCount = (0, _react.useRef)(0);
|
|
124
90
|
var userInteractions = (0, _userInteractions.useUserInteractions)();
|
|
125
|
-
|
|
91
|
+
var setParametersWithOverrides = (0, _react.useCallback)(function (setStateAction) {
|
|
92
|
+
if (typeof setStateAction !== 'function') {
|
|
93
|
+
setParameters(_objectSpread(_objectSpread({}, setStateAction), {}, {
|
|
94
|
+
cloudId: (setStateAction === null || setStateAction === void 0 ? void 0 : setStateAction.cloudId) || ''
|
|
95
|
+
}, overrideParameters));
|
|
96
|
+
} else {
|
|
97
|
+
setParameters(function (prev) {
|
|
98
|
+
return _objectSpread(_objectSpread(_objectSpread({}, prev), {}, {
|
|
99
|
+
cloudId: (prev === null || prev === void 0 ? void 0 : prev.cloudId) || ''
|
|
100
|
+
}, setStateAction(prev)), overrideParameters);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}, [setParameters, overrideParameters]);
|
|
126
104
|
var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
|
|
127
105
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
128
106
|
var hasNoConfluenceSites = availableSites && availableSites.length === 0;
|
|
@@ -138,48 +116,67 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
138
116
|
// TODO: further refactoring in EDM-9573
|
|
139
117
|
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6828283
|
|
140
118
|
(0, _react.useEffect)(function () {
|
|
141
|
-
if (selectedConfluenceSite && (!cloudId || cloudId !== selectedConfluenceSite.cloudId)) {
|
|
142
|
-
|
|
119
|
+
if (selectedConfluenceSite && (!(parameters !== null && parameters !== void 0 && parameters.cloudId) || (parameters === null || parameters === void 0 ? void 0 : parameters.cloudId) !== selectedConfluenceSite.cloudId)) {
|
|
120
|
+
/**
|
|
121
|
+
* This code is primarily to set the cloudId in the parameters when the site selector loads a default value
|
|
122
|
+
* but there is no "onChange" emitted from the site picker
|
|
123
|
+
*/
|
|
124
|
+
setParameters(function (prev) {
|
|
125
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
126
|
+
cloudId: selectedConfluenceSite.cloudId
|
|
127
|
+
});
|
|
128
|
+
});
|
|
143
129
|
}
|
|
144
|
-
}, [
|
|
130
|
+
}, [parameters, setParameters, selectedConfluenceSite]);
|
|
145
131
|
|
|
146
132
|
// TODO: further refactoring in EDM-9573
|
|
147
133
|
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6829171
|
|
148
134
|
var onSiteSelection = (0, _react.useCallback)(function (site) {
|
|
149
135
|
userInteractions.add(_types.DatasourceAction.INSTANCE_UPDATED);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Clear the state of the form filters when the site is changed
|
|
139
|
+
*/
|
|
140
|
+
setParameters(function (prev) {
|
|
141
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
142
|
+
searchString: undefined,
|
|
143
|
+
lastModified: undefined,
|
|
144
|
+
lastModifiedFrom: undefined,
|
|
145
|
+
lastModifiedTo: undefined,
|
|
146
|
+
contributorAccountIds: undefined,
|
|
147
|
+
cloudId: site.cloudId
|
|
148
|
+
});
|
|
149
|
+
});
|
|
154
150
|
reset({
|
|
155
151
|
shouldForceRequest: true
|
|
156
152
|
});
|
|
157
|
-
}, [reset, userInteractions]);
|
|
153
|
+
}, [reset, setParameters, userInteractions]);
|
|
158
154
|
var siteSelectorLabel = availableSites && availableSites.length > 1 ? _messages.confluenceSearchModalMessages.insertIssuesTitleManySites : _messages.confluenceSearchModalMessages.insertIssuesTitle;
|
|
159
155
|
var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
160
|
-
var hasConfluenceSearchParams = selectedConfluenceSite && searchString;
|
|
156
|
+
var hasConfluenceSearchParams = selectedConfluenceSite && (parameters === null || parameters === void 0 ? void 0 : parameters.searchString);
|
|
161
157
|
var selectedConfluenceSiteUrl = selectedConfluenceSite === null || selectedConfluenceSite === void 0 ? void 0 : selectedConfluenceSite.url;
|
|
162
158
|
var confluenceSearchUrl = (0, _react.useMemo)(function () {
|
|
163
|
-
|
|
159
|
+
var _parameters$contribut;
|
|
160
|
+
if (!selectedConfluenceSiteUrl || (parameters === null || parameters === void 0 ? void 0 : parameters.searchString) === undefined) {
|
|
164
161
|
return undefined;
|
|
165
162
|
}
|
|
166
163
|
var params = new URLSearchParams();
|
|
167
|
-
// we are appending "text" without checking searchString as we need the url to have "text" when a user does an empty search
|
|
168
|
-
params.append('text', searchString);
|
|
169
|
-
if (contributorAccountIds
|
|
170
|
-
params.append('contributors', contributorAccountIds.join(','));
|
|
164
|
+
// we are appending "text" without checking searchString as we need the url to have "text" when a user does an empty search)
|
|
165
|
+
params.append('text', (parameters === null || parameters === void 0 ? void 0 : parameters.searchString) || '');
|
|
166
|
+
if (parameters !== null && parameters !== void 0 && (_parameters$contribut = parameters.contributorAccountIds) !== null && _parameters$contribut !== void 0 && _parameters$contribut.length) {
|
|
167
|
+
params.append('contributors', parameters.contributorAccountIds.join(','));
|
|
171
168
|
}
|
|
172
|
-
if (
|
|
173
|
-
params.append('lastModified', lastModified
|
|
169
|
+
if (parameters !== null && parameters !== void 0 && parameters.lastModified) {
|
|
170
|
+
params.append('lastModified', parameters.lastModified);
|
|
174
171
|
}
|
|
175
|
-
if (
|
|
176
|
-
params.append('from',
|
|
172
|
+
if (parameters !== null && parameters !== void 0 && parameters.lastModifiedFrom) {
|
|
173
|
+
params.append('from', parameters.lastModifiedFrom);
|
|
177
174
|
}
|
|
178
|
-
if (
|
|
179
|
-
params.append('to',
|
|
175
|
+
if (parameters !== null && parameters !== void 0 && parameters.lastModifiedTo) {
|
|
176
|
+
params.append('to', parameters.lastModifiedTo);
|
|
180
177
|
}
|
|
181
178
|
return "".concat(selectedConfluenceSiteUrl, "/wiki/search?").concat(params.toString());
|
|
182
|
-
}, [
|
|
179
|
+
}, [parameters, selectedConfluenceSiteUrl]);
|
|
183
180
|
var analyticsPayload = (0, _react.useMemo)(function () {
|
|
184
181
|
return {
|
|
185
182
|
extensionKey: extensionKey,
|
|
@@ -272,10 +269,12 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
272
269
|
return range.value;
|
|
273
270
|
});
|
|
274
271
|
if ((updatedDateRangeOption === null || updatedDateRangeOption === void 0 ? void 0 : updatedDateRangeOption.optionType) === 'dateRange') {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
272
|
+
setParametersWithOverrides(function (prev) {
|
|
273
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
274
|
+
lastModified: updatedDateRangeOption.value,
|
|
275
|
+
lastModifiedFrom: updatedDateRangeOption.from,
|
|
276
|
+
lastModifiedTo: updatedDateRangeOption.to
|
|
277
|
+
});
|
|
279
278
|
});
|
|
280
279
|
}
|
|
281
280
|
}
|
|
@@ -283,14 +282,22 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
283
282
|
var accountIds = editedOrCreatedBy.map(function (user) {
|
|
284
283
|
return user.value;
|
|
285
284
|
});
|
|
286
|
-
|
|
285
|
+
setParametersWithOverrides(function (prev) {
|
|
286
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
287
|
+
contributorAccountIds: accountIds
|
|
288
|
+
});
|
|
289
|
+
});
|
|
287
290
|
}
|
|
288
291
|
}
|
|
289
|
-
|
|
292
|
+
setParametersWithOverrides(function (prev) {
|
|
293
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
294
|
+
searchString: newSearchString
|
|
295
|
+
});
|
|
296
|
+
});
|
|
290
297
|
reset({
|
|
291
298
|
shouldForceRequest: true
|
|
292
299
|
});
|
|
293
|
-
}, [reset, userInteractions]);
|
|
300
|
+
}, [reset, userInteractions, setParametersWithOverrides]);
|
|
294
301
|
var getButtonAnalyticsPayload = (0, _react.useCallback)(function () {
|
|
295
302
|
return {
|
|
296
303
|
extensionKey: extensionKey,
|
|
@@ -354,7 +361,14 @@ var ConnectedConfluenceSearchConfigModal = (0, _createDatasourceModal.createData
|
|
|
354
361
|
});
|
|
355
362
|
var ConfluenceSearchConfigModal = exports.ConfluenceSearchConfigModal = function ConfluenceSearchConfigModal(props) {
|
|
356
363
|
if ((0, _platformFeatureFlags.fg)('platform-datasources-use-refactored-config-modal')) {
|
|
357
|
-
return (0, _react2.jsx)(_state.StoreContainer, null, (0, _react2.jsx)(ConnectedConfluenceSearchConfigModal, props
|
|
364
|
+
return (0, _react2.jsx)(_state.StoreContainer, null, (0, _react2.jsx)(ConnectedConfluenceSearchConfigModal, (0, _extends2.default)({}, props, {
|
|
365
|
+
/**
|
|
366
|
+
* If the intial parameters are not valid, we will not initialise the modal state
|
|
367
|
+
* with `overrideParameters`. This is to allow the modal to be opened without
|
|
368
|
+
* any initial parameters and require the user to perform a search.
|
|
369
|
+
*/
|
|
370
|
+
parameters: props.overrideParameters && isValidParameters(props.parameters) ? _objectSpread(_objectSpread({}, props.parameters), props.overrideParameters) : props.parameters
|
|
371
|
+
})));
|
|
358
372
|
}
|
|
359
373
|
return (0, _react2.jsx)(_state.StoreContainer, null, (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
|
|
360
374
|
data: contextData
|
|
@@ -173,6 +173,7 @@ export const useDatasourceTableState = ({
|
|
|
173
173
|
schema
|
|
174
174
|
}
|
|
175
175
|
} = await getDatasourceData(datasourceId, datasourceDataRequest, shouldForceRequest);
|
|
176
|
+
|
|
176
177
|
/**
|
|
177
178
|
* Let the response finish and store in cache, but throw error if signal is aborted
|
|
178
179
|
*/
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
2
3
|
/**
|
|
3
4
|
* @jsxRuntime classic
|
|
4
5
|
* @jsx jsx
|
|
5
6
|
*/
|
|
6
|
-
import { Fragment, useCallback, useEffect, useMemo, useRef
|
|
7
|
+
import { Fragment, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
7
8
|
|
|
8
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
10
|
import { jsx } from '@emotion/react';
|
|
@@ -49,29 +50,7 @@ const inputContainerStyles = xcss({
|
|
|
49
50
|
display: 'flex',
|
|
50
51
|
minHeight: '72px'
|
|
51
52
|
});
|
|
52
|
-
const isValidParameters = parameters =>
|
|
53
|
-
var _parameters$contribut;
|
|
54
|
-
return !!(parameters && parameters.cloudId && (parameters.searchString !== undefined || (_parameters$contribut = parameters.contributorAccountIds) !== null && _parameters$contribut !== void 0 && _parameters$contribut.length || parameters.lastModified || parameters.lastModifiedFrom || parameters.lastModifiedTo));
|
|
55
|
-
};
|
|
56
|
-
const useUpdateParametersOnFormUpdate = (cloudId, searchString, lastModified, contributorAccountIds, overrideParameters) => {
|
|
57
|
-
const {
|
|
58
|
-
setParameters
|
|
59
|
-
} = useDatasourceContext();
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
setParameters(parameters => {
|
|
62
|
-
return {
|
|
63
|
-
...parameters,
|
|
64
|
-
cloudId: cloudId || '',
|
|
65
|
-
searchString,
|
|
66
|
-
lastModified: lastModified === null || lastModified === void 0 ? void 0 : lastModified.value,
|
|
67
|
-
lastModifiedFrom: lastModified === null || lastModified === void 0 ? void 0 : lastModified.from,
|
|
68
|
-
lastModifiedTo: lastModified === null || lastModified === void 0 ? void 0 : lastModified.to,
|
|
69
|
-
contributorAccountIds: contributorAccountIds.length > 0 ? contributorAccountIds : undefined,
|
|
70
|
-
...(overrideParameters !== null && overrideParameters !== void 0 ? overrideParameters : {})
|
|
71
|
-
};
|
|
72
|
-
});
|
|
73
|
-
}, [cloudId, searchString, lastModified, contributorAccountIds, setParameters, overrideParameters]);
|
|
74
|
-
};
|
|
53
|
+
const isValidParameters = parameters => !!(parameters && parameters.cloudId && Object.values(parameters).filter(v => v !== undefined).length > 1);
|
|
75
54
|
export const PlainConfluenceSearchConfigModal = props => {
|
|
76
55
|
const {
|
|
77
56
|
onCancel,
|
|
@@ -93,25 +72,33 @@ export const PlainConfluenceSearchConfigModal = props => {
|
|
|
93
72
|
columns
|
|
94
73
|
},
|
|
95
74
|
visibleColumnCount,
|
|
96
|
-
parameters
|
|
75
|
+
parameters,
|
|
76
|
+
setParameters
|
|
97
77
|
} = useDatasourceContext();
|
|
98
|
-
const [cloudId, setCloudId] = useState(parameters === null || parameters === void 0 ? void 0 : parameters.cloudId);
|
|
99
78
|
const {
|
|
100
79
|
availableSites,
|
|
101
80
|
selectedSite: selectedConfluenceSite
|
|
102
|
-
} = useAvailableSites('confluence', cloudId);
|
|
103
|
-
const [searchString, setSearchString] = useState(parameters === null || parameters === void 0 ? void 0 : parameters.searchString);
|
|
104
|
-
const [contributorAccountIds, setContributorAccountIds] = useState((parameters === null || parameters === void 0 ? void 0 : parameters.contributorAccountIds) || []);
|
|
105
|
-
const [lastModified, setLastModified] = useState(parameters !== null && parameters !== void 0 && parameters.lastModified ? {
|
|
106
|
-
value: parameters === null || parameters === void 0 ? void 0 : parameters.lastModified,
|
|
107
|
-
from: parameters === null || parameters === void 0 ? void 0 : parameters.lastModifiedFrom,
|
|
108
|
-
to: parameters === null || parameters === void 0 ? void 0 : parameters.lastModifiedTo
|
|
109
|
-
} : undefined);
|
|
81
|
+
} = useAvailableSites('confluence', parameters === null || parameters === void 0 ? void 0 : parameters.cloudId);
|
|
110
82
|
|
|
111
83
|
// analytics related parameters
|
|
112
84
|
const searchCount = useRef(0);
|
|
113
85
|
const userInteractions = useUserInteractions();
|
|
114
|
-
|
|
86
|
+
const setParametersWithOverrides = useCallback(setStateAction => {
|
|
87
|
+
if (typeof setStateAction !== 'function') {
|
|
88
|
+
setParameters({
|
|
89
|
+
...setStateAction,
|
|
90
|
+
cloudId: (setStateAction === null || setStateAction === void 0 ? void 0 : setStateAction.cloudId) || '',
|
|
91
|
+
...overrideParameters
|
|
92
|
+
});
|
|
93
|
+
} else {
|
|
94
|
+
setParameters(prev => ({
|
|
95
|
+
...prev,
|
|
96
|
+
cloudId: (prev === null || prev === void 0 ? void 0 : prev.cloudId) || '',
|
|
97
|
+
...setStateAction(prev),
|
|
98
|
+
...overrideParameters
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
}, [setParameters, overrideParameters]);
|
|
115
102
|
const {
|
|
116
103
|
fireEvent
|
|
117
104
|
} = useDatasourceAnalyticsEvents();
|
|
@@ -128,48 +115,65 @@ export const PlainConfluenceSearchConfigModal = props => {
|
|
|
128
115
|
// TODO: further refactoring in EDM-9573
|
|
129
116
|
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6828283
|
|
130
117
|
useEffect(() => {
|
|
131
|
-
if (selectedConfluenceSite && (!cloudId || cloudId !== selectedConfluenceSite.cloudId)) {
|
|
132
|
-
|
|
118
|
+
if (selectedConfluenceSite && (!(parameters !== null && parameters !== void 0 && parameters.cloudId) || (parameters === null || parameters === void 0 ? void 0 : parameters.cloudId) !== selectedConfluenceSite.cloudId)) {
|
|
119
|
+
/**
|
|
120
|
+
* This code is primarily to set the cloudId in the parameters when the site selector loads a default value
|
|
121
|
+
* but there is no "onChange" emitted from the site picker
|
|
122
|
+
*/
|
|
123
|
+
setParameters(prev => ({
|
|
124
|
+
...prev,
|
|
125
|
+
cloudId: selectedConfluenceSite.cloudId
|
|
126
|
+
}));
|
|
133
127
|
}
|
|
134
|
-
}, [
|
|
128
|
+
}, [parameters, setParameters, selectedConfluenceSite]);
|
|
135
129
|
|
|
136
130
|
// TODO: further refactoring in EDM-9573
|
|
137
131
|
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6829171
|
|
138
132
|
const onSiteSelection = useCallback(site => {
|
|
139
133
|
userInteractions.add(DatasourceAction.INSTANCE_UPDATED);
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Clear the state of the form filters when the site is changed
|
|
137
|
+
*/
|
|
138
|
+
setParameters(prev => ({
|
|
139
|
+
...prev,
|
|
140
|
+
searchString: undefined,
|
|
141
|
+
lastModified: undefined,
|
|
142
|
+
lastModifiedFrom: undefined,
|
|
143
|
+
lastModifiedTo: undefined,
|
|
144
|
+
contributorAccountIds: undefined,
|
|
145
|
+
cloudId: site.cloudId
|
|
146
|
+
}));
|
|
144
147
|
reset({
|
|
145
148
|
shouldForceRequest: true
|
|
146
149
|
});
|
|
147
|
-
}, [reset, userInteractions]);
|
|
150
|
+
}, [reset, setParameters, userInteractions]);
|
|
148
151
|
const siteSelectorLabel = availableSites && availableSites.length > 1 ? confluenceSearchModalMessages.insertIssuesTitleManySites : confluenceSearchModalMessages.insertIssuesTitle;
|
|
149
152
|
const resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
150
|
-
const hasConfluenceSearchParams = selectedConfluenceSite && searchString;
|
|
153
|
+
const hasConfluenceSearchParams = selectedConfluenceSite && (parameters === null || parameters === void 0 ? void 0 : parameters.searchString);
|
|
151
154
|
const selectedConfluenceSiteUrl = selectedConfluenceSite === null || selectedConfluenceSite === void 0 ? void 0 : selectedConfluenceSite.url;
|
|
152
155
|
const confluenceSearchUrl = useMemo(() => {
|
|
153
|
-
|
|
156
|
+
var _parameters$contribut;
|
|
157
|
+
if (!selectedConfluenceSiteUrl || (parameters === null || parameters === void 0 ? void 0 : parameters.searchString) === undefined) {
|
|
154
158
|
return undefined;
|
|
155
159
|
}
|
|
156
160
|
const params = new URLSearchParams();
|
|
157
|
-
// we are appending "text" without checking searchString as we need the url to have "text" when a user does an empty search
|
|
158
|
-
params.append('text', searchString);
|
|
159
|
-
if (contributorAccountIds
|
|
160
|
-
params.append('contributors', contributorAccountIds.join(','));
|
|
161
|
+
// we are appending "text" without checking searchString as we need the url to have "text" when a user does an empty search)
|
|
162
|
+
params.append('text', (parameters === null || parameters === void 0 ? void 0 : parameters.searchString) || '');
|
|
163
|
+
if (parameters !== null && parameters !== void 0 && (_parameters$contribut = parameters.contributorAccountIds) !== null && _parameters$contribut !== void 0 && _parameters$contribut.length) {
|
|
164
|
+
params.append('contributors', parameters.contributorAccountIds.join(','));
|
|
161
165
|
}
|
|
162
|
-
if (
|
|
163
|
-
params.append('lastModified', lastModified
|
|
166
|
+
if (parameters !== null && parameters !== void 0 && parameters.lastModified) {
|
|
167
|
+
params.append('lastModified', parameters.lastModified);
|
|
164
168
|
}
|
|
165
|
-
if (
|
|
166
|
-
params.append('from',
|
|
169
|
+
if (parameters !== null && parameters !== void 0 && parameters.lastModifiedFrom) {
|
|
170
|
+
params.append('from', parameters.lastModifiedFrom);
|
|
167
171
|
}
|
|
168
|
-
if (
|
|
169
|
-
params.append('to',
|
|
172
|
+
if (parameters !== null && parameters !== void 0 && parameters.lastModifiedTo) {
|
|
173
|
+
params.append('to', parameters.lastModifiedTo);
|
|
170
174
|
}
|
|
171
175
|
return `${selectedConfluenceSiteUrl}/wiki/search?${params.toString()}`;
|
|
172
|
-
}, [
|
|
176
|
+
}, [parameters, selectedConfluenceSiteUrl]);
|
|
173
177
|
const analyticsPayload = useMemo(() => ({
|
|
174
178
|
extensionKey,
|
|
175
179
|
destinationObjectTypes,
|
|
@@ -262,23 +266,30 @@ export const PlainConfluenceSearchConfigModal = props => {
|
|
|
262
266
|
if (lastModifiedList) {
|
|
263
267
|
const updatedDateRangeOption = lastModifiedList.find(range => range.value);
|
|
264
268
|
if ((updatedDateRangeOption === null || updatedDateRangeOption === void 0 ? void 0 : updatedDateRangeOption.optionType) === 'dateRange') {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
269
|
+
setParametersWithOverrides(prev => ({
|
|
270
|
+
...prev,
|
|
271
|
+
lastModified: updatedDateRangeOption.value,
|
|
272
|
+
lastModifiedFrom: updatedDateRangeOption.from,
|
|
273
|
+
lastModifiedTo: updatedDateRangeOption.to
|
|
274
|
+
}));
|
|
270
275
|
}
|
|
271
276
|
}
|
|
272
277
|
if (editedOrCreatedBy) {
|
|
273
278
|
const accountIds = editedOrCreatedBy.map(user => user.value);
|
|
274
|
-
|
|
279
|
+
setParametersWithOverrides(prev => ({
|
|
280
|
+
...prev,
|
|
281
|
+
contributorAccountIds: accountIds
|
|
282
|
+
}));
|
|
275
283
|
}
|
|
276
284
|
}
|
|
277
|
-
|
|
285
|
+
setParametersWithOverrides(prev => ({
|
|
286
|
+
...prev,
|
|
287
|
+
searchString: newSearchString
|
|
288
|
+
}));
|
|
278
289
|
reset({
|
|
279
290
|
shouldForceRequest: true
|
|
280
291
|
});
|
|
281
|
-
}, [reset, userInteractions]);
|
|
292
|
+
}, [reset, userInteractions, setParametersWithOverrides]);
|
|
282
293
|
const getButtonAnalyticsPayload = useCallback(() => {
|
|
283
294
|
return {
|
|
284
295
|
extensionKey,
|
|
@@ -346,7 +357,17 @@ const ConnectedConfluenceSearchConfigModal = createDatasourceModal({
|
|
|
346
357
|
});
|
|
347
358
|
export const ConfluenceSearchConfigModal = props => {
|
|
348
359
|
if (fg('platform-datasources-use-refactored-config-modal')) {
|
|
349
|
-
return jsx(StoreContainer, null, jsx(ConnectedConfluenceSearchConfigModal, props
|
|
360
|
+
return jsx(StoreContainer, null, jsx(ConnectedConfluenceSearchConfigModal, _extends({}, props, {
|
|
361
|
+
/**
|
|
362
|
+
* If the intial parameters are not valid, we will not initialise the modal state
|
|
363
|
+
* with `overrideParameters`. This is to allow the modal to be opened without
|
|
364
|
+
* any initial parameters and require the user to perform a search.
|
|
365
|
+
*/
|
|
366
|
+
parameters: props.overrideParameters && isValidParameters(props.parameters) ? {
|
|
367
|
+
...props.parameters,
|
|
368
|
+
...props.overrideParameters
|
|
369
|
+
} : props.parameters
|
|
370
|
+
})));
|
|
350
371
|
}
|
|
351
372
|
return jsx(StoreContainer, null, jsx(AnalyticsContext, {
|
|
352
373
|
data: contextData
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
* @jsxRuntime classic
|
|
8
8
|
* @jsx jsx
|
|
9
9
|
*/
|
|
10
|
-
import { Fragment, useCallback, useEffect, useMemo, useRef
|
|
10
|
+
import { Fragment, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
11
11
|
|
|
12
12
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
13
|
import { jsx } from '@emotion/react';
|
|
@@ -54,24 +54,9 @@ var inputContainerStyles = xcss({
|
|
|
54
54
|
minHeight: '72px'
|
|
55
55
|
});
|
|
56
56
|
var isValidParameters = function isValidParameters(parameters) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
var useUpdateParametersOnFormUpdate = function useUpdateParametersOnFormUpdate(cloudId, searchString, lastModified, contributorAccountIds, overrideParameters) {
|
|
61
|
-
var _useDatasourceContext = useDatasourceContext(),
|
|
62
|
-
setParameters = _useDatasourceContext.setParameters;
|
|
63
|
-
useEffect(function () {
|
|
64
|
-
setParameters(function (parameters) {
|
|
65
|
-
return _objectSpread(_objectSpread({}, parameters), {}, {
|
|
66
|
-
cloudId: cloudId || '',
|
|
67
|
-
searchString: searchString,
|
|
68
|
-
lastModified: lastModified === null || lastModified === void 0 ? void 0 : lastModified.value,
|
|
69
|
-
lastModifiedFrom: lastModified === null || lastModified === void 0 ? void 0 : lastModified.from,
|
|
70
|
-
lastModifiedTo: lastModified === null || lastModified === void 0 ? void 0 : lastModified.to,
|
|
71
|
-
contributorAccountIds: contributorAccountIds.length > 0 ? contributorAccountIds : undefined
|
|
72
|
-
}, overrideParameters !== null && overrideParameters !== void 0 ? overrideParameters : {});
|
|
73
|
-
});
|
|
74
|
-
}, [cloudId, searchString, lastModified, contributorAccountIds, setParameters, overrideParameters]);
|
|
57
|
+
return !!(parameters && parameters.cloudId && Object.values(parameters).filter(function (v) {
|
|
58
|
+
return v !== undefined;
|
|
59
|
+
}).length > 1);
|
|
75
60
|
};
|
|
76
61
|
export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConfigModal(props) {
|
|
77
62
|
var onCancel = props.onCancel,
|
|
@@ -79,47 +64,40 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
79
64
|
overrideParameters = props.overrideParameters;
|
|
80
65
|
var _useViewModeContext = useViewModeContext(),
|
|
81
66
|
currentViewMode = _useViewModeContext.currentViewMode;
|
|
82
|
-
var
|
|
83
|
-
visibleColumnKeys =
|
|
84
|
-
|
|
85
|
-
reset =
|
|
86
|
-
status =
|
|
87
|
-
responseItems =
|
|
88
|
-
|
|
89
|
-
extensionKey =
|
|
90
|
-
destinationObjectTypes =
|
|
91
|
-
totalCount =
|
|
92
|
-
columns =
|
|
93
|
-
visibleColumnCount =
|
|
94
|
-
parameters =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
cloudId = _useState2[0],
|
|
98
|
-
setCloudId = _useState2[1];
|
|
99
|
-
var _useAvailableSites = useAvailableSites('confluence', cloudId),
|
|
67
|
+
var _useDatasourceContext = useDatasourceContext(),
|
|
68
|
+
visibleColumnKeys = _useDatasourceContext.visibleColumnKeys,
|
|
69
|
+
_useDatasourceContext2 = _useDatasourceContext.tableState,
|
|
70
|
+
reset = _useDatasourceContext2.reset,
|
|
71
|
+
status = _useDatasourceContext2.status,
|
|
72
|
+
responseItems = _useDatasourceContext2.responseItems,
|
|
73
|
+
_useDatasourceContext3 = _useDatasourceContext2.extensionKey,
|
|
74
|
+
extensionKey = _useDatasourceContext3 === void 0 ? null : _useDatasourceContext3,
|
|
75
|
+
destinationObjectTypes = _useDatasourceContext2.destinationObjectTypes,
|
|
76
|
+
totalCount = _useDatasourceContext2.totalCount,
|
|
77
|
+
columns = _useDatasourceContext2.columns,
|
|
78
|
+
visibleColumnCount = _useDatasourceContext.visibleColumnCount,
|
|
79
|
+
parameters = _useDatasourceContext.parameters,
|
|
80
|
+
setParameters = _useDatasourceContext.setParameters;
|
|
81
|
+
var _useAvailableSites = useAvailableSites('confluence', parameters === null || parameters === void 0 ? void 0 : parameters.cloudId),
|
|
100
82
|
availableSites = _useAvailableSites.availableSites,
|
|
101
83
|
selectedConfluenceSite = _useAvailableSites.selectedSite;
|
|
102
|
-
var _useState3 = useState(parameters === null || parameters === void 0 ? void 0 : parameters.searchString),
|
|
103
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
104
|
-
searchString = _useState4[0],
|
|
105
|
-
setSearchString = _useState4[1];
|
|
106
|
-
var _useState5 = useState((parameters === null || parameters === void 0 ? void 0 : parameters.contributorAccountIds) || []),
|
|
107
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
108
|
-
contributorAccountIds = _useState6[0],
|
|
109
|
-
setContributorAccountIds = _useState6[1];
|
|
110
|
-
var _useState7 = useState(parameters !== null && parameters !== void 0 && parameters.lastModified ? {
|
|
111
|
-
value: parameters === null || parameters === void 0 ? void 0 : parameters.lastModified,
|
|
112
|
-
from: parameters === null || parameters === void 0 ? void 0 : parameters.lastModifiedFrom,
|
|
113
|
-
to: parameters === null || parameters === void 0 ? void 0 : parameters.lastModifiedTo
|
|
114
|
-
} : undefined),
|
|
115
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
116
|
-
lastModified = _useState8[0],
|
|
117
|
-
setLastModified = _useState8[1];
|
|
118
84
|
|
|
119
85
|
// analytics related parameters
|
|
120
86
|
var searchCount = useRef(0);
|
|
121
87
|
var userInteractions = useUserInteractions();
|
|
122
|
-
|
|
88
|
+
var setParametersWithOverrides = useCallback(function (setStateAction) {
|
|
89
|
+
if (typeof setStateAction !== 'function') {
|
|
90
|
+
setParameters(_objectSpread(_objectSpread({}, setStateAction), {}, {
|
|
91
|
+
cloudId: (setStateAction === null || setStateAction === void 0 ? void 0 : setStateAction.cloudId) || ''
|
|
92
|
+
}, overrideParameters));
|
|
93
|
+
} else {
|
|
94
|
+
setParameters(function (prev) {
|
|
95
|
+
return _objectSpread(_objectSpread(_objectSpread({}, prev), {}, {
|
|
96
|
+
cloudId: (prev === null || prev === void 0 ? void 0 : prev.cloudId) || ''
|
|
97
|
+
}, setStateAction(prev)), overrideParameters);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, [setParameters, overrideParameters]);
|
|
123
101
|
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
124
102
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
125
103
|
var hasNoConfluenceSites = availableSites && availableSites.length === 0;
|
|
@@ -135,48 +113,67 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
135
113
|
// TODO: further refactoring in EDM-9573
|
|
136
114
|
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6828283
|
|
137
115
|
useEffect(function () {
|
|
138
|
-
if (selectedConfluenceSite && (!cloudId || cloudId !== selectedConfluenceSite.cloudId)) {
|
|
139
|
-
|
|
116
|
+
if (selectedConfluenceSite && (!(parameters !== null && parameters !== void 0 && parameters.cloudId) || (parameters === null || parameters === void 0 ? void 0 : parameters.cloudId) !== selectedConfluenceSite.cloudId)) {
|
|
117
|
+
/**
|
|
118
|
+
* This code is primarily to set the cloudId in the parameters when the site selector loads a default value
|
|
119
|
+
* but there is no "onChange" emitted from the site picker
|
|
120
|
+
*/
|
|
121
|
+
setParameters(function (prev) {
|
|
122
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
123
|
+
cloudId: selectedConfluenceSite.cloudId
|
|
124
|
+
});
|
|
125
|
+
});
|
|
140
126
|
}
|
|
141
|
-
}, [
|
|
127
|
+
}, [parameters, setParameters, selectedConfluenceSite]);
|
|
142
128
|
|
|
143
129
|
// TODO: further refactoring in EDM-9573
|
|
144
130
|
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6829171
|
|
145
131
|
var onSiteSelection = useCallback(function (site) {
|
|
146
132
|
userInteractions.add(DatasourceAction.INSTANCE_UPDATED);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Clear the state of the form filters when the site is changed
|
|
136
|
+
*/
|
|
137
|
+
setParameters(function (prev) {
|
|
138
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
139
|
+
searchString: undefined,
|
|
140
|
+
lastModified: undefined,
|
|
141
|
+
lastModifiedFrom: undefined,
|
|
142
|
+
lastModifiedTo: undefined,
|
|
143
|
+
contributorAccountIds: undefined,
|
|
144
|
+
cloudId: site.cloudId
|
|
145
|
+
});
|
|
146
|
+
});
|
|
151
147
|
reset({
|
|
152
148
|
shouldForceRequest: true
|
|
153
149
|
});
|
|
154
|
-
}, [reset, userInteractions]);
|
|
150
|
+
}, [reset, setParameters, userInteractions]);
|
|
155
151
|
var siteSelectorLabel = availableSites && availableSites.length > 1 ? confluenceSearchModalMessages.insertIssuesTitleManySites : confluenceSearchModalMessages.insertIssuesTitle;
|
|
156
152
|
var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
157
|
-
var hasConfluenceSearchParams = selectedConfluenceSite && searchString;
|
|
153
|
+
var hasConfluenceSearchParams = selectedConfluenceSite && (parameters === null || parameters === void 0 ? void 0 : parameters.searchString);
|
|
158
154
|
var selectedConfluenceSiteUrl = selectedConfluenceSite === null || selectedConfluenceSite === void 0 ? void 0 : selectedConfluenceSite.url;
|
|
159
155
|
var confluenceSearchUrl = useMemo(function () {
|
|
160
|
-
|
|
156
|
+
var _parameters$contribut;
|
|
157
|
+
if (!selectedConfluenceSiteUrl || (parameters === null || parameters === void 0 ? void 0 : parameters.searchString) === undefined) {
|
|
161
158
|
return undefined;
|
|
162
159
|
}
|
|
163
160
|
var params = new URLSearchParams();
|
|
164
|
-
// we are appending "text" without checking searchString as we need the url to have "text" when a user does an empty search
|
|
165
|
-
params.append('text', searchString);
|
|
166
|
-
if (contributorAccountIds
|
|
167
|
-
params.append('contributors', contributorAccountIds.join(','));
|
|
161
|
+
// we are appending "text" without checking searchString as we need the url to have "text" when a user does an empty search)
|
|
162
|
+
params.append('text', (parameters === null || parameters === void 0 ? void 0 : parameters.searchString) || '');
|
|
163
|
+
if (parameters !== null && parameters !== void 0 && (_parameters$contribut = parameters.contributorAccountIds) !== null && _parameters$contribut !== void 0 && _parameters$contribut.length) {
|
|
164
|
+
params.append('contributors', parameters.contributorAccountIds.join(','));
|
|
168
165
|
}
|
|
169
|
-
if (
|
|
170
|
-
params.append('lastModified', lastModified
|
|
166
|
+
if (parameters !== null && parameters !== void 0 && parameters.lastModified) {
|
|
167
|
+
params.append('lastModified', parameters.lastModified);
|
|
171
168
|
}
|
|
172
|
-
if (
|
|
173
|
-
params.append('from',
|
|
169
|
+
if (parameters !== null && parameters !== void 0 && parameters.lastModifiedFrom) {
|
|
170
|
+
params.append('from', parameters.lastModifiedFrom);
|
|
174
171
|
}
|
|
175
|
-
if (
|
|
176
|
-
params.append('to',
|
|
172
|
+
if (parameters !== null && parameters !== void 0 && parameters.lastModifiedTo) {
|
|
173
|
+
params.append('to', parameters.lastModifiedTo);
|
|
177
174
|
}
|
|
178
175
|
return "".concat(selectedConfluenceSiteUrl, "/wiki/search?").concat(params.toString());
|
|
179
|
-
}, [
|
|
176
|
+
}, [parameters, selectedConfluenceSiteUrl]);
|
|
180
177
|
var analyticsPayload = useMemo(function () {
|
|
181
178
|
return {
|
|
182
179
|
extensionKey: extensionKey,
|
|
@@ -269,10 +266,12 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
269
266
|
return range.value;
|
|
270
267
|
});
|
|
271
268
|
if ((updatedDateRangeOption === null || updatedDateRangeOption === void 0 ? void 0 : updatedDateRangeOption.optionType) === 'dateRange') {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
269
|
+
setParametersWithOverrides(function (prev) {
|
|
270
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
271
|
+
lastModified: updatedDateRangeOption.value,
|
|
272
|
+
lastModifiedFrom: updatedDateRangeOption.from,
|
|
273
|
+
lastModifiedTo: updatedDateRangeOption.to
|
|
274
|
+
});
|
|
276
275
|
});
|
|
277
276
|
}
|
|
278
277
|
}
|
|
@@ -280,14 +279,22 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
280
279
|
var accountIds = editedOrCreatedBy.map(function (user) {
|
|
281
280
|
return user.value;
|
|
282
281
|
});
|
|
283
|
-
|
|
282
|
+
setParametersWithOverrides(function (prev) {
|
|
283
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
284
|
+
contributorAccountIds: accountIds
|
|
285
|
+
});
|
|
286
|
+
});
|
|
284
287
|
}
|
|
285
288
|
}
|
|
286
|
-
|
|
289
|
+
setParametersWithOverrides(function (prev) {
|
|
290
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
291
|
+
searchString: newSearchString
|
|
292
|
+
});
|
|
293
|
+
});
|
|
287
294
|
reset({
|
|
288
295
|
shouldForceRequest: true
|
|
289
296
|
});
|
|
290
|
-
}, [reset, userInteractions]);
|
|
297
|
+
}, [reset, userInteractions, setParametersWithOverrides]);
|
|
291
298
|
var getButtonAnalyticsPayload = useCallback(function () {
|
|
292
299
|
return {
|
|
293
300
|
extensionKey: extensionKey,
|
|
@@ -351,7 +358,14 @@ var ConnectedConfluenceSearchConfigModal = createDatasourceModal({
|
|
|
351
358
|
});
|
|
352
359
|
export var ConfluenceSearchConfigModal = function ConfluenceSearchConfigModal(props) {
|
|
353
360
|
if (fg('platform-datasources-use-refactored-config-modal')) {
|
|
354
|
-
return jsx(StoreContainer, null, jsx(ConnectedConfluenceSearchConfigModal, props
|
|
361
|
+
return jsx(StoreContainer, null, jsx(ConnectedConfluenceSearchConfigModal, _extends({}, props, {
|
|
362
|
+
/**
|
|
363
|
+
* If the intial parameters are not valid, we will not initialise the modal state
|
|
364
|
+
* with `overrideParameters`. This is to allow the modal to be opened without
|
|
365
|
+
* any initial parameters and require the user to perform a search.
|
|
366
|
+
*/
|
|
367
|
+
parameters: props.overrideParameters && isValidParameters(props.parameters) ? _objectSpread(_objectSpread({}, props.parameters), props.overrideParameters) : props.parameters
|
|
368
|
+
})));
|
|
355
369
|
}
|
|
356
370
|
return jsx(StoreContainer, null, jsx(AnalyticsContext, {
|
|
357
371
|
data: contextData
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/inline-edit": "^13.7.0",
|
|
55
55
|
"@atlaskit/intl-messages-provider": "^1.0.0",
|
|
56
56
|
"@atlaskit/jql-ast": "^3.3.0",
|
|
57
|
-
"@atlaskit/jql-editor": "^4.
|
|
57
|
+
"@atlaskit/jql-editor": "^4.8.0",
|
|
58
58
|
"@atlaskit/jql-editor-autocomplete-rest": "^2.1.0",
|
|
59
59
|
"@atlaskit/layering": "^0.4.0",
|
|
60
60
|
"@atlaskit/link-client-extension": "^2.4.0",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"@atlaskit/linking-types": "^9.0.0",
|
|
63
63
|
"@atlaskit/logo": "^14.2.0",
|
|
64
64
|
"@atlaskit/lozenge": "^11.10.0",
|
|
65
|
-
"@atlaskit/modal-dialog": "^12.
|
|
65
|
+
"@atlaskit/modal-dialog": "^12.16.0",
|
|
66
66
|
"@atlaskit/outbound-auth-flow-client": "^3.4.5",
|
|
67
67
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
68
|
-
"@atlaskit/popup": "^1.
|
|
68
|
+
"@atlaskit/popup": "^1.26.0",
|
|
69
69
|
"@atlaskit/pragmatic-drag-and-drop": "^1.3.0",
|
|
70
70
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
71
71
|
"@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^1.2.0",
|