@atlaskit/link-datasource 2.11.5 → 2.11.7
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 +20 -0
- package/dist/cjs/hooks/useDatasourceTableFlag.js +19 -16
- package/dist/cjs/hooks/useDatasourceTableState.js +3 -1
- package/dist/cjs/hooks/useErrorLogger.js +8 -7
- package/dist/cjs/state/actions/index.js +33 -18
- package/dist/cjs/ui/issue-like-table/edit-type/text/index.js +5 -2
- package/dist/cjs/ui/issue-like-table/messages.js +12 -7
- package/dist/cjs/ui/issue-like-table/table-cell-content/index.js +1 -0
- package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +16 -9
- package/dist/es2019/hooks/useDatasourceTableFlag.js +18 -14
- package/dist/es2019/hooks/useDatasourceTableState.js +3 -1
- package/dist/es2019/hooks/useErrorLogger.js +5 -7
- package/dist/es2019/state/actions/index.js +47 -32
- package/dist/es2019/ui/issue-like-table/edit-type/text/index.js +5 -2
- package/dist/es2019/ui/issue-like-table/messages.js +12 -7
- package/dist/es2019/ui/issue-like-table/table-cell-content/index.js +1 -0
- package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +14 -7
- package/dist/esm/hooks/useDatasourceTableFlag.js +20 -17
- package/dist/esm/hooks/useDatasourceTableState.js +3 -1
- package/dist/esm/hooks/useErrorLogger.js +8 -8
- package/dist/esm/state/actions/index.js +33 -18
- package/dist/esm/ui/issue-like-table/edit-type/text/index.js +5 -2
- package/dist/esm/ui/issue-like-table/messages.js +12 -7
- package/dist/esm/ui/issue-like-table/table-cell-content/index.js +1 -0
- package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +14 -7
- package/dist/types/hooks/useDatasourceTableFlag.d.ts +3 -1
- package/dist/types/hooks/useErrorLogger.d.ts +6 -2
- package/dist/types/state/actions/index.d.ts +6 -4
- package/dist/types/ui/issue-like-table/messages.d.ts +6 -1
- package/dist/types/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
- package/dist/types-ts4.5/hooks/useDatasourceTableFlag.d.ts +3 -1
- package/dist/types-ts4.5/hooks/useErrorLogger.d.ts +6 -2
- package/dist/types-ts4.5/state/actions/index.d.ts +6 -4
- package/dist/types-ts4.5/ui/issue-like-table/messages.d.ts +6 -1
- package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
- package/package.json +4 -3
- package/dist/cjs/common/utils/response-item.js +0 -18
- package/dist/es2019/common/utils/response-item.js +0 -6
- package/dist/esm/common/utils/response-item.js +0 -11
- package/dist/types/common/utils/response-item.d.ts +0 -2
- package/dist/types-ts4.5/common/utils/response-item.d.ts +0 -2
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl-next';
|
|
2
2
|
export const issueLikeTableMessages = defineMessages({
|
|
3
|
-
|
|
4
|
-
id: 'linkDataSource.issue-line-table.
|
|
5
|
-
description: '
|
|
6
|
-
defaultMessage: '
|
|
3
|
+
updateError403Description: {
|
|
4
|
+
id: 'linkDataSource.issue-line-table.error-403-description',
|
|
5
|
+
description: 'Generic error message description shown when updating issue field fails due to user does not have permission to update.',
|
|
6
|
+
defaultMessage: 'You need the right permissions to edit this item.'
|
|
7
|
+
},
|
|
8
|
+
updateError403Title: {
|
|
9
|
+
id: 'linkDataSource.issue-line-table.error-403-title',
|
|
10
|
+
description: 'Generic error message title shown when updating issue field fails due to user does not have permission to update.',
|
|
11
|
+
defaultMessage: 'Changes not saved'
|
|
7
12
|
},
|
|
8
13
|
updateErrorGenericDescription: {
|
|
9
|
-
id: 'linkDataSource.issue-line-table.error-generic-description
|
|
14
|
+
id: 'linkDataSource.issue-line-table.error-generic-description',
|
|
10
15
|
description: 'Generic error message description shown when updating issue field fails',
|
|
11
|
-
defaultMessage: 'We had an issue trying to complete the update.
|
|
16
|
+
defaultMessage: 'We had an issue trying to complete the update. Wait a few minutes, then try again. Contact support if this keeps happening.'
|
|
12
17
|
},
|
|
13
18
|
updateErrorGenericTitle: {
|
|
14
|
-
id: 'linkDataSource.issue-line-table.error-generic-title
|
|
19
|
+
id: 'linkDataSource.issue-line-table.error-generic-title',
|
|
15
20
|
description: 'Generic error message title shown when updating issue field fails',
|
|
16
21
|
defaultMessage: 'Something went wrong'
|
|
17
22
|
},
|
|
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
3
|
import AKInlineEdit from '@atlaskit/inline-edit';
|
|
4
4
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
5
|
-
import { getResourceUrl } from '../../../common/utils/response-item';
|
|
6
5
|
import { useDatasourceTableFlag } from '../../../hooks/useDatasourceTableFlag';
|
|
6
|
+
import useErrorLogger from '../../../hooks/useErrorLogger';
|
|
7
7
|
import { useDatasourceActions, useDatasourceItem } from '../../../state';
|
|
8
8
|
import { editType } from '../edit-type';
|
|
9
9
|
const containerStyles = xcss({
|
|
@@ -30,21 +30,24 @@ export const InlineEdit = ({
|
|
|
30
30
|
execute,
|
|
31
31
|
readView,
|
|
32
32
|
columnKey,
|
|
33
|
+
integrationKey,
|
|
33
34
|
datasourceTypeWithValues
|
|
34
35
|
}) => {
|
|
35
36
|
const [isEditing, setIsEditing] = useState(false);
|
|
36
37
|
const item = useDatasourceItem({
|
|
37
38
|
id: ari
|
|
38
39
|
});
|
|
39
|
-
const url = getResourceUrl(item === null || item === void 0 ? void 0 : item.data);
|
|
40
40
|
const {
|
|
41
41
|
showErrorFlag
|
|
42
|
-
} = useDatasourceTableFlag(
|
|
43
|
-
url
|
|
44
|
-
});
|
|
42
|
+
} = useDatasourceTableFlag();
|
|
45
43
|
const {
|
|
46
44
|
onUpdateItem
|
|
47
45
|
} = useDatasourceActions();
|
|
46
|
+
const {
|
|
47
|
+
captureError
|
|
48
|
+
} = useErrorLogger({
|
|
49
|
+
integrationKey
|
|
50
|
+
});
|
|
48
51
|
const onCommitUpdate = useCallback(value => {
|
|
49
52
|
if (!item) {
|
|
50
53
|
setIsEditing(false);
|
|
@@ -58,11 +61,15 @@ export const InlineEdit = ({
|
|
|
58
61
|
}
|
|
59
62
|
onUpdateItem(ari, newItem);
|
|
60
63
|
execute(value).catch(error => {
|
|
61
|
-
|
|
64
|
+
const status = error && typeof error === 'object' ? error.status : undefined;
|
|
65
|
+
showErrorFlag({
|
|
66
|
+
status
|
|
67
|
+
});
|
|
62
68
|
onUpdateItem(ari, existingData);
|
|
69
|
+
captureError('actionExecution', error);
|
|
63
70
|
});
|
|
64
71
|
setIsEditing(false);
|
|
65
|
-
}, [
|
|
72
|
+
}, [item, datasourceTypeWithValues.type, columnKey, onUpdateItem, ari, execute, showErrorFlag, captureError]);
|
|
66
73
|
return /*#__PURE__*/React.createElement(Box, {
|
|
67
74
|
xcss: containerStyles
|
|
68
75
|
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType(datasourceTypeWithValues), {
|
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
|
-
import React, { useCallback
|
|
4
|
+
import React, { useCallback } from 'react';
|
|
5
5
|
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
9
|
import { issueLikeTableMessages } from '../ui/issue-like-table/messages';
|
|
10
|
+
var getGenericErrorMessage = function getGenericErrorMessage(status) {
|
|
11
|
+
switch (status) {
|
|
12
|
+
case 403:
|
|
13
|
+
return {
|
|
14
|
+
title: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateError403Title),
|
|
15
|
+
description: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateError403Description)
|
|
16
|
+
};
|
|
17
|
+
default:
|
|
18
|
+
return {
|
|
19
|
+
title: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericTitle),
|
|
20
|
+
description: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericDescription)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
};
|
|
10
24
|
export var useDatasourceTableFlag = function useDatasourceTableFlag(options) {
|
|
11
25
|
var _useFlags = useFlags(),
|
|
12
26
|
showFlag = _useFlags.showFlag;
|
|
13
|
-
var actions = useMemo(function () {
|
|
14
|
-
var resourceLink = (options === null || options === void 0 ? void 0 : options.url) && {
|
|
15
|
-
content: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.goToResourceLink),
|
|
16
|
-
href: options === null || options === void 0 ? void 0 : options.url,
|
|
17
|
-
target: '_blank'
|
|
18
|
-
};
|
|
19
|
-
return resourceLink ? [resourceLink] : undefined;
|
|
20
|
-
}, [options === null || options === void 0 ? void 0 : options.url]);
|
|
21
27
|
var showErrorFlag = useCallback(function (args) {
|
|
22
|
-
showFlag(_objectSpread({
|
|
23
|
-
|
|
24
|
-
description: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericDescription),
|
|
25
|
-
// We need IconTile (currently in beta) in order to scale the new icon to 24px
|
|
28
|
+
showFlag(_objectSpread(_objectSpread({
|
|
29
|
+
// We need IconTile in order to scale the new icon to 24px
|
|
26
30
|
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
|
|
27
31
|
icon: /*#__PURE__*/React.createElement(CrossCircleIcon, {
|
|
28
32
|
label: "Error",
|
|
29
33
|
primaryColor: "var(--ds-icon-danger, #C9372C)"
|
|
30
34
|
}),
|
|
31
35
|
id: uuid(),
|
|
32
|
-
isAutoDismiss: true
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}, [actions, showFlag]);
|
|
36
|
+
isAutoDismiss: true
|
|
37
|
+
}, getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status)), args));
|
|
38
|
+
}, [showFlag]);
|
|
36
39
|
return {
|
|
37
40
|
showErrorFlag: showErrorFlag
|
|
38
41
|
};
|
|
@@ -23,7 +23,9 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
23
23
|
captureError = _useErrorLogger.captureError;
|
|
24
24
|
var _useDatasourceActions = useDatasourceActions(),
|
|
25
25
|
onAddItems = _useDatasourceActions.onAddItems;
|
|
26
|
-
var _useDiscoverActions = useDiscoverActions(
|
|
26
|
+
var _useDiscoverActions = useDiscoverActions({
|
|
27
|
+
captureError: captureError
|
|
28
|
+
}),
|
|
27
29
|
discoverActions = _useDiscoverActions.discoverActions;
|
|
28
30
|
var idFieldCount = 1;
|
|
29
31
|
var keyFieldCount = 1;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
1
4
|
import { useCallback } from 'react';
|
|
2
5
|
import { captureException } from '@atlaskit/linking-common/sentry';
|
|
3
6
|
import { getTraceId } from '@atlaskit/linking-common/utils';
|
|
4
|
-
import {
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
8
|
import { useDatasourceAnalyticsEvents } from '../analytics';
|
|
6
9
|
var getNetworkFields = function getNetworkFields(error) {
|
|
7
10
|
return error instanceof Response ? {
|
|
@@ -18,15 +21,14 @@ var getNetworkFields = function getNetworkFields(error) {
|
|
|
18
21
|
* a helper Tail type which removes the first element of the tuple
|
|
19
22
|
*/
|
|
20
23
|
export var logToSentry = function logToSentry(error) {
|
|
21
|
-
if (
|
|
24
|
+
if (error instanceof Error && fg('platform.linking-platform.datasources.enable-sentry-client')) {
|
|
22
25
|
for (var _len = arguments.length, captureExceptionParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
23
26
|
captureExceptionParams[_key - 1] = arguments[_key];
|
|
24
27
|
}
|
|
25
28
|
captureException.apply(void 0, [error].concat(captureExceptionParams));
|
|
26
29
|
}
|
|
27
30
|
};
|
|
28
|
-
var useErrorLogger = function useErrorLogger(
|
|
29
|
-
var datasourceId = _ref.datasourceId;
|
|
31
|
+
var useErrorLogger = function useErrorLogger(loggerProps) {
|
|
30
32
|
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
31
33
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
32
34
|
|
|
@@ -45,10 +47,8 @@ var useErrorLogger = function useErrorLogger(_ref) {
|
|
|
45
47
|
traceId: traceId,
|
|
46
48
|
status: status
|
|
47
49
|
});
|
|
48
|
-
logToSentry(error, 'link-datasource', {
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
}, [fireEvent, datasourceId]);
|
|
50
|
+
logToSentry(error, 'link-datasource', _objectSpread({}, loggerProps));
|
|
51
|
+
}, [fireEvent, loggerProps]);
|
|
52
52
|
return {
|
|
53
53
|
captureError: captureError
|
|
54
54
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
|
+
var _excluded = ["aris", "fieldKeys"];
|
|
4
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
7
|
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; }
|
|
6
8
|
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; }
|
|
@@ -49,17 +51,18 @@ var getInitialState = function getInitialState() {
|
|
|
49
51
|
};
|
|
50
52
|
};
|
|
51
53
|
export var actions = {
|
|
52
|
-
discoverActions: function discoverActions(api, request) {
|
|
54
|
+
discoverActions: function discoverActions(captureError, api, request) {
|
|
53
55
|
return /*#__PURE__*/function () {
|
|
54
56
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
55
|
-
var setState, getState, response, _getState, currentActions, currentPermissions, actionsByIntegration, permissions;
|
|
57
|
+
var setState, getState, response, _getState, currentActions, currentPermissions, actionsByIntegration, permissions, aris, fieldKeys, rest;
|
|
56
58
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
57
59
|
while (1) switch (_context.prev = _context.next) {
|
|
58
60
|
case 0:
|
|
59
61
|
setState = _ref.setState, getState = _ref.getState;
|
|
60
|
-
_context.
|
|
62
|
+
_context.prev = 1;
|
|
63
|
+
_context.next = 4;
|
|
61
64
|
return api.getDatasourceActionsAndPermissions(request);
|
|
62
|
-
case
|
|
65
|
+
case 4:
|
|
63
66
|
response = _context.sent;
|
|
64
67
|
if ('permissions' in response) {
|
|
65
68
|
_getState = getState(), currentActions = _getState.actionsByIntegration, currentPermissions = _getState.permissions;
|
|
@@ -79,11 +82,22 @@ export var actions = {
|
|
|
79
82
|
permissions: permissions
|
|
80
83
|
});
|
|
81
84
|
}
|
|
82
|
-
|
|
85
|
+
_context.next = 12;
|
|
86
|
+
break;
|
|
87
|
+
case 8:
|
|
88
|
+
_context.prev = 8;
|
|
89
|
+
_context.t0 = _context["catch"](1);
|
|
90
|
+
/**
|
|
91
|
+
* Requests can be made with datasourceId or integrationKey
|
|
92
|
+
* We only want one of them with entityType, leave the rest out.
|
|
93
|
+
*/
|
|
94
|
+
aris = request.aris, fieldKeys = request.fieldKeys, rest = _objectWithoutProperties(request, _excluded);
|
|
95
|
+
captureError('actionDiscovery', _context.t0, rest);
|
|
96
|
+
case 12:
|
|
83
97
|
case "end":
|
|
84
98
|
return _context.stop();
|
|
85
99
|
}
|
|
86
|
-
}, _callee);
|
|
100
|
+
}, _callee, null, [[1, 8]]);
|
|
87
101
|
}));
|
|
88
102
|
return function (_x) {
|
|
89
103
|
return _ref2.apply(this, arguments);
|
|
@@ -97,24 +111,25 @@ export var ActionsStore = createStore({
|
|
|
97
111
|
actions: actions
|
|
98
112
|
});
|
|
99
113
|
var useActionStoreActions = createActionsHook(ActionsStore);
|
|
100
|
-
export var useDiscoverActions = function useDiscoverActions() {
|
|
114
|
+
export var useDiscoverActions = function useDiscoverActions(_ref3) {
|
|
115
|
+
var captureError = _ref3.captureError;
|
|
101
116
|
var _useDatasourceClientE = useDatasourceClientExtension(),
|
|
102
117
|
getDatasourceActionsAndPermissions = _useDatasourceClientE.getDatasourceActionsAndPermissions;
|
|
103
118
|
var _useActionStoreAction = useActionStoreActions(),
|
|
104
119
|
discoverActions = _useActionStoreAction.discoverActions;
|
|
105
120
|
return {
|
|
106
121
|
discoverActions: useMemo(function () {
|
|
107
|
-
return discoverActions.bind(null, {
|
|
122
|
+
return discoverActions.bind(null, captureError, {
|
|
108
123
|
getDatasourceActionsAndPermissions: getDatasourceActionsAndPermissions
|
|
109
124
|
});
|
|
110
|
-
}, [discoverActions, getDatasourceActionsAndPermissions])
|
|
125
|
+
}, [captureError, discoverActions, getDatasourceActionsAndPermissions])
|
|
111
126
|
};
|
|
112
127
|
};
|
|
113
|
-
var getFieldUpdateActionByAri = function getFieldUpdateActionByAri(state,
|
|
128
|
+
var getFieldUpdateActionByAri = function getFieldUpdateActionByAri(state, _ref4) {
|
|
114
129
|
var _state$permissions$ar, _state$actionsByInteg;
|
|
115
|
-
var ari =
|
|
116
|
-
fieldKey =
|
|
117
|
-
integrationKey =
|
|
130
|
+
var ari = _ref4.ari,
|
|
131
|
+
fieldKey = _ref4.fieldKey,
|
|
132
|
+
integrationKey = _ref4.integrationKey;
|
|
118
133
|
var isEditable = (_state$permissions$ar = state.permissions[ari]) === null || _state$permissions$ar === void 0 || (_state$permissions$ar = _state$permissions$ar[fieldKey]) === null || _state$permissions$ar === void 0 ? void 0 : _state$permissions$ar.isEditable;
|
|
119
134
|
if (!isEditable) {
|
|
120
135
|
return;
|
|
@@ -140,10 +155,10 @@ export var useAtomicUpdateActionSchema = createHook(ActionsStore, {
|
|
|
140
155
|
* return <button onClick={() => execute('New summary')}>Update summary</button>;
|
|
141
156
|
* ```
|
|
142
157
|
*/
|
|
143
|
-
export var useExecuteAtomicAction = function useExecuteAtomicAction(
|
|
144
|
-
var ari =
|
|
145
|
-
fieldKey =
|
|
146
|
-
integrationKey =
|
|
158
|
+
export var useExecuteAtomicAction = function useExecuteAtomicAction(_ref5) {
|
|
159
|
+
var ari = _ref5.ari,
|
|
160
|
+
fieldKey = _ref5.fieldKey,
|
|
161
|
+
integrationKey = _ref5.integrationKey;
|
|
147
162
|
var _useAtomicUpdateActio = useAtomicUpdateActionSchema({
|
|
148
163
|
ari: ari,
|
|
149
164
|
fieldKey: fieldKey,
|
|
@@ -167,7 +182,7 @@ export var useExecuteAtomicAction = function useExecuteAtomicAction(_ref4) {
|
|
|
167
182
|
}
|
|
168
183
|
}
|
|
169
184
|
});
|
|
170
|
-
}, [executeAction, integrationKey,
|
|
185
|
+
}, [schema, executeAction, integrationKey, fieldKey, ari]);
|
|
171
186
|
if (!schema) {
|
|
172
187
|
return {};
|
|
173
188
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { UNSAFE_LAYERING } from '@atlaskit/layering';
|
|
3
4
|
import Textfield from '@atlaskit/textfield';
|
|
4
5
|
var TextEditType = function TextEditType(props) {
|
|
5
|
-
return /*#__PURE__*/React.createElement(
|
|
6
|
+
return /*#__PURE__*/React.createElement(UNSAFE_LAYERING, {
|
|
7
|
+
isDisabled: false
|
|
8
|
+
}, /*#__PURE__*/React.createElement(Textfield, _extends({}, props, {
|
|
6
9
|
autoFocus: true,
|
|
7
10
|
isCompact: true,
|
|
8
11
|
testId: "inline-edit-text"
|
|
9
|
-
}));
|
|
12
|
+
})));
|
|
10
13
|
};
|
|
11
14
|
export default TextEditType;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl-next';
|
|
2
2
|
export var issueLikeTableMessages = defineMessages({
|
|
3
|
-
|
|
4
|
-
id: 'linkDataSource.issue-line-table.
|
|
5
|
-
description: '
|
|
6
|
-
defaultMessage: '
|
|
3
|
+
updateError403Description: {
|
|
4
|
+
id: 'linkDataSource.issue-line-table.error-403-description',
|
|
5
|
+
description: 'Generic error message description shown when updating issue field fails due to user does not have permission to update.',
|
|
6
|
+
defaultMessage: 'You need the right permissions to edit this item.'
|
|
7
|
+
},
|
|
8
|
+
updateError403Title: {
|
|
9
|
+
id: 'linkDataSource.issue-line-table.error-403-title',
|
|
10
|
+
description: 'Generic error message title shown when updating issue field fails due to user does not have permission to update.',
|
|
11
|
+
defaultMessage: 'Changes not saved'
|
|
7
12
|
},
|
|
8
13
|
updateErrorGenericDescription: {
|
|
9
|
-
id: 'linkDataSource.issue-line-table.error-generic-description
|
|
14
|
+
id: 'linkDataSource.issue-line-table.error-generic-description',
|
|
10
15
|
description: 'Generic error message description shown when updating issue field fails',
|
|
11
|
-
defaultMessage: 'We had an issue trying to complete the update.
|
|
16
|
+
defaultMessage: 'We had an issue trying to complete the update. Wait a few minutes, then try again. Contact support if this keeps happening.'
|
|
12
17
|
},
|
|
13
18
|
updateErrorGenericTitle: {
|
|
14
|
-
id: 'linkDataSource.issue-line-table.error-generic-title
|
|
19
|
+
id: 'linkDataSource.issue-line-table.error-generic-title',
|
|
15
20
|
description: 'Generic error message title shown when updating issue field fails',
|
|
16
21
|
defaultMessage: 'Something went wrong'
|
|
17
22
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
5
|
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; }
|
|
@@ -6,8 +7,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
7
|
import React, { useCallback, useState } from 'react';
|
|
7
8
|
import AKInlineEdit from '@atlaskit/inline-edit';
|
|
8
9
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
9
|
-
import { getResourceUrl } from '../../../common/utils/response-item';
|
|
10
10
|
import { useDatasourceTableFlag } from '../../../hooks/useDatasourceTableFlag';
|
|
11
|
+
import useErrorLogger from '../../../hooks/useErrorLogger';
|
|
11
12
|
import { useDatasourceActions, useDatasourceItem } from '../../../state';
|
|
12
13
|
import { editType } from '../edit-type';
|
|
13
14
|
var containerStyles = xcss({
|
|
@@ -31,6 +32,7 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
31
32
|
execute = _ref.execute,
|
|
32
33
|
_readView = _ref.readView,
|
|
33
34
|
columnKey = _ref.columnKey,
|
|
35
|
+
integrationKey = _ref.integrationKey,
|
|
34
36
|
datasourceTypeWithValues = _ref.datasourceTypeWithValues;
|
|
35
37
|
var _useState = useState(false),
|
|
36
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -39,13 +41,14 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
39
41
|
var item = useDatasourceItem({
|
|
40
42
|
id: ari
|
|
41
43
|
});
|
|
42
|
-
var
|
|
43
|
-
var _useDatasourceTableFl = useDatasourceTableFlag({
|
|
44
|
-
url: url
|
|
45
|
-
}),
|
|
44
|
+
var _useDatasourceTableFl = useDatasourceTableFlag(),
|
|
46
45
|
showErrorFlag = _useDatasourceTableFl.showErrorFlag;
|
|
47
46
|
var _useDatasourceActions = useDatasourceActions(),
|
|
48
47
|
onUpdateItem = _useDatasourceActions.onUpdateItem;
|
|
48
|
+
var _useErrorLogger = useErrorLogger({
|
|
49
|
+
integrationKey: integrationKey
|
|
50
|
+
}),
|
|
51
|
+
captureError = _useErrorLogger.captureError;
|
|
49
52
|
var onCommitUpdate = useCallback(function (value) {
|
|
50
53
|
if (!item) {
|
|
51
54
|
setIsEditing(false);
|
|
@@ -59,11 +62,15 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
59
62
|
}
|
|
60
63
|
onUpdateItem(ari, newItem);
|
|
61
64
|
execute(value).catch(function (error) {
|
|
62
|
-
|
|
65
|
+
var status = error && _typeof(error) === 'object' ? error.status : undefined;
|
|
66
|
+
showErrorFlag({
|
|
67
|
+
status: status
|
|
68
|
+
});
|
|
63
69
|
onUpdateItem(ari, existingData);
|
|
70
|
+
captureError('actionExecution', error);
|
|
64
71
|
});
|
|
65
72
|
setIsEditing(false);
|
|
66
|
-
}, [
|
|
73
|
+
}, [item, datasourceTypeWithValues.type, columnKey, onUpdateItem, ari, execute, showErrorFlag, captureError]);
|
|
67
74
|
return /*#__PURE__*/React.createElement(Box, {
|
|
68
75
|
xcss: containerStyles
|
|
69
76
|
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType(datasourceTypeWithValues), {
|
|
@@ -3,6 +3,8 @@ interface DatasourceTableFlagOptions {
|
|
|
3
3
|
url?: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const useDatasourceTableFlag: (options?: DatasourceTableFlagOptions) => {
|
|
6
|
-
showErrorFlag: (args?: Partial<CreateFlagArgs>
|
|
6
|
+
showErrorFlag: (args?: Partial<CreateFlagArgs> & {
|
|
7
|
+
status?: number;
|
|
8
|
+
}) => void;
|
|
7
9
|
};
|
|
8
10
|
export {};
|
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
export declare const logToSentry: (error: unknown, packageName: string, tags?: {
|
|
7
7
|
[key: string]: string | number | bigint | boolean | symbol | null | undefined;
|
|
8
8
|
} | undefined) => void;
|
|
9
|
-
interface
|
|
9
|
+
interface UseErrorLoggerPropsDatasource {
|
|
10
10
|
datasourceId: string;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
interface UseErrorLoggerPropsActions {
|
|
13
|
+
integrationKey: string;
|
|
14
|
+
}
|
|
15
|
+
export type UseErrorLoggerProps = UseErrorLoggerPropsDatasource | UseErrorLoggerPropsActions;
|
|
16
|
+
declare const useErrorLogger: (loggerProps: UseErrorLoggerProps) => {
|
|
13
17
|
captureError: (errorLocation: string, error: unknown) => void;
|
|
14
18
|
};
|
|
15
19
|
export default useErrorLogger;
|
|
@@ -48,19 +48,21 @@ interface Client {
|
|
|
48
48
|
getDatasourceActionsAndPermissions: ReturnType<typeof useDatasourceClientExtension>['getDatasourceActionsAndPermissions'];
|
|
49
49
|
}
|
|
50
50
|
export declare const actions: {
|
|
51
|
-
discoverActions: (api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
51
|
+
discoverActions: (captureError: (errorLocation: string, error: unknown, extraInfo?: Record<string, any>) => void, api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
52
52
|
};
|
|
53
53
|
export declare const ActionsStore: import("react-sweet-state").Store<ActionsStoreState, {
|
|
54
|
-
discoverActions: (api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
54
|
+
discoverActions: (captureError: (errorLocation: string, error: unknown, extraInfo?: Record<string, any>) => void, api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
55
55
|
}>;
|
|
56
|
-
export declare const useDiscoverActions: (
|
|
56
|
+
export declare const useDiscoverActions: ({ captureError, }: {
|
|
57
|
+
captureError: (errorLocation: string, error: unknown, extraInfo?: Record<string, any>) => void;
|
|
58
|
+
}) => {
|
|
57
59
|
discoverActions: (request: ActionsDiscoveryRequest) => void | Promise<void>;
|
|
58
60
|
};
|
|
59
61
|
/**
|
|
60
62
|
* Retrieves the action schema for a given ARI + fieldKey + integrationKey
|
|
61
63
|
*/
|
|
62
64
|
export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<Pick<AtomicActionInterface, "actionKey" | "type" | "description"> | undefined, import("react-sweet-state").BoundActions<ActionsStoreState, {
|
|
63
|
-
discoverActions: (api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
65
|
+
discoverActions: (captureError: (errorLocation: string, error: unknown, extraInfo?: Record<string, any>) => void, api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
64
66
|
}>, {
|
|
65
67
|
ari: string;
|
|
66
68
|
fieldKey: string;
|
|
@@ -4,9 +4,10 @@ import type { DatasourceTypeWithOnlyValues } from '../types';
|
|
|
4
4
|
interface InlineEditProps {
|
|
5
5
|
ari: string;
|
|
6
6
|
columnKey: string;
|
|
7
|
+
integrationKey: string;
|
|
7
8
|
readView: React.ReactNode;
|
|
8
9
|
datasourceTypeWithValues: DatasourceTypeWithOnlyValues;
|
|
9
10
|
execute: (value: string | number) => Promise<AtomicActionExecuteResponse>;
|
|
10
11
|
}
|
|
11
|
-
export declare const InlineEdit: ({ ari, execute, readView, columnKey, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
|
|
12
|
+
export declare const InlineEdit: ({ ari, execute, readView, columnKey, integrationKey, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -3,6 +3,8 @@ interface DatasourceTableFlagOptions {
|
|
|
3
3
|
url?: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const useDatasourceTableFlag: (options?: DatasourceTableFlagOptions) => {
|
|
6
|
-
showErrorFlag: (args?: Partial<CreateFlagArgs>
|
|
6
|
+
showErrorFlag: (args?: Partial<CreateFlagArgs> & {
|
|
7
|
+
status?: number;
|
|
8
|
+
}) => void;
|
|
7
9
|
};
|
|
8
10
|
export {};
|
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
export declare const logToSentry: (error: unknown, packageName: string, tags?: {
|
|
7
7
|
[key: string]: string | number | bigint | boolean | symbol | null | undefined;
|
|
8
8
|
} | undefined) => void;
|
|
9
|
-
interface
|
|
9
|
+
interface UseErrorLoggerPropsDatasource {
|
|
10
10
|
datasourceId: string;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
interface UseErrorLoggerPropsActions {
|
|
13
|
+
integrationKey: string;
|
|
14
|
+
}
|
|
15
|
+
export type UseErrorLoggerProps = UseErrorLoggerPropsDatasource | UseErrorLoggerPropsActions;
|
|
16
|
+
declare const useErrorLogger: (loggerProps: UseErrorLoggerProps) => {
|
|
13
17
|
captureError: (errorLocation: string, error: unknown) => void;
|
|
14
18
|
};
|
|
15
19
|
export default useErrorLogger;
|
|
@@ -48,19 +48,21 @@ interface Client {
|
|
|
48
48
|
getDatasourceActionsAndPermissions: ReturnType<typeof useDatasourceClientExtension>['getDatasourceActionsAndPermissions'];
|
|
49
49
|
}
|
|
50
50
|
export declare const actions: {
|
|
51
|
-
discoverActions: (api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
51
|
+
discoverActions: (captureError: (errorLocation: string, error: unknown, extraInfo?: Record<string, any>) => void, api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
52
52
|
};
|
|
53
53
|
export declare const ActionsStore: import("react-sweet-state").Store<ActionsStoreState, {
|
|
54
|
-
discoverActions: (api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
54
|
+
discoverActions: (captureError: (errorLocation: string, error: unknown, extraInfo?: Record<string, any>) => void, api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
55
55
|
}>;
|
|
56
|
-
export declare const useDiscoverActions: (
|
|
56
|
+
export declare const useDiscoverActions: ({ captureError, }: {
|
|
57
|
+
captureError: (errorLocation: string, error: unknown, extraInfo?: Record<string, any>) => void;
|
|
58
|
+
}) => {
|
|
57
59
|
discoverActions: (request: ActionsDiscoveryRequest) => void | Promise<void>;
|
|
58
60
|
};
|
|
59
61
|
/**
|
|
60
62
|
* Retrieves the action schema for a given ARI + fieldKey + integrationKey
|
|
61
63
|
*/
|
|
62
64
|
export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<Pick<AtomicActionInterface, "actionKey" | "type" | "description"> | undefined, import("react-sweet-state").BoundActions<ActionsStoreState, {
|
|
63
|
-
discoverActions: (api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
65
|
+
discoverActions: (captureError: (errorLocation: string, error: unknown, extraInfo?: Record<string, any>) => void, api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
64
66
|
}>, {
|
|
65
67
|
ari: string;
|
|
66
68
|
fieldKey: string;
|
|
@@ -4,9 +4,10 @@ import type { DatasourceTypeWithOnlyValues } from '../types';
|
|
|
4
4
|
interface InlineEditProps {
|
|
5
5
|
ari: string;
|
|
6
6
|
columnKey: string;
|
|
7
|
+
integrationKey: string;
|
|
7
8
|
readView: React.ReactNode;
|
|
8
9
|
datasourceTypeWithValues: DatasourceTypeWithOnlyValues;
|
|
9
10
|
execute: (value: string | number) => Promise<AtomicActionExecuteResponse>;
|
|
10
11
|
}
|
|
11
|
-
export declare const InlineEdit: ({ ari, execute, readView, columnKey, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
|
|
12
|
+
export declare const InlineEdit: ({ ari, execute, readView, columnKey, integrationKey, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
|
|
12
13
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.7",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"@atlaskit/jql-ast": "^3.3.0",
|
|
58
58
|
"@atlaskit/jql-editor": "^4.5.0",
|
|
59
59
|
"@atlaskit/jql-editor-autocomplete-rest": "^2.0.0",
|
|
60
|
+
"@atlaskit/layering": "^0.4.0",
|
|
60
61
|
"@atlaskit/link-client-extension": "^2.1.0",
|
|
61
62
|
"@atlaskit/linking-common": "^5.11.0",
|
|
62
63
|
"@atlaskit/linking-types": "^9.0.0",
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
73
74
|
"@atlaskit/primitives": "^12.0.0",
|
|
74
75
|
"@atlaskit/select": "^17.15.0",
|
|
75
|
-
"@atlaskit/smart-card": "^27.
|
|
76
|
+
"@atlaskit/smart-card": "^27.17.0",
|
|
76
77
|
"@atlaskit/smart-user-picker": "6.10.2",
|
|
77
78
|
"@atlaskit/spinner": "^16.3.0",
|
|
78
79
|
"@atlaskit/tag": "^12.5.0",
|
|
@@ -101,7 +102,7 @@
|
|
|
101
102
|
"@af/integration-testing": "*",
|
|
102
103
|
"@af/visual-regression": "*",
|
|
103
104
|
"@atlaskit/link-provider": "^1.14.0",
|
|
104
|
-
"@atlaskit/link-test-helpers": "^7.
|
|
105
|
+
"@atlaskit/link-test-helpers": "^7.5.0",
|
|
105
106
|
"@atlaskit/ssr": "*",
|
|
106
107
|
"@atlaskit/visual-regression": "*",
|
|
107
108
|
"@atlassian/feature-flags-test-utils": "^0.2.0",
|