@atlaskit/link-datasource 1.7.6 → 1.9.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 +12 -0
- package/dist/cjs/analytics/constants.js +1 -1
- package/dist/cjs/common/zindex.js +8 -0
- package/dist/cjs/hooks/useDatasourceTableState.js +0 -1
- package/dist/cjs/ui/assets-modal/modal/index.js +1 -1
- package/dist/cjs/ui/common/error-state/access-required.js +42 -8
- package/dist/cjs/ui/common/error-state/messages.js +4 -4
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +6 -4
- package/dist/cjs/ui/issue-like-table/empty-state/index.js +71 -86
- package/dist/cjs/ui/issue-like-table/empty-state/type.js +1 -1
- package/dist/cjs/ui/issue-like-table/index.js +37 -11
- package/dist/cjs/ui/issue-like-table/styled.js +4 -4
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +25 -27
- package/dist/cjs/ui/jira-issues-modal/modal/messages.js +2 -2
- package/dist/cjs/ui/jira-issues-modal/site-selector/index.js +59 -37
- package/dist/cjs/ui/jira-issues-modal/site-selector/messages.js +4 -9
- package/dist/es2019/analytics/constants.js +1 -1
- package/dist/es2019/common/zindex.js +2 -0
- package/dist/es2019/hooks/useDatasourceTableState.js +0 -1
- package/dist/es2019/ui/assets-modal/modal/index.js +1 -1
- package/dist/es2019/ui/common/error-state/access-required.js +41 -6
- package/dist/es2019/ui/common/error-state/messages.js +4 -4
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +6 -4
- package/dist/es2019/ui/issue-like-table/empty-state/index.js +61 -75
- package/dist/es2019/ui/issue-like-table/empty-state/type.js +1 -1
- package/dist/es2019/ui/issue-like-table/index.js +45 -14
- package/dist/es2019/ui/issue-like-table/styled.js +1 -5
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +26 -28
- package/dist/es2019/ui/jira-issues-modal/modal/messages.js +2 -2
- package/dist/es2019/ui/jira-issues-modal/site-selector/index.js +50 -32
- package/dist/es2019/ui/jira-issues-modal/site-selector/messages.js +4 -9
- package/dist/esm/analytics/constants.js +1 -1
- package/dist/esm/common/zindex.js +2 -0
- package/dist/esm/hooks/useDatasourceTableState.js +0 -1
- package/dist/esm/ui/assets-modal/modal/index.js +1 -1
- package/dist/esm/ui/common/error-state/access-required.js +43 -9
- package/dist/esm/ui/common/error-state/messages.js +4 -4
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +6 -4
- package/dist/esm/ui/issue-like-table/empty-state/index.js +72 -86
- package/dist/esm/ui/issue-like-table/empty-state/type.js +1 -1
- package/dist/esm/ui/issue-like-table/index.js +37 -11
- package/dist/esm/ui/issue-like-table/styled.js +3 -3
- package/dist/esm/ui/jira-issues-modal/modal/index.js +26 -28
- package/dist/esm/ui/jira-issues-modal/modal/messages.js +2 -2
- package/dist/esm/ui/jira-issues-modal/site-selector/index.js +59 -34
- package/dist/esm/ui/jira-issues-modal/site-selector/messages.js +4 -9
- package/dist/types/common/zindex.d.ts +2 -0
- package/dist/types/ui/common/error-state/access-required.d.ts +2 -2
- package/dist/types/ui/issue-like-table/empty-state/index.d.ts +1 -2
- package/dist/types/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types/ui/issue-like-table/styled.d.ts +1 -8
- package/dist/types/ui/jira-issues-modal/site-selector/index.d.ts +0 -1
- package/dist/types/ui/jira-issues-modal/site-selector/messages.d.ts +1 -6
- package/dist/types/ui/jira-issues-modal/types.d.ts +2 -0
- package/dist/types-ts4.5/common/zindex.d.ts +2 -0
- package/dist/types-ts4.5/ui/common/error-state/access-required.d.ts +2 -2
- package/dist/types-ts4.5/ui/issue-like-table/empty-state/index.d.ts +1 -2
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/issue-like-table/styled.d.ts +1 -8
- package/dist/types-ts4.5/ui/jira-issues-modal/site-selector/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/site-selector/messages.d.ts +1 -6
- package/dist/types-ts4.5/ui/jira-issues-modal/types.d.ts +2 -0
- package/package.json +2 -3
- package/report.api.md +1 -0
- package/tmp/api-report-tmp.d.ts +1 -0
|
@@ -13,6 +13,7 @@ import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
|
|
|
13
13
|
import { N40 } from '@atlaskit/theme/colors';
|
|
14
14
|
import Tooltip from '@atlaskit/tooltip';
|
|
15
15
|
import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExperiences';
|
|
16
|
+
import { stickyTableHeadersIndex } from '../../common/zindex';
|
|
16
17
|
import { ColumnPicker } from './column-picker';
|
|
17
18
|
import { DragColumnPreview } from './drag-column-preview';
|
|
18
19
|
import { DraggableTableHeading } from './draggable-table-heading';
|
|
@@ -25,7 +26,7 @@ const tableHeadStyles = css({
|
|
|
25
26
|
background: "var(--ds-surface, #FFF)",
|
|
26
27
|
position: 'sticky',
|
|
27
28
|
top: 0,
|
|
28
|
-
zIndex:
|
|
29
|
+
zIndex: stickyTableHeadersIndex
|
|
29
30
|
});
|
|
30
31
|
const ColumnPickerHeader = styled.th`
|
|
31
32
|
width: 40px;
|
|
@@ -90,8 +91,7 @@ function getColumnWidth(key, type) {
|
|
|
90
91
|
priority: BASE_WIDTH * 8,
|
|
91
92
|
status: BASE_WIDTH * 18,
|
|
92
93
|
summary: BASE_WIDTH * 45,
|
|
93
|
-
description: BASE_WIDTH * 31.25
|
|
94
|
-
type: BASE_WIDTH * 8
|
|
94
|
+
description: BASE_WIDTH * 31.25
|
|
95
95
|
};
|
|
96
96
|
if (keyBasedWidth[key]) {
|
|
97
97
|
return keyBasedWidth[key];
|
|
@@ -153,9 +153,10 @@ export const IssueLikeDataTableView = ({
|
|
|
153
153
|
key
|
|
154
154
|
}) => {
|
|
155
155
|
const content = jsx(Skeleton, {
|
|
156
|
-
borderRadius:
|
|
157
|
-
width:
|
|
158
|
-
height:
|
|
156
|
+
borderRadius: 8,
|
|
157
|
+
width: "100%",
|
|
158
|
+
height: 14,
|
|
159
|
+
testId: "issues-table-row-loading"
|
|
159
160
|
});
|
|
160
161
|
return {
|
|
161
162
|
key,
|
|
@@ -274,7 +275,25 @@ export const IssueLikeDataTableView = ({
|
|
|
274
275
|
}),
|
|
275
276
|
ref: rowIndex === items.length - 1 ? el => setLastRowElement(el) : undefined
|
|
276
277
|
})), [identityColumnKey, renderItem, items, visibleSortedColumns]);
|
|
277
|
-
const rows = useMemo(() =>
|
|
278
|
+
const rows = useMemo(() => {
|
|
279
|
+
if (status !== 'loading') {
|
|
280
|
+
return tableRows;
|
|
281
|
+
}
|
|
282
|
+
// if there are table rows, only add 1 loading row
|
|
283
|
+
if (tableRows.length > 0) {
|
|
284
|
+
return [...tableRows, {
|
|
285
|
+
...loadingRow,
|
|
286
|
+
key: `loading-${tableRows.length}`
|
|
287
|
+
}];
|
|
288
|
+
}
|
|
289
|
+
// if there are no table rows add 14 rows if it is compact (has scrollableContainerHeight or non-modal)
|
|
290
|
+
// add 10 rows if it is modal (no scrollableContainerHeight)
|
|
291
|
+
const loadingRowsCount = scrollableContainerHeight ? 14 : 10;
|
|
292
|
+
return [...Array(loadingRowsCount)].map((_, index) => ({
|
|
293
|
+
...loadingRow,
|
|
294
|
+
key: `loading-${index}`
|
|
295
|
+
}));
|
|
296
|
+
}, [loadingRow, status, tableRows, scrollableContainerHeight]);
|
|
278
297
|
const onSelectedColumnKeysChange = useCallback(newSelectedColumnKeys => {
|
|
279
298
|
onVisibleColumnKeysChange === null || onVisibleColumnKeysChange === void 0 ? void 0 : onVisibleColumnKeysChange(newSelectedColumnKeys);
|
|
280
299
|
}, [onVisibleColumnKeysChange]);
|
|
@@ -352,6 +371,8 @@ export const IssueLikeDataTableView = ({
|
|
|
352
371
|
key: key,
|
|
353
372
|
"data-testid": `${key}-column-heading`,
|
|
354
373
|
style: {
|
|
374
|
+
// this keeps the column headers from collapsing horizontally during loading states
|
|
375
|
+
minWidth: maxWidth,
|
|
355
376
|
maxWidth
|
|
356
377
|
}
|
|
357
378
|
}, heading);
|
|
@@ -377,14 +398,24 @@ export const IssueLikeDataTableView = ({
|
|
|
377
398
|
key: cellKey,
|
|
378
399
|
content,
|
|
379
400
|
maxWidth
|
|
380
|
-
}, cellIndex) =>
|
|
381
|
-
|
|
382
|
-
"data-testid": testId && `${testId}--cell-${cellIndex}`,
|
|
383
|
-
colSpan: cellIndex + 1 === cells.length ? 2 : undefined,
|
|
384
|
-
css: truncatedCellStyles,
|
|
385
|
-
style: {
|
|
401
|
+
}, cellIndex) => {
|
|
402
|
+
let loadingRowStyle = {
|
|
386
403
|
maxWidth
|
|
404
|
+
};
|
|
405
|
+
// extra padding is required around skeleton loader to avoid vertical jumps when data loads
|
|
406
|
+
if (key !== null && key !== void 0 && key.includes('loading')) {
|
|
407
|
+
loadingRowStyle = {
|
|
408
|
+
...loadingRowStyle,
|
|
409
|
+
paddingBlock: "var(--ds-space-100, 12px)"
|
|
410
|
+
};
|
|
387
411
|
}
|
|
388
|
-
|
|
412
|
+
return jsx("td", {
|
|
413
|
+
key: cellKey,
|
|
414
|
+
"data-testid": testId && `${testId}--cell-${cellIndex}`,
|
|
415
|
+
colSpan: cellIndex + 1 === cells.length ? 2 : undefined,
|
|
416
|
+
css: truncatedCellStyles,
|
|
417
|
+
style: loadingRowStyle
|
|
418
|
+
}, content);
|
|
419
|
+
}))))));
|
|
389
420
|
};
|
|
390
421
|
export const EmptyState = TableEmptyState;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import { N40 } from '@atlaskit/theme/colors';
|
|
3
|
+
export const ScrollableContainerHeight = 590;
|
|
3
4
|
export const FieldTextFontSize = '14px';
|
|
4
5
|
export const Table = styled.table`
|
|
5
6
|
width: 100%;
|
|
@@ -15,9 +16,4 @@ export const TableHeading = styled.th`
|
|
|
15
16
|
text-overflow: ellipsis;
|
|
16
17
|
white-space: nowrap;
|
|
17
18
|
}
|
|
18
|
-
`;
|
|
19
|
-
export const EmptyStateTableHeading = styled(TableHeading)`
|
|
20
|
-
&:first-child {
|
|
21
|
-
padding-left: ${"var(--ds-space-100, 8px)"};
|
|
22
|
-
}
|
|
23
19
|
`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { FormattedMessage, FormattedNumber, useIntl } from 'react-intl-next';
|
|
6
6
|
import { v4 as uuidv4 } from 'uuid';
|
|
@@ -30,8 +30,11 @@ import { JiraSiteSelector } from '../site-selector';
|
|
|
30
30
|
import { modalMessages } from './messages';
|
|
31
31
|
const dropdownContainerStyles = css({
|
|
32
32
|
display: 'flex',
|
|
33
|
-
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
gap: "var(--ds-space-100, 0.5rem)",
|
|
35
|
+
minHeight: '40px' // to prevent vertical shifting when site selector pops in
|
|
34
36
|
});
|
|
37
|
+
|
|
35
38
|
const contentContainerStyles = css({
|
|
36
39
|
display: 'grid',
|
|
37
40
|
maxHeight: '420px',
|
|
@@ -77,11 +80,12 @@ export const getColumnAction = (oldVisibleColumnKeys, newVisibleColumnKeys) => {
|
|
|
77
80
|
export const PlainJiraIssuesConfigModal = props => {
|
|
78
81
|
const {
|
|
79
82
|
datasourceId,
|
|
80
|
-
parameters: initialParameters,
|
|
81
|
-
visibleColumnKeys: initialVisibleColumnKeys,
|
|
82
83
|
onCancel,
|
|
83
84
|
onInsert,
|
|
84
|
-
viewMode = 'issue'
|
|
85
|
+
viewMode = 'issue',
|
|
86
|
+
parameters: initialParameters,
|
|
87
|
+
url: urlBeingEdited,
|
|
88
|
+
visibleColumnKeys: initialVisibleColumnKeys
|
|
85
89
|
} = props;
|
|
86
90
|
const [availableSites, setAvailableSites] = useState([]);
|
|
87
91
|
const [currentViewMode, setCurrentViewMode] = useState(viewMode);
|
|
@@ -129,9 +133,7 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
129
133
|
} = useRef(uuidv4());
|
|
130
134
|
const selectedJiraSite = useMemo(() => {
|
|
131
135
|
if (cloudId) {
|
|
132
|
-
|
|
133
|
-
// TODO: unauthorized to edit flow https://product-fabric.atlassian.net/browse/EDM-7216
|
|
134
|
-
return availableSites.find(jiraSite => jiraSite.cloudId === cloudId) || availableSites[0];
|
|
136
|
+
return availableSites.find(jiraSite => jiraSite.cloudId === cloudId);
|
|
135
137
|
} else {
|
|
136
138
|
const currentlyLoggedInSiteUrl = window.location.origin;
|
|
137
139
|
return availableSites.find(jiraSite => jiraSite.url === currentlyLoggedInSiteUrl) || availableSites[0];
|
|
@@ -360,12 +362,12 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
360
362
|
extensionKey: extensionKey
|
|
361
363
|
})), [columns, defaultVisibleColumnKeys, handleOnNextPage, handleVisibleColumnKeysChange, hasNextPage, loadDatasourceDetails, modalRenderInstanceId, responseItems, status, visibleColumnKeys, extensionKey]);
|
|
362
364
|
const renderCountModeContent = useCallback(() => {
|
|
363
|
-
const
|
|
365
|
+
const selectedJiraSiteUrl = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
|
|
364
366
|
if (status === 'unauthorized') {
|
|
365
367
|
return jsx(AccessRequired, {
|
|
366
|
-
|
|
368
|
+
url: selectedJiraSiteUrl || urlBeingEdited
|
|
367
369
|
});
|
|
368
|
-
} else if (status === 'empty' || !jql || !
|
|
370
|
+
} else if (status === 'empty' || !jql || !selectedJiraSiteUrl) {
|
|
369
371
|
return jsx("div", {
|
|
370
372
|
css: smartLinkContainerStyles
|
|
371
373
|
}, jsx("span", {
|
|
@@ -373,22 +375,23 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
373
375
|
css: placeholderSmartLinkStyles
|
|
374
376
|
}, jsx(FormattedMessage, modalMessages.issuesCountSmartCardPlaceholderText)));
|
|
375
377
|
} else {
|
|
376
|
-
const urlWithEncodedJql = `${
|
|
378
|
+
const urlWithEncodedJql = `${selectedJiraSiteUrl}/issues/?jql=${encodeURI(jql)}`;
|
|
377
379
|
return jsx("div", {
|
|
378
380
|
css: smartLinkContainerStyles
|
|
379
381
|
}, jsx(LinkRenderType, {
|
|
380
382
|
url: urlWithEncodedJql
|
|
381
383
|
}));
|
|
382
384
|
}
|
|
383
|
-
}, [jql, selectedJiraSite, status]);
|
|
385
|
+
}, [jql, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited]);
|
|
384
386
|
const renderIssuesModeContent = useCallback(() => {
|
|
387
|
+
const selectedJiraSiteUrl = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
|
|
385
388
|
if (status === 'rejected' && jqlUrl) {
|
|
386
389
|
return jsx(ModalLoadingError, {
|
|
387
390
|
url: jqlUrl
|
|
388
391
|
});
|
|
389
392
|
} else if (status === 'unauthorized') {
|
|
390
393
|
return jsx(AccessRequired, {
|
|
391
|
-
|
|
394
|
+
url: selectedJiraSiteUrl || urlBeingEdited
|
|
392
395
|
});
|
|
393
396
|
} else if (resolvedWithNoResults) {
|
|
394
397
|
return jsx(NoResults, null);
|
|
@@ -397,8 +400,7 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
397
400
|
return jsx("div", {
|
|
398
401
|
css: contentContainerStyles
|
|
399
402
|
}, !!jql ? jsx(EmptyState, {
|
|
400
|
-
testId: `jira-jql-datasource-modal--empty-state
|
|
401
|
-
isLoading: true
|
|
403
|
+
testId: `jira-jql-datasource-modal--empty-state`
|
|
402
404
|
}) : jsx(InitialStateView, {
|
|
403
405
|
searchMethod: currentSearchMethod
|
|
404
406
|
}));
|
|
@@ -412,24 +414,20 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
412
414
|
}));
|
|
413
415
|
}
|
|
414
416
|
return issueLikeDataTableView;
|
|
415
|
-
}, [
|
|
417
|
+
}, [columns.length, currentSearchMethod, issueLikeDataTableView, jql, jqlUrl, resolvedWithNoResults, responseItems.length, retrieveUrlForSmartCardRender, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited]);
|
|
416
418
|
return jsx(ModalTransition, null, jsx(Modal, {
|
|
417
|
-
testId:
|
|
419
|
+
testId: "jira-jql-datasource-modal",
|
|
418
420
|
onClose: onCancel,
|
|
419
421
|
width: "calc(100% - 80px)",
|
|
420
422
|
shouldScrollInViewport: true
|
|
421
|
-
}, jsx(ModalHeader, null, jsx(ModalTitle, null,
|
|
423
|
+
}, jsx(ModalHeader, null, jsx(ModalTitle, null, jsx("div", {
|
|
422
424
|
css: dropdownContainerStyles
|
|
423
|
-
}, jsx(FormattedMessage,
|
|
424
|
-
values: {
|
|
425
|
-
siteName: selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName
|
|
426
|
-
}
|
|
427
|
-
})), jsx(JiraSiteSelector, {
|
|
428
|
-
testId: `jira-jql-datasource-modal--site-selector`,
|
|
425
|
+
}, availableSites.length < 2 ? jsx(FormattedMessage, modalMessages.insertIssuesTitle) : jsx(Fragment, null, jsx(FormattedMessage, modalMessages.insertIssuesTitleManySites), jsx(JiraSiteSelector, {
|
|
429
426
|
availableSites: availableSites,
|
|
430
427
|
onSiteSelection: onSiteSelection,
|
|
431
|
-
selectedJiraSite: selectedJiraSite
|
|
432
|
-
|
|
428
|
+
selectedJiraSite: selectedJiraSite,
|
|
429
|
+
testId: "jira-jql-datasource-modal--site-selector"
|
|
430
|
+
})))), jsx(ModeSwitcher, {
|
|
433
431
|
isCompact: true,
|
|
434
432
|
options: [{
|
|
435
433
|
label: formatMessage(modalMessages.issueViewModeLabel),
|
|
@@ -469,7 +467,7 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
469
467
|
appearance: "primary",
|
|
470
468
|
onClick: onInsertPressed,
|
|
471
469
|
isDisabled: isInsertDisabled,
|
|
472
|
-
testId:
|
|
470
|
+
testId: "jira-jql-datasource-modal--insert-button"
|
|
473
471
|
}, jsx(FormattedMessage, modalMessages.insertIssuesButtonText)))));
|
|
474
472
|
};
|
|
475
473
|
const analyticsContextAttributes = {
|
|
@@ -17,8 +17,8 @@ export const modalMessages = defineMessages({
|
|
|
17
17
|
},
|
|
18
18
|
insertIssuesTitleManySites: {
|
|
19
19
|
id: 'linkDataSource.jira-issues.configmodal.insertIssuesTitleManySites',
|
|
20
|
-
description: 'Title for the Jira Issues
|
|
21
|
-
defaultMessage: 'Insert Jira issues from
|
|
20
|
+
description: 'Title for the Jira Issues modal when a user has to select a site to inserting issues from',
|
|
21
|
+
defaultMessage: 'Insert Jira issues from'
|
|
22
22
|
},
|
|
23
23
|
issueViewModeLabel: {
|
|
24
24
|
id: 'linkDataSource.jira-issues.configmodal.issueViewModeLabel',
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { useIntl } from 'react-intl-next';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
5
|
+
import Select from '@atlaskit/select';
|
|
6
|
+
import { siteSelectorIndex } from '../../../common/zindex';
|
|
8
7
|
import { siteSelectorMessages } from './messages';
|
|
8
|
+
const selectStyles = css({
|
|
9
|
+
fontSize: "var(--ds-font-size-100, 14px)",
|
|
10
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
11
|
+
lineHeight: "var(--ds-font-lineHeight-200, 20px)",
|
|
12
|
+
zIndex: siteSelectorIndex
|
|
13
|
+
});
|
|
9
14
|
export const JiraSiteSelector = props => {
|
|
10
15
|
const {
|
|
11
16
|
availableSites,
|
|
@@ -13,32 +18,45 @@ export const JiraSiteSelector = props => {
|
|
|
13
18
|
selectedJiraSite,
|
|
14
19
|
testId
|
|
15
20
|
} = props;
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
const {
|
|
22
|
+
formatMessage
|
|
23
|
+
} = useIntl();
|
|
24
|
+
const onChange = newValue => {
|
|
25
|
+
const selectedSite = availableSites.find(site => site.cloudId === (newValue === null || newValue === void 0 ? void 0 : newValue.value));
|
|
26
|
+
if (selectedSite) {
|
|
27
|
+
onSiteSelection(selectedSite);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const availableSitesOptions = useMemo(() => availableSites.map(site => ({
|
|
31
|
+
label: site.displayName,
|
|
32
|
+
value: site.cloudId
|
|
33
|
+
})), [availableSites]);
|
|
34
|
+
const selectedSiteOption = selectedJiraSite && {
|
|
35
|
+
label: selectedJiraSite.displayName,
|
|
36
|
+
value: selectedJiraSite.cloudId
|
|
37
|
+
};
|
|
38
|
+
return jsx("span", {
|
|
39
|
+
"data-testid": `${testId}--trigger`
|
|
40
|
+
}, jsx(Select, {
|
|
41
|
+
css: selectStyles,
|
|
42
|
+
classNamePrefix: testId,
|
|
43
|
+
isLoading: availableSites.length === 0,
|
|
44
|
+
onChange: onChange,
|
|
45
|
+
options: availableSitesOptions,
|
|
46
|
+
placeholder: formatMessage(siteSelectorMessages.chooseSite),
|
|
47
|
+
styles: {
|
|
48
|
+
// prevents the popup menu with available sites from being too narrow
|
|
49
|
+
// if the selected site is much shorter than the other options
|
|
50
|
+
menu: ({
|
|
51
|
+
width,
|
|
52
|
+
...css
|
|
53
|
+
}) => ({
|
|
54
|
+
...css,
|
|
55
|
+
minWidth: '100%',
|
|
56
|
+
width: 'max-content'
|
|
57
|
+
})
|
|
58
|
+
},
|
|
19
59
|
testId: testId,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...props
|
|
23
|
-
}) => jsx(Button, _extends({}, props, {
|
|
24
|
-
testId: `${testId}--trigger`,
|
|
25
|
-
spacing: "none",
|
|
26
|
-
iconBefore: jsx(ChevronDownIcon, {
|
|
27
|
-
label: intl.formatMessage(siteSelectorMessages.dropdownChevronLabel)
|
|
28
|
-
}),
|
|
29
|
-
ref: triggerRef
|
|
30
|
-
}))
|
|
31
|
-
}, jsx(DropdownItemGroup, null, availableSites.map(availableSite => {
|
|
32
|
-
const {
|
|
33
|
-
displayName,
|
|
34
|
-
cloudId
|
|
35
|
-
} = availableSite;
|
|
36
|
-
const isSelected = displayName === (selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName);
|
|
37
|
-
return jsx(DropdownItem, {
|
|
38
|
-
isSelected: isSelected,
|
|
39
|
-
key: cloudId,
|
|
40
|
-
onClick: () => onSiteSelection(availableSite),
|
|
41
|
-
testId: testId && `${testId}--dropdown-item${isSelected ? '__selected' : ''}`
|
|
42
|
-
}, displayName);
|
|
43
|
-
})));
|
|
60
|
+
value: selectedSiteOption
|
|
61
|
+
}));
|
|
44
62
|
};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl-next';
|
|
2
2
|
export const siteSelectorMessages = defineMessages({
|
|
3
|
-
|
|
4
|
-
id: 'linkDataSource.jira-issues.configmodal.
|
|
5
|
-
description: 'Label for
|
|
6
|
-
defaultMessage: '
|
|
7
|
-
},
|
|
8
|
-
selectedJiraSiteLabel: {
|
|
9
|
-
id: 'linkDataSource.jira-issues.configmodal.selectedJiraSiteLabel',
|
|
10
|
-
description: 'Label for a check icon declaring which option is selected',
|
|
11
|
-
defaultMessage: '{siteName} is selected'
|
|
3
|
+
chooseSite: {
|
|
4
|
+
id: 'linkDataSource.jira-issues.configmodal.chooseSite',
|
|
5
|
+
description: 'Label for input letting user know they have to choose a site',
|
|
6
|
+
defaultMessage: 'Choose site'
|
|
12
7
|
}
|
|
13
8
|
});
|
|
@@ -273,7 +273,6 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
273
273
|
reset();
|
|
274
274
|
void onNextPage({
|
|
275
275
|
isSchemaFromData: false,
|
|
276
|
-
// since this is not inital load, we will already have schema
|
|
277
276
|
shouldRequestFirstPage: true
|
|
278
277
|
});
|
|
279
278
|
}
|
|
@@ -225,7 +225,7 @@ var analyticsContextAttributes = {
|
|
|
225
225
|
};
|
|
226
226
|
var analyticsContextData = {
|
|
227
227
|
packageName: "@atlaskit/link-datasource",
|
|
228
|
-
packageVersion: "1.
|
|
228
|
+
packageVersion: "1.9.0",
|
|
229
229
|
source: 'datasourceConfigModal'
|
|
230
230
|
};
|
|
231
231
|
var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
|
|
@@ -1,13 +1,41 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import { jsx } from '@emotion/react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { useIntl } from 'react-intl-next';
|
|
5
5
|
import EmptyState from '@atlaskit/empty-state';
|
|
6
|
+
import { N400 } from '@atlaskit/theme/colors';
|
|
6
7
|
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
7
8
|
import { AccessRequiredSVG } from './access-required-svg';
|
|
8
9
|
import { loadingErrorMessages } from './messages';
|
|
9
|
-
|
|
10
|
-
var
|
|
10
|
+
var urlStyles = css({
|
|
11
|
+
color: "var(--ds-text-subtlest, ".concat(N400, ")"),
|
|
12
|
+
fontSize: "var(--ds-font-size-100, 14px)",
|
|
13
|
+
lineHeight: "var(--ds-font-lineHeight-200, 20px)"
|
|
14
|
+
});
|
|
15
|
+
var descriptionMessageStyles = css({
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
gap: "var(--ds-space-200, 16px)"
|
|
19
|
+
});
|
|
20
|
+
var iconContainerStyles = css({
|
|
21
|
+
marginBottom: "var(--ds-space-200, 16px)"
|
|
22
|
+
});
|
|
23
|
+
var Description = function Description(_ref) {
|
|
24
|
+
var message = _ref.message,
|
|
25
|
+
url = _ref.url;
|
|
26
|
+
return jsx("div", {
|
|
27
|
+
css: descriptionMessageStyles
|
|
28
|
+
}, jsx("span", {
|
|
29
|
+
css: urlStyles
|
|
30
|
+
}, url), jsx("span", null, message));
|
|
31
|
+
};
|
|
32
|
+
var IconContainer = function IconContainer() {
|
|
33
|
+
return jsx("div", {
|
|
34
|
+
css: iconContainerStyles
|
|
35
|
+
}, jsx(AccessRequiredSVG, null));
|
|
36
|
+
};
|
|
37
|
+
export var AccessRequired = function AccessRequired(_ref2) {
|
|
38
|
+
var url = _ref2.url;
|
|
11
39
|
var _useIntl = useIntl(),
|
|
12
40
|
formatMessage = _useIntl.formatMessage;
|
|
13
41
|
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
@@ -17,13 +45,19 @@ export var AccessRequired = function AccessRequired(_ref) {
|
|
|
17
45
|
reason: 'access'
|
|
18
46
|
});
|
|
19
47
|
}, [fireEvent]);
|
|
48
|
+
if (url) {
|
|
49
|
+
return jsx(EmptyState, {
|
|
50
|
+
header: formatMessage(loadingErrorMessages.accessRequiredWithSite),
|
|
51
|
+
description: jsx(Description, {
|
|
52
|
+
message: formatMessage(loadingErrorMessages.accessInstructions),
|
|
53
|
+
url: url
|
|
54
|
+
}),
|
|
55
|
+
renderImage: IconContainer
|
|
56
|
+
});
|
|
57
|
+
}
|
|
20
58
|
return jsx(EmptyState, {
|
|
21
|
-
header:
|
|
22
|
-
siteName: siteName
|
|
23
|
-
}) : formatMessage(loadingErrorMessages.accessRequired),
|
|
59
|
+
header: formatMessage(loadingErrorMessages.accessRequired),
|
|
24
60
|
description: formatMessage(loadingErrorMessages.accessInstructions),
|
|
25
|
-
renderImage:
|
|
26
|
-
return jsx(AccessRequiredSVG, null);
|
|
27
|
-
}
|
|
61
|
+
renderImage: IconContainer
|
|
28
62
|
});
|
|
29
63
|
};
|
|
@@ -2,8 +2,8 @@ import { defineMessages } from 'react-intl-next';
|
|
|
2
2
|
export var loadingErrorMessages = defineMessages({
|
|
3
3
|
accessInstructions: {
|
|
4
4
|
id: 'linkDataSource.jira-issues.accessInstructions',
|
|
5
|
-
description: "Instructions to let the user know they must contact
|
|
6
|
-
defaultMessage: 'To request access, contact your
|
|
5
|
+
description: "Instructions to let the user know they must contact their site administrator in order to access this site's content",
|
|
6
|
+
defaultMessage: 'To request access, contact your site administrator.'
|
|
7
7
|
},
|
|
8
8
|
accessRequired: {
|
|
9
9
|
id: 'linkDataSource.jira-issues.accessRequired',
|
|
@@ -12,8 +12,8 @@ export var loadingErrorMessages = defineMessages({
|
|
|
12
12
|
},
|
|
13
13
|
accessRequiredWithSite: {
|
|
14
14
|
id: 'linkDataSource.jira-issues.accessRequiredWithSite',
|
|
15
|
-
description: 'Message letting user know that they do not have access to the site
|
|
16
|
-
defaultMessage: "You don't have access to
|
|
15
|
+
description: 'Message letting user know that they do not have access to the site that will be listed below this message',
|
|
16
|
+
defaultMessage: "You don't have access to the following site:"
|
|
17
17
|
},
|
|
18
18
|
checkConnection: {
|
|
19
19
|
id: 'linkDataSource.jira-issues.checkConnection',
|
|
@@ -9,6 +9,7 @@ import { startUfoExperience } from '../../analytics/ufoExperiences';
|
|
|
9
9
|
import { useColumnPickerRenderedFailedUfoExperience } from '../../analytics/ufoExperiences/hooks/useColumnPickerRenderedFailedUfoExperience';
|
|
10
10
|
import { useDataRenderedUfoExperience } from '../../analytics/ufoExperiences/hooks/useDataRenderedUfoExperience';
|
|
11
11
|
import { useDatasourceTableState } from '../../hooks/useDatasourceTableState';
|
|
12
|
+
import { ScrollableContainerHeight } from '../../ui/issue-like-table/styled';
|
|
12
13
|
import { AccessRequired } from '../common/error-state/access-required';
|
|
13
14
|
import { LoadingError } from '../common/error-state/loading-error';
|
|
14
15
|
import { NoResults } from '../common/error-state/no-results';
|
|
@@ -105,7 +106,9 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
108
|
if (status === 'unauthorized') {
|
|
108
|
-
return jsx(AccessRequired,
|
|
109
|
+
return jsx(AccessRequired, {
|
|
110
|
+
url: url
|
|
111
|
+
});
|
|
109
112
|
}
|
|
110
113
|
if (status === 'rejected') {
|
|
111
114
|
return jsx(LoadingError, {
|
|
@@ -126,13 +129,12 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
126
129
|
columns: columns,
|
|
127
130
|
visibleColumnKeys: visibleColumnKeys || defaultVisibleColumnKeys,
|
|
128
131
|
onVisibleColumnKeysChange: onVisibleColumnKeysChange,
|
|
129
|
-
scrollableContainerHeight:
|
|
132
|
+
scrollableContainerHeight: ScrollableContainerHeight,
|
|
130
133
|
parentContainerRenderInstanceId: tableRenderInstanceId,
|
|
131
134
|
extensionKey: extensionKey
|
|
132
135
|
}) : jsx(EmptyState, {
|
|
133
136
|
testId: "datasource-table-view-skeleton",
|
|
134
|
-
isCompact: true
|
|
135
|
-
isLoading: !isDataReady || status === 'loading'
|
|
137
|
+
isCompact: true
|
|
136
138
|
}), jsx(TableFooter, {
|
|
137
139
|
itemCount: isDataReady ? totalCount : undefined,
|
|
138
140
|
onRefresh: forcedReset,
|