@atlaskit/link-datasource 2.8.0 → 2.9.1
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 +17 -0
- package/dist/cjs/hooks/useDatasourceTableState.js +54 -39
- package/dist/cjs/state/index.js +68 -0
- package/dist/cjs/ui/assets-modal/modal/index.js +8 -5
- package/dist/cjs/ui/common/modal/datasource-modal/createDatasourceModal.js +55 -0
- package/dist/cjs/ui/common/modal/datasources-table-in-modal-preview/index.js +13 -2
- package/dist/cjs/ui/common/modal/insert-button/index.js +5 -4
- package/dist/cjs/ui/confluence-search-modal/modal/index.js +36 -39
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +3 -2
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +142 -211
- package/dist/es2019/hooks/useDatasourceTableState.js +15 -5
- package/dist/es2019/state/index.js +55 -0
- package/dist/es2019/ui/assets-modal/modal/index.js +9 -6
- package/dist/es2019/ui/common/modal/datasource-context/index.js +1 -1
- package/dist/es2019/ui/common/modal/datasource-modal/createDatasourceModal.js +51 -0
- package/dist/es2019/ui/common/modal/datasources-table-in-modal-preview/index.js +9 -2
- package/dist/es2019/ui/common/modal/insert-button/index.js +5 -4
- package/dist/es2019/ui/confluence-search-modal/modal/index.js +36 -39
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +4 -3
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +134 -202
- package/dist/esm/hooks/useDatasourceTableState.js +54 -39
- package/dist/esm/state/index.js +61 -0
- package/dist/esm/ui/assets-modal/modal/index.js +9 -6
- package/dist/esm/ui/common/modal/datasource-modal/createDatasourceModal.js +48 -0
- package/dist/esm/ui/common/modal/datasources-table-in-modal-preview/index.js +10 -2
- package/dist/esm/ui/common/modal/insert-button/index.js +5 -4
- package/dist/esm/ui/confluence-search-modal/modal/index.js +39 -42
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +4 -3
- package/dist/esm/ui/jira-issues-modal/modal/index.js +147 -216
- package/dist/types/common/types.d.ts +2 -1
- package/dist/types/state/index.d.ts +21 -0
- package/dist/types/ui/common/modal/datasource-context/index.d.ts +9 -12
- package/dist/types/ui/common/modal/datasource-modal/createDatasourceModal.d.ts +15 -0
- package/dist/types/ui/common/modal/insert-button/index.d.ts +4 -2
- package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.d.ts +1 -1
- package/dist/types/ui/confluence-search-modal/modal/index.d.ts +3 -4
- package/dist/types/ui/confluence-search-modal/types.d.ts +6 -1
- package/dist/types/ui/jira-issues-modal/modal/index.d.ts +3 -3
- package/dist/types/ui/jira-issues-modal/types.d.ts +3 -0
- package/dist/types-ts4.5/common/types.d.ts +2 -1
- package/dist/types-ts4.5/state/index.d.ts +21 -0
- package/dist/types-ts4.5/ui/common/modal/datasource-context/index.d.ts +9 -12
- package/dist/types-ts4.5/ui/common/modal/datasource-modal/createDatasourceModal.d.ts +15 -0
- package/dist/types-ts4.5/ui/common/modal/insert-button/index.d.ts +4 -2
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.d.ts +1 -1
- package/dist/types-ts4.5/ui/confluence-search-modal/modal/index.d.ts +3 -4
- package/dist/types-ts4.5/ui/confluence-search-modal/types.d.ts +6 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/modal/index.d.ts +3 -3
- package/dist/types-ts4.5/ui/jira-issues-modal/types.d.ts +3 -0
- package/package.json +5 -1
|
@@ -14,25 +14,23 @@ import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'rea
|
|
|
14
14
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
15
|
import { jsx } from '@emotion/react';
|
|
16
16
|
import { FormattedMessage } from 'react-intl-next';
|
|
17
|
-
import {
|
|
18
|
-
import Button from '@atlaskit/button/standard-button';
|
|
17
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
19
18
|
import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
|
|
20
19
|
import { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
21
20
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
|
-
import {
|
|
23
|
-
import { componentMetadata } from '../../../analytics/constants';
|
|
21
|
+
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
22
|
+
import { componentMetadata, EVENT_CHANNEL } from '../../../analytics/constants';
|
|
24
23
|
import { DatasourceAction, DatasourceDisplay } from '../../../analytics/types';
|
|
25
24
|
import { startUfoExperience } from '../../../analytics/ufoExperiences';
|
|
26
25
|
import { useColumnPickerRenderedFailedUfoExperience } from '../../../analytics/ufoExperiences/hooks/useColumnPickerRenderedFailedUfoExperience';
|
|
27
26
|
import { useDataRenderedUfoExperience } from '../../../analytics/ufoExperiences/hooks/useDataRenderedUfoExperience';
|
|
28
27
|
import { mapSearchMethod } from '../../../analytics/utils';
|
|
29
|
-
import { buildDatasourceAdf } from '../../../common/utils/adf';
|
|
30
28
|
import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
|
|
31
29
|
import { DatasourceExperienceIdProvider, useDatasourceExperienceId } from '../../../contexts/datasource-experience-id';
|
|
32
30
|
import { UserInteractionsProvider, useUserInteractions } from '../../../contexts/user-interactions';
|
|
33
|
-
import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
|
|
34
31
|
import i18nEN from '../../../i18n/en';
|
|
35
32
|
import { useAvailableSites } from '../../../services/useAvailableSites';
|
|
33
|
+
import { StoreContainer } from '../../../state';
|
|
36
34
|
import { AccessRequired } from '../../common/error-state/access-required';
|
|
37
35
|
import { loadingErrorMessages } from '../../common/error-state/messages';
|
|
38
36
|
import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
|
|
@@ -43,22 +41,22 @@ import { initialStateViewMessages } from '../../common/initial-state-view/messag
|
|
|
43
41
|
import { CancelButton } from '../../common/modal/cancel-button';
|
|
44
42
|
import { ContentContainer } from '../../common/modal/content-container';
|
|
45
43
|
import { SmartCardPlaceholder, SmartLink } from '../../common/modal/count-view-smart-link';
|
|
44
|
+
import { useDatasourceContext } from '../../common/modal/datasource-context';
|
|
46
45
|
import { DatasourceModal } from '../../common/modal/datasource-modal';
|
|
47
|
-
import {
|
|
48
|
-
import
|
|
46
|
+
import { createDatasourceModal } from '../../common/modal/datasource-modal/createDatasourceModal';
|
|
47
|
+
import DatasourcesTableInModalPreview from '../../common/modal/datasources-table-in-modal-preview';
|
|
48
|
+
import { InsertButton } from '../../common/modal/insert-button';
|
|
49
49
|
import { DatasourceViewModeDropDown } from '../../common/modal/mode-switcher';
|
|
50
|
-
import {
|
|
50
|
+
import { useViewModeContext } from '../../common/modal/mode-switcher/useViewModeContext';
|
|
51
51
|
import TableSearchCount from '../../common/modal/search-count';
|
|
52
52
|
import { SiteSelector } from '../../common/modal/site-selector';
|
|
53
|
-
import { EmptyState
|
|
54
|
-
import { getColumnAction } from '../../issue-like-table/utils';
|
|
53
|
+
import { EmptyState } from '../../issue-like-table';
|
|
55
54
|
import { availableBasicFilterTypes } from '../basic-filters/ui';
|
|
56
55
|
import { isQueryTooComplex } from '../basic-filters/utils/isQueryTooComplex';
|
|
57
56
|
import { JiraSearchContainer } from '../jira-search-container';
|
|
58
57
|
import { JiraInitialStateSVG } from './jira-issues-initial-state-svg';
|
|
59
58
|
import { modalMessages } from './messages';
|
|
60
59
|
import { PlainJiraIssuesConfigModalOld } from './ModalOld';
|
|
61
|
-
var DEFAULT_VIEW_MODE = 'table';
|
|
62
60
|
var getDisplayValue = function getDisplayValue(currentViewMode, itemCount) {
|
|
63
61
|
if (currentViewMode === 'table') {
|
|
64
62
|
return DatasourceDisplay.DATASOURCE_TABLE;
|
|
@@ -66,81 +64,55 @@ var getDisplayValue = function getDisplayValue(currentViewMode, itemCount) {
|
|
|
66
64
|
return itemCount === 1 ? DatasourceDisplay.INLINE : DatasourceDisplay.DATASOURCE_INLINE;
|
|
67
65
|
};
|
|
68
66
|
var jqlSupportDocumentLink = 'https://support.atlassian.com/jira-service-management-cloud/docs/use-advanced-search-with-jira-query-language-jql/';
|
|
67
|
+
var isValidParameters = function isValidParameters(parameters) {
|
|
68
|
+
return typeof (parameters === null || parameters === void 0 ? void 0 : parameters.jql) === 'string' && parameters.jql.length > 0 && typeof (parameters === null || parameters === void 0 ? void 0 : parameters.cloudId) === 'string' && parameters.cloudId.length > 0;
|
|
69
|
+
};
|
|
69
70
|
var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
var onCancel = props.onCancel,
|
|
72
|
+
urlBeingEdited = props.url;
|
|
73
|
+
var _useDatasourceContext = useDatasourceContext(),
|
|
74
|
+
visibleColumnCount = _useDatasourceContext.visibleColumnCount,
|
|
75
|
+
visibleColumnKeys = _useDatasourceContext.visibleColumnKeys,
|
|
76
|
+
parameters = _useDatasourceContext.parameters,
|
|
77
|
+
setParameters = _useDatasourceContext.setParameters,
|
|
78
|
+
tableState = _useDatasourceContext.tableState;
|
|
79
|
+
var reset = tableState.reset,
|
|
80
|
+
status = tableState.status,
|
|
81
|
+
responseItems = tableState.responseItems,
|
|
82
|
+
columns = tableState.columns,
|
|
83
|
+
totalCount = tableState.totalCount,
|
|
84
|
+
_tableState$extension = tableState.extensionKey,
|
|
85
|
+
extensionKey = _tableState$extension === void 0 ? null : _tableState$extension,
|
|
86
|
+
destinationObjectTypes = tableState.destinationObjectTypes;
|
|
87
|
+
var _ref = parameters !== null && parameters !== void 0 ? parameters : {},
|
|
88
|
+
cloudId = _ref.cloudId,
|
|
89
|
+
jql = _ref.jql;
|
|
90
|
+
var _useState = useState(jql),
|
|
91
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
92
|
+
initialJql = _useState2[0];
|
|
78
93
|
var _useViewModeContext = useViewModeContext(),
|
|
79
94
|
currentViewMode = _useViewModeContext.currentViewMode;
|
|
80
|
-
var _useState = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId),
|
|
81
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
82
|
-
cloudId = _useState2[0],
|
|
83
|
-
setCloudId = _useState2[1];
|
|
84
95
|
var _useAvailableSites = useAvailableSites('jira', cloudId),
|
|
85
96
|
availableSites = _useAvailableSites.availableSites,
|
|
86
97
|
selectedJiraSite = _useAvailableSites.selectedSite;
|
|
87
|
-
var _useState3 = useState(
|
|
98
|
+
var _useState3 = useState(jql),
|
|
88
99
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
var _useState5 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql),
|
|
92
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
93
|
-
searchBarJql = _useState6[0],
|
|
94
|
-
setSearchBarJql = _useState6[1];
|
|
95
|
-
var _useState7 = useState(initialVisibleColumnKeys),
|
|
96
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
97
|
-
visibleColumnKeys = _useState8[0],
|
|
98
|
-
setVisibleColumnKeys = _useState8[1];
|
|
100
|
+
searchBarJql = _useState4[0],
|
|
101
|
+
setSearchBarJql = _useState4[1];
|
|
99
102
|
|
|
100
103
|
// analytics related parameters
|
|
101
104
|
var searchCount = useRef(0);
|
|
102
105
|
var userInteractions = useUserInteractions();
|
|
103
106
|
var initialSearchMethod =
|
|
104
107
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
105
|
-
fg('platform.linking-platform.datasource.show-jlol-basic-filters') && !isQueryTooComplex(
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
currentSearchMethod =
|
|
109
|
-
setCurrentSearchMethod =
|
|
108
|
+
fg('platform.linking-platform.datasource.show-jlol-basic-filters') && !isQueryTooComplex(initialJql || '') ? 'basic' : 'jql';
|
|
109
|
+
var _useState5 = useState(initialSearchMethod),
|
|
110
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
111
|
+
currentSearchMethod = _useState6[0],
|
|
112
|
+
setCurrentSearchMethod = _useState6[1];
|
|
110
113
|
var searchMethodSearchedWith = useRef(null);
|
|
111
|
-
var visibleColumnCount = useRef((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
|
|
112
114
|
var basicFilterSelectionsSearchedWith = useRef({});
|
|
113
115
|
var isSearchedWithComplexQuery = useRef(false);
|
|
114
|
-
var parameters = useMemo(function () {
|
|
115
|
-
return !!cloudId ? {
|
|
116
|
-
cloudId: cloudId,
|
|
117
|
-
jql: jql || ''
|
|
118
|
-
} : undefined;
|
|
119
|
-
}, [cloudId, jql]);
|
|
120
|
-
var isParametersSet = !!(jql && cloudId);
|
|
121
|
-
var _useColumnResize = useColumnResize(initialColumnCustomSizes),
|
|
122
|
-
columnCustomSizes = _useColumnResize.columnCustomSizes,
|
|
123
|
-
onColumnResize = _useColumnResize.onColumnResize;
|
|
124
|
-
var _useColumnWrapping = useColumnWrapping(initialWrappedColumnKeys),
|
|
125
|
-
wrappedColumnKeys = _useColumnWrapping.wrappedColumnKeys,
|
|
126
|
-
onWrappedColumnChange = _useColumnWrapping.onWrappedColumnChange;
|
|
127
|
-
var _useDatasourceTableSt = useDatasourceTableState({
|
|
128
|
-
datasourceId: datasourceId,
|
|
129
|
-
parameters: isParametersSet ? parameters : undefined,
|
|
130
|
-
fieldKeys: visibleColumnKeys
|
|
131
|
-
}),
|
|
132
|
-
reset = _useDatasourceTableSt.reset,
|
|
133
|
-
status = _useDatasourceTableSt.status,
|
|
134
|
-
onNextPage = _useDatasourceTableSt.onNextPage,
|
|
135
|
-
responseItems = _useDatasourceTableSt.responseItems,
|
|
136
|
-
hasNextPage = _useDatasourceTableSt.hasNextPage,
|
|
137
|
-
columns = _useDatasourceTableSt.columns,
|
|
138
|
-
defaultVisibleColumnKeys = _useDatasourceTableSt.defaultVisibleColumnKeys,
|
|
139
|
-
loadDatasourceDetails = _useDatasourceTableSt.loadDatasourceDetails,
|
|
140
|
-
totalCount = _useDatasourceTableSt.totalCount,
|
|
141
|
-
_useDatasourceTableSt2 = _useDatasourceTableSt.extensionKey,
|
|
142
|
-
extensionKey = _useDatasourceTableSt2 === void 0 ? null : _useDatasourceTableSt2,
|
|
143
|
-
destinationObjectTypes = _useDatasourceTableSt.destinationObjectTypes;
|
|
144
116
|
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
145
117
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
146
118
|
var experienceId = useDatasourceExperienceId();
|
|
@@ -152,7 +124,6 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
|
152
124
|
}, [destinationObjectTypes, extensionKey]);
|
|
153
125
|
var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
154
126
|
var jqlUrl = selectedJiraSite && jql && "".concat(selectedJiraSite.url, "/issues/?jql=").concat(encodeURI(jql));
|
|
155
|
-
var isInsertDisabled = !isParametersSet || status === 'rejected' || status === 'unauthorized' || status === 'loading';
|
|
156
127
|
var shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'table';
|
|
157
128
|
var isDataReady = (visibleColumnKeys || []).length > 0;
|
|
158
129
|
var hasNoJiraSites = availableSites && availableSites.length === 0;
|
|
@@ -179,16 +150,21 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
|
179
150
|
canBeLink: currentViewMode === 'inline',
|
|
180
151
|
extensionKey: extensionKey
|
|
181
152
|
});
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* If the selected Jira site changes, update the cloudId in the parameters
|
|
156
|
+
* This is mainly useful for setting the initial cloudId after the site selection loads
|
|
157
|
+
*/
|
|
187
158
|
useEffect(function () {
|
|
188
159
|
if (selectedJiraSite && (!cloudId || cloudId !== selectedJiraSite.cloudId)) {
|
|
189
|
-
|
|
160
|
+
setParameters(function () {
|
|
161
|
+
return {
|
|
162
|
+
jql: '',
|
|
163
|
+
cloudId: selectedJiraSite.cloudId
|
|
164
|
+
};
|
|
165
|
+
});
|
|
190
166
|
}
|
|
191
|
-
}, [cloudId, selectedJiraSite]);
|
|
167
|
+
}, [cloudId, selectedJiraSite, setParameters]);
|
|
192
168
|
var fireSingleItemViewedEvent = useCallback(function () {
|
|
193
169
|
fireEvent('ui.link.viewed.singleItem', _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
194
170
|
searchMethod: mapSearchMethod(searchMethodSearchedWith.current)
|
|
@@ -208,7 +184,7 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
|
208
184
|
displayedColumnCount: visibleColumnCount.current
|
|
209
185
|
}));
|
|
210
186
|
}
|
|
211
|
-
}, [
|
|
187
|
+
}, [isDataReady, fireEvent, analyticsPayload, totalCount, visibleColumnCount]);
|
|
212
188
|
var fireIssueViewAnalytics = useCallback(function () {
|
|
213
189
|
if (!totalCount) {
|
|
214
190
|
return;
|
|
@@ -233,10 +209,10 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
|
233
209
|
}
|
|
234
210
|
}, [currentViewMode, status, fireIssueViewAnalytics, fireCountViewedEvent]);
|
|
235
211
|
useColumnPickerRenderedFailedUfoExperience(status, experienceId);
|
|
236
|
-
var onSearch = useCallback(function (newParameters,
|
|
237
|
-
var searchMethod =
|
|
238
|
-
basicFilterSelections =
|
|
239
|
-
isQueryComplex =
|
|
212
|
+
var onSearch = useCallback(function (newParameters, _ref2) {
|
|
213
|
+
var searchMethod = _ref2.searchMethod,
|
|
214
|
+
basicFilterSelections = _ref2.basicFilterSelections,
|
|
215
|
+
isQueryComplex = _ref2.isQueryComplex;
|
|
240
216
|
searchCount.current++;
|
|
241
217
|
searchMethodSearchedWith.current = searchMethod;
|
|
242
218
|
basicFilterSelectionsSearchedWith.current = basicFilterSelections;
|
|
@@ -244,19 +220,26 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
|
244
220
|
if (jql !== newParameters.jql) {
|
|
245
221
|
userInteractions.add(DatasourceAction.QUERY_UPDATED);
|
|
246
222
|
}
|
|
247
|
-
|
|
223
|
+
setParameters(function (state) {
|
|
224
|
+
return state && newParameters.jql ? {
|
|
225
|
+
cloudId: state.cloudId,
|
|
226
|
+
jql: newParameters.jql
|
|
227
|
+
} : undefined;
|
|
228
|
+
});
|
|
248
229
|
reset({
|
|
249
230
|
shouldForceRequest: true
|
|
250
231
|
});
|
|
251
|
-
}, [jql, reset, userInteractions]);
|
|
232
|
+
}, [jql, reset, userInteractions, setParameters]);
|
|
252
233
|
var onSiteSelection = useCallback(function (site) {
|
|
253
234
|
userInteractions.add(DatasourceAction.INSTANCE_UPDATED);
|
|
254
|
-
|
|
255
|
-
|
|
235
|
+
setParameters({
|
|
236
|
+
jql: '',
|
|
237
|
+
cloudId: site.cloudId
|
|
238
|
+
});
|
|
256
239
|
reset({
|
|
257
240
|
shouldForceRequest: true
|
|
258
241
|
});
|
|
259
|
-
}, [reset, userInteractions]);
|
|
242
|
+
}, [reset, userInteractions, setParameters]);
|
|
260
243
|
var retrieveUrlForSmartCardRender = useCallback(function () {
|
|
261
244
|
var _data$key;
|
|
262
245
|
var _responseItems = _slicedToArray(responseItems, 1),
|
|
@@ -264,120 +247,6 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
|
264
247
|
// agreement with BE that we will use `key` for rendering smartlink
|
|
265
248
|
return data === null || data === void 0 || (_data$key = data.key) === null || _data$key === void 0 || (_data$key = _data$key.data) === null || _data$key === void 0 ? void 0 : _data$key.url;
|
|
266
249
|
}, [responseItems]);
|
|
267
|
-
var onInsertPressed = useCallback(function (e, analyticsEvent) {
|
|
268
|
-
var _insertButtonClickedE;
|
|
269
|
-
if (!isParametersSet || !jql || !selectedJiraSite) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// During insertion, we want the JQL of the datasource to be whatever is in the search bar,
|
|
274
|
-
// even if the user didn't previously click search
|
|
275
|
-
var upToDateJql = searchBarJql !== null && searchBarJql !== void 0 ? searchBarJql : jql;
|
|
276
|
-
var upToDateJqlUrl = selectedJiraSite && jql && "".concat(selectedJiraSite.url, "/issues/?jql=").concat(encodeURIComponent(upToDateJql));
|
|
277
|
-
var filterSelectionCount = availableBasicFilterTypes.reduce(function (current, filter) {
|
|
278
|
-
var _basicFilterSelection;
|
|
279
|
-
return _objectSpread(_objectSpread({}, current), {}, _defineProperty({}, "".concat(filter, "BasicFilterSelectionCount"), ((_basicFilterSelection = basicFilterSelectionsSearchedWith.current[filter]) === null || _basicFilterSelection === void 0 ? void 0 : _basicFilterSelection.length) || 0));
|
|
280
|
-
}, {});
|
|
281
|
-
var insertButtonClickedEvent = analyticsEvent.update({
|
|
282
|
-
actionSubjectId: 'insert',
|
|
283
|
-
attributes: _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
284
|
-
totalItemCount: totalCount || 0,
|
|
285
|
-
displayedColumnCount: visibleColumnCount.current,
|
|
286
|
-
display: getDisplayValue(currentViewMode, totalCount || 0),
|
|
287
|
-
searchCount: searchCount.current,
|
|
288
|
-
searchMethod: mapSearchMethod(searchMethodSearchedWith.current),
|
|
289
|
-
actions: userInteractions.get(),
|
|
290
|
-
isQueryComplex: isSearchedWithComplexQuery.current
|
|
291
|
-
}, searchMethodSearchedWith.current === 'basic' ? _objectSpread({}, filterSelectionCount) : {}),
|
|
292
|
-
eventType: 'ui'
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
// additional event for tracking in confluence against JIM
|
|
296
|
-
var macroInsertedEvent = analyticsEvent.clone();
|
|
297
|
-
macroInsertedEvent === null || macroInsertedEvent === void 0 || macroInsertedEvent.update({
|
|
298
|
-
eventType: 'track',
|
|
299
|
-
action: 'inserted',
|
|
300
|
-
actionSubject: 'macro',
|
|
301
|
-
actionSubjectId: 'jlol',
|
|
302
|
-
attributes: _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
303
|
-
totalItemCount: totalCount || 0,
|
|
304
|
-
displayedColumnCount: visibleColumnCount.current,
|
|
305
|
-
display: getDisplayValue(currentViewMode, totalCount || 0),
|
|
306
|
-
searchCount: searchCount.current,
|
|
307
|
-
searchMethod: mapSearchMethod(searchMethodSearchedWith.current),
|
|
308
|
-
actions: userInteractions.get()
|
|
309
|
-
})
|
|
310
|
-
});
|
|
311
|
-
var consumerEvent = (_insertButtonClickedE = insertButtonClickedEvent.clone()) !== null && _insertButtonClickedE !== void 0 ? _insertButtonClickedE : undefined;
|
|
312
|
-
insertButtonClickedEvent.fire(EVENT_CHANNEL);
|
|
313
|
-
var firstIssueUrl = retrieveUrlForSmartCardRender();
|
|
314
|
-
if (currentViewMode === 'inline') {
|
|
315
|
-
macroInsertedEvent === null || macroInsertedEvent === void 0 || macroInsertedEvent.fire(EVENT_CHANNEL);
|
|
316
|
-
var url = responseItems.length === 1 ? firstIssueUrl : upToDateJqlUrl;
|
|
317
|
-
onInsert({
|
|
318
|
-
type: 'inlineCard',
|
|
319
|
-
attrs: {
|
|
320
|
-
url: url
|
|
321
|
-
}
|
|
322
|
-
}, consumerEvent);
|
|
323
|
-
} else {
|
|
324
|
-
onInsert(buildDatasourceAdf({
|
|
325
|
-
id: datasourceId,
|
|
326
|
-
parameters: {
|
|
327
|
-
cloudId: cloudId,
|
|
328
|
-
jql: upToDateJql // TODO support non JQL type
|
|
329
|
-
},
|
|
330
|
-
views: [{
|
|
331
|
-
type: 'table',
|
|
332
|
-
properties: {
|
|
333
|
-
columns: (visibleColumnKeys || []).map(function (key) {
|
|
334
|
-
var width = columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key];
|
|
335
|
-
var isWrapped = wrappedColumnKeys === null || wrappedColumnKeys === void 0 ? void 0 : wrappedColumnKeys.includes(key);
|
|
336
|
-
return _objectSpread(_objectSpread({
|
|
337
|
-
key: key
|
|
338
|
-
}, width ? {
|
|
339
|
-
width: width
|
|
340
|
-
} : {}), isWrapped ? {
|
|
341
|
-
isWrapped: isWrapped
|
|
342
|
-
} : {});
|
|
343
|
-
})
|
|
344
|
-
}
|
|
345
|
-
}]
|
|
346
|
-
}, upToDateJqlUrl), consumerEvent);
|
|
347
|
-
}
|
|
348
|
-
}, [isParametersSet, jql, selectedJiraSite, searchBarJql, analyticsPayload, totalCount, currentViewMode, retrieveUrlForSmartCardRender, responseItems.length, onInsert, datasourceId, cloudId, visibleColumnKeys, columnCustomSizes, wrappedColumnKeys, userInteractions]);
|
|
349
|
-
var handleOnNextPage = useCallback(function () {
|
|
350
|
-
var onNextPageProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
351
|
-
userInteractions.add(DatasourceAction.NEXT_PAGE_SCROLLED);
|
|
352
|
-
onNextPage(onNextPageProps);
|
|
353
|
-
}, [onNextPage, userInteractions]);
|
|
354
|
-
var handleVisibleColumnKeysChange = useCallback(function () {
|
|
355
|
-
var newVisibleColumnKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
356
|
-
var columnAction = getColumnAction(visibleColumnKeys || [], newVisibleColumnKeys);
|
|
357
|
-
userInteractions.add(columnAction);
|
|
358
|
-
visibleColumnCount.current = newVisibleColumnKeys.length;
|
|
359
|
-
setVisibleColumnKeys(newVisibleColumnKeys);
|
|
360
|
-
}, [visibleColumnKeys, userInteractions]);
|
|
361
|
-
var issueLikeDataTableView = useMemo(function () {
|
|
362
|
-
return jsx(ContentContainer, {
|
|
363
|
-
withTableBorder: true
|
|
364
|
-
}, jsx(IssueLikeDataTableView, {
|
|
365
|
-
testId: "jira-datasource-table",
|
|
366
|
-
status: status,
|
|
367
|
-
columns: columns,
|
|
368
|
-
items: responseItems,
|
|
369
|
-
hasNextPage: hasNextPage,
|
|
370
|
-
visibleColumnKeys: visibleColumnKeys || defaultVisibleColumnKeys,
|
|
371
|
-
onNextPage: handleOnNextPage,
|
|
372
|
-
onLoadDatasourceDetails: loadDatasourceDetails,
|
|
373
|
-
onVisibleColumnKeysChange: handleVisibleColumnKeysChange,
|
|
374
|
-
extensionKey: extensionKey,
|
|
375
|
-
columnCustomSizes: columnCustomSizes,
|
|
376
|
-
onColumnResize: onColumnResize,
|
|
377
|
-
wrappedColumnKeys: wrappedColumnKeys,
|
|
378
|
-
onWrappedColumnChange: fg('platform.linking-platform.datasource-word_wrap') ? onWrappedColumnChange : undefined
|
|
379
|
-
}));
|
|
380
|
-
}, [status, columns, responseItems, hasNextPage, visibleColumnKeys, defaultVisibleColumnKeys, handleOnNextPage, loadDatasourceDetails, handleVisibleColumnKeysChange, extensionKey, columnCustomSizes, onColumnResize, wrappedColumnKeys, onWrappedColumnChange]);
|
|
381
250
|
var renderCountModeContent = useCallback(function () {
|
|
382
251
|
var selectedJiraSiteUrl = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
|
|
383
252
|
if (status === 'unauthorized') {
|
|
@@ -437,8 +306,12 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
|
437
306
|
} : undefined
|
|
438
307
|
}));
|
|
439
308
|
}
|
|
440
|
-
return
|
|
441
|
-
|
|
309
|
+
return jsx(ContentContainer, {
|
|
310
|
+
withTableBorder: true
|
|
311
|
+
}, jsx(DatasourcesTableInModalPreview, {
|
|
312
|
+
testId: "jira-datasource-table"
|
|
313
|
+
}));
|
|
314
|
+
}, [columns.length, currentSearchMethod, jql, jqlUrl, resolvedWithNoResults, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited]);
|
|
442
315
|
var siteSelectorLabel = availableSites && availableSites.length > 1 ? modalMessages.insertIssuesTitleManySites : modalMessages.insertIssuesTitle;
|
|
443
316
|
var getCancelButtonAnalyticsPayload = useCallback(function () {
|
|
444
317
|
return _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
@@ -446,6 +319,38 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
|
446
319
|
actions: userInteractions.get()
|
|
447
320
|
});
|
|
448
321
|
}, [analyticsPayload, userInteractions]);
|
|
322
|
+
var filterSelectionCount = availableBasicFilterTypes.reduce(function (current, filter) {
|
|
323
|
+
var _basicFilterSelection;
|
|
324
|
+
return _objectSpread(_objectSpread({}, current), {}, _defineProperty({}, "".concat(filter, "BasicFilterSelectionCount"), ((_basicFilterSelection = basicFilterSelectionsSearchedWith.current[filter]) === null || _basicFilterSelection === void 0 ? void 0 : _basicFilterSelection.length) || 0));
|
|
325
|
+
}, {});
|
|
326
|
+
var getInsertButtonAnalyticsPayload = useCallback(function () {
|
|
327
|
+
return _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
328
|
+
display: getDisplayValue(currentViewMode, totalCount || 0),
|
|
329
|
+
isQueryComplex: isSearchedWithComplexQuery.current,
|
|
330
|
+
searchMethod: mapSearchMethod(searchMethodSearchedWith.current),
|
|
331
|
+
searchCount: searchCount.current,
|
|
332
|
+
actions: userInteractions.get()
|
|
333
|
+
}, searchMethodSearchedWith.current === 'basic' ? _objectSpread({}, filterSelectionCount) : {});
|
|
334
|
+
}, [analyticsPayload, currentViewMode, filterSelectionCount, totalCount, userInteractions]);
|
|
335
|
+
var urlToInsert = useMemo(function () {
|
|
336
|
+
var jql = parameters === null || parameters === void 0 ? void 0 : parameters.jql;
|
|
337
|
+
if (!jql || !(selectedJiraSite !== null && selectedJiraSite !== void 0 && selectedJiraSite.url)) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
// During insertion, we want the JQL of the datasource to be whatever is in the search bar,
|
|
341
|
+
// even if the user didn't previously click search
|
|
342
|
+
var upToDateJql = searchBarJql !== null && searchBarJql !== void 0 ? searchBarJql : jql;
|
|
343
|
+
var upToDateJqlUrl = "".concat(selectedJiraSite.url, "/issues/?jql=").concat(encodeURIComponent(upToDateJql));
|
|
344
|
+
return currentViewMode === 'inline' && responseItems.length === 1 ? retrieveUrlForSmartCardRender() : upToDateJqlUrl;
|
|
345
|
+
}, [currentViewMode, parameters === null || parameters === void 0 ? void 0 : parameters.jql, responseItems, retrieveUrlForSmartCardRender, searchBarJql, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url]);
|
|
346
|
+
var updateParametersBeforeInsert = function updateParametersBeforeInsert(parameters) {
|
|
347
|
+
return {
|
|
348
|
+
cloudId: parameters.cloudId,
|
|
349
|
+
// searchBarJql will not be null at this point, since this function is only called when user press insert button
|
|
350
|
+
//
|
|
351
|
+
jql: searchBarJql || ''
|
|
352
|
+
};
|
|
353
|
+
};
|
|
449
354
|
return jsx(IntlMessagesProvider, {
|
|
450
355
|
defaultMessages: i18nEN,
|
|
451
356
|
loaderFn: fetchMessagesForLocale
|
|
@@ -480,11 +385,11 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
|
480
385
|
onCancel: onCancel,
|
|
481
386
|
getAnalyticsPayload: getCancelButtonAnalyticsPayload,
|
|
482
387
|
testId: "jira-datasource-modal--cancel-button"
|
|
483
|
-
}), !hasNoJiraSites && jsx(
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
388
|
+
}), !hasNoJiraSites && jsx(InsertButton, {
|
|
389
|
+
testId: "jira-datasource-modal--insert-button",
|
|
390
|
+
url: urlToInsert,
|
|
391
|
+
overwriteParameters: updateParametersBeforeInsert,
|
|
392
|
+
getAnalyticsPayload: getInsertButtonAnalyticsPayload
|
|
488
393
|
}, jsx(FormattedMessage, modalMessages.insertIssuesButtonText))))));
|
|
489
394
|
};
|
|
490
395
|
var analyticsContextAttributes = {
|
|
@@ -496,9 +401,35 @@ var analyticsContextData = _objectSpread(_objectSpread({}, componentMetadata.con
|
|
|
496
401
|
var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
|
|
497
402
|
attributes: _objectSpread({}, analyticsContextAttributes)
|
|
498
403
|
});
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
404
|
+
var ConnectedJiraIssueConfigModal = createDatasourceModal({
|
|
405
|
+
isValidParameters: isValidParameters,
|
|
406
|
+
dataProvider: 'jira-issues',
|
|
407
|
+
component: PlainJiraIssuesConfigModal
|
|
408
|
+
});
|
|
409
|
+
var JiraIssuesConfigModalWithExtraAnalyticsOnInsert = function JiraIssuesConfigModalWithExtraAnalyticsOnInsert(props) {
|
|
410
|
+
var onInsert = props.onInsert;
|
|
411
|
+
var onInsertWithMacroAnalytics = useCallback(function (adf, analyticsEvent) {
|
|
412
|
+
if (analyticsEvent && adf.type === 'inlineCard') {
|
|
413
|
+
var macroInsertedEvent = analyticsEvent.clone();
|
|
414
|
+
macroInsertedEvent === null || macroInsertedEvent === void 0 || macroInsertedEvent.update({
|
|
415
|
+
eventType: 'track',
|
|
416
|
+
action: 'inserted',
|
|
417
|
+
actionSubject: 'macro',
|
|
418
|
+
actionSubjectId: 'jlol'
|
|
419
|
+
});
|
|
420
|
+
macroInsertedEvent === null || macroInsertedEvent === void 0 || macroInsertedEvent.fire(EVENT_CHANNEL);
|
|
421
|
+
}
|
|
422
|
+
onInsert(adf, analyticsEvent);
|
|
423
|
+
}, [onInsert]);
|
|
424
|
+
return jsx(StoreContainer, null, jsx(ConnectedJiraIssueConfigModal, _extends({}, props, {
|
|
425
|
+
onInsert: onInsertWithMacroAnalytics
|
|
426
|
+
})));
|
|
427
|
+
};
|
|
428
|
+
export var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
|
|
429
|
+
if (fg('platform-datasources-use-refactored-config-modal')) {
|
|
430
|
+
return jsx(JiraIssuesConfigModalWithExtraAnalyticsOnInsert, props);
|
|
431
|
+
}
|
|
432
|
+
return jsx(StoreContainer, null, jsx(AnalyticsContext, {
|
|
433
|
+
data: contextData
|
|
434
|
+
}, jsx(DatasourceExperienceIdProvider, null, jsx(UserInteractionsProvider, null, jsx(PlainJiraIssuesConfigModalOld, props)))));
|
|
435
|
+
};
|
|
@@ -7,6 +7,7 @@ export interface Site {
|
|
|
7
7
|
url: string;
|
|
8
8
|
}
|
|
9
9
|
export type DisplayViewModes = 'table' | 'inline';
|
|
10
|
+
export type OnInsertFunction<ADF> = (adf: ADF, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
10
11
|
export type ConfigModalProps<ADF, Parameters> = {
|
|
11
12
|
/** Unique identifier for which type of datasource is being rendered and for making its requests */
|
|
12
13
|
datasourceId: string;
|
|
@@ -17,7 +18,7 @@ export type ConfigModalProps<ADF, Parameters> = {
|
|
|
17
18
|
/** Callback function to be invoked when the modal is closed either via cancel button click, esc keydown, or modal blanket click */
|
|
18
19
|
onCancel: () => void;
|
|
19
20
|
/** Callback function to be invoked when the insert issues button is clicked */
|
|
20
|
-
onInsert:
|
|
21
|
+
onInsert: OnInsertFunction<ADF>;
|
|
21
22
|
/**
|
|
22
23
|
* The view mode that the modal will show on open:
|
|
23
24
|
* - Table = Displays a list of links in table format
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type Action } from 'react-sweet-state';
|
|
3
|
+
import { type DatasourceDataResponseItem } from '@atlaskit/linking-types';
|
|
4
|
+
export interface State {
|
|
5
|
+
items: Record<string, DatasourceDataResponseItem>;
|
|
6
|
+
}
|
|
7
|
+
export declare const actions: {
|
|
8
|
+
onAddItems: (items: DatasourceDataResponseItem[]) => Action<State, void, string[]>;
|
|
9
|
+
};
|
|
10
|
+
export declare const Store: import("react-sweet-state").Store<State, {
|
|
11
|
+
onAddItems: (items: DatasourceDataResponseItem[]) => Action<State, void, string[]>;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const useDatasourceItem: import("react-sweet-state").HookStateFunction<DatasourceDataResponseItem | undefined, {
|
|
14
|
+
id: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const useDatasourceActions: import("react-sweet-state").HookActionsFunction<import("react-sweet-state").BoundActions<State, {
|
|
17
|
+
onAddItems: (items: DatasourceDataResponseItem[]) => Action<State, void, string[]>;
|
|
18
|
+
}>>;
|
|
19
|
+
export declare const StoreContainer: ({ children }: {
|
|
20
|
+
children: JSX.Element;
|
|
21
|
+
}) => JSX.Element;
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import React, { type PropsWithChildren } from 'react';
|
|
2
|
-
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
2
|
import { type DatasourceAdf, type InlineCardAdf } from '@atlaskit/linking-common';
|
|
4
3
|
import type { DatasourceParameters } from '@atlaskit/linking-types';
|
|
4
|
+
import { type OnInsertFunction } from '../../../../common/types';
|
|
5
5
|
import { type DatasourceTableState } from '../../../../hooks/useDatasourceTableState';
|
|
6
6
|
import type { ColumnSizesMap } from '../../../issue-like-table/types';
|
|
7
7
|
import { type ColumnResizeProps } from '../datasources-table-in-modal-preview/use-column-resize';
|
|
8
8
|
import { type ColumnVisibilityProps } from '../datasources-table-in-modal-preview/use-column-visibility';
|
|
9
9
|
import { type ColumnWrappingProps } from '../datasources-table-in-modal-preview/use-column-wrapping';
|
|
10
|
-
type
|
|
11
|
-
datasourceId: string;
|
|
12
|
-
isValidParameters: (params: DatasourceParameters | undefined) => boolean;
|
|
10
|
+
type DatasourceContextValue<Parameters extends DatasourceParameters = DatasourceParameters> = ColumnVisibilityProps & ColumnWrappingProps & ColumnResizeProps & Pick<DatasourceContextProviderProps<Parameters>, 'datasourceId' | 'onInsert' | 'isValidParameters'> & {
|
|
13
11
|
tableState: DatasourceTableState;
|
|
14
12
|
visibleColumnKeys?: string[];
|
|
15
|
-
parameters:
|
|
16
|
-
setParameters: React.Dispatch<React.SetStateAction<
|
|
17
|
-
onInsert: (adf: InlineCardAdf | DatasourceAdf<any>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
13
|
+
parameters: Parameters | undefined;
|
|
14
|
+
setParameters: React.Dispatch<React.SetStateAction<Parameters | undefined>>;
|
|
18
15
|
};
|
|
19
|
-
|
|
16
|
+
type DatasourceContextProviderProps<Parameters extends DatasourceParameters> = PropsWithChildren<{
|
|
20
17
|
datasourceId: string;
|
|
21
18
|
isValidParameters: (params: DatasourceParameters | undefined) => boolean;
|
|
22
|
-
initialParameters:
|
|
19
|
+
initialParameters: Parameters | undefined;
|
|
23
20
|
initialVisibleColumnKeys?: string[] | undefined;
|
|
24
21
|
initialWrappedColumnKeys?: string[] | undefined;
|
|
25
22
|
initialColumnCustomSizes?: ColumnSizesMap | undefined;
|
|
26
|
-
onInsert:
|
|
23
|
+
onInsert: OnInsertFunction<InlineCardAdf | DatasourceAdf<Parameters>>;
|
|
27
24
|
}>;
|
|
28
|
-
export declare const DatasourceContextProvider: ({ children, datasourceId, isValidParameters, initialParameters, initialVisibleColumnKeys, initialColumnCustomSizes, initialWrappedColumnKeys, onInsert, }:
|
|
29
|
-
export declare const useDatasourceContext: () =>
|
|
25
|
+
export declare const DatasourceContextProvider: <Parameters extends DatasourceParameters>({ children, datasourceId, isValidParameters, initialParameters, initialVisibleColumnKeys, initialColumnCustomSizes, initialWrappedColumnKeys, onInsert, }: DatasourceContextProviderProps<Parameters>) => JSX.Element;
|
|
26
|
+
export declare const useDatasourceContext: <Parameters extends DatasourceParameters>() => DatasourceContextValue<Parameters>;
|
|
30
27
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
import { type DatasourceAdf, type InlineCardAdf } from '@atlaskit/linking-common';
|
|
8
|
+
import { type DatasourceParameters } from '@atlaskit/linking-types';
|
|
9
|
+
import { type ConfigModalProps } from '../../../../common/types';
|
|
10
|
+
export type ConnectedConfigModalProps<Parameters extends DatasourceParameters> = Omit<ConfigModalProps<DatasourceAdf<Parameters> | InlineCardAdf, Parameters>, 'onInsert' | 'parameters'>;
|
|
11
|
+
export declare const createDatasourceModal: <Parameters extends DatasourceParameters>({ isValidParameters, dataProvider, component: ModalContent, }: {
|
|
12
|
+
isValidParameters: (params: DatasourceParameters | undefined) => boolean;
|
|
13
|
+
dataProvider: string;
|
|
14
|
+
component: React.ComponentType<ConnectedConfigModalProps<Parameters>>;
|
|
15
|
+
}) => (props: ConfigModalProps<DatasourceAdf<Parameters> | InlineCardAdf, DatasourceParameters | Parameters>) => jsx.JSX.Element;
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { type PropsWithChildren } from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
|
-
|
|
7
|
+
import { type DatasourceParameters } from '@atlaskit/linking-types';
|
|
8
|
+
export type InsertButtonProps<Parameters extends DatasourceParameters> = PropsWithChildren<{
|
|
8
9
|
testId: string;
|
|
9
10
|
url: string | undefined;
|
|
10
11
|
getAnalyticsPayload: () => Record<string, any>;
|
|
12
|
+
overwriteParameters?: (parameters: Parameters) => Parameters;
|
|
11
13
|
}>;
|
|
12
|
-
export declare const InsertButton: ({ testId, url, getAnalyticsPayload, children }: InsertButtonProps) => jsx.JSX.Element;
|
|
14
|
+
export declare const InsertButton: <Parameters extends DatasourceParameters>({ testId, url, getAnalyticsPayload, overwriteParameters, children, }: InsertButtonProps<Parameters>) => jsx.JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { PopupComponentProps } from '@atlaskit/popup';
|
|
3
|
-
export declare const PopupComponent: React.ForwardRefExoticComponent<Pick<PopupComponentProps, "
|
|
3
|
+
export declare const PopupComponent: React.ForwardRefExoticComponent<Pick<PopupComponentProps, "id" | "children" | "style" | "data-testid" | "tabIndex" | "role" | "shouldFitContainer" | "shouldRenderToParent" | "data-placement"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { jsx } from '@emotion/react';
|
|
3
|
-
import { type ConfluenceSearchConfigModalProps } from '../types';
|
|
4
|
-
export declare const PlainConfluenceSearchConfigModal: (props:
|
|
5
|
-
export declare const ConfluenceSearchConfigModal:
|
|
2
|
+
import { type ConfluenceSearchConfigModalProps, type ConnectedConfluenceSearchConfigModalProps } from '../types';
|
|
3
|
+
export declare const PlainConfluenceSearchConfigModal: (props: ConnectedConfluenceSearchConfigModalProps) => jsx.JSX.Element;
|
|
4
|
+
export declare const ConfluenceSearchConfigModal: (props: ConfluenceSearchConfigModalProps) => jsx.JSX.Element;
|