@atlaskit/link-datasource 1.26.3 → 1.27.0
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 +10 -0
- package/dist/cjs/ui/common/modal/count-view-smart-link/index.js +40 -0
- package/dist/cjs/ui/{jira-issues-modal/modal/jira-display-view-dropdown/jira-display-view-drop-down.js → common/modal/display-view-dropdown/display-view-drop-down.js} +29 -13
- package/dist/cjs/ui/common/modal/display-view-dropdown/messages.js +58 -0
- package/dist/cjs/ui/confluence-search-modal/modal/index.js +114 -45
- package/dist/cjs/ui/confluence-search-modal/modal/messages.js +5 -0
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +8 -23
- package/dist/cjs/ui/jira-issues-modal/modal/messages.js +0 -20
- package/dist/es2019/ui/common/modal/count-view-smart-link/index.js +30 -0
- package/dist/es2019/ui/common/modal/display-view-dropdown/display-view-drop-down.js +71 -0
- package/dist/es2019/ui/common/modal/display-view-dropdown/messages.js +52 -0
- package/dist/es2019/ui/confluence-search-modal/modal/index.js +98 -31
- package/dist/es2019/ui/confluence-search-modal/modal/messages.js +5 -0
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +9 -24
- package/dist/es2019/ui/jira-issues-modal/modal/messages.js +0 -20
- package/dist/esm/ui/common/modal/count-view-smart-link/index.js +32 -0
- package/dist/esm/ui/common/modal/display-view-dropdown/display-view-drop-down.js +73 -0
- package/dist/esm/ui/common/modal/display-view-dropdown/messages.js +52 -0
- package/dist/esm/ui/confluence-search-modal/modal/index.js +114 -45
- package/dist/esm/ui/confluence-search-modal/modal/messages.js +5 -0
- package/dist/esm/ui/jira-issues-modal/modal/index.js +9 -24
- package/dist/esm/ui/jira-issues-modal/modal/messages.js +0 -20
- package/dist/types/common/types.d.ts +5 -5
- package/dist/types/ui/common/modal/count-view-smart-link/index.d.ts +9 -0
- package/dist/types/ui/common/modal/display-view-dropdown/display-view-drop-down.d.ts +8 -0
- package/dist/types/ui/common/modal/display-view-dropdown/messages.d.ts +42 -0
- package/dist/types/ui/confluence-search-modal/modal/messages.d.ts +5 -0
- package/dist/types/ui/confluence-search-modal/types.d.ts +2 -2
- package/dist/types/ui/jira-issues-modal/modal/messages.d.ts +0 -20
- package/dist/types-ts4.5/common/types.d.ts +5 -5
- package/dist/types-ts4.5/ui/common/modal/count-view-smart-link/index.d.ts +9 -0
- package/dist/types-ts4.5/ui/common/modal/display-view-dropdown/display-view-drop-down.d.ts +8 -0
- package/dist/types-ts4.5/ui/common/modal/display-view-dropdown/messages.d.ts +42 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/modal/messages.d.ts +5 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/types.d.ts +2 -2
- package/dist/types-ts4.5/ui/jira-issues-modal/modal/messages.d.ts +0 -20
- package/examples-helpers/mockSmartLinkData.ts +49 -0
- package/examples-helpers/smartLinkCustomClient.ts +8 -3
- package/package.json +1 -1
- package/dist/es2019/ui/jira-issues-modal/modal/jira-display-view-dropdown/jira-display-view-drop-down.js +0 -55
- package/dist/esm/ui/jira-issues-modal/modal/jira-display-view-dropdown/jira-display-view-drop-down.js +0 -57
- package/dist/types/ui/jira-issues-modal/modal/jira-display-view-dropdown/jira-display-view-drop-down.d.ts +0 -8
- package/dist/types-ts4.5/ui/jira-issues-modal/modal/jira-display-view-dropdown/jira-display-view-drop-down.d.ts +0 -8
|
@@ -34,6 +34,8 @@ import { NoResults } from '../../common/error-state/no-results';
|
|
|
34
34
|
import { InitialStateView } from '../../common/initial-state-view';
|
|
35
35
|
import { CancelButton } from '../../common/modal/cancel-button';
|
|
36
36
|
import { ContentContainer } from '../../common/modal/content-container';
|
|
37
|
+
import { SmartCardPlaceholder, SmartLink } from '../../common/modal/count-view-smart-link';
|
|
38
|
+
import { DisplayViewDropDown } from '../../common/modal/display-view-dropdown/display-view-drop-down';
|
|
37
39
|
import { SiteSelector } from '../../common/modal/site-selector';
|
|
38
40
|
import { EmptyState, IssueLikeDataTableView } from '../../issue-like-table';
|
|
39
41
|
import ConfluenceSearchContainer from '../confluence-search-container';
|
|
@@ -69,6 +71,8 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
69
71
|
initialWrappedColumnKeys = props.wrappedColumnKeys,
|
|
70
72
|
onCancel = props.onCancel,
|
|
71
73
|
onInsert = props.onInsert,
|
|
74
|
+
_props$viewMode = props.viewMode,
|
|
75
|
+
viewMode = _props$viewMode === void 0 ? 'table' : _props$viewMode,
|
|
72
76
|
initialParameters = props.parameters,
|
|
73
77
|
urlBeingEdited = props.url,
|
|
74
78
|
initialVisibleColumnKeys = props.visibleColumnKeys;
|
|
@@ -76,18 +80,22 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
76
80
|
_useState2 = _slicedToArray(_useState, 2),
|
|
77
81
|
availableSites = _useState2[0],
|
|
78
82
|
setAvailableSites = _useState2[1];
|
|
79
|
-
var _useState3 = useState(
|
|
83
|
+
var _useState3 = useState(viewMode),
|
|
80
84
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
var _useState5 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.
|
|
85
|
+
currentViewMode = _useState4[0],
|
|
86
|
+
setCurrentViewMode = _useState4[1];
|
|
87
|
+
var _useState5 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId),
|
|
84
88
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
var _useState7 = useState(
|
|
89
|
+
cloudId = _useState6[0],
|
|
90
|
+
setCloudId = _useState6[1];
|
|
91
|
+
var _useState7 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.searchString),
|
|
88
92
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
searchString = _useState8[0],
|
|
94
|
+
setSearchString = _useState8[1];
|
|
95
|
+
var _useState9 = useState(initialVisibleColumnKeys),
|
|
96
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
97
|
+
visibleColumnKeys = _useState10[0],
|
|
98
|
+
setVisibleColumnKeys = _useState10[1];
|
|
91
99
|
|
|
92
100
|
// analytics related parameters
|
|
93
101
|
var searchCount = useRef(0);
|
|
@@ -157,6 +165,7 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
157
165
|
// TODO: further refactoring in EDM-9573
|
|
158
166
|
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6829171
|
|
159
167
|
var onSiteSelection = useCallback(function (site) {
|
|
168
|
+
userInteractionActions.current.add(DatasourceAction.INSTANCE_UPDATED);
|
|
160
169
|
setSearchString(undefined);
|
|
161
170
|
setCloudId(site.cloudId);
|
|
162
171
|
reset({
|
|
@@ -200,17 +209,17 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
200
209
|
setVisibleColumnKeys(newVisibleColumnKeys);
|
|
201
210
|
}, [initialVisibleColumnKeys, defaultVisibleColumnKeys]);
|
|
202
211
|
var siteSelectorLabel = availableSites && availableSites.length > 1 ? confluenceSearchModalMessages.insertIssuesTitleManySites : confluenceSearchModalMessages.insertIssuesTitle;
|
|
203
|
-
var
|
|
204
|
-
|
|
205
|
-
columnCustomSizes =
|
|
206
|
-
setColumnCustomSizes =
|
|
212
|
+
var _useState11 = useState(initialColumnCustomSizes),
|
|
213
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
214
|
+
columnCustomSizes = _useState12[0],
|
|
215
|
+
setColumnCustomSizes = _useState12[1];
|
|
207
216
|
var onColumnResize = useCallback(function (key, width) {
|
|
208
217
|
setColumnCustomSizes(_objectSpread(_objectSpread({}, columnCustomSizes), {}, _defineProperty({}, key, width)));
|
|
209
218
|
}, [columnCustomSizes]);
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
wrappedColumnKeys =
|
|
213
|
-
setWrappedColumnKeys =
|
|
219
|
+
var _useState13 = useState(initialWrappedColumnKeys),
|
|
220
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
221
|
+
wrappedColumnKeys = _useState14[0],
|
|
222
|
+
setWrappedColumnKeys = _useState14[1];
|
|
214
223
|
var onWrappedColumnChange = useCallback(function (key, isWrapped) {
|
|
215
224
|
var set = new Set(wrappedColumnKeys);
|
|
216
225
|
if (isWrapped) {
|
|
@@ -256,7 +265,7 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
256
265
|
var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
257
266
|
var hasConfluenceSearchParams = selectedConfluenceSite && searchString;
|
|
258
267
|
var selectedConfluenceSiteUrl = selectedConfluenceSite === null || selectedConfluenceSite === void 0 ? void 0 : selectedConfluenceSite.url;
|
|
259
|
-
var confluenceSearchUrl = selectedConfluenceSiteUrl && searchString !== undefined && "".concat(selectedConfluenceSiteUrl, "/wiki/search
|
|
268
|
+
var confluenceSearchUrl = selectedConfluenceSiteUrl && searchString !== undefined && "".concat(selectedConfluenceSiteUrl, "/wiki/search?text=").concat(encodeURI(searchString));
|
|
260
269
|
var analyticsPayload = useMemo(function () {
|
|
261
270
|
return {
|
|
262
271
|
extensionKey: extensionKey,
|
|
@@ -265,7 +274,36 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
265
274
|
actions: Array.from(userInteractionActions.current)
|
|
266
275
|
};
|
|
267
276
|
}, [destinationObjectTypes, extensionKey]);
|
|
268
|
-
var
|
|
277
|
+
var isDataReady = (visibleColumnKeys || []).length > 0;
|
|
278
|
+
var fireInlineViewedEvent = useCallback(function () {
|
|
279
|
+
fireEvent('ui.link.viewed.count', _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
280
|
+
searchMethod: DatasourceSearchMethod.DATASOURCE_SEARCH_QUERY,
|
|
281
|
+
totalItemCount: totalCount || 0
|
|
282
|
+
}));
|
|
283
|
+
}, [analyticsPayload, fireEvent, totalCount]);
|
|
284
|
+
var fireTableViewedEvent = useCallback(function () {
|
|
285
|
+
if (isDataReady) {
|
|
286
|
+
fireEvent('ui.table.viewed.datasourceConfigModal', _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
287
|
+
totalItemCount: totalCount || 0,
|
|
288
|
+
searchMethod: DatasourceSearchMethod.DATASOURCE_SEARCH_QUERY,
|
|
289
|
+
displayedColumnCount: visibleColumnCount.current
|
|
290
|
+
}));
|
|
291
|
+
}
|
|
292
|
+
}, [analyticsPayload, fireEvent, totalCount, isDataReady]);
|
|
293
|
+
useEffect(function () {
|
|
294
|
+
var isResolved = status === 'resolved';
|
|
295
|
+
var isTableViewMode = currentViewMode === 'issue' || currentViewMode === 'table';
|
|
296
|
+
var isInlineViewMode = currentViewMode === 'count' || currentViewMode === 'inline';
|
|
297
|
+
if (!isResolved) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (isTableViewMode) {
|
|
301
|
+
fireTableViewedEvent();
|
|
302
|
+
} else if (isInlineViewMode) {
|
|
303
|
+
fireInlineViewedEvent();
|
|
304
|
+
}
|
|
305
|
+
}, [currentViewMode, fireInlineViewedEvent, fireTableViewedEvent, status]);
|
|
306
|
+
var renderTableModalContent = useCallback(function () {
|
|
269
307
|
if (status === 'rejected') {
|
|
270
308
|
return jsx(ModalLoadingError, null);
|
|
271
309
|
} else if (status === 'unauthorized') {
|
|
@@ -289,7 +327,22 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
289
327
|
}
|
|
290
328
|
return confluenceSearchTable;
|
|
291
329
|
}, [columns.length, selectedConfluenceSiteUrl, confluenceSearchTable, resolvedWithNoResults, status, urlBeingEdited, hasConfluenceSearchParams]);
|
|
292
|
-
var
|
|
330
|
+
var renderInlineLinkModalContent = useCallback(function () {
|
|
331
|
+
if (status === 'unauthorized') {
|
|
332
|
+
return jsx(AccessRequired, {
|
|
333
|
+
url: selectedConfluenceSiteUrl || urlBeingEdited
|
|
334
|
+
});
|
|
335
|
+
} else if (status === 'empty' || !selectedConfluenceSiteUrl) {
|
|
336
|
+
return jsx(SmartCardPlaceholder, {
|
|
337
|
+
placeholderText: confluenceSearchModalMessages.resultsCountSmartCardPlaceholderText
|
|
338
|
+
});
|
|
339
|
+
} else {
|
|
340
|
+
return confluenceSearchUrl && jsx(SmartLink, {
|
|
341
|
+
url: confluenceSearchUrl
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
}, [confluenceSearchUrl, selectedConfluenceSiteUrl, status, urlBeingEdited]);
|
|
345
|
+
var shouldShowResultsCount = !!totalCount && currentViewMode === 'table';
|
|
293
346
|
var onInsertPressed = useCallback(function (e, analyticsEvent) {
|
|
294
347
|
var _insertButtonClickedE;
|
|
295
348
|
if (!isParametersSet || !cloudId) {
|
|
@@ -300,7 +353,7 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
300
353
|
attributes: _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
301
354
|
totalItemCount: totalCount || 0,
|
|
302
355
|
displayedColumnCount: visibleColumnCount.current,
|
|
303
|
-
display: DatasourceDisplay.DATASOURCE_TABLE,
|
|
356
|
+
display: currentViewMode === 'inline' ? DatasourceDisplay.DATASOURCE_INLINE : DatasourceDisplay.DATASOURCE_TABLE,
|
|
304
357
|
searchCount: searchCount.current,
|
|
305
358
|
searchMethod: DatasourceSearchMethod.DATASOURCE_SEARCH_QUERY,
|
|
306
359
|
actions: Array.from(userInteractionActions.current)
|
|
@@ -309,29 +362,42 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
309
362
|
});
|
|
310
363
|
var consumerEvent = (_insertButtonClickedE = insertButtonClickedEvent.clone()) !== null && _insertButtonClickedE !== void 0 ? _insertButtonClickedE : undefined;
|
|
311
364
|
insertButtonClickedEvent.fire(EVENT_CHANNEL);
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
views: [{
|
|
318
|
-
type: 'table',
|
|
319
|
-
properties: {
|
|
320
|
-
columns: (visibleColumnKeys || []).map(function (key) {
|
|
321
|
-
var width = columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key];
|
|
322
|
-
var isWrapped = wrappedColumnKeys === null || wrappedColumnKeys === void 0 ? void 0 : wrappedColumnKeys.includes(key);
|
|
323
|
-
return _objectSpread(_objectSpread({
|
|
324
|
-
key: key
|
|
325
|
-
}, width ? {
|
|
326
|
-
width: width
|
|
327
|
-
} : {}), isWrapped ? {
|
|
328
|
-
isWrapped: isWrapped
|
|
329
|
-
} : {});
|
|
330
|
-
})
|
|
365
|
+
if (currentViewMode === 'inline') {
|
|
366
|
+
onInsert({
|
|
367
|
+
type: 'inlineCard',
|
|
368
|
+
attrs: {
|
|
369
|
+
url: confluenceSearchUrl
|
|
331
370
|
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
371
|
+
}, consumerEvent);
|
|
372
|
+
} else {
|
|
373
|
+
onInsert(buildDatasourceAdf({
|
|
374
|
+
id: datasourceId,
|
|
375
|
+
parameters: _objectSpread(_objectSpread({}, parameters), {}, {
|
|
376
|
+
cloudId: cloudId
|
|
377
|
+
}),
|
|
378
|
+
views: [{
|
|
379
|
+
type: 'table',
|
|
380
|
+
properties: {
|
|
381
|
+
columns: (visibleColumnKeys || []).map(function (key) {
|
|
382
|
+
var width = columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key];
|
|
383
|
+
var isWrapped = wrappedColumnKeys === null || wrappedColumnKeys === void 0 ? void 0 : wrappedColumnKeys.includes(key);
|
|
384
|
+
return _objectSpread(_objectSpread({
|
|
385
|
+
key: key
|
|
386
|
+
}, width ? {
|
|
387
|
+
width: width
|
|
388
|
+
} : {}), isWrapped ? {
|
|
389
|
+
isWrapped: isWrapped
|
|
390
|
+
} : {});
|
|
391
|
+
})
|
|
392
|
+
}
|
|
393
|
+
}]
|
|
394
|
+
}), consumerEvent);
|
|
395
|
+
}
|
|
396
|
+
}, [isParametersSet, cloudId, analyticsPayload, totalCount, currentViewMode, onInsert, confluenceSearchUrl, datasourceId, parameters, visibleColumnKeys, columnCustomSizes, wrappedColumnKeys]);
|
|
397
|
+
var handleViewModeChange = function handleViewModeChange(selectedMode) {
|
|
398
|
+
userInteractionActions.current.add(DatasourceAction.DISPLAY_VIEW_CHANGED);
|
|
399
|
+
setCurrentViewMode(selectedMode);
|
|
400
|
+
};
|
|
335
401
|
var onSearch = useCallback(function (newSearchString) {
|
|
336
402
|
searchCount.current++;
|
|
337
403
|
userInteractionActions.current.add(DatasourceAction.QUERY_UPDATED);
|
|
@@ -363,14 +429,17 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
363
429
|
selectedSite: selectedConfluenceSite,
|
|
364
430
|
testId: "confluence-search-datasource-modal--site-selector",
|
|
365
431
|
label: siteSelectorLabel
|
|
366
|
-
}))
|
|
432
|
+
})), !hasNoConfluenceSites && jsx(DisplayViewDropDown, {
|
|
433
|
+
onViewModeChange: handleViewModeChange,
|
|
434
|
+
viewMode: currentViewMode
|
|
435
|
+
})), jsx(ModalBody, null, !hasNoConfluenceSites ? jsx(Fragment, null, jsx(Box, {
|
|
367
436
|
xcss: inputContainerStyles
|
|
368
437
|
}, jsx(ConfluenceSearchContainer, {
|
|
369
438
|
cloudId: cloudId,
|
|
370
439
|
isSearching: status === 'loading',
|
|
371
440
|
onSearch: onSearch,
|
|
372
441
|
initialSearchValue: initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.searchString
|
|
373
|
-
})),
|
|
442
|
+
})), currentViewMode === 'inline' ? renderInlineLinkModalContent() : renderTableModalContent()) : jsx(NoInstancesView, {
|
|
374
443
|
title: confluenceSearchModalMessages.noAccessToConfluenceSitesTitle,
|
|
375
444
|
description: confluenceSearchModalMessages.noAccessToConfluenceSitesDescription,
|
|
376
445
|
testId: 'no-confluence-instances-content'
|
|
@@ -44,5 +44,10 @@ export var confluenceSearchModalMessages = defineMessages({
|
|
|
44
44
|
id: 'linkDataSource.confluence-search.no.confluence.sites.access.description',
|
|
45
45
|
description: 'Description that shows in the modal when user has no access to any Confluence sites',
|
|
46
46
|
defaultMessage: 'To request access, contact your admin.'
|
|
47
|
+
},
|
|
48
|
+
resultsCountSmartCardPlaceholderText: {
|
|
49
|
+
id: 'linkDataSource.confluence-search.configmodal.placeholder.issues',
|
|
50
|
+
description: 'Placeholder text that will be placed next to a count of confluence search results',
|
|
51
|
+
defaultMessage: '### Results'
|
|
47
52
|
}
|
|
48
53
|
});
|
|
@@ -17,7 +17,7 @@ import { IntlMessagesProvider } from '@atlaskit/intl-messages-provider';
|
|
|
17
17
|
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
18
18
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
19
19
|
import LinkUrl from '@atlaskit/smart-card/link-url';
|
|
20
|
-
import {
|
|
20
|
+
import { N800 } from '@atlaskit/theme/colors';
|
|
21
21
|
import { EVENT_CHANNEL, useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
22
22
|
import { componentMetadata } from '../../../analytics/constants';
|
|
23
23
|
import { DatasourceAction, DatasourceDisplay } from '../../../analytics/types';
|
|
@@ -39,29 +39,19 @@ import { InitialStateView } from '../../common/initial-state-view';
|
|
|
39
39
|
import { initialStateViewMessages } from '../../common/initial-state-view/messages';
|
|
40
40
|
import { CancelButton } from '../../common/modal/cancel-button';
|
|
41
41
|
import { ContentContainer } from '../../common/modal/content-container';
|
|
42
|
+
import { SmartCardPlaceholder, SmartLink } from '../../common/modal/count-view-smart-link';
|
|
43
|
+
import { DisplayViewDropDown } from '../../common/modal/display-view-dropdown/display-view-drop-down';
|
|
42
44
|
import { SiteSelector } from '../../common/modal/site-selector';
|
|
43
45
|
import { EmptyState, IssueLikeDataTableView } from '../../issue-like-table';
|
|
44
|
-
import LinkRenderType from '../../issue-like-table/render-type/link';
|
|
45
46
|
import { availableBasicFilterTypes } from '../basic-filters/ui';
|
|
46
47
|
import { isQueryTooComplex } from '../basic-filters/utils/isQueryTooComplex';
|
|
47
48
|
import { JiraSearchContainer } from '../jira-search-container';
|
|
48
|
-
import { JiraDisplayViewDropDown } from './jira-display-view-dropdown/jira-display-view-drop-down';
|
|
49
49
|
import { JiraInitialStateSVG } from './jira-issues-initial-state-svg';
|
|
50
50
|
import { modalMessages } from './messages';
|
|
51
|
-
var placeholderSmartLinkStyles = css({
|
|
52
|
-
backgroundColor: "var(--ds-surface-raised, ".concat(N0, ")"),
|
|
53
|
-
borderRadius: "var(--ds-border-radius-200, 3px)",
|
|
54
|
-
boxShadow: '0px 1px 1px rgba(9, 30, 66, 0.25), 0px 0px 1px rgba(9, 30, 66, 0.31)',
|
|
55
|
-
color: "var(--ds-text-brand, ".concat(B400, ")"),
|
|
56
|
-
padding: "var(--ds-space-0, 0px)".concat(" ", "var(--ds-space-025, 2px)")
|
|
57
|
-
});
|
|
58
51
|
var issueCountStyles = css({
|
|
59
52
|
flex: 1,
|
|
60
53
|
fontWeight: 600
|
|
61
54
|
});
|
|
62
|
-
var smartLinkContainerStyles = css({
|
|
63
|
-
paddingLeft: "var(--ds-space-025, 2px)"
|
|
64
|
-
});
|
|
65
55
|
var getDisplayValue = function getDisplayValue(currentViewMode, itemCount) {
|
|
66
56
|
if (currentViewMode === 'issue') {
|
|
67
57
|
return DatasourceDisplay.DATASOURCE_TABLE;
|
|
@@ -468,12 +458,9 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
468
458
|
url: selectedJiraSiteUrl || urlBeingEdited
|
|
469
459
|
});
|
|
470
460
|
} else if (status === 'empty' || !jql || !selectedJiraSiteUrl) {
|
|
471
|
-
return jsx(
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
"data-testid": "jira-datasource-modal--smart-card-placeholder",
|
|
475
|
-
css: placeholderSmartLinkStyles
|
|
476
|
-
}, jsx(FormattedMessage, modalMessages.issuesCountSmartCardPlaceholderText)));
|
|
461
|
+
return jsx(SmartCardPlaceholder, {
|
|
462
|
+
placeholderText: modalMessages.issuesCountSmartCardPlaceholderText
|
|
463
|
+
});
|
|
477
464
|
} else {
|
|
478
465
|
var url;
|
|
479
466
|
if (responseItems.length === 1 && retrieveUrlForSmartCardRender()) {
|
|
@@ -481,11 +468,9 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
481
468
|
} else {
|
|
482
469
|
url = "".concat(selectedJiraSiteUrl, "/issues/?jql=").concat(getBooleanFF('platform.linking-platform.datasource.enable-stricter-jql-encoding') ? encodeURIComponent(jql) : encodeURI(jql));
|
|
483
470
|
}
|
|
484
|
-
return jsx(
|
|
485
|
-
css: smartLinkContainerStyles
|
|
486
|
-
}, jsx(LinkRenderType, {
|
|
471
|
+
return jsx(SmartLink, {
|
|
487
472
|
url: url
|
|
488
|
-
})
|
|
473
|
+
});
|
|
489
474
|
}
|
|
490
475
|
}, [jql, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited, responseItems, retrieveUrlForSmartCardRender]);
|
|
491
476
|
var renderIssuesModeContent = useCallback(function () {
|
|
@@ -548,7 +533,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
548
533
|
selectedSite: selectedJiraSite,
|
|
549
534
|
testId: "jira-datasource-modal--site-selector",
|
|
550
535
|
label: siteSelectorLabel
|
|
551
|
-
})), !hasNoJiraSites && jsx(
|
|
536
|
+
})), !hasNoJiraSites && jsx(DisplayViewDropDown, {
|
|
552
537
|
onViewModeChange: handleViewModeChange,
|
|
553
538
|
viewMode: currentViewMode
|
|
554
539
|
})), jsx(ModalBody, null, !hasNoJiraSites ? jsx(Fragment, null, jsx(JiraSearchContainer, {
|
|
@@ -15,26 +15,6 @@ export var modalMessages = defineMessages({
|
|
|
15
15
|
description: 'Title for the Jira Issues modal when a user has to select a site to inserting issues from',
|
|
16
16
|
defaultMessage: 'Insert Jira issues from'
|
|
17
17
|
},
|
|
18
|
-
tableViewModeLabel: {
|
|
19
|
-
id: 'linkDataSource.jira-issues.configmodal.tableViewModeLabel',
|
|
20
|
-
description: 'Display Jira search results as a table',
|
|
21
|
-
defaultMessage: 'Table'
|
|
22
|
-
},
|
|
23
|
-
tableViewModeDescription: {
|
|
24
|
-
id: 'linkDataSource.jira-issues.configmodal.tableViewModeDescription',
|
|
25
|
-
description: 'Description for table view mode',
|
|
26
|
-
defaultMessage: 'Display Jira search results as a table'
|
|
27
|
-
},
|
|
28
|
-
inlineLinkViewModeLabel: {
|
|
29
|
-
id: 'linkDataSource.jira-issues.configmodal.inlineLinkViewModeLabel',
|
|
30
|
-
description: 'Display the number of search results as an inline smart link',
|
|
31
|
-
defaultMessage: 'Inline link'
|
|
32
|
-
},
|
|
33
|
-
inlineLinkViewModeDescription: {
|
|
34
|
-
id: 'linkDataSource.jira-issues.configmodal.inlineLinkViewModeDescription',
|
|
35
|
-
description: 'Description for inline link view mode',
|
|
36
|
-
defaultMessage: 'Display the number of search results or as an inline smart link'
|
|
37
|
-
},
|
|
38
18
|
issuesCountSmartCardPlaceholderText: {
|
|
39
19
|
id: 'linkDataSource.jira-issues.configmodal.placeholder.issues',
|
|
40
20
|
description: 'Placeholder text that will be placed next to a count of jira issues',
|
|
@@ -7,6 +7,8 @@ export interface Site {
|
|
|
7
7
|
url: string;
|
|
8
8
|
}
|
|
9
9
|
export type IssueViewModes = 'issue' | 'count';
|
|
10
|
+
export type ViewModes = 'table' | 'inline';
|
|
11
|
+
export type DisplayViewModes = IssueViewModes | ViewModes;
|
|
10
12
|
export type ConfigModalProps<ADF, Parameters> = {
|
|
11
13
|
/** Unique identifier for which type of datasource is being rendered and for making its requests */
|
|
12
14
|
datasourceId: string;
|
|
@@ -20,9 +22,7 @@ export type ConfigModalProps<ADF, Parameters> = {
|
|
|
20
22
|
onInsert: (adf: ADF, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
21
23
|
/** The view mode that the modal will show on open:
|
|
22
24
|
* - Table = Displays a list of links in table format
|
|
23
|
-
* - Inline
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* because it will introduce breaking changes to the public API requiring a major version bump*/
|
|
27
|
-
viewMode?: IssueViewModes;
|
|
25
|
+
* - Inline = Presents a smart link that shows the count of query results. However, if there's only one result, it converts to an inline smart link of that issue.
|
|
26
|
+
* The view modes in 'DisplayViewModes' includes IssueViewModes which has not been changed from 'count' to 'inline' and 'issue' to 'table' */
|
|
27
|
+
viewMode?: DisplayViewModes;
|
|
28
28
|
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'wrappedColumnKeys' | 'columnCustomSizes'>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { MessageDescriptor } from 'react-intl-next';
|
|
4
|
+
export declare const SmartCardPlaceholder: ({ placeholderText, }: {
|
|
5
|
+
placeholderText: MessageDescriptor;
|
|
6
|
+
}) => jsx.JSX.Element;
|
|
7
|
+
export declare const SmartLink: ({ url }: {
|
|
8
|
+
url: string;
|
|
9
|
+
}) => jsx.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { DisplayViewModes } from '../../../../common/types';
|
|
4
|
+
export type DisplayViewDropDownProps = {
|
|
5
|
+
onViewModeChange: (value: DisplayViewModes) => void;
|
|
6
|
+
viewMode: DisplayViewModes;
|
|
7
|
+
};
|
|
8
|
+
export declare const DisplayViewDropDown: ({ onViewModeChange, viewMode, }: DisplayViewDropDownProps) => jsx.JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const displayViewDropDownMessages: {
|
|
2
|
+
tableViewModeLabelDuplicate: {
|
|
3
|
+
id: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defaultMessage: string;
|
|
6
|
+
};
|
|
7
|
+
tableViewModeDescriptionDuplicate: {
|
|
8
|
+
id: string;
|
|
9
|
+
description: string;
|
|
10
|
+
defaultMessage: string;
|
|
11
|
+
};
|
|
12
|
+
inlineLinkViewModeLabelDuplicate: {
|
|
13
|
+
id: string;
|
|
14
|
+
description: string;
|
|
15
|
+
defaultMessage: string;
|
|
16
|
+
};
|
|
17
|
+
inlineLinkViewModeDescriptionDuplicate: {
|
|
18
|
+
id: string;
|
|
19
|
+
description: string;
|
|
20
|
+
defaultMessage: string;
|
|
21
|
+
};
|
|
22
|
+
tableViewModeLabel: {
|
|
23
|
+
id: string;
|
|
24
|
+
description: string;
|
|
25
|
+
defaultMessage: string;
|
|
26
|
+
};
|
|
27
|
+
tableViewModeDescription: {
|
|
28
|
+
id: string;
|
|
29
|
+
description: string;
|
|
30
|
+
defaultMessage: string;
|
|
31
|
+
};
|
|
32
|
+
inlineLinkViewModeLabel: {
|
|
33
|
+
id: string;
|
|
34
|
+
description: string;
|
|
35
|
+
defaultMessage: string;
|
|
36
|
+
};
|
|
37
|
+
inlineLinkViewModeDescription: {
|
|
38
|
+
id: string;
|
|
39
|
+
description: string;
|
|
40
|
+
defaultMessage: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DatasourceAdf } from '@atlaskit/linking-common/types';
|
|
1
|
+
import { DatasourceAdf, InlineCardAdf } from '@atlaskit/linking-common/types';
|
|
2
2
|
import { ConfigModalProps } from '../../common/types';
|
|
3
|
-
export interface ConfluenceSearchConfigModalProps extends ConfigModalProps<ConfluenceSearchDatasourceAdf, ConfluenceSearchDatasourceParameters> {
|
|
3
|
+
export interface ConfluenceSearchConfigModalProps extends ConfigModalProps<InlineCardAdf | ConfluenceSearchDatasourceAdf, ConfluenceSearchDatasourceParameters> {
|
|
4
4
|
}
|
|
5
5
|
export type ConfluenceSearchDatasourceParameters = {
|
|
6
6
|
cloudId: string;
|
|
@@ -14,26 +14,6 @@ export declare const modalMessages: {
|
|
|
14
14
|
description: string;
|
|
15
15
|
defaultMessage: string;
|
|
16
16
|
};
|
|
17
|
-
tableViewModeLabel: {
|
|
18
|
-
id: string;
|
|
19
|
-
description: string;
|
|
20
|
-
defaultMessage: string;
|
|
21
|
-
};
|
|
22
|
-
tableViewModeDescription: {
|
|
23
|
-
id: string;
|
|
24
|
-
description: string;
|
|
25
|
-
defaultMessage: string;
|
|
26
|
-
};
|
|
27
|
-
inlineLinkViewModeLabel: {
|
|
28
|
-
id: string;
|
|
29
|
-
description: string;
|
|
30
|
-
defaultMessage: string;
|
|
31
|
-
};
|
|
32
|
-
inlineLinkViewModeDescription: {
|
|
33
|
-
id: string;
|
|
34
|
-
description: string;
|
|
35
|
-
defaultMessage: string;
|
|
36
|
-
};
|
|
37
17
|
issuesCountSmartCardPlaceholderText: {
|
|
38
18
|
id: string;
|
|
39
19
|
description: string;
|
|
@@ -7,6 +7,8 @@ export interface Site {
|
|
|
7
7
|
url: string;
|
|
8
8
|
}
|
|
9
9
|
export type IssueViewModes = 'issue' | 'count';
|
|
10
|
+
export type ViewModes = 'table' | 'inline';
|
|
11
|
+
export type DisplayViewModes = IssueViewModes | ViewModes;
|
|
10
12
|
export type ConfigModalProps<ADF, Parameters> = {
|
|
11
13
|
/** Unique identifier for which type of datasource is being rendered and for making its requests */
|
|
12
14
|
datasourceId: string;
|
|
@@ -20,9 +22,7 @@ export type ConfigModalProps<ADF, Parameters> = {
|
|
|
20
22
|
onInsert: (adf: ADF, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
21
23
|
/** The view mode that the modal will show on open:
|
|
22
24
|
* - Table = Displays a list of links in table format
|
|
23
|
-
* - Inline
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* because it will introduce breaking changes to the public API requiring a major version bump*/
|
|
27
|
-
viewMode?: IssueViewModes;
|
|
25
|
+
* - Inline = Presents a smart link that shows the count of query results. However, if there's only one result, it converts to an inline smart link of that issue.
|
|
26
|
+
* The view modes in 'DisplayViewModes' includes IssueViewModes which has not been changed from 'count' to 'inline' and 'issue' to 'table' */
|
|
27
|
+
viewMode?: DisplayViewModes;
|
|
28
28
|
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'wrappedColumnKeys' | 'columnCustomSizes'>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { MessageDescriptor } from 'react-intl-next';
|
|
4
|
+
export declare const SmartCardPlaceholder: ({ placeholderText, }: {
|
|
5
|
+
placeholderText: MessageDescriptor;
|
|
6
|
+
}) => jsx.JSX.Element;
|
|
7
|
+
export declare const SmartLink: ({ url }: {
|
|
8
|
+
url: string;
|
|
9
|
+
}) => jsx.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { DisplayViewModes } from '../../../../common/types';
|
|
4
|
+
export type DisplayViewDropDownProps = {
|
|
5
|
+
onViewModeChange: (value: DisplayViewModes) => void;
|
|
6
|
+
viewMode: DisplayViewModes;
|
|
7
|
+
};
|
|
8
|
+
export declare const DisplayViewDropDown: ({ onViewModeChange, viewMode, }: DisplayViewDropDownProps) => jsx.JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const displayViewDropDownMessages: {
|
|
2
|
+
tableViewModeLabelDuplicate: {
|
|
3
|
+
id: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defaultMessage: string;
|
|
6
|
+
};
|
|
7
|
+
tableViewModeDescriptionDuplicate: {
|
|
8
|
+
id: string;
|
|
9
|
+
description: string;
|
|
10
|
+
defaultMessage: string;
|
|
11
|
+
};
|
|
12
|
+
inlineLinkViewModeLabelDuplicate: {
|
|
13
|
+
id: string;
|
|
14
|
+
description: string;
|
|
15
|
+
defaultMessage: string;
|
|
16
|
+
};
|
|
17
|
+
inlineLinkViewModeDescriptionDuplicate: {
|
|
18
|
+
id: string;
|
|
19
|
+
description: string;
|
|
20
|
+
defaultMessage: string;
|
|
21
|
+
};
|
|
22
|
+
tableViewModeLabel: {
|
|
23
|
+
id: string;
|
|
24
|
+
description: string;
|
|
25
|
+
defaultMessage: string;
|
|
26
|
+
};
|
|
27
|
+
tableViewModeDescription: {
|
|
28
|
+
id: string;
|
|
29
|
+
description: string;
|
|
30
|
+
defaultMessage: string;
|
|
31
|
+
};
|
|
32
|
+
inlineLinkViewModeLabel: {
|
|
33
|
+
id: string;
|
|
34
|
+
description: string;
|
|
35
|
+
defaultMessage: string;
|
|
36
|
+
};
|
|
37
|
+
inlineLinkViewModeDescription: {
|
|
38
|
+
id: string;
|
|
39
|
+
description: string;
|
|
40
|
+
defaultMessage: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DatasourceAdf } from '@atlaskit/linking-common/types';
|
|
1
|
+
import { DatasourceAdf, InlineCardAdf } from '@atlaskit/linking-common/types';
|
|
2
2
|
import { ConfigModalProps } from '../../common/types';
|
|
3
|
-
export interface ConfluenceSearchConfigModalProps extends ConfigModalProps<ConfluenceSearchDatasourceAdf, ConfluenceSearchDatasourceParameters> {
|
|
3
|
+
export interface ConfluenceSearchConfigModalProps extends ConfigModalProps<InlineCardAdf | ConfluenceSearchDatasourceAdf, ConfluenceSearchDatasourceParameters> {
|
|
4
4
|
}
|
|
5
5
|
export type ConfluenceSearchDatasourceParameters = {
|
|
6
6
|
cloudId: string;
|
|
@@ -14,26 +14,6 @@ export declare const modalMessages: {
|
|
|
14
14
|
description: string;
|
|
15
15
|
defaultMessage: string;
|
|
16
16
|
};
|
|
17
|
-
tableViewModeLabel: {
|
|
18
|
-
id: string;
|
|
19
|
-
description: string;
|
|
20
|
-
defaultMessage: string;
|
|
21
|
-
};
|
|
22
|
-
tableViewModeDescription: {
|
|
23
|
-
id: string;
|
|
24
|
-
description: string;
|
|
25
|
-
defaultMessage: string;
|
|
26
|
-
};
|
|
27
|
-
inlineLinkViewModeLabel: {
|
|
28
|
-
id: string;
|
|
29
|
-
description: string;
|
|
30
|
-
defaultMessage: string;
|
|
31
|
-
};
|
|
32
|
-
inlineLinkViewModeDescription: {
|
|
33
|
-
id: string;
|
|
34
|
-
description: string;
|
|
35
|
-
defaultMessage: string;
|
|
36
|
-
};
|
|
37
17
|
issuesCountSmartCardPlaceholderText: {
|
|
38
18
|
id: string;
|
|
39
19
|
description: string;
|