@atlaskit/link-datasource 2.11.16 → 2.12.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 +23 -0
- package/dist/cjs/hooks/useDatasourceTableFlag.js +15 -1
- package/dist/cjs/hooks/useDatasourceTableState.js +5 -3
- package/dist/cjs/state/index.js +2 -1
- package/dist/cjs/ui/common/modal/datasource-modal/createDatasourceModal.js +4 -2
- package/dist/cjs/ui/common/modal/mode-switcher/index.js +6 -2
- package/dist/cjs/ui/common/modal/mode-switcher/useViewModeContext.js +4 -2
- package/dist/cjs/ui/confluence-search-modal/modal/index.js +1 -3
- package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +14 -3
- package/dist/cjs/ui/jira-issues-modal/modal/ModalOld.js +4 -2
- package/dist/es2019/hooks/useDatasourceTableFlag.js +16 -1
- package/dist/es2019/hooks/useDatasourceTableState.js +4 -3
- package/dist/es2019/state/index.js +2 -1
- package/dist/es2019/ui/common/modal/datasource-modal/createDatasourceModal.js +4 -2
- package/dist/es2019/ui/common/modal/mode-switcher/index.js +6 -2
- package/dist/es2019/ui/common/modal/mode-switcher/useViewModeContext.js +4 -2
- package/dist/es2019/ui/confluence-search-modal/modal/index.js +1 -2
- package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +15 -1
- package/dist/es2019/ui/jira-issues-modal/modal/ModalOld.js +3 -2
- package/dist/esm/hooks/useDatasourceTableFlag.js +15 -1
- package/dist/esm/hooks/useDatasourceTableState.js +5 -3
- package/dist/esm/state/index.js +2 -1
- package/dist/esm/ui/common/modal/datasource-modal/createDatasourceModal.js +4 -2
- package/dist/esm/ui/common/modal/mode-switcher/index.js +6 -2
- package/dist/esm/ui/common/modal/mode-switcher/useViewModeContext.js +4 -2
- package/dist/esm/ui/confluence-search-modal/modal/index.js +1 -3
- package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +14 -3
- package/dist/esm/ui/jira-issues-modal/modal/ModalOld.js +4 -2
- package/dist/types/analytics/generated/analytics.types.d.ts +15 -1
- package/dist/types/common/types.d.ts +2 -0
- package/dist/types/state/index.d.ts +4 -3
- package/dist/types/ui/common/modal/mode-switcher/index.d.ts +1 -1
- package/dist/types/ui/common/modal/mode-switcher/useViewModeContext.d.ts +3 -1
- package/dist/types/ui/confluence-search-modal/types.d.ts +0 -2
- package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +15 -1
- package/dist/types-ts4.5/common/types.d.ts +2 -0
- package/dist/types-ts4.5/state/index.d.ts +4 -3
- package/dist/types-ts4.5/ui/common/modal/mode-switcher/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/common/modal/mode-switcher/useViewModeContext.d.ts +3 -1
- package/dist/types-ts4.5/ui/confluence-search-modal/types.d.ts +0 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 2.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#137443](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/137443)
|
|
8
|
+
[`1be2afe0863d9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1be2afe0863d9) -
|
|
9
|
+
Fire analytic event `ui.error.shown.inlineEdit` when error flag is shown
|
|
10
|
+
|
|
11
|
+
## 2.12.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#137119](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/137119)
|
|
16
|
+
[`39898be3befdd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/39898be3befdd) -
|
|
17
|
+
Expose `disableDisplayDropdown` Prop for JiraIssuesConfigModal
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#136467](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/136467)
|
|
22
|
+
[`121a4c6220928`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/121a4c6220928) -
|
|
23
|
+
Fire event when user clicks on inline edit
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 2.11.16
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -12,11 +12,20 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
12
12
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
13
13
|
var _flag = require("@atlaskit/flag");
|
|
14
14
|
var _crossCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/cross-circle"));
|
|
15
|
+
var _analytics = require("../analytics");
|
|
15
16
|
var _messages = require("../ui/issue-like-table/messages");
|
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
19
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
20
|
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; }
|
|
21
|
+
var getErrorReason = function getErrorReason(status) {
|
|
22
|
+
switch (status) {
|
|
23
|
+
case 403:
|
|
24
|
+
return 'access_denied';
|
|
25
|
+
default:
|
|
26
|
+
return 'request_failed';
|
|
27
|
+
}
|
|
28
|
+
};
|
|
20
29
|
var getGenericErrorMessage = function getGenericErrorMessage(status) {
|
|
21
30
|
switch (status) {
|
|
22
31
|
case 403:
|
|
@@ -34,6 +43,8 @@ var getGenericErrorMessage = function getGenericErrorMessage(status) {
|
|
|
34
43
|
var useDatasourceTableFlag = exports.useDatasourceTableFlag = function useDatasourceTableFlag(options) {
|
|
35
44
|
var _useFlags = (0, _flag.useFlags)(),
|
|
36
45
|
showFlag = _useFlags.showFlag;
|
|
46
|
+
var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
|
|
47
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
37
48
|
var showErrorFlag = (0, _react.useCallback)(function (args) {
|
|
38
49
|
showFlag(_objectSpread(_objectSpread({
|
|
39
50
|
// We need IconTile in order to scale the new icon to 24px
|
|
@@ -45,7 +56,10 @@ var useDatasourceTableFlag = exports.useDatasourceTableFlag = function useDataso
|
|
|
45
56
|
id: (0, _uuid.default)(),
|
|
46
57
|
isAutoDismiss: true
|
|
47
58
|
}, getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status)), args));
|
|
48
|
-
|
|
59
|
+
fireEvent('ui.error.shown.inlineEdit', {
|
|
60
|
+
reason: getErrorReason(args === null || args === void 0 ? void 0 : args.status)
|
|
61
|
+
});
|
|
62
|
+
}, [fireEvent, showFlag]);
|
|
49
63
|
return {
|
|
50
64
|
showErrorFlag: showErrorFlag
|
|
51
65
|
};
|
|
@@ -232,6 +232,7 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
232
232
|
_totalCount,
|
|
233
233
|
schema,
|
|
234
234
|
integrationKey,
|
|
235
|
+
entityType,
|
|
235
236
|
newIds,
|
|
236
237
|
aris,
|
|
237
238
|
isUserLoadingNextPage,
|
|
@@ -314,7 +315,8 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
314
315
|
* Product is typed as any.
|
|
315
316
|
*/
|
|
316
317
|
integrationKey = product;
|
|
317
|
-
|
|
318
|
+
entityType = _destinationObjectTypes !== null && _destinationObjectTypes !== void 0 && _destinationObjectTypes.length ? _destinationObjectTypes[0] : undefined;
|
|
319
|
+
newIds = onAddItems(items, typeof integrationKey === 'string' ? integrationKey : undefined, entityType);
|
|
318
320
|
setResponseItemIds(function (currentIds) {
|
|
319
321
|
return [].concat((0, _toConsumableArray2.default)(currentIds), (0, _toConsumableArray2.default)(newIds));
|
|
320
322
|
});
|
|
@@ -325,12 +327,12 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
325
327
|
var _item$ari;
|
|
326
328
|
return typeof ((_item$ari = item.ari) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === 'string' ? [].concat((0, _toConsumableArray2.default)(acc), [item.ari.data]) : acc;
|
|
327
329
|
}, []);
|
|
328
|
-
if (aris.length &&
|
|
330
|
+
if (aris.length && entityType) {
|
|
329
331
|
discoverActions({
|
|
330
332
|
aris: aris,
|
|
331
333
|
integrationKey: integrationKey,
|
|
332
334
|
fieldKeys: fieldKeys,
|
|
333
|
-
entityType:
|
|
335
|
+
entityType: entityType
|
|
334
336
|
});
|
|
335
337
|
}
|
|
336
338
|
}
|
package/dist/cjs/state/index.js
CHANGED
|
@@ -38,7 +38,7 @@ var actions = exports.actions = {
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
},
|
|
41
|
-
onAddItems: function onAddItems(items, integrationKey) {
|
|
41
|
+
onAddItems: function onAddItems(items, integrationKey, entityType) {
|
|
42
42
|
return function (_ref2) {
|
|
43
43
|
var setState = _ref2.setState,
|
|
44
44
|
getState = _ref2.getState;
|
|
@@ -52,6 +52,7 @@ var actions = exports.actions = {
|
|
|
52
52
|
var id = ari !== null && ari !== void 0 ? ari : (0, _uuid.v4)();
|
|
53
53
|
return [[].concat((0, _toConsumableArray2.default)(ids), [id]), _objectSpread(_objectSpread({}, itemMap), {}, (0, _defineProperty2.default)({}, id, {
|
|
54
54
|
ari: ari,
|
|
55
|
+
entityType: entityType,
|
|
55
56
|
integrationKey: integrationKey,
|
|
56
57
|
data: _objectSpread(_objectSpread({}, (_oldItems$id = oldItems[id]) === null || _oldItems$id === void 0 ? void 0 : _oldItems$id.data), item)
|
|
57
58
|
}))];
|
|
@@ -31,7 +31,8 @@ var createDatasourceModal = exports.createDatasourceModal = function createDatas
|
|
|
31
31
|
wrappedColumnKeys = props.wrappedColumnKeys,
|
|
32
32
|
parameters = props.parameters,
|
|
33
33
|
onInsert = props.onInsert,
|
|
34
|
-
viewMode = props.viewMode
|
|
34
|
+
viewMode = props.viewMode,
|
|
35
|
+
disableDisplayDropdown = props.disableDisplayDropdown;
|
|
35
36
|
return (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
|
|
36
37
|
data: {
|
|
37
38
|
source: 'datasourceConfigModal',
|
|
@@ -49,7 +50,8 @@ var createDatasourceModal = exports.createDatasourceModal = function createDatas
|
|
|
49
50
|
isValidParameters: isValidParameters,
|
|
50
51
|
onInsert: onInsert
|
|
51
52
|
}, (0, _react2.jsx)(_useViewModeContext.DatasourceViewModeProvider, {
|
|
52
|
-
viewMode: viewMode !== null && viewMode !== void 0 ? viewMode : DEFAULT_VIEW_MODE
|
|
53
|
+
viewMode: viewMode !== null && viewMode !== void 0 ? viewMode : DEFAULT_VIEW_MODE,
|
|
54
|
+
disableDisplayDropdown: disableDisplayDropdown || false
|
|
53
55
|
}, (0, _react2.jsx)(ModalContent, props))))));
|
|
54
56
|
};
|
|
55
57
|
};
|
|
@@ -121,10 +121,14 @@ var ModeSwitcher = exports.ModeSwitcher = function ModeSwitcher(props) {
|
|
|
121
121
|
})) : null;
|
|
122
122
|
};
|
|
123
123
|
var DatasourceViewModeDropDown = exports.DatasourceViewModeDropDown = function DatasourceViewModeDropDown() {
|
|
124
|
+
var userInteractions = (0, _userInteractions.useUserInteractions)();
|
|
124
125
|
var _useViewModeContext = (0, _useViewModeContext2.useViewModeContext)(),
|
|
125
126
|
currentViewMode = _useViewModeContext.currentViewMode,
|
|
126
|
-
setCurrentViewMode = _useViewModeContext.setCurrentViewMode
|
|
127
|
-
|
|
127
|
+
setCurrentViewMode = _useViewModeContext.setCurrentViewMode,
|
|
128
|
+
disableDisplayDropdown = _useViewModeContext.disableDisplayDropdown;
|
|
129
|
+
if (disableDisplayDropdown) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
128
132
|
var handleViewModeChange = function handleViewModeChange(selectedMode) {
|
|
129
133
|
userInteractions.add(_types.DatasourceAction.DISPLAY_VIEW_CHANGED);
|
|
130
134
|
setCurrentViewMode(selectedMode);
|
|
@@ -21,6 +21,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
21
21
|
var ViewModeContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
22
22
|
var DatasourceViewModeProvider = exports.DatasourceViewModeProvider = function DatasourceViewModeProvider(_ref) {
|
|
23
23
|
var initialViewMode = _ref.viewMode,
|
|
24
|
+
disableDisplayDropdown = _ref.disableDisplayDropdown,
|
|
24
25
|
children = _ref.children;
|
|
25
26
|
var _useState = (0, _react.useState)(initialViewMode),
|
|
26
27
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -29,9 +30,10 @@ var DatasourceViewModeProvider = exports.DatasourceViewModeProvider = function D
|
|
|
29
30
|
var value = (0, _react.useMemo)(function () {
|
|
30
31
|
return {
|
|
31
32
|
currentViewMode: currentViewMode,
|
|
32
|
-
setCurrentViewMode: setCurrentViewMode
|
|
33
|
+
setCurrentViewMode: setCurrentViewMode,
|
|
34
|
+
disableDisplayDropdown: disableDisplayDropdown
|
|
33
35
|
};
|
|
34
|
-
}, [currentViewMode, setCurrentViewMode]);
|
|
36
|
+
}, [currentViewMode, setCurrentViewMode, disableDisplayDropdown]);
|
|
35
37
|
return (0, _react2.jsx)(ViewModeContext.Provider, {
|
|
36
38
|
value: value
|
|
37
39
|
}, children);
|
|
@@ -79,8 +79,6 @@ var useUpdateParametersOnFormUpdate = function useUpdateParametersOnFormUpdate(c
|
|
|
79
79
|
var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConfigModal(props) {
|
|
80
80
|
var onCancel = props.onCancel,
|
|
81
81
|
urlBeingEdited = props.url,
|
|
82
|
-
_props$disableDisplay = props.disableDisplayDropdown,
|
|
83
|
-
disableDisplayDropdown = _props$disableDisplay === void 0 ? false : _props$disableDisplay,
|
|
84
82
|
overrideParameters = props.overrideParameters;
|
|
85
83
|
var _useViewModeContext = (0, _useViewModeContext2.useViewModeContext)(),
|
|
86
84
|
currentViewMode = _useViewModeContext.currentViewMode;
|
|
@@ -313,7 +311,7 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
313
311
|
selectedSite: selectedConfluenceSite,
|
|
314
312
|
testId: "confluence-search-datasource-modal--site-selector",
|
|
315
313
|
label: siteSelectorLabel
|
|
316
|
-
})), !hasNoConfluenceSites &&
|
|
314
|
+
})), !hasNoConfluenceSites && (0, _react2.jsx)(_modeSwitcher.DatasourceViewModeDropDown, null)), (0, _react2.jsx)(_modalDialog.ModalBody, null, !hasNoConfluenceSites ? (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_primitives.Box, {
|
|
317
315
|
xcss: inputContainerStyles
|
|
318
316
|
}, (0, _react2.jsx)(_confluenceSearchContainer.default, {
|
|
319
317
|
isSearching: status === 'loading',
|
|
@@ -50,6 +50,9 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
|
50
50
|
var item = (0, _state.useDatasourceItem)({
|
|
51
51
|
id: ari
|
|
52
52
|
});
|
|
53
|
+
var _ref2 = item || {},
|
|
54
|
+
entityType = _ref2.entityType,
|
|
55
|
+
integrationKey = _ref2.integrationKey;
|
|
53
56
|
var _useDatasourceTableFl = (0, _useDatasourceTableFlag.useDatasourceTableFlag)(),
|
|
54
57
|
showErrorFlag = _useDatasourceTableFl.showErrorFlag;
|
|
55
58
|
var _useDatasourceActions = (0, _state.useDatasourceActions)(),
|
|
@@ -78,6 +81,16 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
|
78
81
|
});
|
|
79
82
|
setIsEditing(false);
|
|
80
83
|
}, [item, datasourceTypeWithValues.type, columnKey, onUpdateItem, ari, execute, fireEvent, showErrorFlag]);
|
|
84
|
+
var onEdit = (0, _react.useCallback)(function () {
|
|
85
|
+
setIsEditing(true);
|
|
86
|
+
if (integrationKey && entityType) {
|
|
87
|
+
fireEvent('ui.inlineEdit.clicked.datasource', {
|
|
88
|
+
integrationKey: integrationKey,
|
|
89
|
+
entityType: entityType,
|
|
90
|
+
fieldKey: columnKey
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}, [columnKey, entityType, fireEvent, integrationKey]);
|
|
81
94
|
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
82
95
|
xcss: editContainerStyles
|
|
83
96
|
}, /*#__PURE__*/_react.default.createElement(_inlineEdit.default, (0, _extends2.default)({}, (0, _editType.editType)(datasourceTypeWithValues), {
|
|
@@ -87,9 +100,7 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
|
87
100
|
},
|
|
88
101
|
readViewFitContainerWidth: true,
|
|
89
102
|
isEditing: isEditing,
|
|
90
|
-
onEdit:
|
|
91
|
-
return setIsEditing(true);
|
|
92
|
-
},
|
|
103
|
+
onEdit: onEdit,
|
|
93
104
|
onCancel: function onCancel() {
|
|
94
105
|
return setIsEditing(false);
|
|
95
106
|
},
|
|
@@ -73,7 +73,9 @@ var PlainJiraIssuesConfigModalOld = exports.PlainJiraIssuesConfigModalOld = func
|
|
|
73
73
|
viewMode = _props$viewMode === void 0 ? 'table' : _props$viewMode,
|
|
74
74
|
initialParameters = props.parameters,
|
|
75
75
|
urlBeingEdited = props.url,
|
|
76
|
-
initialVisibleColumnKeys = props.visibleColumnKeys
|
|
76
|
+
initialVisibleColumnKeys = props.visibleColumnKeys,
|
|
77
|
+
_props$disableDisplay = props.disableDisplayDropdown,
|
|
78
|
+
disableDisplayDropdown = _props$disableDisplay === void 0 ? false : _props$disableDisplay;
|
|
77
79
|
var _useState = (0, _react.useState)(viewMode),
|
|
78
80
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
79
81
|
currentViewMode = _useState2[0],
|
|
@@ -463,7 +465,7 @@ var PlainJiraIssuesConfigModalOld = exports.PlainJiraIssuesConfigModalOld = func
|
|
|
463
465
|
selectedSite: selectedJiraSite,
|
|
464
466
|
testId: "jira-datasource-modal--site-selector",
|
|
465
467
|
label: siteSelectorLabel
|
|
466
|
-
})), !hasNoJiraSites && (0, _react2.jsx)(_displayViewDropDown.DisplayViewDropDown, {
|
|
468
|
+
})), !hasNoJiraSites && !disableDisplayDropdown && (0, _react2.jsx)(_displayViewDropDown.DisplayViewDropDown, {
|
|
467
469
|
onViewModeChange: handleViewModeChange,
|
|
468
470
|
viewMode: currentViewMode
|
|
469
471
|
})), (0, _react2.jsx)(_modalDialog.ModalBody, null, !hasNoJiraSites ? (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_jiraSearchContainer.JiraSearchContainer, {
|
|
@@ -3,7 +3,16 @@ import { FormattedMessage } from 'react-intl-next';
|
|
|
3
3
|
import uuid from 'uuid';
|
|
4
4
|
import { useFlags } from '@atlaskit/flag';
|
|
5
5
|
import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
|
|
6
|
+
import { useDatasourceAnalyticsEvents } from '../analytics';
|
|
6
7
|
import { issueLikeTableMessages } from '../ui/issue-like-table/messages';
|
|
8
|
+
const getErrorReason = status => {
|
|
9
|
+
switch (status) {
|
|
10
|
+
case 403:
|
|
11
|
+
return 'access_denied';
|
|
12
|
+
default:
|
|
13
|
+
return 'request_failed';
|
|
14
|
+
}
|
|
15
|
+
};
|
|
7
16
|
const getGenericErrorMessage = status => {
|
|
8
17
|
switch (status) {
|
|
9
18
|
case 403:
|
|
@@ -22,6 +31,9 @@ export const useDatasourceTableFlag = options => {
|
|
|
22
31
|
const {
|
|
23
32
|
showFlag
|
|
24
33
|
} = useFlags();
|
|
34
|
+
const {
|
|
35
|
+
fireEvent
|
|
36
|
+
} = useDatasourceAnalyticsEvents();
|
|
25
37
|
const showErrorFlag = useCallback(args => {
|
|
26
38
|
showFlag({
|
|
27
39
|
// We need IconTile in order to scale the new icon to 24px
|
|
@@ -35,7 +47,10 @@ export const useDatasourceTableFlag = options => {
|
|
|
35
47
|
...getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status),
|
|
36
48
|
...args
|
|
37
49
|
});
|
|
38
|
-
|
|
50
|
+
fireEvent('ui.error.shown.inlineEdit', {
|
|
51
|
+
reason: getErrorReason(args === null || args === void 0 ? void 0 : args.status)
|
|
52
|
+
});
|
|
53
|
+
}, [fireEvent, showFlag]);
|
|
39
54
|
return {
|
|
40
55
|
showErrorFlag
|
|
41
56
|
};
|
|
@@ -199,7 +199,8 @@ export const useDatasourceTableState = ({
|
|
|
199
199
|
* Product is typed as any.
|
|
200
200
|
*/
|
|
201
201
|
const integrationKey = product;
|
|
202
|
-
const
|
|
202
|
+
const entityType = destinationObjectTypes !== null && destinationObjectTypes !== void 0 && destinationObjectTypes.length ? destinationObjectTypes[0] : undefined;
|
|
203
|
+
const newIds = onAddItems(items, typeof integrationKey === 'string' ? integrationKey : undefined, entityType);
|
|
203
204
|
setResponseItemIds(currentIds => [...currentIds, ...newIds]);
|
|
204
205
|
if (fg('platform-datasources-enable-two-way-sync')) {
|
|
205
206
|
if (!isFedRamp()) {
|
|
@@ -208,12 +209,12 @@ export const useDatasourceTableState = ({
|
|
|
208
209
|
var _item$ari;
|
|
209
210
|
return typeof ((_item$ari = item.ari) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === 'string' ? [...acc, item.ari.data] : acc;
|
|
210
211
|
}, []);
|
|
211
|
-
if (aris.length &&
|
|
212
|
+
if (aris.length && entityType) {
|
|
212
213
|
discoverActions({
|
|
213
214
|
aris,
|
|
214
215
|
integrationKey,
|
|
215
216
|
fieldKeys,
|
|
216
|
-
entityType
|
|
217
|
+
entityType
|
|
217
218
|
});
|
|
218
219
|
}
|
|
219
220
|
}
|
|
@@ -30,7 +30,7 @@ export const actions = {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
},
|
|
33
|
-
onAddItems: (items, integrationKey) => ({
|
|
33
|
+
onAddItems: (items, integrationKey, entityType) => ({
|
|
34
34
|
setState,
|
|
35
35
|
getState
|
|
36
36
|
}) => {
|
|
@@ -45,6 +45,7 @@ export const actions = {
|
|
|
45
45
|
...itemMap,
|
|
46
46
|
[id]: {
|
|
47
47
|
ari,
|
|
48
|
+
entityType,
|
|
48
49
|
integrationKey,
|
|
49
50
|
data: {
|
|
50
51
|
...((_oldItems$id = oldItems[id]) === null || _oldItems$id === void 0 ? void 0 : _oldItems$id.data),
|
|
@@ -26,7 +26,8 @@ export const createDatasourceModal = ({
|
|
|
26
26
|
wrappedColumnKeys,
|
|
27
27
|
parameters,
|
|
28
28
|
onInsert,
|
|
29
|
-
viewMode
|
|
29
|
+
viewMode,
|
|
30
|
+
disableDisplayDropdown
|
|
30
31
|
} = props;
|
|
31
32
|
return jsx(AnalyticsContext, {
|
|
32
33
|
data: {
|
|
@@ -45,7 +46,8 @@ export const createDatasourceModal = ({
|
|
|
45
46
|
isValidParameters: isValidParameters,
|
|
46
47
|
onInsert: onInsert
|
|
47
48
|
}, jsx(DatasourceViewModeProvider, {
|
|
48
|
-
viewMode: viewMode !== null && viewMode !== void 0 ? viewMode : DEFAULT_VIEW_MODE
|
|
49
|
+
viewMode: viewMode !== null && viewMode !== void 0 ? viewMode : DEFAULT_VIEW_MODE,
|
|
50
|
+
disableDisplayDropdown: disableDisplayDropdown || false
|
|
49
51
|
}, jsx(ModalContent, props))))));
|
|
50
52
|
};
|
|
51
53
|
};
|
|
@@ -113,11 +113,15 @@ export const ModeSwitcher = props => {
|
|
|
113
113
|
})) : null;
|
|
114
114
|
};
|
|
115
115
|
export const DatasourceViewModeDropDown = () => {
|
|
116
|
+
const userInteractions = useUserInteractions();
|
|
116
117
|
const {
|
|
117
118
|
currentViewMode,
|
|
118
|
-
setCurrentViewMode
|
|
119
|
+
setCurrentViewMode,
|
|
120
|
+
disableDisplayDropdown
|
|
119
121
|
} = useViewModeContext();
|
|
120
|
-
|
|
122
|
+
if (disableDisplayDropdown) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
121
125
|
const handleViewModeChange = selectedMode => {
|
|
122
126
|
userInteractions.add(DatasourceAction.DISPLAY_VIEW_CHANGED);
|
|
123
127
|
setCurrentViewMode(selectedMode);
|
|
@@ -9,13 +9,15 @@ import { jsx } from '@emotion/react';
|
|
|
9
9
|
const ViewModeContext = /*#__PURE__*/createContext(null);
|
|
10
10
|
export const DatasourceViewModeProvider = ({
|
|
11
11
|
viewMode: initialViewMode,
|
|
12
|
+
disableDisplayDropdown,
|
|
12
13
|
children
|
|
13
14
|
}) => {
|
|
14
15
|
const [currentViewMode, setCurrentViewMode] = useState(initialViewMode);
|
|
15
16
|
const value = useMemo(() => ({
|
|
16
17
|
currentViewMode,
|
|
17
|
-
setCurrentViewMode
|
|
18
|
-
|
|
18
|
+
setCurrentViewMode,
|
|
19
|
+
disableDisplayDropdown
|
|
20
|
+
}), [currentViewMode, setCurrentViewMode, disableDisplayDropdown]);
|
|
19
21
|
return jsx(ViewModeContext.Provider, {
|
|
20
22
|
value: value
|
|
21
23
|
}, children);
|
|
@@ -76,7 +76,6 @@ export const PlainConfluenceSearchConfigModal = props => {
|
|
|
76
76
|
const {
|
|
77
77
|
onCancel,
|
|
78
78
|
url: urlBeingEdited,
|
|
79
|
-
disableDisplayDropdown = false,
|
|
80
79
|
overrideParameters
|
|
81
80
|
} = props;
|
|
82
81
|
const {
|
|
@@ -300,7 +299,7 @@ export const PlainConfluenceSearchConfigModal = props => {
|
|
|
300
299
|
selectedSite: selectedConfluenceSite,
|
|
301
300
|
testId: "confluence-search-datasource-modal--site-selector",
|
|
302
301
|
label: siteSelectorLabel
|
|
303
|
-
})), !hasNoConfluenceSites &&
|
|
302
|
+
})), !hasNoConfluenceSites && jsx(DatasourceViewModeDropDown, null)), jsx(ModalBody, null, !hasNoConfluenceSites ? jsx(Fragment, null, jsx(Box, {
|
|
304
303
|
xcss: inputContainerStyles
|
|
305
304
|
}, jsx(ConfluenceSearchContainer, {
|
|
306
305
|
isSearching: status === 'loading',
|
|
@@ -36,6 +36,10 @@ export const InlineEdit = ({
|
|
|
36
36
|
const item = useDatasourceItem({
|
|
37
37
|
id: ari
|
|
38
38
|
});
|
|
39
|
+
const {
|
|
40
|
+
entityType,
|
|
41
|
+
integrationKey
|
|
42
|
+
} = item || {};
|
|
39
43
|
const {
|
|
40
44
|
showErrorFlag
|
|
41
45
|
} = useDatasourceTableFlag();
|
|
@@ -67,6 +71,16 @@ export const InlineEdit = ({
|
|
|
67
71
|
});
|
|
68
72
|
setIsEditing(false);
|
|
69
73
|
}, [item, datasourceTypeWithValues.type, columnKey, onUpdateItem, ari, execute, fireEvent, showErrorFlag]);
|
|
74
|
+
const onEdit = useCallback(() => {
|
|
75
|
+
setIsEditing(true);
|
|
76
|
+
if (integrationKey && entityType) {
|
|
77
|
+
fireEvent('ui.inlineEdit.clicked.datasource', {
|
|
78
|
+
integrationKey,
|
|
79
|
+
entityType,
|
|
80
|
+
fieldKey: columnKey
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}, [columnKey, entityType, fireEvent, integrationKey]);
|
|
70
84
|
return /*#__PURE__*/React.createElement(Box, {
|
|
71
85
|
xcss: editContainerStyles
|
|
72
86
|
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType(datasourceTypeWithValues), {
|
|
@@ -74,7 +88,7 @@ export const InlineEdit = ({
|
|
|
74
88
|
readView: () => readView,
|
|
75
89
|
readViewFitContainerWidth: true,
|
|
76
90
|
isEditing: isEditing,
|
|
77
|
-
onEdit:
|
|
91
|
+
onEdit: onEdit,
|
|
78
92
|
onCancel: () => setIsEditing(false),
|
|
79
93
|
onConfirm: onCommitUpdate
|
|
80
94
|
})));
|
|
@@ -66,7 +66,8 @@ export const PlainJiraIssuesConfigModalOld = props => {
|
|
|
66
66
|
viewMode = 'table',
|
|
67
67
|
parameters: initialParameters,
|
|
68
68
|
url: urlBeingEdited,
|
|
69
|
-
visibleColumnKeys: initialVisibleColumnKeys
|
|
69
|
+
visibleColumnKeys: initialVisibleColumnKeys,
|
|
70
|
+
disableDisplayDropdown = false
|
|
70
71
|
} = props;
|
|
71
72
|
const [currentViewMode, setCurrentViewMode] = useState(viewMode);
|
|
72
73
|
const [cloudId, setCloudId] = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.cloudId);
|
|
@@ -447,7 +448,7 @@ export const PlainJiraIssuesConfigModalOld = props => {
|
|
|
447
448
|
selectedSite: selectedJiraSite,
|
|
448
449
|
testId: "jira-datasource-modal--site-selector",
|
|
449
450
|
label: siteSelectorLabel
|
|
450
|
-
})), !hasNoJiraSites && jsx(DisplayViewDropDown, {
|
|
451
|
+
})), !hasNoJiraSites && !disableDisplayDropdown && jsx(DisplayViewDropDown, {
|
|
451
452
|
onViewModeChange: handleViewModeChange,
|
|
452
453
|
viewMode: currentViewMode
|
|
453
454
|
})), jsx(ModalBody, null, !hasNoJiraSites ? jsx(Fragment, null, jsx(JiraSearchContainer, {
|
|
@@ -6,7 +6,16 @@ import { FormattedMessage } from 'react-intl-next';
|
|
|
6
6
|
import uuid from 'uuid';
|
|
7
7
|
import { useFlags } from '@atlaskit/flag';
|
|
8
8
|
import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
|
|
9
|
+
import { useDatasourceAnalyticsEvents } from '../analytics';
|
|
9
10
|
import { issueLikeTableMessages } from '../ui/issue-like-table/messages';
|
|
11
|
+
var getErrorReason = function getErrorReason(status) {
|
|
12
|
+
switch (status) {
|
|
13
|
+
case 403:
|
|
14
|
+
return 'access_denied';
|
|
15
|
+
default:
|
|
16
|
+
return 'request_failed';
|
|
17
|
+
}
|
|
18
|
+
};
|
|
10
19
|
var getGenericErrorMessage = function getGenericErrorMessage(status) {
|
|
11
20
|
switch (status) {
|
|
12
21
|
case 403:
|
|
@@ -24,6 +33,8 @@ var getGenericErrorMessage = function getGenericErrorMessage(status) {
|
|
|
24
33
|
export var useDatasourceTableFlag = function useDatasourceTableFlag(options) {
|
|
25
34
|
var _useFlags = useFlags(),
|
|
26
35
|
showFlag = _useFlags.showFlag;
|
|
36
|
+
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
37
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
27
38
|
var showErrorFlag = useCallback(function (args) {
|
|
28
39
|
showFlag(_objectSpread(_objectSpread({
|
|
29
40
|
// We need IconTile in order to scale the new icon to 24px
|
|
@@ -35,7 +46,10 @@ export var useDatasourceTableFlag = function useDatasourceTableFlag(options) {
|
|
|
35
46
|
id: uuid(),
|
|
36
47
|
isAutoDismiss: true
|
|
37
48
|
}, getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status)), args));
|
|
38
|
-
|
|
49
|
+
fireEvent('ui.error.shown.inlineEdit', {
|
|
50
|
+
reason: getErrorReason(args === null || args === void 0 ? void 0 : args.status)
|
|
51
|
+
});
|
|
52
|
+
}, [fireEvent, showFlag]);
|
|
39
53
|
return {
|
|
40
54
|
showErrorFlag: showErrorFlag
|
|
41
55
|
};
|
|
@@ -225,6 +225,7 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
225
225
|
_totalCount,
|
|
226
226
|
schema,
|
|
227
227
|
integrationKey,
|
|
228
|
+
entityType,
|
|
228
229
|
newIds,
|
|
229
230
|
aris,
|
|
230
231
|
isUserLoadingNextPage,
|
|
@@ -307,7 +308,8 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
307
308
|
* Product is typed as any.
|
|
308
309
|
*/
|
|
309
310
|
integrationKey = product;
|
|
310
|
-
|
|
311
|
+
entityType = _destinationObjectTypes !== null && _destinationObjectTypes !== void 0 && _destinationObjectTypes.length ? _destinationObjectTypes[0] : undefined;
|
|
312
|
+
newIds = onAddItems(items, typeof integrationKey === 'string' ? integrationKey : undefined, entityType);
|
|
311
313
|
setResponseItemIds(function (currentIds) {
|
|
312
314
|
return [].concat(_toConsumableArray(currentIds), _toConsumableArray(newIds));
|
|
313
315
|
});
|
|
@@ -318,12 +320,12 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
318
320
|
var _item$ari;
|
|
319
321
|
return typeof ((_item$ari = item.ari) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === 'string' ? [].concat(_toConsumableArray(acc), [item.ari.data]) : acc;
|
|
320
322
|
}, []);
|
|
321
|
-
if (aris.length &&
|
|
323
|
+
if (aris.length && entityType) {
|
|
322
324
|
discoverActions({
|
|
323
325
|
aris: aris,
|
|
324
326
|
integrationKey: integrationKey,
|
|
325
327
|
fieldKeys: fieldKeys,
|
|
326
|
-
entityType:
|
|
328
|
+
entityType: entityType
|
|
327
329
|
});
|
|
328
330
|
}
|
|
329
331
|
}
|
package/dist/esm/state/index.js
CHANGED
|
@@ -31,7 +31,7 @@ export var actions = {
|
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
},
|
|
34
|
-
onAddItems: function onAddItems(items, integrationKey) {
|
|
34
|
+
onAddItems: function onAddItems(items, integrationKey, entityType) {
|
|
35
35
|
return function (_ref2) {
|
|
36
36
|
var setState = _ref2.setState,
|
|
37
37
|
getState = _ref2.getState;
|
|
@@ -45,6 +45,7 @@ export var actions = {
|
|
|
45
45
|
var id = ari !== null && ari !== void 0 ? ari : uuidv4();
|
|
46
46
|
return [[].concat(_toConsumableArray(ids), [id]), _objectSpread(_objectSpread({}, itemMap), {}, _defineProperty({}, id, {
|
|
47
47
|
ari: ari,
|
|
48
|
+
entityType: entityType,
|
|
48
49
|
integrationKey: integrationKey,
|
|
49
50
|
data: _objectSpread(_objectSpread({}, (_oldItems$id = oldItems[id]) === null || _oldItems$id === void 0 ? void 0 : _oldItems$id.data), item)
|
|
50
51
|
}))];
|
|
@@ -24,7 +24,8 @@ export var createDatasourceModal = function createDatasourceModal(_ref) {
|
|
|
24
24
|
wrappedColumnKeys = props.wrappedColumnKeys,
|
|
25
25
|
parameters = props.parameters,
|
|
26
26
|
onInsert = props.onInsert,
|
|
27
|
-
viewMode = props.viewMode
|
|
27
|
+
viewMode = props.viewMode,
|
|
28
|
+
disableDisplayDropdown = props.disableDisplayDropdown;
|
|
28
29
|
return jsx(AnalyticsContext, {
|
|
29
30
|
data: {
|
|
30
31
|
source: 'datasourceConfigModal',
|
|
@@ -42,7 +43,8 @@ export var createDatasourceModal = function createDatasourceModal(_ref) {
|
|
|
42
43
|
isValidParameters: isValidParameters,
|
|
43
44
|
onInsert: onInsert
|
|
44
45
|
}, jsx(DatasourceViewModeProvider, {
|
|
45
|
-
viewMode: viewMode !== null && viewMode !== void 0 ? viewMode : DEFAULT_VIEW_MODE
|
|
46
|
+
viewMode: viewMode !== null && viewMode !== void 0 ? viewMode : DEFAULT_VIEW_MODE,
|
|
47
|
+
disableDisplayDropdown: disableDisplayDropdown || false
|
|
46
48
|
}, jsx(ModalContent, props))))));
|
|
47
49
|
};
|
|
48
50
|
};
|
|
@@ -113,10 +113,14 @@ export var ModeSwitcher = function ModeSwitcher(props) {
|
|
|
113
113
|
})) : null;
|
|
114
114
|
};
|
|
115
115
|
export var DatasourceViewModeDropDown = function DatasourceViewModeDropDown() {
|
|
116
|
+
var userInteractions = useUserInteractions();
|
|
116
117
|
var _useViewModeContext = useViewModeContext(),
|
|
117
118
|
currentViewMode = _useViewModeContext.currentViewMode,
|
|
118
|
-
setCurrentViewMode = _useViewModeContext.setCurrentViewMode
|
|
119
|
-
|
|
119
|
+
setCurrentViewMode = _useViewModeContext.setCurrentViewMode,
|
|
120
|
+
disableDisplayDropdown = _useViewModeContext.disableDisplayDropdown;
|
|
121
|
+
if (disableDisplayDropdown) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
120
124
|
var handleViewModeChange = function handleViewModeChange(selectedMode) {
|
|
121
125
|
userInteractions.add(DatasourceAction.DISPLAY_VIEW_CHANGED);
|
|
122
126
|
setCurrentViewMode(selectedMode);
|
|
@@ -10,6 +10,7 @@ import { jsx } from '@emotion/react';
|
|
|
10
10
|
var ViewModeContext = /*#__PURE__*/createContext(null);
|
|
11
11
|
export var DatasourceViewModeProvider = function DatasourceViewModeProvider(_ref) {
|
|
12
12
|
var initialViewMode = _ref.viewMode,
|
|
13
|
+
disableDisplayDropdown = _ref.disableDisplayDropdown,
|
|
13
14
|
children = _ref.children;
|
|
14
15
|
var _useState = useState(initialViewMode),
|
|
15
16
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -18,9 +19,10 @@ export var DatasourceViewModeProvider = function DatasourceViewModeProvider(_ref
|
|
|
18
19
|
var value = useMemo(function () {
|
|
19
20
|
return {
|
|
20
21
|
currentViewMode: currentViewMode,
|
|
21
|
-
setCurrentViewMode: setCurrentViewMode
|
|
22
|
+
setCurrentViewMode: setCurrentViewMode,
|
|
23
|
+
disableDisplayDropdown: disableDisplayDropdown
|
|
22
24
|
};
|
|
23
|
-
}, [currentViewMode, setCurrentViewMode]);
|
|
25
|
+
}, [currentViewMode, setCurrentViewMode, disableDisplayDropdown]);
|
|
24
26
|
return jsx(ViewModeContext.Provider, {
|
|
25
27
|
value: value
|
|
26
28
|
}, children);
|
|
@@ -76,8 +76,6 @@ var useUpdateParametersOnFormUpdate = function useUpdateParametersOnFormUpdate(c
|
|
|
76
76
|
export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConfigModal(props) {
|
|
77
77
|
var onCancel = props.onCancel,
|
|
78
78
|
urlBeingEdited = props.url,
|
|
79
|
-
_props$disableDisplay = props.disableDisplayDropdown,
|
|
80
|
-
disableDisplayDropdown = _props$disableDisplay === void 0 ? false : _props$disableDisplay,
|
|
81
79
|
overrideParameters = props.overrideParameters;
|
|
82
80
|
var _useViewModeContext = useViewModeContext(),
|
|
83
81
|
currentViewMode = _useViewModeContext.currentViewMode;
|
|
@@ -310,7 +308,7 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
310
308
|
selectedSite: selectedConfluenceSite,
|
|
311
309
|
testId: "confluence-search-datasource-modal--site-selector",
|
|
312
310
|
label: siteSelectorLabel
|
|
313
|
-
})), !hasNoConfluenceSites &&
|
|
311
|
+
})), !hasNoConfluenceSites && jsx(DatasourceViewModeDropDown, null)), jsx(ModalBody, null, !hasNoConfluenceSites ? jsx(Fragment, null, jsx(Box, {
|
|
314
312
|
xcss: inputContainerStyles
|
|
315
313
|
}, jsx(ConfluenceSearchContainer, {
|
|
316
314
|
isSearching: status === 'loading',
|
|
@@ -40,6 +40,9 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
40
40
|
var item = useDatasourceItem({
|
|
41
41
|
id: ari
|
|
42
42
|
});
|
|
43
|
+
var _ref2 = item || {},
|
|
44
|
+
entityType = _ref2.entityType,
|
|
45
|
+
integrationKey = _ref2.integrationKey;
|
|
43
46
|
var _useDatasourceTableFl = useDatasourceTableFlag(),
|
|
44
47
|
showErrorFlag = _useDatasourceTableFl.showErrorFlag;
|
|
45
48
|
var _useDatasourceActions = useDatasourceActions(),
|
|
@@ -68,6 +71,16 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
68
71
|
});
|
|
69
72
|
setIsEditing(false);
|
|
70
73
|
}, [item, datasourceTypeWithValues.type, columnKey, onUpdateItem, ari, execute, fireEvent, showErrorFlag]);
|
|
74
|
+
var onEdit = useCallback(function () {
|
|
75
|
+
setIsEditing(true);
|
|
76
|
+
if (integrationKey && entityType) {
|
|
77
|
+
fireEvent('ui.inlineEdit.clicked.datasource', {
|
|
78
|
+
integrationKey: integrationKey,
|
|
79
|
+
entityType: entityType,
|
|
80
|
+
fieldKey: columnKey
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}, [columnKey, entityType, fireEvent, integrationKey]);
|
|
71
84
|
return /*#__PURE__*/React.createElement(Box, {
|
|
72
85
|
xcss: editContainerStyles
|
|
73
86
|
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType(datasourceTypeWithValues), {
|
|
@@ -77,9 +90,7 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
77
90
|
},
|
|
78
91
|
readViewFitContainerWidth: true,
|
|
79
92
|
isEditing: isEditing,
|
|
80
|
-
onEdit:
|
|
81
|
-
return setIsEditing(true);
|
|
82
|
-
},
|
|
93
|
+
onEdit: onEdit,
|
|
83
94
|
onCancel: function onCancel() {
|
|
84
95
|
return setIsEditing(false);
|
|
85
96
|
},
|
|
@@ -70,7 +70,9 @@ export var PlainJiraIssuesConfigModalOld = function PlainJiraIssuesConfigModalOl
|
|
|
70
70
|
viewMode = _props$viewMode === void 0 ? 'table' : _props$viewMode,
|
|
71
71
|
initialParameters = props.parameters,
|
|
72
72
|
urlBeingEdited = props.url,
|
|
73
|
-
initialVisibleColumnKeys = props.visibleColumnKeys
|
|
73
|
+
initialVisibleColumnKeys = props.visibleColumnKeys,
|
|
74
|
+
_props$disableDisplay = props.disableDisplayDropdown,
|
|
75
|
+
disableDisplayDropdown = _props$disableDisplay === void 0 ? false : _props$disableDisplay;
|
|
74
76
|
var _useState = useState(viewMode),
|
|
75
77
|
_useState2 = _slicedToArray(_useState, 2),
|
|
76
78
|
currentViewMode = _useState2[0],
|
|
@@ -460,7 +462,7 @@ export var PlainJiraIssuesConfigModalOld = function PlainJiraIssuesConfigModalOl
|
|
|
460
462
|
selectedSite: selectedJiraSite,
|
|
461
463
|
testId: "jira-datasource-modal--site-selector",
|
|
462
464
|
label: siteSelectorLabel
|
|
463
|
-
})), !hasNoJiraSites && jsx(DisplayViewDropDown, {
|
|
465
|
+
})), !hasNoJiraSites && !disableDisplayDropdown && jsx(DisplayViewDropDown, {
|
|
464
466
|
onViewModeChange: handleViewModeChange,
|
|
465
467
|
viewMode: currentViewMode
|
|
466
468
|
})), jsx(ModalBody, null, !hasNoJiraSites ? jsx(Fragment, null, jsx(JiraSearchContainer, {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::87bb81d0c3b90473d208f9c02285004e>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
|
|
8
8
|
*/
|
|
9
9
|
export type ComponentMetaDataType = {
|
|
@@ -152,6 +152,14 @@ export type ActionDiscoverySuccessAttributesType = {
|
|
|
152
152
|
datasourceId: string | null;
|
|
153
153
|
};
|
|
154
154
|
export type FormSubmittedInlineEditAttributesType = {};
|
|
155
|
+
export type InlineEditClickedDatasourceAttributesType = {
|
|
156
|
+
entityType: string;
|
|
157
|
+
integrationKey: string;
|
|
158
|
+
fieldKey: string;
|
|
159
|
+
};
|
|
160
|
+
export type ErrorShownInlineEditAttributesType = {
|
|
161
|
+
reason: 'access_denied' | 'request_failed';
|
|
162
|
+
};
|
|
155
163
|
export type AnalyticsEventAttributes = {
|
|
156
164
|
/**
|
|
157
165
|
* Fires when user sees modal dialog. */
|
|
@@ -270,5 +278,11 @@ export type AnalyticsEventAttributes = {
|
|
|
270
278
|
/**
|
|
271
279
|
* Fired when the user initiates an update via inline edit through enter key press or submit */
|
|
272
280
|
'ui.form.submitted.inlineEdit': FormSubmittedInlineEditAttributesType;
|
|
281
|
+
/**
|
|
282
|
+
* Fired when inline edit is clicked to show edit mode */
|
|
283
|
+
'ui.inlineEdit.clicked.datasource': InlineEditClickedDatasourceAttributesType;
|
|
284
|
+
/**
|
|
285
|
+
* Fired when the inline edit failed and the error flag is shown. */
|
|
286
|
+
'ui.error.shown.inlineEdit': ErrorShownInlineEditAttributesType;
|
|
273
287
|
};
|
|
274
288
|
export type EventKey = keyof AnalyticsEventAttributes;
|
|
@@ -25,4 +25,6 @@ export type ConfigModalProps<ADF, Parameters> = {
|
|
|
25
25
|
* - Inline = Presents a smart link that shows the count of query results. However, if there's only one result, it converts to an inline smart link of that issue.
|
|
26
26
|
*/
|
|
27
27
|
viewMode?: DisplayViewModes;
|
|
28
|
+
/** Disable the view mode display dropdown */
|
|
29
|
+
disableDisplayDropdown?: boolean;
|
|
28
30
|
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'wrappedColumnKeys' | 'columnCustomSizes'>>;
|
|
@@ -4,6 +4,7 @@ import type { DatasourceDataResponseItem } from '@atlaskit/linking-types';
|
|
|
4
4
|
type UniqueIdentifier = string;
|
|
5
5
|
interface DatasourceItem {
|
|
6
6
|
ari: string | undefined;
|
|
7
|
+
entityType: string | undefined;
|
|
7
8
|
integrationKey: string | undefined;
|
|
8
9
|
data: DatasourceDataResponseItem;
|
|
9
10
|
}
|
|
@@ -12,18 +13,18 @@ export interface State {
|
|
|
12
13
|
}
|
|
13
14
|
export declare const actions: {
|
|
14
15
|
onUpdateItem: (id: string, data: DatasourceDataResponseItem) => Action<State, void, void>;
|
|
15
|
-
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined) => Action<State, void, string[]>;
|
|
16
|
+
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined, entityType: string | undefined) => Action<State, void, string[]>;
|
|
16
17
|
};
|
|
17
18
|
export declare const Store: import("react-sweet-state").Store<State, {
|
|
18
19
|
onUpdateItem: (id: string, data: DatasourceDataResponseItem) => Action<State, void, void>;
|
|
19
|
-
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined) => Action<State, void, string[]>;
|
|
20
|
+
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined, entityType: string | undefined) => Action<State, void, string[]>;
|
|
20
21
|
}>;
|
|
21
22
|
export declare const useDatasourceItem: import("react-sweet-state").HookStateFunction<DatasourceItem | undefined, {
|
|
22
23
|
id: string;
|
|
23
24
|
}>;
|
|
24
25
|
export declare const useDatasourceActions: import("react-sweet-state").HookActionsFunction<import("react-sweet-state").BoundActions<State, {
|
|
25
26
|
onUpdateItem: (id: string, data: DatasourceDataResponseItem) => Action<State, void, void>;
|
|
26
|
-
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined) => Action<State, void, string[]>;
|
|
27
|
+
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined, entityType: string | undefined) => Action<State, void, string[]>;
|
|
27
28
|
}>>;
|
|
28
29
|
export declare const StoreContainer: ({ children }: {
|
|
29
30
|
children: JSX.Element;
|
|
@@ -13,4 +13,4 @@ export interface ModeSwitcherProps<T extends string = string> {
|
|
|
13
13
|
selectedOptionValue?: string;
|
|
14
14
|
}
|
|
15
15
|
export declare const ModeSwitcher: <T extends string = string>(props: ModeSwitcherProps<T>) => jsx.JSX.Element | null;
|
|
16
|
-
export declare const DatasourceViewModeDropDown: () => jsx.JSX.Element;
|
|
16
|
+
export declare const DatasourceViewModeDropDown: () => jsx.JSX.Element | null;
|
|
@@ -8,9 +8,11 @@ import type { DisplayViewModes } from '../../../../common/types';
|
|
|
8
8
|
interface ViewModeHookState {
|
|
9
9
|
currentViewMode: DisplayViewModes;
|
|
10
10
|
setCurrentViewMode: (selectedMode: DisplayViewModes) => void;
|
|
11
|
+
disableDisplayDropdown: boolean;
|
|
11
12
|
}
|
|
12
|
-
export declare const DatasourceViewModeProvider: ({ viewMode: initialViewMode, children, }: {
|
|
13
|
+
export declare const DatasourceViewModeProvider: ({ viewMode: initialViewMode, disableDisplayDropdown, children, }: {
|
|
13
14
|
viewMode: DisplayViewModes;
|
|
15
|
+
disableDisplayDropdown: boolean;
|
|
14
16
|
children: React.ReactNode;
|
|
15
17
|
}) => jsx.JSX.Element;
|
|
16
18
|
export declare const useViewModeContext: () => ViewModeHookState;
|
|
@@ -4,11 +4,9 @@ import { type ConfigModalProps } from '../../common/types';
|
|
|
4
4
|
import { type ConnectedConfigModalProps } from '../common/modal/datasource-modal/createDatasourceModal';
|
|
5
5
|
import { type DateRangeType } from '../common/modal/popup-select/types';
|
|
6
6
|
export interface ConfluenceSearchConfigModalProps extends ConfigModalProps<InlineCardAdf | ConfluenceSearchDatasourceAdf, DatasourceParameters | ConfluenceSearchDatasourceParameters> {
|
|
7
|
-
disableDisplayDropdown?: boolean;
|
|
8
7
|
overrideParameters?: Pick<ConfluenceSearchDatasourceParameters, 'entityTypes'>;
|
|
9
8
|
}
|
|
10
9
|
export interface ConnectedConfluenceSearchConfigModalProps extends ConnectedConfigModalProps<ConfluenceSearchDatasourceParameters> {
|
|
11
|
-
disableDisplayDropdown?: boolean;
|
|
12
10
|
overrideParameters?: Pick<ConfluenceSearchDatasourceParameters, 'entityTypes'>;
|
|
13
11
|
}
|
|
14
12
|
export type ConfluenceSearchDatasourceParameters = {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::87bb81d0c3b90473d208f9c02285004e>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
|
|
8
8
|
*/
|
|
9
9
|
export type ComponentMetaDataType = {
|
|
@@ -152,6 +152,14 @@ export type ActionDiscoverySuccessAttributesType = {
|
|
|
152
152
|
datasourceId: string | null;
|
|
153
153
|
};
|
|
154
154
|
export type FormSubmittedInlineEditAttributesType = {};
|
|
155
|
+
export type InlineEditClickedDatasourceAttributesType = {
|
|
156
|
+
entityType: string;
|
|
157
|
+
integrationKey: string;
|
|
158
|
+
fieldKey: string;
|
|
159
|
+
};
|
|
160
|
+
export type ErrorShownInlineEditAttributesType = {
|
|
161
|
+
reason: 'access_denied' | 'request_failed';
|
|
162
|
+
};
|
|
155
163
|
export type AnalyticsEventAttributes = {
|
|
156
164
|
/**
|
|
157
165
|
* Fires when user sees modal dialog. */
|
|
@@ -270,5 +278,11 @@ export type AnalyticsEventAttributes = {
|
|
|
270
278
|
/**
|
|
271
279
|
* Fired when the user initiates an update via inline edit through enter key press or submit */
|
|
272
280
|
'ui.form.submitted.inlineEdit': FormSubmittedInlineEditAttributesType;
|
|
281
|
+
/**
|
|
282
|
+
* Fired when inline edit is clicked to show edit mode */
|
|
283
|
+
'ui.inlineEdit.clicked.datasource': InlineEditClickedDatasourceAttributesType;
|
|
284
|
+
/**
|
|
285
|
+
* Fired when the inline edit failed and the error flag is shown. */
|
|
286
|
+
'ui.error.shown.inlineEdit': ErrorShownInlineEditAttributesType;
|
|
273
287
|
};
|
|
274
288
|
export type EventKey = keyof AnalyticsEventAttributes;
|
|
@@ -25,4 +25,6 @@ export type ConfigModalProps<ADF, Parameters> = {
|
|
|
25
25
|
* - Inline = Presents a smart link that shows the count of query results. However, if there's only one result, it converts to an inline smart link of that issue.
|
|
26
26
|
*/
|
|
27
27
|
viewMode?: DisplayViewModes;
|
|
28
|
+
/** Disable the view mode display dropdown */
|
|
29
|
+
disableDisplayDropdown?: boolean;
|
|
28
30
|
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'wrappedColumnKeys' | 'columnCustomSizes'>>;
|
|
@@ -4,6 +4,7 @@ import type { DatasourceDataResponseItem } from '@atlaskit/linking-types';
|
|
|
4
4
|
type UniqueIdentifier = string;
|
|
5
5
|
interface DatasourceItem {
|
|
6
6
|
ari: string | undefined;
|
|
7
|
+
entityType: string | undefined;
|
|
7
8
|
integrationKey: string | undefined;
|
|
8
9
|
data: DatasourceDataResponseItem;
|
|
9
10
|
}
|
|
@@ -12,18 +13,18 @@ export interface State {
|
|
|
12
13
|
}
|
|
13
14
|
export declare const actions: {
|
|
14
15
|
onUpdateItem: (id: string, data: DatasourceDataResponseItem) => Action<State, void, void>;
|
|
15
|
-
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined) => Action<State, void, string[]>;
|
|
16
|
+
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined, entityType: string | undefined) => Action<State, void, string[]>;
|
|
16
17
|
};
|
|
17
18
|
export declare const Store: import("react-sweet-state").Store<State, {
|
|
18
19
|
onUpdateItem: (id: string, data: DatasourceDataResponseItem) => Action<State, void, void>;
|
|
19
|
-
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined) => Action<State, void, string[]>;
|
|
20
|
+
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined, entityType: string | undefined) => Action<State, void, string[]>;
|
|
20
21
|
}>;
|
|
21
22
|
export declare const useDatasourceItem: import("react-sweet-state").HookStateFunction<DatasourceItem | undefined, {
|
|
22
23
|
id: string;
|
|
23
24
|
}>;
|
|
24
25
|
export declare const useDatasourceActions: import("react-sweet-state").HookActionsFunction<import("react-sweet-state").BoundActions<State, {
|
|
25
26
|
onUpdateItem: (id: string, data: DatasourceDataResponseItem) => Action<State, void, void>;
|
|
26
|
-
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined) => Action<State, void, string[]>;
|
|
27
|
+
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined, entityType: string | undefined) => Action<State, void, string[]>;
|
|
27
28
|
}>>;
|
|
28
29
|
export declare const StoreContainer: ({ children }: {
|
|
29
30
|
children: JSX.Element;
|
|
@@ -13,4 +13,4 @@ export interface ModeSwitcherProps<T extends string = string> {
|
|
|
13
13
|
selectedOptionValue?: string;
|
|
14
14
|
}
|
|
15
15
|
export declare const ModeSwitcher: <T extends string = string>(props: ModeSwitcherProps<T>) => jsx.JSX.Element | null;
|
|
16
|
-
export declare const DatasourceViewModeDropDown: () => jsx.JSX.Element;
|
|
16
|
+
export declare const DatasourceViewModeDropDown: () => jsx.JSX.Element | null;
|
|
@@ -8,9 +8,11 @@ import type { DisplayViewModes } from '../../../../common/types';
|
|
|
8
8
|
interface ViewModeHookState {
|
|
9
9
|
currentViewMode: DisplayViewModes;
|
|
10
10
|
setCurrentViewMode: (selectedMode: DisplayViewModes) => void;
|
|
11
|
+
disableDisplayDropdown: boolean;
|
|
11
12
|
}
|
|
12
|
-
export declare const DatasourceViewModeProvider: ({ viewMode: initialViewMode, children, }: {
|
|
13
|
+
export declare const DatasourceViewModeProvider: ({ viewMode: initialViewMode, disableDisplayDropdown, children, }: {
|
|
13
14
|
viewMode: DisplayViewModes;
|
|
15
|
+
disableDisplayDropdown: boolean;
|
|
14
16
|
children: React.ReactNode;
|
|
15
17
|
}) => jsx.JSX.Element;
|
|
16
18
|
export declare const useViewModeContext: () => ViewModeHookState;
|
|
@@ -4,11 +4,9 @@ import { type ConfigModalProps } from '../../common/types';
|
|
|
4
4
|
import { type ConnectedConfigModalProps } from '../common/modal/datasource-modal/createDatasourceModal';
|
|
5
5
|
import { type DateRangeType } from '../common/modal/popup-select/types';
|
|
6
6
|
export interface ConfluenceSearchConfigModalProps extends ConfigModalProps<InlineCardAdf | ConfluenceSearchDatasourceAdf, DatasourceParameters | ConfluenceSearchDatasourceParameters> {
|
|
7
|
-
disableDisplayDropdown?: boolean;
|
|
8
7
|
overrideParameters?: Pick<ConfluenceSearchDatasourceParameters, 'entityTypes'>;
|
|
9
8
|
}
|
|
10
9
|
export interface ConnectedConfluenceSearchConfigModalProps extends ConnectedConfigModalProps<ConfluenceSearchDatasourceParameters> {
|
|
11
|
-
disableDisplayDropdown?: boolean;
|
|
12
10
|
overrideParameters?: Pick<ConfluenceSearchDatasourceParameters, 'entityTypes'>;
|
|
13
11
|
}
|
|
14
12
|
export type ConfluenceSearchDatasourceParameters = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.1",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"@atlaskit/inline-edit": "^13.7.0",
|
|
55
55
|
"@atlaskit/intl-messages-provider": "^1.0.0",
|
|
56
56
|
"@atlaskit/jql-ast": "^3.3.0",
|
|
57
|
-
"@atlaskit/jql-editor": "^4.
|
|
58
|
-
"@atlaskit/jql-editor-autocomplete-rest": "^2.
|
|
57
|
+
"@atlaskit/jql-editor": "^4.7.0",
|
|
58
|
+
"@atlaskit/jql-editor-autocomplete-rest": "^2.1.0",
|
|
59
59
|
"@atlaskit/layering": "^0.4.0",
|
|
60
60
|
"@atlaskit/link-client-extension": "^2.3.0",
|
|
61
61
|
"@atlaskit/linking-common": "^5.11.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
73
73
|
"@atlaskit/primitives": "^12.1.0",
|
|
74
74
|
"@atlaskit/select": "^17.15.0",
|
|
75
|
-
"@atlaskit/smart-card": "^27.
|
|
75
|
+
"@atlaskit/smart-card": "^27.20.0",
|
|
76
76
|
"@atlaskit/smart-user-picker": "6.10.2",
|
|
77
77
|
"@atlaskit/spinner": "^16.3.0",
|
|
78
78
|
"@atlaskit/tag": "^12.5.0",
|