@atlaskit/link-datasource 3.13.16 → 3.13.18
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 +21 -0
- package/dist/cjs/hooks/useLoadOptions.js +20 -9
- package/dist/cjs/ui/confluence-search-modal/modal/index.js +8 -27
- package/dist/cjs/ui/issue-like-table/edit-type/icon/index.js +4 -1
- package/dist/cjs/ui/issue-like-table/edit-type/index.js +9 -4
- package/dist/cjs/ui/issue-like-table/edit-type/status/index.js +7 -1
- package/dist/cjs/ui/issue-like-table/edit-type/text/index.js +3 -1
- package/dist/cjs/ui/issue-like-table/edit-type/user/index.js +7 -1
- package/dist/cjs/ui/issue-like-table/index.js +6 -2
- package/dist/cjs/ui/issue-like-table/table-cell-content/index.js +5 -0
- package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +31 -2
- package/dist/cjs/ui/issue-like-table/table-cell-content/messages.js +14 -0
- package/dist/cjs/ui/issue-like-table/utils.js +21 -1
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +1 -18
- package/dist/es2019/hooks/useLoadOptions.js +15 -4
- package/dist/es2019/ui/confluence-search-modal/modal/index.js +12 -35
- package/dist/es2019/ui/issue-like-table/edit-type/icon/index.js +4 -1
- package/dist/es2019/ui/issue-like-table/edit-type/index.js +9 -4
- package/dist/es2019/ui/issue-like-table/edit-type/status/index.js +5 -1
- package/dist/es2019/ui/issue-like-table/edit-type/text/index.js +3 -1
- package/dist/es2019/ui/issue-like-table/edit-type/user/index.js +5 -1
- package/dist/es2019/ui/issue-like-table/index.js +7 -3
- package/dist/es2019/ui/issue-like-table/table-cell-content/index.js +5 -0
- package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +33 -3
- package/dist/es2019/ui/issue-like-table/table-cell-content/messages.js +8 -0
- package/dist/es2019/ui/issue-like-table/utils.js +18 -1
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +4 -25
- package/dist/esm/hooks/useLoadOptions.js +21 -10
- package/dist/esm/ui/confluence-search-modal/modal/index.js +9 -28
- package/dist/esm/ui/issue-like-table/edit-type/icon/index.js +4 -1
- package/dist/esm/ui/issue-like-table/edit-type/index.js +9 -4
- package/dist/esm/ui/issue-like-table/edit-type/status/index.js +7 -1
- package/dist/esm/ui/issue-like-table/edit-type/text/index.js +3 -1
- package/dist/esm/ui/issue-like-table/edit-type/user/index.js +7 -1
- package/dist/esm/ui/issue-like-table/index.js +7 -3
- package/dist/esm/ui/issue-like-table/table-cell-content/index.js +5 -0
- package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +32 -3
- package/dist/esm/ui/issue-like-table/table-cell-content/messages.js +8 -0
- package/dist/esm/ui/issue-like-table/utils.js +19 -0
- package/dist/esm/ui/jira-issues-modal/modal/index.js +4 -21
- package/dist/types/ui/issue-like-table/edit-type/icon/index.d.ts +1 -0
- package/dist/types/ui/issue-like-table/edit-type/index.d.ts +2 -1
- package/dist/types/ui/issue-like-table/edit-type/status/index.d.ts +1 -0
- package/dist/types/ui/issue-like-table/edit-type/text/index.d.ts +1 -0
- package/dist/types/ui/issue-like-table/edit-type/user/index.d.ts +1 -0
- package/dist/types/ui/issue-like-table/table-cell-content/index.d.ts +2 -1
- package/dist/types/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
- package/dist/types/ui/issue-like-table/table-cell-content/messages.d.ts +7 -0
- package/dist/types/ui/issue-like-table/utils.d.ts +20 -0
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/icon/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/status/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/text/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/user/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
- package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/messages.d.ts +7 -0
- package/dist/types-ts4.5/ui/issue-like-table/utils.d.ts +20 -0
- package/package.json +3 -6
- package/dist/cjs/ui/confluence-search-modal/modal/ModalOld.js +0 -455
- package/dist/cjs/ui/jira-issues-modal/modal/ModalOld.js +0 -493
- package/dist/es2019/ui/confluence-search-modal/modal/ModalOld.js +0 -430
- package/dist/es2019/ui/jira-issues-modal/modal/ModalOld.js +0 -476
- package/dist/esm/ui/confluence-search-modal/modal/ModalOld.js +0 -451
- package/dist/esm/ui/jira-issues-modal/modal/ModalOld.js +0 -490
- package/dist/types/ui/confluence-search-modal/modal/ModalOld.d.ts +0 -3
- package/dist/types/ui/jira-issues-modal/modal/ModalOld.d.ts +0 -3
- package/dist/types-ts4.5/ui/confluence-search-modal/modal/ModalOld.d.ts +0 -3
- package/dist/types-ts4.5/ui/jira-issues-modal/modal/ModalOld.d.ts +0 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { type FieldProps } from '@atlaskit/form';
|
|
2
3
|
import { DatasourceAction } from '../../analytics/types';
|
|
3
4
|
export declare const COLUMN_BASE_WIDTH = 8;
|
|
4
5
|
export type GetWidthCss = (arg: {
|
|
@@ -21,3 +22,22 @@ export declare const getWidthCss: GetWidthCss;
|
|
|
21
22
|
* 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.
|
|
22
23
|
*/
|
|
23
24
|
export declare const getColumnAction: (oldVisibleColumnKeys: string[], newVisibleColumnKeys: string[]) => DatasourceAction;
|
|
25
|
+
/**
|
|
26
|
+
* Remove deprecated `aria-labelledby` prop from select component props.
|
|
27
|
+
*/
|
|
28
|
+
export declare const getCleanedSelectProps: (props: Omit<FieldProps<string>, 'value'>) => {
|
|
29
|
+
name: string;
|
|
30
|
+
id: string;
|
|
31
|
+
'aria-describedby'?: string | undefined;
|
|
32
|
+
'aria-invalid': "true" | "false";
|
|
33
|
+
onFocus: () => void;
|
|
34
|
+
onBlur: () => void;
|
|
35
|
+
onChange: (value: string | import("react").FormEvent<HTMLInputElement>) => void;
|
|
36
|
+
isDisabled: boolean;
|
|
37
|
+
isRequired: boolean;
|
|
38
|
+
isInvalid: boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Create id for table header to be used as aria-labelledby on form fields.
|
|
42
|
+
*/
|
|
43
|
+
export declare const getFieldLabelById: (fieldId: string) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.18",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
39
39
|
"@atlaskit/atlassian-context": "^0.0.2",
|
|
40
40
|
"@atlaskit/avatar": "^21.17.0",
|
|
41
|
-
"@atlaskit/avatar-group": "^10.
|
|
41
|
+
"@atlaskit/avatar-group": "^10.1.0",
|
|
42
42
|
"@atlaskit/badge": "^16.4.0",
|
|
43
43
|
"@atlaskit/button": "^20.3.0",
|
|
44
44
|
"@atlaskit/datetime-picker": "^15.9.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@atlaskit/link-client-extension": "^3.0.0",
|
|
61
61
|
"@atlaskit/linking-common": "^6.0.0",
|
|
62
62
|
"@atlaskit/linking-types": "^9.5.0",
|
|
63
|
-
"@atlaskit/logo": "^15.
|
|
63
|
+
"@atlaskit/logo": "^15.1.0",
|
|
64
64
|
"@atlaskit/lozenge": "^11.12.0",
|
|
65
65
|
"@atlaskit/modal-dialog": "^12.18.0",
|
|
66
66
|
"@atlaskit/outbound-auth-flow-client": "^3.4.5",
|
|
@@ -173,9 +173,6 @@
|
|
|
173
173
|
},
|
|
174
174
|
"platform-datasources-enable-two-way-sync-assignee": {
|
|
175
175
|
"type": "boolean"
|
|
176
|
-
},
|
|
177
|
-
"platform-datasources-use-refactored-config-modal": {
|
|
178
|
-
"type": "boolean"
|
|
179
176
|
}
|
|
180
177
|
}
|
|
181
178
|
}
|
|
@@ -1,455 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.PlainConfluenceSearchConfigModal = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
var _react2 = require("@emotion/react");
|
|
12
|
-
var _reactIntlNext = require("react-intl-next");
|
|
13
|
-
var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
|
|
14
|
-
var _intlMessagesProvider = require("@atlaskit/intl-messages-provider");
|
|
15
|
-
var _modalDialog = require("@atlaskit/modal-dialog");
|
|
16
|
-
var _primitives = require("@atlaskit/primitives");
|
|
17
|
-
var _analytics = require("../../../analytics");
|
|
18
|
-
var _types = require("../../../analytics/types");
|
|
19
|
-
var _adf = require("../../../common/utils/adf");
|
|
20
|
-
var _fetchMessagesForLocale = require("../../../common/utils/locale/fetch-messages-for-locale");
|
|
21
|
-
var _userInteractions = require("../../../contexts/user-interactions");
|
|
22
|
-
var _useDatasourceTableState = require("../../../hooks/useDatasourceTableState");
|
|
23
|
-
var _en = _interopRequireDefault(require("../../../i18n/en"));
|
|
24
|
-
var _useAvailableSites2 = require("../../../services/useAvailableSites");
|
|
25
|
-
var _accessRequired = require("../../common/error-state/access-required");
|
|
26
|
-
var _modalLoadingError = require("../../common/error-state/modal-loading-error");
|
|
27
|
-
var _noInstances = require("../../common/error-state/no-instances");
|
|
28
|
-
var _noResults = require("../../common/error-state/no-results");
|
|
29
|
-
var _initialStateView = require("../../common/initial-state-view");
|
|
30
|
-
var _cancelButton = require("../../common/modal/cancel-button");
|
|
31
|
-
var _contentContainer = require("../../common/modal/content-container");
|
|
32
|
-
var _countViewSmartLink = require("../../common/modal/count-view-smart-link");
|
|
33
|
-
var _datasourceModal = require("../../common/modal/datasource-modal");
|
|
34
|
-
var _useColumnResize2 = require("../../common/modal/datasources-table-in-modal-preview/use-column-resize");
|
|
35
|
-
var _useColumnWrapping2 = require("../../common/modal/datasources-table-in-modal-preview/use-column-wrapping");
|
|
36
|
-
var _displayViewDropDown = require("../../common/modal/display-view-dropdown/display-view-drop-down");
|
|
37
|
-
var _searchCount = _interopRequireDefault(require("../../common/modal/search-count"));
|
|
38
|
-
var _siteSelector = require("../../common/modal/site-selector");
|
|
39
|
-
var _issueLikeTable = require("../../issue-like-table");
|
|
40
|
-
var _utils = require("../../issue-like-table/utils");
|
|
41
|
-
var _confluenceSearchContainer = _interopRequireDefault(require("../confluence-search-container"));
|
|
42
|
-
var _confluenceSearchInitialStateSvg = require("./confluence-search-initial-state-svg");
|
|
43
|
-
var _messages = require("./messages");
|
|
44
|
-
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; }
|
|
45
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
46
|
-
* @jsxRuntime classic
|
|
47
|
-
* @jsx jsx
|
|
48
|
-
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
49
|
-
var inputContainerStyles = (0, _primitives.xcss)({
|
|
50
|
-
alignItems: 'baseline',
|
|
51
|
-
display: 'flex',
|
|
52
|
-
minHeight: '72px'
|
|
53
|
-
});
|
|
54
|
-
var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConfigModal(props) {
|
|
55
|
-
var datasourceId = props.datasourceId,
|
|
56
|
-
initialColumnCustomSizes = props.columnCustomSizes,
|
|
57
|
-
initialWrappedColumnKeys = props.wrappedColumnKeys,
|
|
58
|
-
onCancel = props.onCancel,
|
|
59
|
-
onInsert = props.onInsert,
|
|
60
|
-
_props$viewMode = props.viewMode,
|
|
61
|
-
viewMode = _props$viewMode === void 0 ? 'table' : _props$viewMode,
|
|
62
|
-
initialParameters = props.parameters,
|
|
63
|
-
urlBeingEdited = props.url,
|
|
64
|
-
initialVisibleColumnKeys = props.visibleColumnKeys,
|
|
65
|
-
_props$disableDisplay = props.disableDisplayDropdown,
|
|
66
|
-
disableDisplayDropdown = _props$disableDisplay === void 0 ? false : _props$disableDisplay,
|
|
67
|
-
overrideParameters = props.overrideParameters;
|
|
68
|
-
var _useState = (0, _react.useState)(viewMode),
|
|
69
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
70
|
-
currentViewMode = _useState2[0],
|
|
71
|
-
setCurrentViewMode = _useState2[1];
|
|
72
|
-
var _useState3 = (0, _react.useState)(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId),
|
|
73
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
74
|
-
cloudId = _useState4[0],
|
|
75
|
-
setCloudId = _useState4[1];
|
|
76
|
-
var _useAvailableSites = (0, _useAvailableSites2.useAvailableSites)('confluence', cloudId),
|
|
77
|
-
availableSites = _useAvailableSites.availableSites,
|
|
78
|
-
selectedConfluenceSite = _useAvailableSites.selectedSite;
|
|
79
|
-
var _useState5 = (0, _react.useState)(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.searchString),
|
|
80
|
-
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
81
|
-
searchString = _useState6[0],
|
|
82
|
-
setSearchString = _useState6[1];
|
|
83
|
-
var _useState7 = (0, _react.useState)(initialVisibleColumnKeys),
|
|
84
|
-
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
85
|
-
visibleColumnKeys = _useState8[0],
|
|
86
|
-
setVisibleColumnKeys = _useState8[1];
|
|
87
|
-
var _useState9 = (0, _react.useState)((initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.contributorAccountIds) || []),
|
|
88
|
-
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
89
|
-
contributorAccountIds = _useState10[0],
|
|
90
|
-
setContributorAccountIds = _useState10[1];
|
|
91
|
-
var _useState11 = (0, _react.useState)(initialParameters !== null && initialParameters !== void 0 && initialParameters.lastModified ? {
|
|
92
|
-
value: initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.lastModified,
|
|
93
|
-
from: initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.lastModifiedFrom,
|
|
94
|
-
to: initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.lastModifiedTo
|
|
95
|
-
} : undefined),
|
|
96
|
-
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
97
|
-
lastModified = _useState12[0],
|
|
98
|
-
setLastModified = _useState12[1];
|
|
99
|
-
|
|
100
|
-
// analytics related parameters
|
|
101
|
-
var searchCount = (0, _react.useRef)(0);
|
|
102
|
-
var userInteractions = (0, _userInteractions.useUserInteractions)();
|
|
103
|
-
var visibleColumnCount = (0, _react.useRef)((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
|
|
104
|
-
var parameters = (0, _react.useMemo)(function () {
|
|
105
|
-
return _objectSpread(_objectSpread({}, initialParameters), {}, {
|
|
106
|
-
cloudId: cloudId || '',
|
|
107
|
-
searchString: searchString,
|
|
108
|
-
lastModified: lastModified === null || lastModified === void 0 ? void 0 : lastModified.value,
|
|
109
|
-
lastModifiedFrom: lastModified === null || lastModified === void 0 ? void 0 : lastModified.from,
|
|
110
|
-
lastModifiedTo: lastModified === null || lastModified === void 0 ? void 0 : lastModified.to,
|
|
111
|
-
contributorAccountIds: (contributorAccountIds === null || contributorAccountIds === void 0 ? void 0 : contributorAccountIds.length) > 0 ? contributorAccountIds : undefined
|
|
112
|
-
});
|
|
113
|
-
}, [initialParameters, cloudId, searchString, lastModified, contributorAccountIds]);
|
|
114
|
-
var isParametersSet = (0, _react.useMemo)(function () {
|
|
115
|
-
return !!cloudId && Object.values(parameters !== null && parameters !== void 0 ? parameters : {}).filter(function (v) {
|
|
116
|
-
return v !== undefined;
|
|
117
|
-
}).length > 1;
|
|
118
|
-
}, [cloudId, parameters]);
|
|
119
|
-
var parametersToSend = (0, _react.useMemo)(function () {
|
|
120
|
-
if (!isParametersSet) {
|
|
121
|
-
return undefined;
|
|
122
|
-
}
|
|
123
|
-
return _objectSpread(_objectSpread({}, parameters), overrideParameters !== null && overrideParameters !== void 0 ? overrideParameters : {});
|
|
124
|
-
}, [parameters, overrideParameters, isParametersSet]);
|
|
125
|
-
var _useDatasourceTableSt = (0, _useDatasourceTableState.useDatasourceTableState)({
|
|
126
|
-
datasourceId: datasourceId,
|
|
127
|
-
parameters: parametersToSend,
|
|
128
|
-
fieldKeys: visibleColumnKeys
|
|
129
|
-
}),
|
|
130
|
-
reset = _useDatasourceTableSt.reset,
|
|
131
|
-
status = _useDatasourceTableSt.status,
|
|
132
|
-
onNextPage = _useDatasourceTableSt.onNextPage,
|
|
133
|
-
responseItems = _useDatasourceTableSt.responseItems,
|
|
134
|
-
responseItemIds = _useDatasourceTableSt.responseItemIds,
|
|
135
|
-
hasNextPage = _useDatasourceTableSt.hasNextPage,
|
|
136
|
-
columns = _useDatasourceTableSt.columns,
|
|
137
|
-
defaultVisibleColumnKeys = _useDatasourceTableSt.defaultVisibleColumnKeys,
|
|
138
|
-
loadDatasourceDetails = _useDatasourceTableSt.loadDatasourceDetails,
|
|
139
|
-
totalCount = _useDatasourceTableSt.totalCount,
|
|
140
|
-
_useDatasourceTableSt2 = _useDatasourceTableSt.extensionKey,
|
|
141
|
-
extensionKey = _useDatasourceTableSt2 === void 0 ? null : _useDatasourceTableSt2,
|
|
142
|
-
destinationObjectTypes = _useDatasourceTableSt.destinationObjectTypes;
|
|
143
|
-
var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
|
|
144
|
-
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
145
|
-
var hasNoConfluenceSites = availableSites && availableSites.length === 0;
|
|
146
|
-
(0, _react.useEffect)(function () {
|
|
147
|
-
if (availableSites) {
|
|
148
|
-
fireEvent('ui.modal.ready.datasource', {
|
|
149
|
-
instancesCount: availableSites.length,
|
|
150
|
-
schemasCount: null
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}, [fireEvent, availableSites]);
|
|
154
|
-
|
|
155
|
-
// TODO: further refactoring in EDM-9573
|
|
156
|
-
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6828283
|
|
157
|
-
(0, _react.useEffect)(function () {
|
|
158
|
-
if (selectedConfluenceSite && (!cloudId || cloudId !== selectedConfluenceSite.cloudId)) {
|
|
159
|
-
setCloudId(selectedConfluenceSite.cloudId);
|
|
160
|
-
}
|
|
161
|
-
}, [cloudId, selectedConfluenceSite]);
|
|
162
|
-
|
|
163
|
-
// TODO: further refactoring in EDM-9573
|
|
164
|
-
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6829171
|
|
165
|
-
var onSiteSelection = (0, _react.useCallback)(function (site) {
|
|
166
|
-
userInteractions.add(_types.DatasourceAction.INSTANCE_UPDATED);
|
|
167
|
-
setSearchString(undefined);
|
|
168
|
-
setLastModified(undefined);
|
|
169
|
-
setContributorAccountIds([]);
|
|
170
|
-
setCloudId(site.cloudId);
|
|
171
|
-
reset({
|
|
172
|
-
shouldForceRequest: true
|
|
173
|
-
});
|
|
174
|
-
}, [reset, userInteractions]);
|
|
175
|
-
(0, _react.useEffect)(function () {
|
|
176
|
-
var newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
|
|
177
|
-
visibleColumnCount.current = newVisibleColumnKeys.length;
|
|
178
|
-
setVisibleColumnKeys(newVisibleColumnKeys);
|
|
179
|
-
}, [initialVisibleColumnKeys, defaultVisibleColumnKeys]);
|
|
180
|
-
var siteSelectorLabel = availableSites && availableSites.length > 1 ? _messages.confluenceSearchModalMessages.insertIssuesTitleManySites : _messages.confluenceSearchModalMessages.insertIssuesTitle;
|
|
181
|
-
var _useColumnResize = (0, _useColumnResize2.useColumnResize)(initialColumnCustomSizes),
|
|
182
|
-
columnCustomSizes = _useColumnResize.columnCustomSizes,
|
|
183
|
-
onColumnResize = _useColumnResize.onColumnResize;
|
|
184
|
-
var _useColumnWrapping = (0, _useColumnWrapping2.useColumnWrapping)(initialWrappedColumnKeys),
|
|
185
|
-
wrappedColumnKeys = _useColumnWrapping.wrappedColumnKeys,
|
|
186
|
-
onWrappedColumnChange = _useColumnWrapping.onWrappedColumnChange;
|
|
187
|
-
|
|
188
|
-
// TODO: common functionality of all modals refactor in EDM-9573
|
|
189
|
-
var handleVisibleColumnKeysChange = (0, _react.useCallback)(function () {
|
|
190
|
-
var newVisibleColumnKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
191
|
-
var columnAction = (0, _utils.getColumnAction)(visibleColumnKeys || [], newVisibleColumnKeys);
|
|
192
|
-
userInteractions.add(columnAction);
|
|
193
|
-
visibleColumnCount.current = newVisibleColumnKeys.length;
|
|
194
|
-
setVisibleColumnKeys(newVisibleColumnKeys);
|
|
195
|
-
}, [visibleColumnKeys, userInteractions]);
|
|
196
|
-
|
|
197
|
-
// TODO: further refactoring in EDM-9573
|
|
198
|
-
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6798258
|
|
199
|
-
var confluenceSearchTable = (0, _react.useMemo)(function () {
|
|
200
|
-
return (0, _react2.jsx)(_contentContainer.ContentContainer, {
|
|
201
|
-
withTableBorder: true
|
|
202
|
-
}, (0, _react2.jsx)(_issueLikeTable.IssueLikeDataTableView, {
|
|
203
|
-
testId: "confluence-search-datasource-table",
|
|
204
|
-
status: status,
|
|
205
|
-
columns: columns,
|
|
206
|
-
items: responseItems,
|
|
207
|
-
itemIds: responseItemIds,
|
|
208
|
-
hasNextPage: hasNextPage,
|
|
209
|
-
visibleColumnKeys: visibleColumnKeys || defaultVisibleColumnKeys,
|
|
210
|
-
onNextPage: onNextPage,
|
|
211
|
-
onLoadDatasourceDetails: loadDatasourceDetails,
|
|
212
|
-
onVisibleColumnKeysChange: handleVisibleColumnKeysChange,
|
|
213
|
-
extensionKey: extensionKey,
|
|
214
|
-
columnCustomSizes: columnCustomSizes,
|
|
215
|
-
onColumnResize: onColumnResize,
|
|
216
|
-
wrappedColumnKeys: wrappedColumnKeys,
|
|
217
|
-
onWrappedColumnChange: onWrappedColumnChange
|
|
218
|
-
}));
|
|
219
|
-
}, [status, columns, responseItems, responseItemIds, hasNextPage, visibleColumnKeys, defaultVisibleColumnKeys, onNextPage, loadDatasourceDetails, handleVisibleColumnKeysChange, extensionKey, columnCustomSizes, onColumnResize, wrappedColumnKeys, onWrappedColumnChange]);
|
|
220
|
-
var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
221
|
-
var hasConfluenceSearchParams = selectedConfluenceSite && searchString;
|
|
222
|
-
var selectedConfluenceSiteUrl = selectedConfluenceSite === null || selectedConfluenceSite === void 0 ? void 0 : selectedConfluenceSite.url;
|
|
223
|
-
var confluenceSearchUrl = (0, _react.useMemo)(function () {
|
|
224
|
-
if (!selectedConfluenceSiteUrl || searchString === undefined) {
|
|
225
|
-
return undefined;
|
|
226
|
-
}
|
|
227
|
-
var params = new URLSearchParams();
|
|
228
|
-
// we are appending "text" without checking searchString as we need the url to have "text" when a user does an empty search
|
|
229
|
-
params.append('text', searchString);
|
|
230
|
-
if (contributorAccountIds.length > 0) {
|
|
231
|
-
params.append('contributors', contributorAccountIds.join(','));
|
|
232
|
-
}
|
|
233
|
-
if (lastModified !== null && lastModified !== void 0 && lastModified.value) {
|
|
234
|
-
params.append('lastModified', lastModified.value);
|
|
235
|
-
}
|
|
236
|
-
if (lastModified !== null && lastModified !== void 0 && lastModified.from) {
|
|
237
|
-
params.append('from', lastModified === null || lastModified === void 0 ? void 0 : lastModified.from);
|
|
238
|
-
}
|
|
239
|
-
if (lastModified !== null && lastModified !== void 0 && lastModified.to) {
|
|
240
|
-
params.append('to', lastModified === null || lastModified === void 0 ? void 0 : lastModified.to);
|
|
241
|
-
}
|
|
242
|
-
return "".concat(selectedConfluenceSiteUrl, "/wiki/search?").concat(params.toString());
|
|
243
|
-
}, [contributorAccountIds, lastModified, searchString, selectedConfluenceSiteUrl]);
|
|
244
|
-
var analyticsPayload = (0, _react.useMemo)(function () {
|
|
245
|
-
return {
|
|
246
|
-
extensionKey: extensionKey,
|
|
247
|
-
destinationObjectTypes: destinationObjectTypes,
|
|
248
|
-
searchCount: searchCount.current,
|
|
249
|
-
actions: userInteractions.get()
|
|
250
|
-
};
|
|
251
|
-
}, [destinationObjectTypes, extensionKey, userInteractions]);
|
|
252
|
-
var isDataReady = (visibleColumnKeys || []).length > 0;
|
|
253
|
-
var fireInlineViewedEvent = (0, _react.useCallback)(function () {
|
|
254
|
-
fireEvent('ui.link.viewed.count', _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
255
|
-
searchMethod: _types.DatasourceSearchMethod.DATASOURCE_SEARCH_QUERY,
|
|
256
|
-
totalItemCount: totalCount || 0
|
|
257
|
-
}));
|
|
258
|
-
}, [analyticsPayload, fireEvent, totalCount]);
|
|
259
|
-
var fireTableViewedEvent = (0, _react.useCallback)(function () {
|
|
260
|
-
if (isDataReady) {
|
|
261
|
-
fireEvent('ui.table.viewed.datasourceConfigModal', _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
262
|
-
totalItemCount: totalCount || 0,
|
|
263
|
-
searchMethod: _types.DatasourceSearchMethod.DATASOURCE_SEARCH_QUERY,
|
|
264
|
-
displayedColumnCount: visibleColumnCount.current
|
|
265
|
-
}));
|
|
266
|
-
}
|
|
267
|
-
}, [analyticsPayload, fireEvent, totalCount, isDataReady]);
|
|
268
|
-
(0, _react.useEffect)(function () {
|
|
269
|
-
var isResolved = status === 'resolved';
|
|
270
|
-
var isTableViewMode = currentViewMode === 'table';
|
|
271
|
-
var isInlineViewMode = currentViewMode === 'inline';
|
|
272
|
-
if (!isResolved) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
if (isTableViewMode) {
|
|
276
|
-
fireTableViewedEvent();
|
|
277
|
-
} else if (isInlineViewMode) {
|
|
278
|
-
fireInlineViewedEvent();
|
|
279
|
-
}
|
|
280
|
-
}, [currentViewMode, fireInlineViewedEvent, fireTableViewedEvent, status]);
|
|
281
|
-
var renderTableModalContent = (0, _react.useCallback)(function () {
|
|
282
|
-
if (status === 'rejected') {
|
|
283
|
-
return (0, _react2.jsx)(_modalLoadingError.ModalLoadingError, null);
|
|
284
|
-
} else if (status === 'unauthorized') {
|
|
285
|
-
return (0, _react2.jsx)(_accessRequired.AccessRequired, {
|
|
286
|
-
url: selectedConfluenceSiteUrl || urlBeingEdited
|
|
287
|
-
});
|
|
288
|
-
} else if (resolvedWithNoResults || status === 'forbidden') {
|
|
289
|
-
return (0, _react2.jsx)(_noResults.NoResults, null);
|
|
290
|
-
} else if (status === 'empty' || !columns.length) {
|
|
291
|
-
// persist the empty state when making the initial /data request which contains the columns
|
|
292
|
-
if (hasConfluenceSearchParams !== undefined) {
|
|
293
|
-
return (0, _react2.jsx)(_issueLikeTable.EmptyState, {
|
|
294
|
-
testId: "confluence-search-datasource-modal--empty-state"
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
return (0, _react2.jsx)(_contentContainer.ContentContainer, null, (0, _react2.jsx)(_initialStateView.InitialStateView, {
|
|
298
|
-
icon: (0, _react2.jsx)(_confluenceSearchInitialStateSvg.ConfluenceSearchInitialStateSVG, null),
|
|
299
|
-
title: _messages.confluenceSearchModalMessages.initialViewSearchTitle,
|
|
300
|
-
description: _messages.confluenceSearchModalMessages.initialViewSearchDescription
|
|
301
|
-
}));
|
|
302
|
-
}
|
|
303
|
-
return confluenceSearchTable;
|
|
304
|
-
}, [columns.length, selectedConfluenceSiteUrl, confluenceSearchTable, resolvedWithNoResults, status, urlBeingEdited, hasConfluenceSearchParams]);
|
|
305
|
-
var renderInlineLinkModalContent = (0, _react.useCallback)(function () {
|
|
306
|
-
if (status === 'unauthorized') {
|
|
307
|
-
return (0, _react2.jsx)(_accessRequired.AccessRequired, {
|
|
308
|
-
url: selectedConfluenceSiteUrl || urlBeingEdited
|
|
309
|
-
});
|
|
310
|
-
} else if (status === 'empty' || !selectedConfluenceSiteUrl) {
|
|
311
|
-
return (0, _react2.jsx)(_countViewSmartLink.SmartCardPlaceholder, {
|
|
312
|
-
placeholderText: _messages.confluenceSearchModalMessages.resultsCountSmartCardPlaceholderText
|
|
313
|
-
});
|
|
314
|
-
} else {
|
|
315
|
-
return confluenceSearchUrl && (0, _react2.jsx)(_countViewSmartLink.SmartLink, {
|
|
316
|
-
url: confluenceSearchUrl
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
}, [confluenceSearchUrl, selectedConfluenceSiteUrl, status, urlBeingEdited]);
|
|
320
|
-
var shouldShowResultsCount = !!totalCount && currentViewMode === 'table';
|
|
321
|
-
var onInsertPressed = (0, _react.useCallback)(function (e, analyticsEvent) {
|
|
322
|
-
var _insertButtonClickedE;
|
|
323
|
-
if (!isParametersSet || !cloudId || !confluenceSearchUrl) {
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
var insertButtonClickedEvent = analyticsEvent.update({
|
|
327
|
-
actionSubjectId: 'insert',
|
|
328
|
-
attributes: _objectSpread(_objectSpread({}, analyticsPayload), {}, {
|
|
329
|
-
totalItemCount: totalCount || 0,
|
|
330
|
-
displayedColumnCount: visibleColumnCount.current,
|
|
331
|
-
display: currentViewMode === 'inline' ? _types.DatasourceDisplay.DATASOURCE_INLINE : _types.DatasourceDisplay.DATASOURCE_TABLE,
|
|
332
|
-
searchCount: searchCount.current,
|
|
333
|
-
searchMethod: _types.DatasourceSearchMethod.DATASOURCE_SEARCH_QUERY,
|
|
334
|
-
actions: userInteractions.get()
|
|
335
|
-
}),
|
|
336
|
-
eventType: 'ui'
|
|
337
|
-
});
|
|
338
|
-
var consumerEvent = (_insertButtonClickedE = insertButtonClickedEvent.clone()) !== null && _insertButtonClickedE !== void 0 ? _insertButtonClickedE : undefined;
|
|
339
|
-
insertButtonClickedEvent.fire(_analytics.EVENT_CHANNEL);
|
|
340
|
-
if (currentViewMode === 'inline') {
|
|
341
|
-
onInsert({
|
|
342
|
-
type: 'inlineCard',
|
|
343
|
-
attrs: {
|
|
344
|
-
url: confluenceSearchUrl
|
|
345
|
-
}
|
|
346
|
-
}, consumerEvent);
|
|
347
|
-
} else {
|
|
348
|
-
onInsert((0, _adf.buildDatasourceAdf)({
|
|
349
|
-
id: datasourceId,
|
|
350
|
-
parameters: _objectSpread(_objectSpread({}, parametersToSend), {}, {
|
|
351
|
-
cloudId: cloudId
|
|
352
|
-
}),
|
|
353
|
-
views: [{
|
|
354
|
-
type: 'table',
|
|
355
|
-
properties: {
|
|
356
|
-
columns: (visibleColumnKeys || []).map(function (key) {
|
|
357
|
-
var width = columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key];
|
|
358
|
-
var isWrapped = wrappedColumnKeys === null || wrappedColumnKeys === void 0 ? void 0 : wrappedColumnKeys.includes(key);
|
|
359
|
-
return _objectSpread(_objectSpread({
|
|
360
|
-
key: key
|
|
361
|
-
}, width ? {
|
|
362
|
-
width: width
|
|
363
|
-
} : {}), isWrapped ? {
|
|
364
|
-
isWrapped: isWrapped
|
|
365
|
-
} : {});
|
|
366
|
-
})
|
|
367
|
-
}
|
|
368
|
-
}]
|
|
369
|
-
}, confluenceSearchUrl), consumerEvent);
|
|
370
|
-
}
|
|
371
|
-
}, [isParametersSet, cloudId, analyticsPayload, totalCount, currentViewMode, onInsert, confluenceSearchUrl, datasourceId, parametersToSend, visibleColumnKeys, columnCustomSizes, wrappedColumnKeys, userInteractions]);
|
|
372
|
-
var handleViewModeChange = function handleViewModeChange(selectedMode) {
|
|
373
|
-
userInteractions.add(_types.DatasourceAction.DISPLAY_VIEW_CHANGED);
|
|
374
|
-
setCurrentViewMode(selectedMode);
|
|
375
|
-
};
|
|
376
|
-
var onSearch = (0, _react.useCallback)(function (newSearchString, filters) {
|
|
377
|
-
searchCount.current++;
|
|
378
|
-
userInteractions.add(_types.DatasourceAction.QUERY_UPDATED);
|
|
379
|
-
if (filters) {
|
|
380
|
-
var editedOrCreatedBy = filters.editedOrCreatedBy,
|
|
381
|
-
lastModifiedList = filters.lastModified;
|
|
382
|
-
if (lastModifiedList) {
|
|
383
|
-
var updatedDateRangeOption = lastModifiedList.find(function (range) {
|
|
384
|
-
return range.value;
|
|
385
|
-
});
|
|
386
|
-
if ((updatedDateRangeOption === null || updatedDateRangeOption === void 0 ? void 0 : updatedDateRangeOption.optionType) === 'dateRange') {
|
|
387
|
-
setLastModified({
|
|
388
|
-
value: updatedDateRangeOption.value,
|
|
389
|
-
from: updatedDateRangeOption.from,
|
|
390
|
-
to: updatedDateRangeOption.to
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
if (editedOrCreatedBy) {
|
|
395
|
-
var accountIds = editedOrCreatedBy.map(function (user) {
|
|
396
|
-
return user.value;
|
|
397
|
-
});
|
|
398
|
-
setContributorAccountIds(accountIds);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
setSearchString(newSearchString);
|
|
402
|
-
reset({
|
|
403
|
-
shouldForceRequest: true
|
|
404
|
-
});
|
|
405
|
-
}, [reset, userInteractions]);
|
|
406
|
-
var isInsertDisabled = !isParametersSet || status === 'rejected' || status === 'unauthorized' || status === 'loading';
|
|
407
|
-
var getCancelButtonAnalyticsPayload = (0, _react.useCallback)(function () {
|
|
408
|
-
return {
|
|
409
|
-
extensionKey: extensionKey,
|
|
410
|
-
destinationObjectTypes: destinationObjectTypes,
|
|
411
|
-
searchCount: searchCount.current,
|
|
412
|
-
actions: userInteractions.get()
|
|
413
|
-
};
|
|
414
|
-
}, [destinationObjectTypes, extensionKey, userInteractions]);
|
|
415
|
-
return (0, _react2.jsx)(_intlMessagesProvider.IntlMessagesProvider, {
|
|
416
|
-
defaultMessages: _en.default,
|
|
417
|
-
loaderFn: _fetchMessagesForLocale.fetchMessagesForLocale
|
|
418
|
-
}, (0, _react2.jsx)(_datasourceModal.DatasourceModal, {
|
|
419
|
-
testId: "confluence-search-datasource-modal",
|
|
420
|
-
onClose: onCancel
|
|
421
|
-
}, (0, _react2.jsx)(_modalDialog.ModalHeader, null, (0, _react2.jsx)(_modalDialog.ModalTitle, null, (0, _react2.jsx)(_siteSelector.SiteSelector, {
|
|
422
|
-
availableSites: availableSites,
|
|
423
|
-
onSiteSelection: onSiteSelection,
|
|
424
|
-
selectedSite: selectedConfluenceSite,
|
|
425
|
-
testId: "confluence-search-datasource-modal--site-selector",
|
|
426
|
-
label: siteSelectorLabel
|
|
427
|
-
})), !hasNoConfluenceSites && !disableDisplayDropdown && (0, _react2.jsx)(_displayViewDropDown.DisplayViewDropDown, {
|
|
428
|
-
onViewModeChange: handleViewModeChange,
|
|
429
|
-
viewMode: currentViewMode
|
|
430
|
-
})), (0, _react2.jsx)(_modalDialog.ModalBody, null, !hasNoConfluenceSites ? (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_primitives.Box, {
|
|
431
|
-
xcss: inputContainerStyles
|
|
432
|
-
}, (0, _react2.jsx)(_confluenceSearchContainer.default, {
|
|
433
|
-
isSearching: status === 'loading',
|
|
434
|
-
onSearch: onSearch,
|
|
435
|
-
parameters: parameters
|
|
436
|
-
})), currentViewMode === 'inline' ? renderInlineLinkModalContent() : renderTableModalContent()) : (0, _react2.jsx)(_noInstances.NoInstancesView, {
|
|
437
|
-
title: _messages.confluenceSearchModalMessages.noAccessToConfluenceSitesTitle,
|
|
438
|
-
description: _messages.confluenceSearchModalMessages.noAccessToConfluenceSitesDescription,
|
|
439
|
-
testId: 'no-confluence-instances-content'
|
|
440
|
-
})), (0, _react2.jsx)(_modalDialog.ModalFooter, null, shouldShowResultsCount && confluenceSearchUrl && (0, _react2.jsx)(_searchCount.default, {
|
|
441
|
-
searchCount: totalCount,
|
|
442
|
-
url: confluenceSearchUrl,
|
|
443
|
-
prefixTextType: "result",
|
|
444
|
-
testId: "confluence-search-datasource-modal-total-results-count"
|
|
445
|
-
}), (0, _react2.jsx)(_cancelButton.CancelButton, {
|
|
446
|
-
onCancel: onCancel,
|
|
447
|
-
getAnalyticsPayload: getCancelButtonAnalyticsPayload,
|
|
448
|
-
testId: "confluence-search-modal--cancel-button"
|
|
449
|
-
}), !hasNoConfluenceSites && (0, _react2.jsx)(_standardButton.default, {
|
|
450
|
-
appearance: "primary",
|
|
451
|
-
onClick: onInsertPressed,
|
|
452
|
-
isDisabled: isInsertDisabled,
|
|
453
|
-
testId: "confluence-search-datasource-modal--insert-button"
|
|
454
|
-
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.confluenceSearchModalMessages.insertResultsButtonText)))));
|
|
455
|
-
};
|