@atlaskit/link-datasource 2.1.0 → 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 +10 -0
- package/dist/cjs/services/useAvailableSites.js +64 -0
- package/dist/cjs/ui/confluence-search-modal/modal/index.js +29 -71
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +34 -76
- package/dist/es2019/services/useAvailableSites.js +27 -0
- package/dist/es2019/ui/confluence-search-modal/modal/index.js +12 -24
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +13 -25
- package/dist/esm/services/useAvailableSites.js +57 -0
- package/dist/esm/ui/confluence-search-modal/modal/index.js +29 -71
- package/dist/esm/ui/jira-issues-modal/modal/index.js +34 -76
- package/dist/types/services/useAvailableSites.d.ts +5 -0
- package/dist/types/ui/issue-like-table/index.d.ts +3 -3
- package/dist/types-ts4.5/services/useAvailableSites.d.ts +5 -0
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +3 -3
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#97731](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97731)
|
|
8
|
+
[`3c244075bbb8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3c244075bbb8) -
|
|
9
|
+
Minor refactor to site picker for Jira and Confluence site picker. No expected functional
|
|
10
|
+
changes.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 2.1.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useAvailableSites = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
var _getAvailableSites = require("./getAvailableSites");
|
|
14
|
+
var useAvailableSites = exports.useAvailableSites = function useAvailableSites(product, cloudId) {
|
|
15
|
+
var _useState = (0, _react.useState)(undefined),
|
|
16
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
17
|
+
availableSites = _useState2[0],
|
|
18
|
+
setAvailableSites = _useState2[1];
|
|
19
|
+
(0, _react.useEffect)(function () {
|
|
20
|
+
var fetchSiteDisplayNames = /*#__PURE__*/function () {
|
|
21
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
22
|
+
var sites, sortedAvailableSites;
|
|
23
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
24
|
+
while (1) switch (_context.prev = _context.next) {
|
|
25
|
+
case 0:
|
|
26
|
+
_context.next = 2;
|
|
27
|
+
return (0, _getAvailableSites.getAvailableSites)(product);
|
|
28
|
+
case 2:
|
|
29
|
+
sites = _context.sent;
|
|
30
|
+
sortedAvailableSites = (0, _toConsumableArray2.default)(sites).sort(function (a, b) {
|
|
31
|
+
return a.displayName.localeCompare(b.displayName);
|
|
32
|
+
});
|
|
33
|
+
setAvailableSites(sortedAvailableSites);
|
|
34
|
+
case 5:
|
|
35
|
+
case "end":
|
|
36
|
+
return _context.stop();
|
|
37
|
+
}
|
|
38
|
+
}, _callee);
|
|
39
|
+
}));
|
|
40
|
+
return function fetchSiteDisplayNames() {
|
|
41
|
+
return _ref.apply(this, arguments);
|
|
42
|
+
};
|
|
43
|
+
}();
|
|
44
|
+
void fetchSiteDisplayNames();
|
|
45
|
+
}, [product]);
|
|
46
|
+
var selectedSite = (0, _react.useMemo)(function () {
|
|
47
|
+
if (cloudId) {
|
|
48
|
+
return availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(function (site) {
|
|
49
|
+
return site.cloudId === cloudId;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
var currentlyLoggedInSiteUrl;
|
|
53
|
+
if (typeof window.location !== 'undefined') {
|
|
54
|
+
currentlyLoggedInSiteUrl = window.location.origin;
|
|
55
|
+
}
|
|
56
|
+
return (availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(function (site) {
|
|
57
|
+
return site.url === currentlyLoggedInSiteUrl;
|
|
58
|
+
})) || (availableSites === null || availableSites === void 0 ? void 0 : availableSites[0]);
|
|
59
|
+
}, [availableSites, cloudId]);
|
|
60
|
+
return {
|
|
61
|
+
availableSites: availableSites,
|
|
62
|
+
selectedSite: selectedSite
|
|
63
|
+
};
|
|
64
|
+
};
|
|
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.PlainConfluenceSearchConfigModal = exports.ConfluenceSearchConfigModal = void 0;
|
|
9
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
12
|
var _react = require("react");
|
|
@@ -31,7 +28,7 @@ var _adf = require("../../../common/utils/adf");
|
|
|
31
28
|
var _fetchMessagesForLocale = require("../../../common/utils/locale/fetch-messages-for-locale");
|
|
32
29
|
var _useDatasourceTableState = require("../../../hooks/useDatasourceTableState");
|
|
33
30
|
var _en = _interopRequireDefault(require("../../../i18n/en"));
|
|
34
|
-
var
|
|
31
|
+
var _useAvailableSites2 = require("../../../services/useAvailableSites");
|
|
35
32
|
var _accessRequired = require("../../common/error-state/access-required");
|
|
36
33
|
var _modalLoadingError = require("../../common/error-state/modal-loading-error");
|
|
37
34
|
var _noInstances = require("../../common/error-state/no-instances");
|
|
@@ -78,38 +75,37 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
78
75
|
_props$disableDisplay = props.disableDisplayDropdown,
|
|
79
76
|
disableDisplayDropdown = _props$disableDisplay === void 0 ? false : _props$disableDisplay,
|
|
80
77
|
overrideParameters = props.overrideParameters;
|
|
81
|
-
var _useState = (0, _react.useState)(
|
|
78
|
+
var _useState = (0, _react.useState)(viewMode),
|
|
82
79
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var _useState3 = (0, _react.useState)(
|
|
80
|
+
currentViewMode = _useState2[0],
|
|
81
|
+
setCurrentViewMode = _useState2[1];
|
|
82
|
+
var _useState3 = (0, _react.useState)(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId),
|
|
86
83
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var
|
|
84
|
+
cloudId = _useState4[0],
|
|
85
|
+
setCloudId = _useState4[1];
|
|
86
|
+
var _useAvailableSites = (0, _useAvailableSites2.useAvailableSites)('confluence', cloudId),
|
|
87
|
+
availableSites = _useAvailableSites.availableSites,
|
|
88
|
+
selectedConfluenceSite = _useAvailableSites.selectedSite;
|
|
89
|
+
var _useState5 = (0, _react.useState)(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.searchString),
|
|
90
90
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var _useState7 = (0, _react.useState)(
|
|
91
|
+
searchString = _useState6[0],
|
|
92
|
+
setSearchString = _useState6[1];
|
|
93
|
+
var _useState7 = (0, _react.useState)(initialVisibleColumnKeys),
|
|
94
94
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var _useState9 = (0, _react.useState)(
|
|
95
|
+
visibleColumnKeys = _useState8[0],
|
|
96
|
+
setVisibleColumnKeys = _useState8[1];
|
|
97
|
+
var _useState9 = (0, _react.useState)((initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.contributorAccountIds) || []),
|
|
98
98
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var _useState11 = (0, _react.useState)(
|
|
102
|
-
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
103
|
-
contributorAccountIds = _useState12[0],
|
|
104
|
-
setContributorAccountIds = _useState12[1];
|
|
105
|
-
var _useState13 = (0, _react.useState)(initialParameters !== null && initialParameters !== void 0 && initialParameters.lastModified ? {
|
|
99
|
+
contributorAccountIds = _useState10[0],
|
|
100
|
+
setContributorAccountIds = _useState10[1];
|
|
101
|
+
var _useState11 = (0, _react.useState)(initialParameters !== null && initialParameters !== void 0 && initialParameters.lastModified ? {
|
|
106
102
|
value: initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.lastModified,
|
|
107
103
|
from: initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.lastModifiedFrom,
|
|
108
104
|
to: initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.lastModifiedTo
|
|
109
105
|
} : undefined),
|
|
110
|
-
|
|
111
|
-
lastModified =
|
|
112
|
-
setLastModified =
|
|
106
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
107
|
+
lastModified = _useState12[0],
|
|
108
|
+
setLastModified = _useState12[1];
|
|
113
109
|
|
|
114
110
|
// analytics related parameters
|
|
115
111
|
var searchCount = (0, _react.useRef)(0);
|
|
@@ -156,21 +152,14 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
156
152
|
var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
|
|
157
153
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
158
154
|
var hasNoConfluenceSites = availableSites && availableSites.length === 0;
|
|
159
|
-
|
|
160
|
-
if (
|
|
161
|
-
|
|
162
|
-
|
|
155
|
+
(0, _react.useEffect)(function () {
|
|
156
|
+
if (availableSites) {
|
|
157
|
+
fireEvent('ui.modal.ready.datasource', {
|
|
158
|
+
instancesCount: availableSites.length,
|
|
159
|
+
schemasCount: null
|
|
163
160
|
});
|
|
164
|
-
} else {
|
|
165
|
-
var currentlyLoggedInSiteUrl;
|
|
166
|
-
if (typeof window.location !== 'undefined') {
|
|
167
|
-
currentlyLoggedInSiteUrl = window.location.origin;
|
|
168
|
-
}
|
|
169
|
-
return (availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(function (confluenceSite) {
|
|
170
|
-
return confluenceSite.url === currentlyLoggedInSiteUrl;
|
|
171
|
-
})) || (availableSites === null || availableSites === void 0 ? void 0 : availableSites[0]);
|
|
172
161
|
}
|
|
173
|
-
}, [
|
|
162
|
+
}, [fireEvent, availableSites]);
|
|
174
163
|
(0, _react.useEffect)(function () {
|
|
175
164
|
fireEvent('screen.datasourceModalDialog.viewed', {});
|
|
176
165
|
}, [fireEvent]);
|
|
@@ -195,37 +184,6 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
195
184
|
shouldForceRequest: true
|
|
196
185
|
});
|
|
197
186
|
}, [reset]);
|
|
198
|
-
(0, _react.useEffect)(function () {
|
|
199
|
-
var fetchSiteDisplayNames = /*#__PURE__*/function () {
|
|
200
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
201
|
-
var confluenceSites, sortedAvailableSites;
|
|
202
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
203
|
-
while (1) switch (_context.prev = _context.next) {
|
|
204
|
-
case 0:
|
|
205
|
-
_context.next = 2;
|
|
206
|
-
return (0, _getAvailableSites.getAvailableSites)('confluence');
|
|
207
|
-
case 2:
|
|
208
|
-
confluenceSites = _context.sent;
|
|
209
|
-
sortedAvailableSites = (0, _toConsumableArray2.default)(confluenceSites).sort(function (a, b) {
|
|
210
|
-
return a.displayName.localeCompare(b.displayName);
|
|
211
|
-
});
|
|
212
|
-
setAvailableSites(sortedAvailableSites);
|
|
213
|
-
fireEvent('ui.modal.ready.datasource', {
|
|
214
|
-
instancesCount: sortedAvailableSites.length,
|
|
215
|
-
schemasCount: null
|
|
216
|
-
});
|
|
217
|
-
case 6:
|
|
218
|
-
case "end":
|
|
219
|
-
return _context.stop();
|
|
220
|
-
}
|
|
221
|
-
}, _callee);
|
|
222
|
-
}));
|
|
223
|
-
return function fetchSiteDisplayNames() {
|
|
224
|
-
return _ref.apply(this, arguments);
|
|
225
|
-
};
|
|
226
|
-
}();
|
|
227
|
-
void fetchSiteDisplayNames();
|
|
228
|
-
}, [fireEvent]);
|
|
229
187
|
(0, _react.useEffect)(function () {
|
|
230
188
|
var newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
|
|
231
189
|
visibleColumnCount.current = newVisibleColumnKeys.length;
|
|
@@ -6,11 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.PlainJiraIssuesConfigModal = exports.JiraIssuesConfigModal = void 0;
|
|
9
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
12
|
var _react = require("react");
|
|
16
13
|
var _react2 = require("@emotion/react");
|
|
@@ -34,7 +31,7 @@ var _adf = require("../../../common/utils/adf");
|
|
|
34
31
|
var _fetchMessagesForLocale = require("../../../common/utils/locale/fetch-messages-for-locale");
|
|
35
32
|
var _useDatasourceTableState = require("../../../hooks/useDatasourceTableState");
|
|
36
33
|
var _en = _interopRequireDefault(require("../../../i18n/en"));
|
|
37
|
-
var
|
|
34
|
+
var _useAvailableSites2 = require("../../../services/useAvailableSites");
|
|
38
35
|
var _accessRequired = require("../../common/error-state/access-required");
|
|
39
36
|
var _messages = require("../../common/error-state/messages");
|
|
40
37
|
var _modalLoadingError = require("../../common/error-state/modal-loading-error");
|
|
@@ -82,39 +79,38 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
82
79
|
initialParameters = props.parameters,
|
|
83
80
|
urlBeingEdited = props.url,
|
|
84
81
|
initialVisibleColumnKeys = props.visibleColumnKeys;
|
|
85
|
-
var _useState = (0, _react.useState)(
|
|
82
|
+
var _useState = (0, _react.useState)(viewMode),
|
|
86
83
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var _useState3 = (0, _react.useState)(
|
|
84
|
+
currentViewMode = _useState2[0],
|
|
85
|
+
setCurrentViewMode = _useState2[1];
|
|
86
|
+
var _useState3 = (0, _react.useState)(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId),
|
|
90
87
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var
|
|
88
|
+
cloudId = _useState4[0],
|
|
89
|
+
setCloudId = _useState4[1];
|
|
90
|
+
var _useAvailableSites = (0, _useAvailableSites2.useAvailableSites)('jira', cloudId),
|
|
91
|
+
availableSites = _useAvailableSites.availableSites,
|
|
92
|
+
selectedJiraSite = _useAvailableSites.selectedSite;
|
|
93
|
+
var _useState5 = (0, _react.useState)(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql),
|
|
94
94
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
jql = _useState6[0],
|
|
96
|
+
setJql = _useState6[1];
|
|
97
97
|
var _useState7 = (0, _react.useState)(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql),
|
|
98
98
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var _useState9 = (0, _react.useState)(
|
|
99
|
+
searchBarJql = _useState8[0],
|
|
100
|
+
setSearchBarJql = _useState8[1];
|
|
101
|
+
var _useState9 = (0, _react.useState)(initialVisibleColumnKeys),
|
|
102
102
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
var _useState11 = (0, _react.useState)(initialVisibleColumnKeys),
|
|
106
|
-
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
107
|
-
visibleColumnKeys = _useState12[0],
|
|
108
|
-
setVisibleColumnKeys = _useState12[1];
|
|
103
|
+
visibleColumnKeys = _useState10[0],
|
|
104
|
+
setVisibleColumnKeys = _useState10[1];
|
|
109
105
|
|
|
110
106
|
// analytics related parameters
|
|
111
107
|
var searchCount = (0, _react.useRef)(0);
|
|
112
108
|
var userInteractionActions = (0, _react.useRef)(new Set());
|
|
113
109
|
var initialSearchMethod = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource.show-jlol-basic-filters') && !(0, _isQueryTooComplex.isQueryTooComplex)((initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql) || '') ? 'basic' : 'jql';
|
|
114
|
-
var
|
|
115
|
-
|
|
116
|
-
currentSearchMethod =
|
|
117
|
-
setCurrentSearchMethod =
|
|
110
|
+
var _useState11 = (0, _react.useState)(initialSearchMethod),
|
|
111
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
112
|
+
currentSearchMethod = _useState12[0],
|
|
113
|
+
setCurrentSearchMethod = _useState12[1];
|
|
118
114
|
var searchMethodSearchedWith = (0, _react.useRef)(null);
|
|
119
115
|
var visibleColumnCount = (0, _react.useRef)((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
|
|
120
116
|
var basicFilterSelectionsSearchedWith = (0, _react.useRef)({});
|
|
@@ -153,21 +149,6 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
153
149
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
154
150
|
var _useRef = (0, _react.useRef)((0, _uuid.v4)()),
|
|
155
151
|
modalRenderInstanceId = _useRef.current;
|
|
156
|
-
var selectedJiraSite = (0, _react.useMemo)(function () {
|
|
157
|
-
if (cloudId) {
|
|
158
|
-
return availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(function (jiraSite) {
|
|
159
|
-
return jiraSite.cloudId === cloudId;
|
|
160
|
-
});
|
|
161
|
-
} else {
|
|
162
|
-
var currentlyLoggedInSiteUrl;
|
|
163
|
-
if (typeof window.location !== 'undefined') {
|
|
164
|
-
currentlyLoggedInSiteUrl = window.location.origin;
|
|
165
|
-
}
|
|
166
|
-
return (availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(function (jiraSite) {
|
|
167
|
-
return jiraSite.url === currentlyLoggedInSiteUrl;
|
|
168
|
-
})) || (availableSites === null || availableSites === void 0 ? void 0 : availableSites[0]);
|
|
169
|
-
}
|
|
170
|
-
}, [availableSites, cloudId]);
|
|
171
152
|
var analyticsPayload = (0, _react.useMemo)(function () {
|
|
172
153
|
return {
|
|
173
154
|
extensionKey: extensionKey,
|
|
@@ -180,6 +161,14 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
180
161
|
var shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'table';
|
|
181
162
|
var isDataReady = (visibleColumnKeys || []).length > 0;
|
|
182
163
|
var hasNoJiraSites = availableSites && availableSites.length === 0;
|
|
164
|
+
(0, _react.useEffect)(function () {
|
|
165
|
+
if (availableSites) {
|
|
166
|
+
fireEvent('ui.modal.ready.datasource', {
|
|
167
|
+
instancesCount: availableSites.length,
|
|
168
|
+
schemasCount: null
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}, [fireEvent, availableSites]);
|
|
183
172
|
(0, _react.useEffect)(function () {
|
|
184
173
|
var shouldStartUfoExperience = status === 'loading';
|
|
185
174
|
if (shouldStartUfoExperience) {
|
|
@@ -203,37 +192,6 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
203
192
|
visibleColumnCount.current = newVisibleColumnKeys.length;
|
|
204
193
|
setVisibleColumnKeys(newVisibleColumnKeys);
|
|
205
194
|
}, [initialVisibleColumnKeys, defaultVisibleColumnKeys]);
|
|
206
|
-
(0, _react.useEffect)(function () {
|
|
207
|
-
var fetchSiteDisplayNames = /*#__PURE__*/function () {
|
|
208
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
209
|
-
var jiraSites, sortedAvailableSites;
|
|
210
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
211
|
-
while (1) switch (_context.prev = _context.next) {
|
|
212
|
-
case 0:
|
|
213
|
-
_context.next = 2;
|
|
214
|
-
return (0, _getAvailableSites.getAvailableSites)('jira');
|
|
215
|
-
case 2:
|
|
216
|
-
jiraSites = _context.sent;
|
|
217
|
-
sortedAvailableSites = (0, _toConsumableArray2.default)(jiraSites).sort(function (a, b) {
|
|
218
|
-
return a.displayName.localeCompare(b.displayName);
|
|
219
|
-
});
|
|
220
|
-
setAvailableSites(sortedAvailableSites);
|
|
221
|
-
fireEvent('ui.modal.ready.datasource', {
|
|
222
|
-
instancesCount: sortedAvailableSites.length,
|
|
223
|
-
schemasCount: null
|
|
224
|
-
});
|
|
225
|
-
case 6:
|
|
226
|
-
case "end":
|
|
227
|
-
return _context.stop();
|
|
228
|
-
}
|
|
229
|
-
}, _callee);
|
|
230
|
-
}));
|
|
231
|
-
return function fetchSiteDisplayNames() {
|
|
232
|
-
return _ref.apply(this, arguments);
|
|
233
|
-
};
|
|
234
|
-
}();
|
|
235
|
-
void fetchSiteDisplayNames();
|
|
236
|
-
}, [fireEvent]);
|
|
237
195
|
(0, _react.useEffect)(function () {
|
|
238
196
|
if (selectedJiraSite && (!cloudId || cloudId !== selectedJiraSite.cloudId)) {
|
|
239
197
|
setCloudId(selectedJiraSite.cloudId);
|
|
@@ -283,10 +241,10 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
283
241
|
}
|
|
284
242
|
}, [currentViewMode, status, fireIssueViewAnalytics, fireCountViewedEvent]);
|
|
285
243
|
(0, _useColumnPickerRenderedFailedUfoExperience.useColumnPickerRenderedFailedUfoExperience)(status, modalRenderInstanceId);
|
|
286
|
-
var onSearch = (0, _react.useCallback)(function (newParameters,
|
|
287
|
-
var searchMethod =
|
|
288
|
-
basicFilterSelections =
|
|
289
|
-
isQueryComplex =
|
|
244
|
+
var onSearch = (0, _react.useCallback)(function (newParameters, _ref) {
|
|
245
|
+
var searchMethod = _ref.searchMethod,
|
|
246
|
+
basicFilterSelections = _ref.basicFilterSelections,
|
|
247
|
+
isQueryComplex = _ref.isQueryComplex;
|
|
290
248
|
searchCount.current++;
|
|
291
249
|
searchMethodSearchedWith.current = searchMethod;
|
|
292
250
|
basicFilterSelectionsSearchedWith.current = basicFilterSelections;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { getAvailableSites } from './getAvailableSites';
|
|
3
|
+
export const useAvailableSites = (product, cloudId) => {
|
|
4
|
+
const [availableSites, setAvailableSites] = useState(undefined);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const fetchSiteDisplayNames = async () => {
|
|
7
|
+
const sites = await getAvailableSites(product);
|
|
8
|
+
const sortedAvailableSites = [...sites].sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
9
|
+
setAvailableSites(sortedAvailableSites);
|
|
10
|
+
};
|
|
11
|
+
void fetchSiteDisplayNames();
|
|
12
|
+
}, [product]);
|
|
13
|
+
const selectedSite = useMemo(() => {
|
|
14
|
+
if (cloudId) {
|
|
15
|
+
return availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(site => site.cloudId === cloudId);
|
|
16
|
+
}
|
|
17
|
+
let currentlyLoggedInSiteUrl;
|
|
18
|
+
if (typeof window.location !== 'undefined') {
|
|
19
|
+
currentlyLoggedInSiteUrl = window.location.origin;
|
|
20
|
+
}
|
|
21
|
+
return (availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(site => site.url === currentlyLoggedInSiteUrl)) || (availableSites === null || availableSites === void 0 ? void 0 : availableSites[0]);
|
|
22
|
+
}, [availableSites, cloudId]);
|
|
23
|
+
return {
|
|
24
|
+
availableSites,
|
|
25
|
+
selectedSite
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -19,7 +19,7 @@ import { buildDatasourceAdf } from '../../../common/utils/adf';
|
|
|
19
19
|
import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
|
|
20
20
|
import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
|
|
21
21
|
import i18nEN from '../../../i18n/en';
|
|
22
|
-
import {
|
|
22
|
+
import { useAvailableSites } from '../../../services/useAvailableSites';
|
|
23
23
|
import { AccessRequired } from '../../common/error-state/access-required';
|
|
24
24
|
import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
|
|
25
25
|
import { NoInstancesView } from '../../common/error-state/no-instances';
|
|
@@ -63,9 +63,12 @@ export const PlainConfluenceSearchConfigModal = props => {
|
|
|
63
63
|
disableDisplayDropdown = false,
|
|
64
64
|
overrideParameters
|
|
65
65
|
} = props;
|
|
66
|
-
const [availableSites, setAvailableSites] = useState(undefined);
|
|
67
66
|
const [currentViewMode, setCurrentViewMode] = useState(viewMode);
|
|
68
67
|
const [cloudId, setCloudId] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId);
|
|
68
|
+
const {
|
|
69
|
+
availableSites,
|
|
70
|
+
selectedSite: selectedConfluenceSite
|
|
71
|
+
} = useAvailableSites('confluence', cloudId);
|
|
69
72
|
const [searchString, setSearchString] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.searchString);
|
|
70
73
|
const [visibleColumnKeys, setVisibleColumnKeys] = useState(initialVisibleColumnKeys);
|
|
71
74
|
const [contributorAccountIds, setContributorAccountIds] = useState((initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.contributorAccountIds) || []);
|
|
@@ -119,17 +122,14 @@ export const PlainConfluenceSearchConfigModal = props => {
|
|
|
119
122
|
fireEvent
|
|
120
123
|
} = useDatasourceAnalyticsEvents();
|
|
121
124
|
const hasNoConfluenceSites = availableSites && availableSites.length === 0;
|
|
122
|
-
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
currentlyLoggedInSiteUrl = window.location.origin;
|
|
129
|
-
}
|
|
130
|
-
return (availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(confluenceSite => confluenceSite.url === currentlyLoggedInSiteUrl)) || (availableSites === null || availableSites === void 0 ? void 0 : availableSites[0]);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (availableSites) {
|
|
127
|
+
fireEvent('ui.modal.ready.datasource', {
|
|
128
|
+
instancesCount: availableSites.length,
|
|
129
|
+
schemasCount: null
|
|
130
|
+
});
|
|
131
131
|
}
|
|
132
|
-
}, [
|
|
132
|
+
}, [fireEvent, availableSites]);
|
|
133
133
|
useEffect(() => {
|
|
134
134
|
fireEvent('screen.datasourceModalDialog.viewed', {});
|
|
135
135
|
}, [fireEvent]);
|
|
@@ -154,18 +154,6 @@ export const PlainConfluenceSearchConfigModal = props => {
|
|
|
154
154
|
shouldForceRequest: true
|
|
155
155
|
});
|
|
156
156
|
}, [reset]);
|
|
157
|
-
useEffect(() => {
|
|
158
|
-
const fetchSiteDisplayNames = async () => {
|
|
159
|
-
const confluenceSites = await getAvailableSites('confluence');
|
|
160
|
-
const sortedAvailableSites = [...confluenceSites].sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
161
|
-
setAvailableSites(sortedAvailableSites);
|
|
162
|
-
fireEvent('ui.modal.ready.datasource', {
|
|
163
|
-
instancesCount: sortedAvailableSites.length,
|
|
164
|
-
schemasCount: null
|
|
165
|
-
});
|
|
166
|
-
};
|
|
167
|
-
void fetchSiteDisplayNames();
|
|
168
|
-
}, [fireEvent]);
|
|
169
157
|
useEffect(() => {
|
|
170
158
|
const newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
|
|
171
159
|
visibleColumnCount.current = newVisibleColumnKeys.length;
|
|
@@ -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';
|
|
@@ -67,9 +67,12 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
67
67
|
url: urlBeingEdited,
|
|
68
68
|
visibleColumnKeys: initialVisibleColumnKeys
|
|
69
69
|
} = props;
|
|
70
|
-
const [availableSites, setAvailableSites] = useState(undefined);
|
|
71
70
|
const [currentViewMode, setCurrentViewMode] = useState(viewMode);
|
|
72
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);
|
|
73
76
|
const [jql, setJql] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql);
|
|
74
77
|
const [searchBarJql, setSearchBarJql] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql);
|
|
75
78
|
const [visibleColumnKeys, setVisibleColumnKeys] = useState(initialVisibleColumnKeys);
|
|
@@ -119,17 +122,6 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
119
122
|
const {
|
|
120
123
|
current: modalRenderInstanceId
|
|
121
124
|
} = useRef(uuidv4());
|
|
122
|
-
const selectedJiraSite = useMemo(() => {
|
|
123
|
-
if (cloudId) {
|
|
124
|
-
return availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(jiraSite => jiraSite.cloudId === cloudId);
|
|
125
|
-
} else {
|
|
126
|
-
let currentlyLoggedInSiteUrl;
|
|
127
|
-
if (typeof window.location !== 'undefined') {
|
|
128
|
-
currentlyLoggedInSiteUrl = window.location.origin;
|
|
129
|
-
}
|
|
130
|
-
return (availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(jiraSite => jiraSite.url === currentlyLoggedInSiteUrl)) || (availableSites === null || availableSites === void 0 ? void 0 : availableSites[0]);
|
|
131
|
-
}
|
|
132
|
-
}, [availableSites, cloudId]);
|
|
133
125
|
const analyticsPayload = useMemo(() => ({
|
|
134
126
|
extensionKey,
|
|
135
127
|
destinationObjectTypes
|
|
@@ -140,6 +132,14 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
140
132
|
const shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'table';
|
|
141
133
|
const isDataReady = (visibleColumnKeys || []).length > 0;
|
|
142
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]);
|
|
143
143
|
useEffect(() => {
|
|
144
144
|
const shouldStartUfoExperience = status === 'loading';
|
|
145
145
|
if (shouldStartUfoExperience) {
|
|
@@ -163,18 +163,6 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
163
163
|
visibleColumnCount.current = newVisibleColumnKeys.length;
|
|
164
164
|
setVisibleColumnKeys(newVisibleColumnKeys);
|
|
165
165
|
}, [initialVisibleColumnKeys, defaultVisibleColumnKeys]);
|
|
166
|
-
useEffect(() => {
|
|
167
|
-
const fetchSiteDisplayNames = async () => {
|
|
168
|
-
const jiraSites = await getAvailableSites('jira');
|
|
169
|
-
const sortedAvailableSites = [...jiraSites].sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
170
|
-
setAvailableSites(sortedAvailableSites);
|
|
171
|
-
fireEvent('ui.modal.ready.datasource', {
|
|
172
|
-
instancesCount: sortedAvailableSites.length,
|
|
173
|
-
schemasCount: null
|
|
174
|
-
});
|
|
175
|
-
};
|
|
176
|
-
void fetchSiteDisplayNames();
|
|
177
|
-
}, [fireEvent]);
|
|
178
166
|
useEffect(() => {
|
|
179
167
|
if (selectedJiraSite && (!cloudId || cloudId !== selectedJiraSite.cloudId)) {
|
|
180
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';
|
|
@@ -69,38 +66,37 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
69
66
|
_props$disableDisplay = props.disableDisplayDropdown,
|
|
70
67
|
disableDisplayDropdown = _props$disableDisplay === void 0 ? false : _props$disableDisplay,
|
|
71
68
|
overrideParameters = props.overrideParameters;
|
|
72
|
-
var _useState = useState(
|
|
69
|
+
var _useState = useState(viewMode),
|
|
73
70
|
_useState2 = _slicedToArray(_useState, 2),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var _useState3 = useState(
|
|
71
|
+
currentViewMode = _useState2[0],
|
|
72
|
+
setCurrentViewMode = _useState2[1];
|
|
73
|
+
var _useState3 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId),
|
|
77
74
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
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),
|
|
81
81
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
var _useState7 = useState(
|
|
82
|
+
searchString = _useState6[0],
|
|
83
|
+
setSearchString = _useState6[1];
|
|
84
|
+
var _useState7 = useState(initialVisibleColumnKeys),
|
|
85
85
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
var _useState9 = useState(
|
|
86
|
+
visibleColumnKeys = _useState8[0],
|
|
87
|
+
setVisibleColumnKeys = _useState8[1];
|
|
88
|
+
var _useState9 = useState((initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.contributorAccountIds) || []),
|
|
89
89
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var _useState11 = useState(
|
|
93
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
94
|
-
contributorAccountIds = _useState12[0],
|
|
95
|
-
setContributorAccountIds = _useState12[1];
|
|
96
|
-
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 ? {
|
|
97
93
|
value: initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.lastModified,
|
|
98
94
|
from: initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.lastModifiedFrom,
|
|
99
95
|
to: initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.lastModifiedTo
|
|
100
96
|
} : undefined),
|
|
101
|
-
|
|
102
|
-
lastModified =
|
|
103
|
-
setLastModified =
|
|
97
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
98
|
+
lastModified = _useState12[0],
|
|
99
|
+
setLastModified = _useState12[1];
|
|
104
100
|
|
|
105
101
|
// analytics related parameters
|
|
106
102
|
var searchCount = useRef(0);
|
|
@@ -147,21 +143,14 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
147
143
|
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
148
144
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
149
145
|
var hasNoConfluenceSites = availableSites && availableSites.length === 0;
|
|
150
|
-
|
|
151
|
-
if (
|
|
152
|
-
|
|
153
|
-
|
|
146
|
+
useEffect(function () {
|
|
147
|
+
if (availableSites) {
|
|
148
|
+
fireEvent('ui.modal.ready.datasource', {
|
|
149
|
+
instancesCount: availableSites.length,
|
|
150
|
+
schemasCount: null
|
|
154
151
|
});
|
|
155
|
-
} else {
|
|
156
|
-
var currentlyLoggedInSiteUrl;
|
|
157
|
-
if (typeof window.location !== 'undefined') {
|
|
158
|
-
currentlyLoggedInSiteUrl = window.location.origin;
|
|
159
|
-
}
|
|
160
|
-
return (availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(function (confluenceSite) {
|
|
161
|
-
return confluenceSite.url === currentlyLoggedInSiteUrl;
|
|
162
|
-
})) || (availableSites === null || availableSites === void 0 ? void 0 : availableSites[0]);
|
|
163
152
|
}
|
|
164
|
-
}, [
|
|
153
|
+
}, [fireEvent, availableSites]);
|
|
165
154
|
useEffect(function () {
|
|
166
155
|
fireEvent('screen.datasourceModalDialog.viewed', {});
|
|
167
156
|
}, [fireEvent]);
|
|
@@ -186,37 +175,6 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
186
175
|
shouldForceRequest: true
|
|
187
176
|
});
|
|
188
177
|
}, [reset]);
|
|
189
|
-
useEffect(function () {
|
|
190
|
-
var fetchSiteDisplayNames = /*#__PURE__*/function () {
|
|
191
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
192
|
-
var confluenceSites, sortedAvailableSites;
|
|
193
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
194
|
-
while (1) switch (_context.prev = _context.next) {
|
|
195
|
-
case 0:
|
|
196
|
-
_context.next = 2;
|
|
197
|
-
return getAvailableSites('confluence');
|
|
198
|
-
case 2:
|
|
199
|
-
confluenceSites = _context.sent;
|
|
200
|
-
sortedAvailableSites = _toConsumableArray(confluenceSites).sort(function (a, b) {
|
|
201
|
-
return a.displayName.localeCompare(b.displayName);
|
|
202
|
-
});
|
|
203
|
-
setAvailableSites(sortedAvailableSites);
|
|
204
|
-
fireEvent('ui.modal.ready.datasource', {
|
|
205
|
-
instancesCount: sortedAvailableSites.length,
|
|
206
|
-
schemasCount: null
|
|
207
|
-
});
|
|
208
|
-
case 6:
|
|
209
|
-
case "end":
|
|
210
|
-
return _context.stop();
|
|
211
|
-
}
|
|
212
|
-
}, _callee);
|
|
213
|
-
}));
|
|
214
|
-
return function fetchSiteDisplayNames() {
|
|
215
|
-
return _ref.apply(this, arguments);
|
|
216
|
-
};
|
|
217
|
-
}();
|
|
218
|
-
void fetchSiteDisplayNames();
|
|
219
|
-
}, [fireEvent]);
|
|
220
178
|
useEffect(function () {
|
|
221
179
|
var newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
|
|
222
180
|
visibleColumnCount.current = newVisibleColumnKeys.length;
|
|
@@ -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';
|
|
@@ -73,39 +70,38 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
73
70
|
initialParameters = props.parameters,
|
|
74
71
|
urlBeingEdited = props.url,
|
|
75
72
|
initialVisibleColumnKeys = props.visibleColumnKeys;
|
|
76
|
-
var _useState = useState(
|
|
73
|
+
var _useState = useState(viewMode),
|
|
77
74
|
_useState2 = _slicedToArray(_useState, 2),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var _useState3 = useState(
|
|
75
|
+
currentViewMode = _useState2[0],
|
|
76
|
+
setCurrentViewMode = _useState2[1];
|
|
77
|
+
var _useState3 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId),
|
|
81
78
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
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),
|
|
85
85
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
jql = _useState6[0],
|
|
87
|
+
setJql = _useState6[1];
|
|
88
88
|
var _useState7 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql),
|
|
89
89
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var _useState9 = useState(
|
|
90
|
+
searchBarJql = _useState8[0],
|
|
91
|
+
setSearchBarJql = _useState8[1];
|
|
92
|
+
var _useState9 = useState(initialVisibleColumnKeys),
|
|
93
93
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
var _useState11 = useState(initialVisibleColumnKeys),
|
|
97
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
98
|
-
visibleColumnKeys = _useState12[0],
|
|
99
|
-
setVisibleColumnKeys = _useState12[1];
|
|
94
|
+
visibleColumnKeys = _useState10[0],
|
|
95
|
+
setVisibleColumnKeys = _useState10[1];
|
|
100
96
|
|
|
101
97
|
// analytics related parameters
|
|
102
98
|
var searchCount = useRef(0);
|
|
103
99
|
var userInteractionActions = useRef(new Set());
|
|
104
100
|
var initialSearchMethod = getBooleanFF('platform.linking-platform.datasource.show-jlol-basic-filters') && !isQueryTooComplex((initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql) || '') ? 'basic' : 'jql';
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
currentSearchMethod =
|
|
108
|
-
setCurrentSearchMethod =
|
|
101
|
+
var _useState11 = useState(initialSearchMethod),
|
|
102
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
103
|
+
currentSearchMethod = _useState12[0],
|
|
104
|
+
setCurrentSearchMethod = _useState12[1];
|
|
109
105
|
var searchMethodSearchedWith = useRef(null);
|
|
110
106
|
var visibleColumnCount = useRef((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
|
|
111
107
|
var basicFilterSelectionsSearchedWith = useRef({});
|
|
@@ -144,21 +140,6 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
144
140
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
145
141
|
var _useRef = useRef(uuidv4()),
|
|
146
142
|
modalRenderInstanceId = _useRef.current;
|
|
147
|
-
var selectedJiraSite = useMemo(function () {
|
|
148
|
-
if (cloudId) {
|
|
149
|
-
return availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(function (jiraSite) {
|
|
150
|
-
return jiraSite.cloudId === cloudId;
|
|
151
|
-
});
|
|
152
|
-
} else {
|
|
153
|
-
var currentlyLoggedInSiteUrl;
|
|
154
|
-
if (typeof window.location !== 'undefined') {
|
|
155
|
-
currentlyLoggedInSiteUrl = window.location.origin;
|
|
156
|
-
}
|
|
157
|
-
return (availableSites === null || availableSites === void 0 ? void 0 : availableSites.find(function (jiraSite) {
|
|
158
|
-
return jiraSite.url === currentlyLoggedInSiteUrl;
|
|
159
|
-
})) || (availableSites === null || availableSites === void 0 ? void 0 : availableSites[0]);
|
|
160
|
-
}
|
|
161
|
-
}, [availableSites, cloudId]);
|
|
162
143
|
var analyticsPayload = useMemo(function () {
|
|
163
144
|
return {
|
|
164
145
|
extensionKey: extensionKey,
|
|
@@ -171,6 +152,14 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
171
152
|
var shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'table';
|
|
172
153
|
var isDataReady = (visibleColumnKeys || []).length > 0;
|
|
173
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]);
|
|
174
163
|
useEffect(function () {
|
|
175
164
|
var shouldStartUfoExperience = status === 'loading';
|
|
176
165
|
if (shouldStartUfoExperience) {
|
|
@@ -194,37 +183,6 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
194
183
|
visibleColumnCount.current = newVisibleColumnKeys.length;
|
|
195
184
|
setVisibleColumnKeys(newVisibleColumnKeys);
|
|
196
185
|
}, [initialVisibleColumnKeys, defaultVisibleColumnKeys]);
|
|
197
|
-
useEffect(function () {
|
|
198
|
-
var fetchSiteDisplayNames = /*#__PURE__*/function () {
|
|
199
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
200
|
-
var jiraSites, sortedAvailableSites;
|
|
201
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
202
|
-
while (1) switch (_context.prev = _context.next) {
|
|
203
|
-
case 0:
|
|
204
|
-
_context.next = 2;
|
|
205
|
-
return getAvailableSites('jira');
|
|
206
|
-
case 2:
|
|
207
|
-
jiraSites = _context.sent;
|
|
208
|
-
sortedAvailableSites = _toConsumableArray(jiraSites).sort(function (a, b) {
|
|
209
|
-
return a.displayName.localeCompare(b.displayName);
|
|
210
|
-
});
|
|
211
|
-
setAvailableSites(sortedAvailableSites);
|
|
212
|
-
fireEvent('ui.modal.ready.datasource', {
|
|
213
|
-
instancesCount: sortedAvailableSites.length,
|
|
214
|
-
schemasCount: null
|
|
215
|
-
});
|
|
216
|
-
case 6:
|
|
217
|
-
case "end":
|
|
218
|
-
return _context.stop();
|
|
219
|
-
}
|
|
220
|
-
}, _callee);
|
|
221
|
-
}));
|
|
222
|
-
return function fetchSiteDisplayNames() {
|
|
223
|
-
return _ref.apply(this, arguments);
|
|
224
|
-
};
|
|
225
|
-
}();
|
|
226
|
-
void fetchSiteDisplayNames();
|
|
227
|
-
}, [fireEvent]);
|
|
228
186
|
useEffect(function () {
|
|
229
187
|
if (selectedJiraSite && (!cloudId || cloudId !== selectedJiraSite.cloudId)) {
|
|
230
188
|
setCloudId(selectedJiraSite.cloudId);
|
|
@@ -274,10 +232,10 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
|
|
|
274
232
|
}
|
|
275
233
|
}, [currentViewMode, status, fireIssueViewAnalytics, fireCountViewedEvent]);
|
|
276
234
|
useColumnPickerRenderedFailedUfoExperience(status, modalRenderInstanceId);
|
|
277
|
-
var onSearch = useCallback(function (newParameters,
|
|
278
|
-
var searchMethod =
|
|
279
|
-
basicFilterSelections =
|
|
280
|
-
isQueryComplex =
|
|
235
|
+
var onSearch = useCallback(function (newParameters, _ref) {
|
|
236
|
+
var searchMethod = _ref.searchMethod,
|
|
237
|
+
basicFilterSelections = _ref.basicFilterSelections,
|
|
238
|
+
isQueryComplex = _ref.isQueryComplex;
|
|
281
239
|
searchCount.current++;
|
|
282
240
|
searchMethodSearchedWith.current = searchMethod;
|
|
283
241
|
basicFilterSelectionsSearchedWith.current = basicFilterSelections;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { Ref } from 'react';
|
|
2
|
+
import { type Ref } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import { DatasourceResponseSchemaProperty } from '@atlaskit/linking-types/datasource';
|
|
5
|
-
import { IssueLikeDataTableViewProps } from './types';
|
|
4
|
+
import { type DatasourceResponseSchemaProperty } from '@atlaskit/linking-types/datasource';
|
|
5
|
+
import { type IssueLikeDataTableViewProps } from './types';
|
|
6
6
|
export declare const scrollableContainerShadowsCssComponents: {
|
|
7
7
|
backgroundImage: string;
|
|
8
8
|
backgroundPosition: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { Ref } from 'react';
|
|
2
|
+
import { type Ref } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import { DatasourceResponseSchemaProperty } from '@atlaskit/linking-types/datasource';
|
|
5
|
-
import { IssueLikeDataTableViewProps } from './types';
|
|
4
|
+
import { type DatasourceResponseSchemaProperty } from '@atlaskit/linking-types/datasource';
|
|
5
|
+
import { type IssueLikeDataTableViewProps } from './types';
|
|
6
6
|
export declare const scrollableContainerShadowsCssComponents: {
|
|
7
7
|
backgroundImage: string;
|
|
8
8
|
backgroundPosition: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"@atlaskit/smart-user-picker": "6.9.3",
|
|
71
71
|
"@atlaskit/spinner": "^16.1.0",
|
|
72
72
|
"@atlaskit/tag": "^12.2.0",
|
|
73
|
-
"@atlaskit/textfield": "6.3.
|
|
74
|
-
"@atlaskit/theme": "^12.
|
|
75
|
-
"@atlaskit/tokens": "^1.
|
|
73
|
+
"@atlaskit/textfield": "6.3.1",
|
|
74
|
+
"@atlaskit/theme": "^12.8.0",
|
|
75
|
+
"@atlaskit/tokens": "^1.46.0",
|
|
76
76
|
"@atlaskit/tooltip": "^18.3.0",
|
|
77
77
|
"@atlaskit/ufo": "^0.2.4",
|
|
78
78
|
"@atlaskit/width-detector": "^4.2.0",
|