@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
|
@@ -46,8 +46,11 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
46
46
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** @jsx jsx */
|
|
47
47
|
var dropdownContainerStyles = (0, _react2.css)({
|
|
48
48
|
display: 'flex',
|
|
49
|
-
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
gap: "var(--ds-space-100, 0.5rem)",
|
|
51
|
+
minHeight: '40px' // to prevent vertical shifting when site selector pops in
|
|
50
52
|
});
|
|
53
|
+
|
|
51
54
|
var contentContainerStyles = (0, _react2.css)({
|
|
52
55
|
display: 'grid',
|
|
53
56
|
maxHeight: '420px',
|
|
@@ -92,12 +95,13 @@ var getColumnAction = exports.getColumnAction = function getColumnAction(oldVisi
|
|
|
92
95
|
};
|
|
93
96
|
var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
94
97
|
var datasourceId = props.datasourceId,
|
|
95
|
-
initialParameters = props.parameters,
|
|
96
|
-
initialVisibleColumnKeys = props.visibleColumnKeys,
|
|
97
98
|
onCancel = props.onCancel,
|
|
98
99
|
onInsert = props.onInsert,
|
|
99
100
|
_props$viewMode = props.viewMode,
|
|
100
|
-
viewMode = _props$viewMode === void 0 ? 'issue' : _props$viewMode
|
|
101
|
+
viewMode = _props$viewMode === void 0 ? 'issue' : _props$viewMode,
|
|
102
|
+
initialParameters = props.parameters,
|
|
103
|
+
urlBeingEdited = props.url,
|
|
104
|
+
initialVisibleColumnKeys = props.visibleColumnKeys;
|
|
101
105
|
var _useState = (0, _react.useState)([]),
|
|
102
106
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
103
107
|
availableSites = _useState2[0],
|
|
@@ -161,11 +165,9 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
161
165
|
modalRenderInstanceId = _useRef.current;
|
|
162
166
|
var selectedJiraSite = (0, _react.useMemo)(function () {
|
|
163
167
|
if (cloudId) {
|
|
164
|
-
// if the cloud id we're editing isn't in available sites then user is likely unauthorized for that site
|
|
165
|
-
// TODO: unauthorized to edit flow https://product-fabric.atlassian.net/browse/EDM-7216
|
|
166
168
|
return availableSites.find(function (jiraSite) {
|
|
167
169
|
return jiraSite.cloudId === cloudId;
|
|
168
|
-
})
|
|
170
|
+
});
|
|
169
171
|
} else {
|
|
170
172
|
var currentlyLoggedInSiteUrl = window.location.origin;
|
|
171
173
|
return availableSites.find(function (jiraSite) {
|
|
@@ -417,12 +419,12 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
417
419
|
}));
|
|
418
420
|
}, [columns, defaultVisibleColumnKeys, handleOnNextPage, handleVisibleColumnKeysChange, hasNextPage, loadDatasourceDetails, modalRenderInstanceId, responseItems, status, visibleColumnKeys, extensionKey]);
|
|
419
421
|
var renderCountModeContent = (0, _react.useCallback)(function () {
|
|
420
|
-
var
|
|
422
|
+
var selectedJiraSiteUrl = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
|
|
421
423
|
if (status === 'unauthorized') {
|
|
422
424
|
return (0, _react2.jsx)(_accessRequired.AccessRequired, {
|
|
423
|
-
|
|
425
|
+
url: selectedJiraSiteUrl || urlBeingEdited
|
|
424
426
|
});
|
|
425
|
-
} else if (status === 'empty' || !jql || !
|
|
427
|
+
} else if (status === 'empty' || !jql || !selectedJiraSiteUrl) {
|
|
426
428
|
return (0, _react2.jsx)("div", {
|
|
427
429
|
css: smartLinkContainerStyles
|
|
428
430
|
}, (0, _react2.jsx)("span", {
|
|
@@ -430,22 +432,23 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
430
432
|
css: placeholderSmartLinkStyles
|
|
431
433
|
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.modalMessages.issuesCountSmartCardPlaceholderText)));
|
|
432
434
|
} else {
|
|
433
|
-
var urlWithEncodedJql = "".concat(
|
|
435
|
+
var urlWithEncodedJql = "".concat(selectedJiraSiteUrl, "/issues/?jql=").concat(encodeURI(jql));
|
|
434
436
|
return (0, _react2.jsx)("div", {
|
|
435
437
|
css: smartLinkContainerStyles
|
|
436
438
|
}, (0, _react2.jsx)(_link.default, {
|
|
437
439
|
url: urlWithEncodedJql
|
|
438
440
|
}));
|
|
439
441
|
}
|
|
440
|
-
}, [jql, selectedJiraSite, status]);
|
|
442
|
+
}, [jql, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited]);
|
|
441
443
|
var renderIssuesModeContent = (0, _react.useCallback)(function () {
|
|
444
|
+
var selectedJiraSiteUrl = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
|
|
442
445
|
if (status === 'rejected' && jqlUrl) {
|
|
443
446
|
return (0, _react2.jsx)(_modalLoadingError.ModalLoadingError, {
|
|
444
447
|
url: jqlUrl
|
|
445
448
|
});
|
|
446
449
|
} else if (status === 'unauthorized') {
|
|
447
450
|
return (0, _react2.jsx)(_accessRequired.AccessRequired, {
|
|
448
|
-
|
|
451
|
+
url: selectedJiraSiteUrl || urlBeingEdited
|
|
449
452
|
});
|
|
450
453
|
} else if (resolvedWithNoResults) {
|
|
451
454
|
return (0, _react2.jsx)(_noResults.NoResults, null);
|
|
@@ -454,8 +457,7 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
454
457
|
return (0, _react2.jsx)("div", {
|
|
455
458
|
css: contentContainerStyles
|
|
456
459
|
}, !!jql ? (0, _react2.jsx)(_issueLikeTable.EmptyState, {
|
|
457
|
-
testId: "jira-jql-datasource-modal--empty-state"
|
|
458
|
-
isLoading: true
|
|
460
|
+
testId: "jira-jql-datasource-modal--empty-state"
|
|
459
461
|
}) : (0, _react2.jsx)(_initialStateView.InitialStateView, {
|
|
460
462
|
searchMethod: currentSearchMethod
|
|
461
463
|
}));
|
|
@@ -469,24 +471,20 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
469
471
|
}));
|
|
470
472
|
}
|
|
471
473
|
return issueLikeDataTableView;
|
|
472
|
-
}, [
|
|
474
|
+
}, [columns.length, currentSearchMethod, issueLikeDataTableView, jql, jqlUrl, resolvedWithNoResults, responseItems.length, retrieveUrlForSmartCardRender, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited]);
|
|
473
475
|
return (0, _react2.jsx)(_modalDialog.ModalTransition, null, (0, _react2.jsx)(_modalDialog.default, {
|
|
474
|
-
testId:
|
|
476
|
+
testId: "jira-jql-datasource-modal",
|
|
475
477
|
onClose: onCancel,
|
|
476
478
|
width: "calc(100% - 80px)",
|
|
477
479
|
shouldScrollInViewport: true
|
|
478
|
-
}, (0, _react2.jsx)(_modalDialog.ModalHeader, null, (0, _react2.jsx)(_modalDialog.ModalTitle, null,
|
|
480
|
+
}, (0, _react2.jsx)(_modalDialog.ModalHeader, null, (0, _react2.jsx)(_modalDialog.ModalTitle, null, (0, _react2.jsx)("div", {
|
|
479
481
|
css: dropdownContainerStyles
|
|
480
|
-
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, (0,
|
|
481
|
-
values: {
|
|
482
|
-
siteName: selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.displayName
|
|
483
|
-
}
|
|
484
|
-
})), (0, _react2.jsx)(_siteSelector.JiraSiteSelector, {
|
|
485
|
-
testId: "jira-jql-datasource-modal--site-selector",
|
|
482
|
+
}, availableSites.length < 2 ? (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.modalMessages.insertIssuesTitle) : (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.modalMessages.insertIssuesTitleManySites), (0, _react2.jsx)(_siteSelector.JiraSiteSelector, {
|
|
486
483
|
availableSites: availableSites,
|
|
487
484
|
onSiteSelection: onSiteSelection,
|
|
488
|
-
selectedJiraSite: selectedJiraSite
|
|
489
|
-
|
|
485
|
+
selectedJiraSite: selectedJiraSite,
|
|
486
|
+
testId: "jira-jql-datasource-modal--site-selector"
|
|
487
|
+
})))), (0, _react2.jsx)(_modeSwitcher.ModeSwitcher, {
|
|
490
488
|
isCompact: true,
|
|
491
489
|
options: [{
|
|
492
490
|
label: formatMessage(_messages.modalMessages.issueViewModeLabel),
|
|
@@ -526,7 +524,7 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
526
524
|
appearance: "primary",
|
|
527
525
|
onClick: onInsertPressed,
|
|
528
526
|
isDisabled: isInsertDisabled,
|
|
529
|
-
testId:
|
|
527
|
+
testId: "jira-jql-datasource-modal--insert-button"
|
|
530
528
|
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.modalMessages.insertIssuesButtonText)))));
|
|
531
529
|
};
|
|
532
530
|
var analyticsContextAttributes = {
|
|
@@ -23,8 +23,8 @@ var modalMessages = exports.modalMessages = (0, _reactIntlNext.defineMessages)({
|
|
|
23
23
|
},
|
|
24
24
|
insertIssuesTitleManySites: {
|
|
25
25
|
id: 'linkDataSource.jira-issues.configmodal.insertIssuesTitleManySites',
|
|
26
|
-
description: 'Title for the Jira Issues
|
|
27
|
-
defaultMessage: 'Insert Jira issues from
|
|
26
|
+
description: 'Title for the Jira Issues modal when a user has to select a site to inserting issues from',
|
|
27
|
+
defaultMessage: 'Insert Jira issues from'
|
|
28
28
|
},
|
|
29
29
|
issueViewModeLabel: {
|
|
30
30
|
id: 'linkDataSource.jira-issues.configmodal.issueViewModeLabel',
|
|
@@ -1,55 +1,77 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.JiraSiteSelector = void 0;
|
|
9
|
-
var
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var _react = require("
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _react2 = require("@emotion/react");
|
|
12
12
|
var _reactIntlNext = require("react-intl-next");
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
|
|
13
|
+
var _select = _interopRequireDefault(require("@atlaskit/select"));
|
|
14
|
+
var _zindex = require("../../../common/zindex");
|
|
16
15
|
var _messages = require("./messages");
|
|
17
|
-
var _excluded = ["
|
|
16
|
+
var _excluded = ["width"];
|
|
18
17
|
/** @jsx jsx */
|
|
19
|
-
function
|
|
20
|
-
function
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
var selectStyles = (0, _react2.css)({
|
|
21
|
+
fontSize: "var(--ds-font-size-100, 14px)",
|
|
22
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
23
|
+
lineHeight: "var(--ds-font-lineHeight-200, 20px)",
|
|
24
|
+
zIndex: _zindex.siteSelectorIndex
|
|
25
|
+
});
|
|
21
26
|
var JiraSiteSelector = exports.JiraSiteSelector = function JiraSiteSelector(props) {
|
|
22
27
|
var availableSites = props.availableSites,
|
|
23
28
|
onSiteSelection = props.onSiteSelection,
|
|
24
29
|
selectedJiraSite = props.selectedJiraSite,
|
|
25
30
|
testId = props.testId;
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
testId: "".concat(testId, "--trigger"),
|
|
35
|
-
spacing: "none",
|
|
36
|
-
iconBefore: (0, _react.jsx)(_chevronDown.default, {
|
|
37
|
-
label: intl.formatMessage(_messages.siteSelectorMessages.dropdownChevronLabel)
|
|
38
|
-
}),
|
|
39
|
-
ref: triggerRef
|
|
40
|
-
}));
|
|
31
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
32
|
+
formatMessage = _useIntl.formatMessage;
|
|
33
|
+
var onChange = function onChange(newValue) {
|
|
34
|
+
var selectedSite = availableSites.find(function (site) {
|
|
35
|
+
return site.cloudId === (newValue === null || newValue === void 0 ? void 0 : newValue.value);
|
|
36
|
+
});
|
|
37
|
+
if (selectedSite) {
|
|
38
|
+
onSiteSelection(selectedSite);
|
|
41
39
|
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
40
|
+
};
|
|
41
|
+
var availableSitesOptions = (0, _react.useMemo)(function () {
|
|
42
|
+
return availableSites.map(function (site) {
|
|
43
|
+
return {
|
|
44
|
+
label: site.displayName,
|
|
45
|
+
value: site.cloudId
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
}, [availableSites]);
|
|
49
|
+
var selectedSiteOption = selectedJiraSite && {
|
|
50
|
+
label: selectedJiraSite.displayName,
|
|
51
|
+
value: selectedJiraSite.cloudId
|
|
52
|
+
};
|
|
53
|
+
return (0, _react2.jsx)("span", {
|
|
54
|
+
"data-testid": "".concat(testId, "--trigger")
|
|
55
|
+
}, (0, _react2.jsx)(_select.default, {
|
|
56
|
+
css: selectStyles,
|
|
57
|
+
classNamePrefix: testId,
|
|
58
|
+
isLoading: availableSites.length === 0,
|
|
59
|
+
onChange: onChange,
|
|
60
|
+
options: availableSitesOptions,
|
|
61
|
+
placeholder: formatMessage(_messages.siteSelectorMessages.chooseSite),
|
|
62
|
+
styles: {
|
|
63
|
+
// prevents the popup menu with available sites from being too narrow
|
|
64
|
+
// if the selected site is much shorter than the other options
|
|
65
|
+
menu: function menu(_ref) {
|
|
66
|
+
var width = _ref.width,
|
|
67
|
+
css = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
68
|
+
return _objectSpread(_objectSpread({}, css), {}, {
|
|
69
|
+
minWidth: '100%',
|
|
70
|
+
width: 'max-content'
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
testId: testId,
|
|
75
|
+
value: selectedSiteOption
|
|
76
|
+
}));
|
|
55
77
|
};
|
|
@@ -6,14 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.siteSelectorMessages = void 0;
|
|
7
7
|
var _reactIntlNext = require("react-intl-next");
|
|
8
8
|
var siteSelectorMessages = exports.siteSelectorMessages = (0, _reactIntlNext.defineMessages)({
|
|
9
|
-
|
|
10
|
-
id: 'linkDataSource.jira-issues.configmodal.
|
|
11
|
-
description: 'Label for
|
|
12
|
-
defaultMessage: '
|
|
13
|
-
},
|
|
14
|
-
selectedJiraSiteLabel: {
|
|
15
|
-
id: 'linkDataSource.jira-issues.configmodal.selectedJiraSiteLabel',
|
|
16
|
-
description: 'Label for a check icon declaring which option is selected',
|
|
17
|
-
defaultMessage: '{siteName} is selected'
|
|
9
|
+
chooseSite: {
|
|
10
|
+
id: 'linkDataSource.jira-issues.configmodal.chooseSite',
|
|
11
|
+
description: 'Label for input letting user know they have to choose a site',
|
|
12
|
+
defaultMessage: 'Choose site'
|
|
18
13
|
}
|
|
19
14
|
});
|
|
@@ -1,13 +1,40 @@
|
|
|
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';
|
|
10
|
+
const urlStyles = css({
|
|
11
|
+
color: `var(--ds-text-subtlest, ${N400})`,
|
|
12
|
+
fontSize: "var(--ds-font-size-100, 14px)",
|
|
13
|
+
lineHeight: "var(--ds-font-lineHeight-200, 20px)"
|
|
14
|
+
});
|
|
15
|
+
const descriptionMessageStyles = css({
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
gap: "var(--ds-space-200, 16px)"
|
|
19
|
+
});
|
|
20
|
+
const iconContainerStyles = css({
|
|
21
|
+
marginBottom: "var(--ds-space-200, 16px)"
|
|
22
|
+
});
|
|
23
|
+
const Description = ({
|
|
24
|
+
message,
|
|
25
|
+
url
|
|
26
|
+
}) => {
|
|
27
|
+
return jsx("div", {
|
|
28
|
+
css: descriptionMessageStyles
|
|
29
|
+
}, jsx("span", {
|
|
30
|
+
css: urlStyles
|
|
31
|
+
}, url), jsx("span", null, message));
|
|
32
|
+
};
|
|
33
|
+
const IconContainer = () => jsx("div", {
|
|
34
|
+
css: iconContainerStyles
|
|
35
|
+
}, jsx(AccessRequiredSVG, null));
|
|
9
36
|
export const AccessRequired = ({
|
|
10
|
-
|
|
37
|
+
url
|
|
11
38
|
}) => {
|
|
12
39
|
const {
|
|
13
40
|
formatMessage
|
|
@@ -20,11 +47,19 @@ export const AccessRequired = ({
|
|
|
20
47
|
reason: 'access'
|
|
21
48
|
});
|
|
22
49
|
}, [fireEvent]);
|
|
50
|
+
if (url) {
|
|
51
|
+
return jsx(EmptyState, {
|
|
52
|
+
header: formatMessage(loadingErrorMessages.accessRequiredWithSite),
|
|
53
|
+
description: jsx(Description, {
|
|
54
|
+
message: formatMessage(loadingErrorMessages.accessInstructions),
|
|
55
|
+
url: url
|
|
56
|
+
}),
|
|
57
|
+
renderImage: IconContainer
|
|
58
|
+
});
|
|
59
|
+
}
|
|
23
60
|
return jsx(EmptyState, {
|
|
24
|
-
header:
|
|
25
|
-
siteName
|
|
26
|
-
}) : formatMessage(loadingErrorMessages.accessRequired),
|
|
61
|
+
header: formatMessage(loadingErrorMessages.accessRequired),
|
|
27
62
|
description: formatMessage(loadingErrorMessages.accessInstructions),
|
|
28
|
-
renderImage:
|
|
63
|
+
renderImage: IconContainer
|
|
29
64
|
});
|
|
30
65
|
};
|
|
@@ -2,8 +2,8 @@ import { defineMessages } from 'react-intl-next';
|
|
|
2
2
|
export const 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 const 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';
|
|
@@ -108,7 +109,9 @@ const DatasourceTableViewWithoutAnalytics = ({
|
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
111
|
if (status === 'unauthorized') {
|
|
111
|
-
return jsx(AccessRequired,
|
|
112
|
+
return jsx(AccessRequired, {
|
|
113
|
+
url: url
|
|
114
|
+
});
|
|
112
115
|
}
|
|
113
116
|
if (status === 'rejected') {
|
|
114
117
|
return jsx(LoadingError, {
|
|
@@ -129,13 +132,12 @@ const DatasourceTableViewWithoutAnalytics = ({
|
|
|
129
132
|
columns: columns,
|
|
130
133
|
visibleColumnKeys: visibleColumnKeys || defaultVisibleColumnKeys,
|
|
131
134
|
onVisibleColumnKeysChange: onVisibleColumnKeysChange,
|
|
132
|
-
scrollableContainerHeight:
|
|
135
|
+
scrollableContainerHeight: ScrollableContainerHeight,
|
|
133
136
|
parentContainerRenderInstanceId: tableRenderInstanceId,
|
|
134
137
|
extensionKey: extensionKey
|
|
135
138
|
}) : jsx(EmptyState, {
|
|
136
139
|
testId: "datasource-table-view-skeleton",
|
|
137
|
-
isCompact: true
|
|
138
|
-
isLoading: !isDataReady || status === 'loading'
|
|
140
|
+
isCompact: true
|
|
139
141
|
}), jsx(TableFooter, {
|
|
140
142
|
itemCount: isDataReady ? totalCount : undefined,
|
|
141
143
|
onRefresh: forcedReset,
|
|
@@ -1,25 +1,38 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/react';
|
|
3
3
|
import { Skeleton } from '@atlaskit/linking-common';
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { ScrollableContainerHeight, TableHeading } from '../styled';
|
|
5
|
+
const SkeletonComponent = ({
|
|
6
|
+
width,
|
|
7
|
+
itemName
|
|
8
|
+
}) => jsx(Skeleton, {
|
|
9
|
+
borderRadius: 8,
|
|
10
|
+
testId: `${itemName}-empty-state-skeleton`,
|
|
11
|
+
height: 14,
|
|
12
|
+
width: width
|
|
13
|
+
});
|
|
14
|
+
const tableSidePadding = "var(--ds-space-200, 16px)";
|
|
8
15
|
const tableBodyStyles = css({
|
|
9
16
|
borderBottom: 0
|
|
10
17
|
});
|
|
18
|
+
const cellStyles = css({
|
|
19
|
+
paddingBlock: "var(--ds-space-100, 12px)",
|
|
20
|
+
'&:last-child': {
|
|
21
|
+
paddingRight: "var(--ds-space-100, 8px)"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
11
24
|
const baseColumns = [{
|
|
12
25
|
key: 'type',
|
|
13
|
-
width:
|
|
26
|
+
width: 35
|
|
14
27
|
}, {
|
|
15
28
|
key: 'issue',
|
|
16
29
|
width: 50
|
|
17
30
|
}, {
|
|
18
31
|
key: 'summary',
|
|
19
|
-
width:
|
|
32
|
+
width: 100
|
|
20
33
|
}, {
|
|
21
34
|
key: 'assignee',
|
|
22
|
-
width:
|
|
35
|
+
width: 70
|
|
23
36
|
}, {
|
|
24
37
|
key: 'priority',
|
|
25
38
|
width: 60
|
|
@@ -36,91 +49,65 @@ const baseColumns = [{
|
|
|
36
49
|
key: 'due',
|
|
37
50
|
width: 50
|
|
38
51
|
}];
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const summaryColumnWidths = [141, 208, 186, 212, 212, 151, 212, 182, 180, 147];
|
|
42
|
-
const statusColumnWidths = [75, 54, 66, 73, 52, 73, 55, 80, 66, 59];
|
|
43
|
-
const rows = new Array(10).fill(null).map((_, index) => ({
|
|
44
|
-
id: index,
|
|
45
|
-
priority: priorities[index],
|
|
46
|
-
type: types[index],
|
|
47
|
-
summaryWidth: summaryColumnWidths[index],
|
|
48
|
-
statusWidth: statusColumnWidths[index]
|
|
49
|
-
}));
|
|
50
|
-
const cellStyles = css({
|
|
51
|
-
'&:first-child': {
|
|
52
|
-
paddingLeft: "var(--ds-space-100, 8px)"
|
|
53
|
-
},
|
|
54
|
-
'&:last-child': {
|
|
55
|
-
paddingRight: "var(--ds-space-100, 8px)"
|
|
56
|
-
}
|
|
57
|
-
});
|
|
52
|
+
const longColumnWidths = [141, 208, 186, 212, 212, 151, 212, 182, 180, 163, 172, 211, 145, 190];
|
|
53
|
+
const shortColumnWidths = [75, 54, 66, 73, 52, 73, 55, 80, 67, 76, 58, 65, 56, 76];
|
|
58
54
|
const renderItem = ({
|
|
59
55
|
key,
|
|
60
56
|
width
|
|
61
57
|
}, {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
statusWidth
|
|
66
|
-
}, isShimmering) => {
|
|
58
|
+
longWidth,
|
|
59
|
+
shortWidth
|
|
60
|
+
}) => {
|
|
67
61
|
switch (key) {
|
|
68
|
-
case '
|
|
69
|
-
return jsx(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
height: 13,
|
|
73
|
-
isShimmering: isShimmering,
|
|
74
|
-
width: width
|
|
75
|
-
}));
|
|
76
|
-
case 'priority':
|
|
77
|
-
return jsx(Priority, {
|
|
78
|
-
priority: priority
|
|
79
|
-
});
|
|
80
|
-
case 'type':
|
|
81
|
-
return jsx(Type, {
|
|
82
|
-
type: type
|
|
62
|
+
case 'status':
|
|
63
|
+
return jsx(SkeletonComponent, {
|
|
64
|
+
width: shortWidth,
|
|
65
|
+
itemName: key
|
|
83
66
|
});
|
|
84
67
|
case 'summary':
|
|
85
|
-
return jsx(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
testId: "empty-state-skeleton",
|
|
89
|
-
height: 13,
|
|
90
|
-
isShimmering: isShimmering,
|
|
91
|
-
width: summaryWidth
|
|
92
|
-
});
|
|
93
|
-
case 'status':
|
|
94
|
-
return jsx(Skeleton, {
|
|
95
|
-
appearance: "blue",
|
|
96
|
-
borderRadius: 3,
|
|
97
|
-
testId: "empty-state-skeleton",
|
|
98
|
-
height: 16,
|
|
99
|
-
isShimmering: isShimmering,
|
|
100
|
-
width: statusWidth
|
|
68
|
+
return jsx(SkeletonComponent, {
|
|
69
|
+
width: longWidth,
|
|
70
|
+
itemName: key
|
|
101
71
|
});
|
|
102
72
|
default:
|
|
103
|
-
return jsx(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
height: 13,
|
|
107
|
-
isShimmering: isShimmering,
|
|
108
|
-
width: width
|
|
73
|
+
return jsx(SkeletonComponent, {
|
|
74
|
+
width: width,
|
|
75
|
+
itemName: key
|
|
109
76
|
});
|
|
110
77
|
}
|
|
111
78
|
};
|
|
112
79
|
export default (({
|
|
113
80
|
isCompact,
|
|
114
|
-
isLoading = false,
|
|
115
81
|
testId
|
|
116
82
|
}) => {
|
|
117
83
|
const columnsToRender = isCompact ? baseColumns.slice(0, 6) : baseColumns;
|
|
118
|
-
|
|
84
|
+
// if it is compact (non-modal), there is room for 14 rows
|
|
85
|
+
// if it is modal (not compact), there is only room for 10 rows
|
|
86
|
+
const rowsNumber = isCompact ? 14 : 10;
|
|
87
|
+
const rows = new Array(rowsNumber).fill(null).map((_, index) => ({
|
|
88
|
+
id: index,
|
|
89
|
+
longWidth: longColumnWidths[index],
|
|
90
|
+
shortWidth: shortColumnWidths[index]
|
|
91
|
+
}));
|
|
92
|
+
return jsx("div", {
|
|
93
|
+
style: {
|
|
94
|
+
// the IssueLikeDataTableView wraps the table in a container with the styling below while modal doesn't
|
|
95
|
+
// the isCompact prop is applied to non-modal empty states which require additional padding
|
|
96
|
+
// this maxHeight comes from scrollableContainerHeight
|
|
97
|
+
maxHeight: ScrollableContainerHeight,
|
|
98
|
+
padding: isCompact ? `0 ${tableSidePadding} 0 ${tableSidePadding}` : '0',
|
|
99
|
+
boxSizing: 'border-box'
|
|
100
|
+
}
|
|
101
|
+
}, jsx("table", {
|
|
119
102
|
"data-testid": testId
|
|
120
|
-
}, jsx("thead",
|
|
103
|
+
}, jsx("thead", {
|
|
104
|
+
style: {
|
|
105
|
+
borderBottom: 0
|
|
106
|
+
}
|
|
107
|
+
}, jsx("tr", null, columnsToRender.map(({
|
|
121
108
|
key,
|
|
122
109
|
width
|
|
123
|
-
}) => jsx(
|
|
110
|
+
}) => jsx(TableHeading, {
|
|
124
111
|
key: key,
|
|
125
112
|
style: {
|
|
126
113
|
width
|
|
@@ -129,8 +116,7 @@ export default (({
|
|
|
129
116
|
appearance: "darkGray",
|
|
130
117
|
borderRadius: 8,
|
|
131
118
|
testId: "empty-state-skeleton",
|
|
132
|
-
|
|
133
|
-
height: 13,
|
|
119
|
+
height: 12,
|
|
134
120
|
width: width
|
|
135
121
|
}))))), jsx("tbody", {
|
|
136
122
|
css: tableBodyStyles
|
|
@@ -139,5 +125,5 @@ export default (({
|
|
|
139
125
|
}, columnsToRender.map(column => jsx("td", {
|
|
140
126
|
css: cellStyles,
|
|
141
127
|
key: column.key
|
|
142
|
-
}, renderItem(column, row
|
|
128
|
+
}, renderItem(column, row))))))));
|
|
143
129
|
});
|