@atlaskit/link-datasource 2.0.4 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/dist/cjs/services/useAvailableSites.js +64 -0
- package/dist/cjs/ui/confluence-search-modal/modal/index.js +32 -86
- package/dist/cjs/ui/issue-like-table/utils.js +18 -1
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +37 -94
- package/dist/es2019/services/useAvailableSites.js +27 -0
- package/dist/es2019/ui/confluence-search-modal/modal/index.js +13 -37
- package/dist/es2019/ui/issue-like-table/utils.js +17 -0
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +14 -41
- package/dist/esm/services/useAvailableSites.js +57 -0
- package/dist/esm/ui/confluence-search-modal/modal/index.js +30 -84
- package/dist/esm/ui/issue-like-table/utils.js +17 -0
- package/dist/esm/ui/jira-issues-modal/modal/index.js +35 -92
- package/dist/types/services/useAvailableSites.d.ts +5 -0
- package/dist/types/ui/assets-modal/modal/index.d.ts +1 -1
- package/dist/types/ui/assets-modal/types.d.ts +4 -8
- package/dist/types/ui/confluence-search-modal/modal/index.d.ts +0 -2
- package/dist/types/ui/confluence-search-modal/types.d.ts +2 -1
- package/dist/types/ui/issue-like-table/index.d.ts +3 -3
- package/dist/types/ui/issue-like-table/utils.d.ts +6 -0
- package/dist/types/ui/jira-issues-modal/modal/index.d.ts +0 -6
- package/dist/types-ts4.5/services/useAvailableSites.d.ts +5 -0
- package/dist/types-ts4.5/ui/assets-modal/modal/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/assets-modal/types.d.ts +4 -8
- package/dist/types-ts4.5/ui/confluence-search-modal/modal/index.d.ts +0 -2
- package/dist/types-ts4.5/ui/confluence-search-modal/types.d.ts +2 -1
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +3 -3
- package/dist/types-ts4.5/ui/issue-like-table/utils.d.ts +6 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/modal/index.d.ts +0 -6
- package/package.json +4 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DatasourceAction } from '../../analytics/types';
|
|
1
2
|
export const COLUMN_BASE_WIDTH = 8;
|
|
2
3
|
export const COLUMN_MIN_WIDTH = COLUMN_BASE_WIDTH * 3;
|
|
3
4
|
/**
|
|
@@ -16,4 +17,20 @@ export const getWidthCss = ({
|
|
|
16
17
|
width
|
|
17
18
|
} : {
|
|
18
19
|
maxWidth: width
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* This method should be called when one atomic action is performed on columns: adding new item, removing one item, changing items order.
|
|
24
|
+
* The assumption is that since only one action is changed at each time, we don't have to verify the actual contents of the lists.
|
|
25
|
+
*/
|
|
26
|
+
export const getColumnAction = (oldVisibleColumnKeys, newVisibleColumnKeys) => {
|
|
27
|
+
const newColumnSize = newVisibleColumnKeys.length;
|
|
28
|
+
const oldColumnSize = oldVisibleColumnKeys.length;
|
|
29
|
+
if (newColumnSize > oldColumnSize) {
|
|
30
|
+
return DatasourceAction.COLUMN_ADDED;
|
|
31
|
+
} else if (newColumnSize < oldColumnSize) {
|
|
32
|
+
return DatasourceAction.COLUMN_REMOVED;
|
|
33
|
+
} else {
|
|
34
|
+
return DatasourceAction.COLUMN_REORDERED;
|
|
35
|
+
}
|
|
19
36
|
};
|
|
@@ -22,7 +22,7 @@ import { buildDatasourceAdf } from '../../../common/utils/adf';
|
|
|
22
22
|
import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
|
|
23
23
|
import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
|
|
24
24
|
import i18nEN from '../../../i18n/en';
|
|
25
|
-
import {
|
|
25
|
+
import { useAvailableSites } from '../../../services/useAvailableSites';
|
|
26
26
|
import { AccessRequired } from '../../common/error-state/access-required';
|
|
27
27
|
import { loadingErrorMessages } from '../../common/error-state/messages';
|
|
28
28
|
import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
|
|
@@ -38,6 +38,7 @@ import { SiteSelector } from '../../common/modal/site-selector';
|
|
|
38
38
|
import { EmptyState, IssueLikeDataTableView } from '../../issue-like-table';
|
|
39
39
|
import { useColumnResize } from '../../issue-like-table/use-column-resize';
|
|
40
40
|
import { useColumnWrapping } from '../../issue-like-table/use-column-wrapping';
|
|
41
|
+
import { getColumnAction } from '../../issue-like-table/utils';
|
|
41
42
|
import { availableBasicFilterTypes } from '../basic-filters/ui';
|
|
42
43
|
import { isQueryTooComplex } from '../basic-filters/utils/isQueryTooComplex';
|
|
43
44
|
import { JiraSearchContainer } from '../jira-search-container';
|
|
@@ -54,22 +55,6 @@ const getDisplayValue = (currentViewMode, itemCount) => {
|
|
|
54
55
|
return itemCount === 1 ? DatasourceDisplay.INLINE : DatasourceDisplay.DATASOURCE_INLINE;
|
|
55
56
|
};
|
|
56
57
|
const jqlSupportDocumentLink = 'https://support.atlassian.com/jira-service-management-cloud/docs/use-advanced-search-with-jira-query-language-jql/';
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* This method should be called when one atomic action is performed on columns: adding new item, removing one item, changing items order.
|
|
60
|
-
* The assumption is that since only one action is changed at each time, we don't have to verify the actual contents of the lists.
|
|
61
|
-
*/
|
|
62
|
-
export const getColumnAction = (oldVisibleColumnKeys, newVisibleColumnKeys) => {
|
|
63
|
-
const newColumnSize = newVisibleColumnKeys.length;
|
|
64
|
-
const oldColumnSize = oldVisibleColumnKeys.length;
|
|
65
|
-
if (newColumnSize > oldColumnSize) {
|
|
66
|
-
return DatasourceAction.COLUMN_ADDED;
|
|
67
|
-
} else if (newColumnSize < oldColumnSize) {
|
|
68
|
-
return DatasourceAction.COLUMN_REMOVED;
|
|
69
|
-
} else {
|
|
70
|
-
return DatasourceAction.COLUMN_REORDERED;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
58
|
export const PlainJiraIssuesConfigModal = props => {
|
|
74
59
|
const {
|
|
75
60
|
datasourceId,
|
|
@@ -82,9 +67,12 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
82
67
|
url: urlBeingEdited,
|
|
83
68
|
visibleColumnKeys: initialVisibleColumnKeys
|
|
84
69
|
} = props;
|
|
85
|
-
const [availableSites, setAvailableSites] = useState(undefined);
|
|
86
70
|
const [currentViewMode, setCurrentViewMode] = useState(viewMode);
|
|
87
71
|
const [cloudId, setCloudId] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId);
|
|
72
|
+
const {
|
|
73
|
+
availableSites,
|
|
74
|
+
selectedSite: selectedJiraSite
|
|
75
|
+
} = useAvailableSites('jira', cloudId);
|
|
88
76
|
const [jql, setJql] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql);
|
|
89
77
|
const [searchBarJql, setSearchBarJql] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql);
|
|
90
78
|
const [visibleColumnKeys, setVisibleColumnKeys] = useState(initialVisibleColumnKeys);
|
|
@@ -134,17 +122,6 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
134
122
|
const {
|
|
135
123
|
current: modalRenderInstanceId
|
|
136
124
|
} = useRef(uuidv4());
|
|
137
|
-
const selectedJiraSite = useMemo(() => {
|
|
138
|
-
if (cloudId) {
|
|
139
|
-
return availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(jiraSite => jiraSite.cloudId === cloudId);
|
|
140
|
-
} else {
|
|
141
|
-
let currentlyLoggedInSiteUrl;
|
|
142
|
-
if (typeof window.location !== 'undefined') {
|
|
143
|
-
currentlyLoggedInSiteUrl = window.location.origin;
|
|
144
|
-
}
|
|
145
|
-
return (availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(jiraSite => jiraSite.url === currentlyLoggedInSiteUrl)) || (availableSites === null || availableSites === void 0 ? void 0 : availableSites[0]);
|
|
146
|
-
}
|
|
147
|
-
}, [availableSites, cloudId]);
|
|
148
125
|
const analyticsPayload = useMemo(() => ({
|
|
149
126
|
extensionKey,
|
|
150
127
|
destinationObjectTypes
|
|
@@ -155,6 +132,14 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
155
132
|
const shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'table';
|
|
156
133
|
const isDataReady = (visibleColumnKeys || []).length > 0;
|
|
157
134
|
const hasNoJiraSites = availableSites && availableSites.length === 0;
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
if (availableSites) {
|
|
137
|
+
fireEvent('ui.modal.ready.datasource', {
|
|
138
|
+
instancesCount: availableSites.length,
|
|
139
|
+
schemasCount: null
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}, [fireEvent, availableSites]);
|
|
158
143
|
useEffect(() => {
|
|
159
144
|
const shouldStartUfoExperience = status === 'loading';
|
|
160
145
|
if (shouldStartUfoExperience) {
|
|
@@ -178,18 +163,6 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
178
163
|
visibleColumnCount.current = newVisibleColumnKeys.length;
|
|
179
164
|
setVisibleColumnKeys(newVisibleColumnKeys);
|
|
180
165
|
}, [initialVisibleColumnKeys, defaultVisibleColumnKeys]);
|
|
181
|
-
useEffect(() => {
|
|
182
|
-
const fetchSiteDisplayNames = async () => {
|
|
183
|
-
const jiraSites = await getAvailableSites('jira');
|
|
184
|
-
const sortedAvailableSites = [...jiraSites].sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
185
|
-
setAvailableSites(sortedAvailableSites);
|
|
186
|
-
fireEvent('ui.modal.ready.datasource', {
|
|
187
|
-
instancesCount: sortedAvailableSites.length,
|
|
188
|
-
schemasCount: null
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
|
-
void fetchSiteDisplayNames();
|
|
192
|
-
}, [fireEvent]);
|
|
193
166
|
useEffect(() => {
|
|
194
167
|
if (selectedJiraSite && (!cloudId || cloudId !== selectedJiraSite.cloudId)) {
|
|
195
168
|
setCloudId(selectedJiraSite.cloudId);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
6
|
+
import { getAvailableSites } from './getAvailableSites';
|
|
7
|
+
export var useAvailableSites = function useAvailableSites(product, cloudId) {
|
|
8
|
+
var _useState = useState(undefined),
|
|
9
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
10
|
+
availableSites = _useState2[0],
|
|
11
|
+
setAvailableSites = _useState2[1];
|
|
12
|
+
useEffect(function () {
|
|
13
|
+
var fetchSiteDisplayNames = /*#__PURE__*/function () {
|
|
14
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
15
|
+
var sites, sortedAvailableSites;
|
|
16
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
17
|
+
while (1) switch (_context.prev = _context.next) {
|
|
18
|
+
case 0:
|
|
19
|
+
_context.next = 2;
|
|
20
|
+
return getAvailableSites(product);
|
|
21
|
+
case 2:
|
|
22
|
+
sites = _context.sent;
|
|
23
|
+
sortedAvailableSites = _toConsumableArray(sites).sort(function (a, b) {
|
|
24
|
+
return a.displayName.localeCompare(b.displayName);
|
|
25
|
+
});
|
|
26
|
+
setAvailableSites(sortedAvailableSites);
|
|
27
|
+
case 5:
|
|
28
|
+
case "end":
|
|
29
|
+
return _context.stop();
|
|
30
|
+
}
|
|
31
|
+
}, _callee);
|
|
32
|
+
}));
|
|
33
|
+
return function fetchSiteDisplayNames() {
|
|
34
|
+
return _ref.apply(this, arguments);
|
|
35
|
+
};
|
|
36
|
+
}();
|
|
37
|
+
void fetchSiteDisplayNames();
|
|
38
|
+
}, [product]);
|
|
39
|
+
var selectedSite = useMemo(function () {
|
|
40
|
+
if (cloudId) {
|
|
41
|
+
return availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(function (site) {
|
|
42
|
+
return site.cloudId === cloudId;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
var currentlyLoggedInSiteUrl;
|
|
46
|
+
if (typeof window.location !== 'undefined') {
|
|
47
|
+
currentlyLoggedInSiteUrl = window.location.origin;
|
|
48
|
+
}
|
|
49
|
+
return (availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(function (site) {
|
|
50
|
+
return site.url === currentlyLoggedInSiteUrl;
|
|
51
|
+
})) || (availableSites === null || availableSites === void 0 ? void 0 : availableSites[0]);
|
|
52
|
+
}, [availableSites, cloudId]);
|
|
53
|
+
return {
|
|
54
|
+
availableSites: availableSites,
|
|
55
|
+
selectedSite: selectedSite
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
6
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
4
|
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; }
|
|
8
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
6
|
/** @jsx jsx */
|
|
@@ -26,7 +23,7 @@ import { buildDatasourceAdf } from '../../../common/utils/adf';
|
|
|
26
23
|
import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
|
|
27
24
|
import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
|
|
28
25
|
import i18nEN from '../../../i18n/en';
|
|
29
|
-
import {
|
|
26
|
+
import { useAvailableSites } from '../../../services/useAvailableSites';
|
|
30
27
|
import { AccessRequired } from '../../common/error-state/access-required';
|
|
31
28
|
import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
|
|
32
29
|
import { NoInstancesView } from '../../common/error-state/no-instances';
|
|
@@ -40,6 +37,7 @@ import { SiteSelector } from '../../common/modal/site-selector';
|
|
|
40
37
|
import { EmptyState, IssueLikeDataTableView } from '../../issue-like-table';
|
|
41
38
|
import { useColumnResize } from '../../issue-like-table/use-column-resize';
|
|
42
39
|
import { useColumnWrapping } from '../../issue-like-table/use-column-wrapping';
|
|
40
|
+
import { getColumnAction } from '../../issue-like-table/utils';
|
|
43
41
|
import ConfluenceSearchContainer from '../confluence-search-container';
|
|
44
42
|
import { ConfluenceSearchInitialStateSVG } from './confluence-search-initial-state-svg';
|
|
45
43
|
import { confluenceSearchModalMessages } from './messages';
|
|
@@ -52,19 +50,6 @@ var searchCountStyles = xcss({
|
|
|
52
50
|
flex: 1,
|
|
53
51
|
fontWeight: 600
|
|
54
52
|
});
|
|
55
|
-
|
|
56
|
-
// TODO: common functionality of all modals refactor in EDM-9573
|
|
57
|
-
export var getColumnAction = function getColumnAction(oldVisibleColumnKeys, newVisibleColumnKeys) {
|
|
58
|
-
var newColumnSize = newVisibleColumnKeys.length;
|
|
59
|
-
var oldColumnSize = oldVisibleColumnKeys.length;
|
|
60
|
-
if (newColumnSize > oldColumnSize) {
|
|
61
|
-
return DatasourceAction.COLUMN_ADDED;
|
|
62
|
-
} else if (newColumnSize < oldColumnSize) {
|
|
63
|
-
return DatasourceAction.COLUMN_REMOVED;
|
|
64
|
-
} else {
|
|
65
|
-
return DatasourceAction.COLUMN_REORDERED;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
53
|
export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConfigModal(props) {
|
|
69
54
|
var _useRef = useRef(uuidv4()),
|
|
70
55
|
modalRenderInstanceId = _useRef.current;
|
|
@@ -81,38 +66,37 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
81
66
|
_props$disableDisplay = props.disableDisplayDropdown,
|
|
82
67
|
disableDisplayDropdown = _props$disableDisplay === void 0 ? false : _props$disableDisplay,
|
|
83
68
|
overrideParameters = props.overrideParameters;
|
|
84
|
-
var _useState = useState(
|
|
69
|
+
var _useState = useState(viewMode),
|
|
85
70
|
_useState2 = _slicedToArray(_useState, 2),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
var _useState3 = useState(
|
|
71
|
+
currentViewMode = _useState2[0],
|
|
72
|
+
setCurrentViewMode = _useState2[1];
|
|
73
|
+
var _useState3 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId),
|
|
89
74
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var
|
|
75
|
+
cloudId = _useState4[0],
|
|
76
|
+
setCloudId = _useState4[1];
|
|
77
|
+
var _useAvailableSites = useAvailableSites('confluence', cloudId),
|
|
78
|
+
availableSites = _useAvailableSites.availableSites,
|
|
79
|
+
selectedConfluenceSite = _useAvailableSites.selectedSite;
|
|
80
|
+
var _useState5 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.searchString),
|
|
93
81
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
var _useState7 = useState(
|
|
82
|
+
searchString = _useState6[0],
|
|
83
|
+
setSearchString = _useState6[1];
|
|
84
|
+
var _useState7 = useState(initialVisibleColumnKeys),
|
|
97
85
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
var _useState9 = useState(
|
|
86
|
+
visibleColumnKeys = _useState8[0],
|
|
87
|
+
setVisibleColumnKeys = _useState8[1];
|
|
88
|
+
var _useState9 = useState((initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.contributorAccountIds) || []),
|
|
101
89
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
var _useState11 = useState(
|
|
105
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
106
|
-
contributorAccountIds = _useState12[0],
|
|
107
|
-
setContributorAccountIds = _useState12[1];
|
|
108
|
-
var _useState13 = useState(initialParameters !== null && initialParameters !== void 0 && initialParameters.lastModified ? {
|
|
90
|
+
contributorAccountIds = _useState10[0],
|
|
91
|
+
setContributorAccountIds = _useState10[1];
|
|
92
|
+
var _useState11 = useState(initialParameters !== null && initialParameters !== void 0 && initialParameters.lastModified ? {
|
|
109
93
|
value: initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.lastModified,
|
|
110
94
|
from: initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.lastModifiedFrom,
|
|
111
95
|
to: initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.lastModifiedTo
|
|
112
96
|
} : undefined),
|
|
113
|
-
|
|
114
|
-
lastModified =
|
|
115
|
-
setLastModified =
|
|
97
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
98
|
+
lastModified = _useState12[0],
|
|
99
|
+
setLastModified = _useState12[1];
|
|
116
100
|
|
|
117
101
|
// analytics related parameters
|
|
118
102
|
var searchCount = useRef(0);
|
|
@@ -159,21 +143,14 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
159
143
|
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
160
144
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
161
145
|
var hasNoConfluenceSites = availableSites && availableSites.length === 0;
|
|
162
|
-
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
146
|
+
useEffect(function () {
|
|
147
|
+
if (availableSites) {
|
|
148
|
+
fireEvent('ui.modal.ready.datasource', {
|
|
149
|
+
instancesCount: availableSites.length,
|
|
150
|
+
schemasCount: null
|
|
166
151
|
});
|
|
167
|
-
} else {
|
|
168
|
-
var currentlyLoggedInSiteUrl;
|
|
169
|
-
if (typeof window.location !== 'undefined') {
|
|
170
|
-
currentlyLoggedInSiteUrl = window.location.origin;
|
|
171
|
-
}
|
|
172
|
-
return (availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(function (confluenceSite) {
|
|
173
|
-
return confluenceSite.url === currentlyLoggedInSiteUrl;
|
|
174
|
-
})) || (availableSites === null || availableSites === void 0 ? void 0 : availableSites[0]);
|
|
175
152
|
}
|
|
176
|
-
}, [
|
|
153
|
+
}, [fireEvent, availableSites]);
|
|
177
154
|
useEffect(function () {
|
|
178
155
|
fireEvent('screen.datasourceModalDialog.viewed', {});
|
|
179
156
|
}, [fireEvent]);
|
|
@@ -198,37 +175,6 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
198
175
|
shouldForceRequest: true
|
|
199
176
|
});
|
|
200
177
|
}, [reset]);
|
|
201
|
-
useEffect(function () {
|
|
202
|
-
var fetchSiteDisplayNames = /*#__PURE__*/function () {
|
|
203
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
204
|
-
var confluenceSites, sortedAvailableSites;
|
|
205
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
206
|
-
while (1) switch (_context.prev = _context.next) {
|
|
207
|
-
case 0:
|
|
208
|
-
_context.next = 2;
|
|
209
|
-
return getAvailableSites('confluence');
|
|
210
|
-
case 2:
|
|
211
|
-
confluenceSites = _context.sent;
|
|
212
|
-
sortedAvailableSites = _toConsumableArray(confluenceSites).sort(function (a, b) {
|
|
213
|
-
return a.displayName.localeCompare(b.displayName);
|
|
214
|
-
});
|
|
215
|
-
setAvailableSites(sortedAvailableSites);
|
|
216
|
-
fireEvent('ui.modal.ready.datasource', {
|
|
217
|
-
instancesCount: sortedAvailableSites.length,
|
|
218
|
-
schemasCount: null
|
|
219
|
-
});
|
|
220
|
-
case 6:
|
|
221
|
-
case "end":
|
|
222
|
-
return _context.stop();
|
|
223
|
-
}
|
|
224
|
-
}, _callee);
|
|
225
|
-
}));
|
|
226
|
-
return function fetchSiteDisplayNames() {
|
|
227
|
-
return _ref.apply(this, arguments);
|
|
228
|
-
};
|
|
229
|
-
}();
|
|
230
|
-
void fetchSiteDisplayNames();
|
|
231
|
-
}, [fireEvent]);
|
|
232
178
|
useEffect(function () {
|
|
233
179
|
var newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
|
|
234
180
|
visibleColumnCount.current = newVisibleColumnKeys.length;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DatasourceAction } from '../../analytics/types';
|
|
1
2
|
export var COLUMN_BASE_WIDTH = 8;
|
|
2
3
|
export var COLUMN_MIN_WIDTH = COLUMN_BASE_WIDTH * 3;
|
|
3
4
|
/**
|
|
@@ -17,4 +18,20 @@ export var getWidthCss = function getWidthCss(_ref) {
|
|
|
17
18
|
} : {
|
|
18
19
|
maxWidth: width
|
|
19
20
|
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* This method should be called when one atomic action is performed on columns: adding new item, removing one item, changing items order.
|
|
25
|
+
* The assumption is that since only one action is changed at each time, we don't have to verify the actual contents of the lists.
|
|
26
|
+
*/
|
|
27
|
+
export var getColumnAction = function getColumnAction(oldVisibleColumnKeys, newVisibleColumnKeys) {
|
|
28
|
+
var newColumnSize = newVisibleColumnKeys.length;
|
|
29
|
+
var oldColumnSize = oldVisibleColumnKeys.length;
|
|
30
|
+
if (newColumnSize > oldColumnSize) {
|
|
31
|
+
return DatasourceAction.COLUMN_ADDED;
|
|
32
|
+
} else if (newColumnSize < oldColumnSize) {
|
|
33
|
+
return DatasourceAction.COLUMN_REMOVED;
|
|
34
|
+
} else {
|
|
35
|
+
return DatasourceAction.COLUMN_REORDERED;
|
|
36
|
+
}
|
|
20
37
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
4
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
6
4
|
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; }
|
|
7
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
6
|
/** @jsx jsx */
|
|
10
7
|
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
11
8
|
import { css, jsx } from '@emotion/react';
|
|
@@ -29,7 +26,7 @@ import { buildDatasourceAdf } from '../../../common/utils/adf';
|
|
|
29
26
|
import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
|
|
30
27
|
import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
|
|
31
28
|
import i18nEN from '../../../i18n/en';
|
|
32
|
-
import {
|
|
29
|
+
import { useAvailableSites } from '../../../services/useAvailableSites';
|
|
33
30
|
import { AccessRequired } from '../../common/error-state/access-required';
|
|
34
31
|
import { loadingErrorMessages } from '../../common/error-state/messages';
|
|
35
32
|
import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
|
|
@@ -45,6 +42,7 @@ import { SiteSelector } from '../../common/modal/site-selector';
|
|
|
45
42
|
import { EmptyState, IssueLikeDataTableView } from '../../issue-like-table';
|
|
46
43
|
import { useColumnResize } from '../../issue-like-table/use-column-resize';
|
|
47
44
|
import { useColumnWrapping } from '../../issue-like-table/use-column-wrapping';
|
|
45
|
+
import { getColumnAction } from '../../issue-like-table/utils';
|
|
48
46
|
import { availableBasicFilterTypes } from '../basic-filters/ui';
|
|
49
47
|
import { isQueryTooComplex } from '../basic-filters/utils/isQueryTooComplex';
|
|
50
48
|
import { JiraSearchContainer } from '../jira-search-container';
|
|
@@ -61,22 +59,6 @@ var getDisplayValue = function getDisplayValue(currentViewMode, itemCount) {
|
|
|
61
59
|
return itemCount === 1 ? DatasourceDisplay.INLINE : DatasourceDisplay.DATASOURCE_INLINE;
|
|
62
60
|
};
|
|
63
61
|
var jqlSupportDocumentLink = 'https://support.atlassian.com/jira-service-management-cloud/docs/use-advanced-search-with-jira-query-language-jql/';
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* This method should be called when one atomic action is performed on columns: adding new item, removing one item, changing items order.
|
|
67
|
-
* The assumption is that since only one action is changed at each time, we don't have to verify the actual contents of the lists.
|
|
68
|
-
*/
|
|
69
|
-
export var getColumnAction = function getColumnAction(oldVisibleColumnKeys, newVisibleColumnKeys) {
|
|
70
|
-
var newColumnSize = newVisibleColumnKeys.length;
|
|
71
|
-
var oldColumnSize = oldVisibleColumnKeys.length;
|
|
72
|
-
if (newColumnSize > oldColumnSize) {
|
|
73
|
-
return DatasourceAction.COLUMN_ADDED;
|
|
74
|
-
} else if (newColumnSize < oldColumnSize) {
|
|
75
|
-
return DatasourceAction.COLUMN_REMOVED;
|
|
76
|
-
} else {
|
|
77
|
-
return DatasourceAction.COLUMN_REORDERED;
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
62
|
export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
81
63
|
var datasourceId = props.datasourceId,
|
|
82
64
|
initialColumnCustomSizes = props.columnCustomSizes,
|
|
@@ -88,39 +70,38 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
88
70
|
initialParameters = props.parameters,
|
|
89
71
|
urlBeingEdited = props.url,
|
|
90
72
|
initialVisibleColumnKeys = props.visibleColumnKeys;
|
|
91
|
-
var _useState = useState(
|
|
73
|
+
var _useState = useState(viewMode),
|
|
92
74
|
_useState2 = _slicedToArray(_useState, 2),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
var _useState3 = useState(
|
|
75
|
+
currentViewMode = _useState2[0],
|
|
76
|
+
setCurrentViewMode = _useState2[1];
|
|
77
|
+
var _useState3 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId),
|
|
96
78
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
var
|
|
79
|
+
cloudId = _useState4[0],
|
|
80
|
+
setCloudId = _useState4[1];
|
|
81
|
+
var _useAvailableSites = useAvailableSites('jira', cloudId),
|
|
82
|
+
availableSites = _useAvailableSites.availableSites,
|
|
83
|
+
selectedJiraSite = _useAvailableSites.selectedSite;
|
|
84
|
+
var _useState5 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql),
|
|
100
85
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
101
|
-
|
|
102
|
-
|
|
86
|
+
jql = _useState6[0],
|
|
87
|
+
setJql = _useState6[1];
|
|
103
88
|
var _useState7 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql),
|
|
104
89
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var _useState9 = useState(
|
|
90
|
+
searchBarJql = _useState8[0],
|
|
91
|
+
setSearchBarJql = _useState8[1];
|
|
92
|
+
var _useState9 = useState(initialVisibleColumnKeys),
|
|
108
93
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
var _useState11 = useState(initialVisibleColumnKeys),
|
|
112
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
113
|
-
visibleColumnKeys = _useState12[0],
|
|
114
|
-
setVisibleColumnKeys = _useState12[1];
|
|
94
|
+
visibleColumnKeys = _useState10[0],
|
|
95
|
+
setVisibleColumnKeys = _useState10[1];
|
|
115
96
|
|
|
116
97
|
// analytics related parameters
|
|
117
98
|
var searchCount = useRef(0);
|
|
118
99
|
var userInteractionActions = useRef(new Set());
|
|
119
100
|
var initialSearchMethod = getBooleanFF('platform.linking-platform.datasource.show-jlol-basic-filters') && !isQueryTooComplex((initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql) || '') ? 'basic' : 'jql';
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
currentSearchMethod =
|
|
123
|
-
setCurrentSearchMethod =
|
|
101
|
+
var _useState11 = useState(initialSearchMethod),
|
|
102
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
103
|
+
currentSearchMethod = _useState12[0],
|
|
104
|
+
setCurrentSearchMethod = _useState12[1];
|
|
124
105
|
var searchMethodSearchedWith = useRef(null);
|
|
125
106
|
var visibleColumnCount = useRef((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
|
|
126
107
|
var basicFilterSelectionsSearchedWith = useRef({});
|
|
@@ -159,21 +140,6 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
159
140
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
160
141
|
var _useRef = useRef(uuidv4()),
|
|
161
142
|
modalRenderInstanceId = _useRef.current;
|
|
162
|
-
var selectedJiraSite = useMemo(function () {
|
|
163
|
-
if (cloudId) {
|
|
164
|
-
return availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(function (jiraSite) {
|
|
165
|
-
return jiraSite.cloudId === cloudId;
|
|
166
|
-
});
|
|
167
|
-
} else {
|
|
168
|
-
var currentlyLoggedInSiteUrl;
|
|
169
|
-
if (typeof window.location !== 'undefined') {
|
|
170
|
-
currentlyLoggedInSiteUrl = window.location.origin;
|
|
171
|
-
}
|
|
172
|
-
return (availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(function (jiraSite) {
|
|
173
|
-
return jiraSite.url === currentlyLoggedInSiteUrl;
|
|
174
|
-
})) || (availableSites === null || availableSites === void 0 ? void 0 : availableSites[0]);
|
|
175
|
-
}
|
|
176
|
-
}, [availableSites, cloudId]);
|
|
177
143
|
var analyticsPayload = useMemo(function () {
|
|
178
144
|
return {
|
|
179
145
|
extensionKey: extensionKey,
|
|
@@ -186,6 +152,14 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
186
152
|
var shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'table';
|
|
187
153
|
var isDataReady = (visibleColumnKeys || []).length > 0;
|
|
188
154
|
var hasNoJiraSites = availableSites && availableSites.length === 0;
|
|
155
|
+
useEffect(function () {
|
|
156
|
+
if (availableSites) {
|
|
157
|
+
fireEvent('ui.modal.ready.datasource', {
|
|
158
|
+
instancesCount: availableSites.length,
|
|
159
|
+
schemasCount: null
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}, [fireEvent, availableSites]);
|
|
189
163
|
useEffect(function () {
|
|
190
164
|
var shouldStartUfoExperience = status === 'loading';
|
|
191
165
|
if (shouldStartUfoExperience) {
|
|
@@ -209,37 +183,6 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
209
183
|
visibleColumnCount.current = newVisibleColumnKeys.length;
|
|
210
184
|
setVisibleColumnKeys(newVisibleColumnKeys);
|
|
211
185
|
}, [initialVisibleColumnKeys, defaultVisibleColumnKeys]);
|
|
212
|
-
useEffect(function () {
|
|
213
|
-
var fetchSiteDisplayNames = /*#__PURE__*/function () {
|
|
214
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
215
|
-
var jiraSites, sortedAvailableSites;
|
|
216
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
217
|
-
while (1) switch (_context.prev = _context.next) {
|
|
218
|
-
case 0:
|
|
219
|
-
_context.next = 2;
|
|
220
|
-
return getAvailableSites('jira');
|
|
221
|
-
case 2:
|
|
222
|
-
jiraSites = _context.sent;
|
|
223
|
-
sortedAvailableSites = _toConsumableArray(jiraSites).sort(function (a, b) {
|
|
224
|
-
return a.displayName.localeCompare(b.displayName);
|
|
225
|
-
});
|
|
226
|
-
setAvailableSites(sortedAvailableSites);
|
|
227
|
-
fireEvent('ui.modal.ready.datasource', {
|
|
228
|
-
instancesCount: sortedAvailableSites.length,
|
|
229
|
-
schemasCount: null
|
|
230
|
-
});
|
|
231
|
-
case 6:
|
|
232
|
-
case "end":
|
|
233
|
-
return _context.stop();
|
|
234
|
-
}
|
|
235
|
-
}, _callee);
|
|
236
|
-
}));
|
|
237
|
-
return function fetchSiteDisplayNames() {
|
|
238
|
-
return _ref.apply(this, arguments);
|
|
239
|
-
};
|
|
240
|
-
}();
|
|
241
|
-
void fetchSiteDisplayNames();
|
|
242
|
-
}, [fireEvent]);
|
|
243
186
|
useEffect(function () {
|
|
244
187
|
if (selectedJiraSite && (!cloudId || cloudId !== selectedJiraSite.cloudId)) {
|
|
245
188
|
setCloudId(selectedJiraSite.cloudId);
|
|
@@ -289,10 +232,10 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
289
232
|
}
|
|
290
233
|
}, [currentViewMode, status, fireIssueViewAnalytics, fireCountViewedEvent]);
|
|
291
234
|
useColumnPickerRenderedFailedUfoExperience(status, modalRenderInstanceId);
|
|
292
|
-
var onSearch = useCallback(function (newParameters,
|
|
293
|
-
var searchMethod =
|
|
294
|
-
basicFilterSelections =
|
|
295
|
-
isQueryComplex =
|
|
235
|
+
var onSearch = useCallback(function (newParameters, _ref) {
|
|
236
|
+
var searchMethod = _ref.searchMethod,
|
|
237
|
+
basicFilterSelections = _ref.basicFilterSelections,
|
|
238
|
+
isQueryComplex = _ref.isQueryComplex;
|
|
296
239
|
searchCount.current++;
|
|
297
240
|
searchMethodSearchedWith.current = searchMethod;
|
|
298
241
|
basicFilterSelectionsSearchedWith.current = basicFilterSelections;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AssetsConfigModalProps } from '../types';
|
|
2
|
+
import { type AssetsConfigModalProps } from '../types';
|
|
3
3
|
export declare const AssetsConfigModal: import("react").ForwardRefExoticComponent<AssetsConfigModalProps & import("@atlaskit/analytics-next").WithContextProps & import("react").RefAttributes<any>>;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
1
|
+
import { type DatasourceAdf, type InlineCardAdf } from '@atlaskit/linking-common/types';
|
|
2
|
+
import { type DatasourceParameters } from '@atlaskit/linking-types';
|
|
3
|
+
import { type ConfigModalProps } from '../../common/types';
|
|
3
4
|
export type AssetsDatasourceParameters = {
|
|
4
5
|
workspaceId: string;
|
|
5
6
|
aql: string;
|
|
6
7
|
schemaId: string;
|
|
7
8
|
};
|
|
8
9
|
export type AssetsDatasourceAdf = DatasourceAdf<AssetsDatasourceParameters>;
|
|
9
|
-
export interface AssetsConfigModalProps {
|
|
10
|
-
datasourceId: string;
|
|
11
|
-
visibleColumnKeys?: string[];
|
|
12
|
-
parameters?: AssetsDatasourceParameters;
|
|
13
|
-
onCancel: () => void;
|
|
14
|
-
onInsert: (adf: InlineCardAdf | AssetsDatasourceAdf, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
10
|
+
export interface AssetsConfigModalProps extends ConfigModalProps<InlineCardAdf | AssetsDatasourceAdf, DatasourceParameters | AssetsDatasourceParameters> {
|
|
15
11
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
import { DatasourceAction } from '../../../analytics/types';
|
|
4
3
|
import { type ConfluenceSearchConfigModalProps } from '../types';
|
|
5
|
-
export declare const getColumnAction: (oldVisibleColumnKeys: string[], newVisibleColumnKeys: string[]) => DatasourceAction;
|
|
6
4
|
export declare const PlainConfluenceSearchConfigModal: (props: ConfluenceSearchConfigModalProps) => jsx.JSX.Element;
|
|
7
5
|
export declare const ConfluenceSearchConfigModal: import("react").ForwardRefExoticComponent<ConfluenceSearchConfigModalProps & import("@atlaskit/analytics-next").WithContextProps & import("react").RefAttributes<any>>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type DatasourceAdf, type InlineCardAdf } from '@atlaskit/linking-common/types';
|
|
2
|
+
import type { DatasourceParameters } from '@atlaskit/linking-types';
|
|
2
3
|
import { type ConfigModalProps } from '../../common/types';
|
|
3
4
|
import { type DateRangeType } from '../common/modal/popup-select/types';
|
|
4
|
-
export interface ConfluenceSearchConfigModalProps extends ConfigModalProps<InlineCardAdf | ConfluenceSearchDatasourceAdf, ConfluenceSearchDatasourceParameters> {
|
|
5
|
+
export interface ConfluenceSearchConfigModalProps extends ConfigModalProps<InlineCardAdf | ConfluenceSearchDatasourceAdf, DatasourceParameters | ConfluenceSearchDatasourceParameters> {
|
|
5
6
|
disableDisplayDropdown?: boolean;
|
|
6
7
|
overrideParameters?: Pick<ConfluenceSearchDatasourceParameters, 'entityTypes'>;
|
|
7
8
|
}
|