@atlaskit/link-datasource 2.11.5 → 2.11.6
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 +11 -0
- package/dist/cjs/hooks/useDatasourceTableFlag.js +19 -16
- 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/inline-edit.js +8 -8
- package/dist/es2019/hooks/useDatasourceTableFlag.js +18 -14
- 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/inline-edit.js +5 -6
- package/dist/esm/hooks/useDatasourceTableFlag.js +20 -17
- 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/inline-edit.js +6 -6
- package/dist/types/hooks/useDatasourceTableFlag.d.ts +3 -1
- package/dist/types/ui/issue-like-table/messages.d.ts +6 -1
- package/dist/types-ts4.5/hooks/useDatasourceTableFlag.d.ts +3 -1
- package/dist/types-ts4.5/ui/issue-like-table/messages.d.ts +6 -1
- package/package.json +3 -2
- 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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 2.11.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#130683](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130683)
|
|
8
|
+
[`c61bb13127c88`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c61bb13127c88) -
|
|
9
|
+
Add datasource table inline edit 403 error message behind feature flag
|
|
10
|
+
- [#132566](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132566)
|
|
11
|
+
[`3e30b62782282`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3e30b62782282) -
|
|
12
|
+
Fix datasource modal close on pressing escape (ESC) from inline edit behind feature flag
|
|
13
|
+
|
|
3
14
|
## 2.11.5
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -17,32 +17,35 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
17
17
|
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
18
|
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
19
|
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; }
|
|
20
|
+
var getGenericErrorMessage = function getGenericErrorMessage(status) {
|
|
21
|
+
switch (status) {
|
|
22
|
+
case 403:
|
|
23
|
+
return {
|
|
24
|
+
title: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.updateError403Title),
|
|
25
|
+
description: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.updateError403Description)
|
|
26
|
+
};
|
|
27
|
+
default:
|
|
28
|
+
return {
|
|
29
|
+
title: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.updateErrorGenericTitle),
|
|
30
|
+
description: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.updateErrorGenericDescription)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
20
34
|
var useDatasourceTableFlag = exports.useDatasourceTableFlag = function useDatasourceTableFlag(options) {
|
|
21
35
|
var _useFlags = (0, _flag.useFlags)(),
|
|
22
36
|
showFlag = _useFlags.showFlag;
|
|
23
|
-
var actions = (0, _react.useMemo)(function () {
|
|
24
|
-
var resourceLink = (options === null || options === void 0 ? void 0 : options.url) && {
|
|
25
|
-
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.goToResourceLink),
|
|
26
|
-
href: options === null || options === void 0 ? void 0 : options.url,
|
|
27
|
-
target: '_blank'
|
|
28
|
-
};
|
|
29
|
-
return resourceLink ? [resourceLink] : undefined;
|
|
30
|
-
}, [options === null || options === void 0 ? void 0 : options.url]);
|
|
31
37
|
var showErrorFlag = (0, _react.useCallback)(function (args) {
|
|
32
|
-
showFlag(_objectSpread({
|
|
33
|
-
|
|
34
|
-
description: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.issueLikeTableMessages.updateErrorGenericDescription),
|
|
35
|
-
// We need IconTile (currently in beta) in order to scale the new icon to 24px
|
|
38
|
+
showFlag(_objectSpread(_objectSpread({
|
|
39
|
+
// We need IconTile in order to scale the new icon to 24px
|
|
36
40
|
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
|
|
37
41
|
icon: /*#__PURE__*/_react.default.createElement(_crossCircle.default, {
|
|
38
42
|
label: "Error",
|
|
39
43
|
primaryColor: "var(--ds-icon-danger, #C9372C)"
|
|
40
44
|
}),
|
|
41
45
|
id: (0, _uuid.default)(),
|
|
42
|
-
isAutoDismiss: true
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, [actions, showFlag]);
|
|
46
|
+
isAutoDismiss: true
|
|
47
|
+
}, getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status)), args));
|
|
48
|
+
}, [showFlag]);
|
|
46
49
|
return {
|
|
47
50
|
showErrorFlag: showErrorFlag
|
|
48
51
|
};
|
|
@@ -7,12 +7,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _layering = require("@atlaskit/layering");
|
|
10
11
|
var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
11
12
|
var TextEditType = function TextEditType(props) {
|
|
12
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
13
|
+
return /*#__PURE__*/_react.default.createElement(_layering.UNSAFE_LAYERING, {
|
|
14
|
+
isDisabled: false
|
|
15
|
+
}, /*#__PURE__*/_react.default.createElement(_textfield.default, (0, _extends2.default)({}, props, {
|
|
13
16
|
autoFocus: true,
|
|
14
17
|
isCompact: true,
|
|
15
18
|
testId: "inline-edit-text"
|
|
16
|
-
}));
|
|
19
|
+
})));
|
|
17
20
|
};
|
|
18
21
|
var _default = exports.default = TextEditType;
|
|
@@ -6,18 +6,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.issueLikeTableMessages = void 0;
|
|
7
7
|
var _reactIntlNext = require("react-intl-next");
|
|
8
8
|
var issueLikeTableMessages = exports.issueLikeTableMessages = (0, _reactIntlNext.defineMessages)({
|
|
9
|
-
|
|
10
|
-
id: 'linkDataSource.issue-line-table.
|
|
11
|
-
description: '
|
|
12
|
-
defaultMessage: '
|
|
9
|
+
updateError403Description: {
|
|
10
|
+
id: 'linkDataSource.issue-line-table.error-403-description',
|
|
11
|
+
description: 'Generic error message description shown when updating issue field fails due to user does not have permission to update.',
|
|
12
|
+
defaultMessage: 'You need the right permissions to edit this item.'
|
|
13
|
+
},
|
|
14
|
+
updateError403Title: {
|
|
15
|
+
id: 'linkDataSource.issue-line-table.error-403-title',
|
|
16
|
+
description: 'Generic error message title shown when updating issue field fails due to user does not have permission to update.',
|
|
17
|
+
defaultMessage: 'Changes not saved'
|
|
13
18
|
},
|
|
14
19
|
updateErrorGenericDescription: {
|
|
15
|
-
id: 'linkDataSource.issue-line-table.error-generic-description
|
|
20
|
+
id: 'linkDataSource.issue-line-table.error-generic-description',
|
|
16
21
|
description: 'Generic error message description shown when updating issue field fails',
|
|
17
|
-
defaultMessage: 'We had an issue trying to complete the update.
|
|
22
|
+
defaultMessage: 'We had an issue trying to complete the update. Wait a few minutes, then try again. Contact support if this keeps happening.'
|
|
18
23
|
},
|
|
19
24
|
updateErrorGenericTitle: {
|
|
20
|
-
id: 'linkDataSource.issue-line-table.error-generic-title
|
|
25
|
+
id: 'linkDataSource.issue-line-table.error-generic-title',
|
|
21
26
|
description: 'Generic error message title shown when updating issue field fails',
|
|
22
27
|
defaultMessage: 'Something went wrong'
|
|
23
28
|
},
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var
|
|
4
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.InlineEdit = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
14
|
var _inlineEdit = _interopRequireDefault(require("@atlaskit/inline-edit"));
|
|
14
15
|
var _primitives = require("@atlaskit/primitives");
|
|
15
|
-
var _responseItem = require("../../../common/utils/response-item");
|
|
16
16
|
var _useDatasourceTableFlag = require("../../../hooks/useDatasourceTableFlag");
|
|
17
17
|
var _state = require("../../../state");
|
|
18
18
|
var _editType = require("../edit-type");
|
|
19
19
|
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); }
|
|
20
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" !=
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(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; }
|
|
21
21
|
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; }
|
|
22
22
|
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; }
|
|
23
23
|
var containerStyles = (0, _primitives.xcss)({
|
|
@@ -49,10 +49,7 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
|
49
49
|
var item = (0, _state.useDatasourceItem)({
|
|
50
50
|
id: ari
|
|
51
51
|
});
|
|
52
|
-
var
|
|
53
|
-
var _useDatasourceTableFl = (0, _useDatasourceTableFlag.useDatasourceTableFlag)({
|
|
54
|
-
url: url
|
|
55
|
-
}),
|
|
52
|
+
var _useDatasourceTableFl = (0, _useDatasourceTableFlag.useDatasourceTableFlag)(),
|
|
56
53
|
showErrorFlag = _useDatasourceTableFl.showErrorFlag;
|
|
57
54
|
var _useDatasourceActions = (0, _state.useDatasourceActions)(),
|
|
58
55
|
onUpdateItem = _useDatasourceActions.onUpdateItem;
|
|
@@ -69,7 +66,10 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
|
69
66
|
}
|
|
70
67
|
onUpdateItem(ari, newItem);
|
|
71
68
|
execute(value).catch(function (error) {
|
|
72
|
-
|
|
69
|
+
var status = error && (0, _typeof2.default)(error) === 'object' ? error.status : undefined;
|
|
70
|
+
showErrorFlag({
|
|
71
|
+
status: status
|
|
72
|
+
});
|
|
73
73
|
onUpdateItem(ari, existingData);
|
|
74
74
|
});
|
|
75
75
|
setIsEditing(false);
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
import React, { useCallback
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
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
6
|
import { issueLikeTableMessages } from '../ui/issue-like-table/messages';
|
|
7
|
+
const getGenericErrorMessage = status => {
|
|
8
|
+
switch (status) {
|
|
9
|
+
case 403:
|
|
10
|
+
return {
|
|
11
|
+
title: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateError403Title),
|
|
12
|
+
description: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateError403Description)
|
|
13
|
+
};
|
|
14
|
+
default:
|
|
15
|
+
return {
|
|
16
|
+
title: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericTitle),
|
|
17
|
+
description: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericDescription)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
};
|
|
7
21
|
export const useDatasourceTableFlag = options => {
|
|
8
22
|
const {
|
|
9
23
|
showFlag
|
|
10
24
|
} = useFlags();
|
|
11
|
-
const actions = useMemo(() => {
|
|
12
|
-
const resourceLink = (options === null || options === void 0 ? void 0 : options.url) && {
|
|
13
|
-
content: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.goToResourceLink),
|
|
14
|
-
href: options === null || options === void 0 ? void 0 : options.url,
|
|
15
|
-
target: '_blank'
|
|
16
|
-
};
|
|
17
|
-
return resourceLink ? [resourceLink] : undefined;
|
|
18
|
-
}, [options === null || options === void 0 ? void 0 : options.url]);
|
|
19
25
|
const showErrorFlag = useCallback(args => {
|
|
20
26
|
showFlag({
|
|
21
|
-
|
|
22
|
-
description: /*#__PURE__*/React.createElement(FormattedMessage, issueLikeTableMessages.updateErrorGenericDescription),
|
|
23
|
-
// We need IconTile (currently in beta) in order to scale the new icon to 24px
|
|
27
|
+
// We need IconTile in order to scale the new icon to 24px
|
|
24
28
|
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
|
|
25
29
|
icon: /*#__PURE__*/React.createElement(CrossCircleIcon, {
|
|
26
30
|
label: "Error",
|
|
@@ -28,10 +32,10 @@ export const useDatasourceTableFlag = options => {
|
|
|
28
32
|
}),
|
|
29
33
|
id: uuid(),
|
|
30
34
|
isAutoDismiss: true,
|
|
31
|
-
|
|
35
|
+
...getGenericErrorMessage(args === null || args === void 0 ? void 0 : args.status),
|
|
32
36
|
...args
|
|
33
37
|
});
|
|
34
|
-
}, [
|
|
38
|
+
}, [showFlag]);
|
|
35
39
|
return {
|
|
36
40
|
showErrorFlag
|
|
37
41
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
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
|
-
const TextEditType = props => /*#__PURE__*/React.createElement(
|
|
5
|
+
const TextEditType = props => /*#__PURE__*/React.createElement(UNSAFE_LAYERING, {
|
|
6
|
+
isDisabled: false
|
|
7
|
+
}, /*#__PURE__*/React.createElement(Textfield, _extends({}, props, {
|
|
5
8
|
autoFocus: true,
|
|
6
9
|
isCompact: true,
|
|
7
10
|
testId: "inline-edit-text"
|
|
8
|
-
}));
|
|
11
|
+
})));
|
|
9
12
|
export default TextEditType;
|
|
@@ -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,7 +2,6 @@ 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';
|
|
7
6
|
import { useDatasourceActions, useDatasourceItem } from '../../../state';
|
|
8
7
|
import { editType } from '../edit-type';
|
|
@@ -36,12 +35,9 @@ export const InlineEdit = ({
|
|
|
36
35
|
const item = useDatasourceItem({
|
|
37
36
|
id: ari
|
|
38
37
|
});
|
|
39
|
-
const url = getResourceUrl(item === null || item === void 0 ? void 0 : item.data);
|
|
40
38
|
const {
|
|
41
39
|
showErrorFlag
|
|
42
|
-
} = useDatasourceTableFlag(
|
|
43
|
-
url
|
|
44
|
-
});
|
|
40
|
+
} = useDatasourceTableFlag();
|
|
45
41
|
const {
|
|
46
42
|
onUpdateItem
|
|
47
43
|
} = useDatasourceActions();
|
|
@@ -58,7 +54,10 @@ export const InlineEdit = ({
|
|
|
58
54
|
}
|
|
59
55
|
onUpdateItem(ari, newItem);
|
|
60
56
|
execute(value).catch(error => {
|
|
61
|
-
|
|
57
|
+
const status = error && typeof error === 'object' ? error.status : undefined;
|
|
58
|
+
showErrorFlag({
|
|
59
|
+
status
|
|
60
|
+
});
|
|
62
61
|
onUpdateItem(ari, existingData);
|
|
63
62
|
});
|
|
64
63
|
setIsEditing(false);
|
|
@@ -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
|
};
|
|
@@ -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,7 +7,6 @@ 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
11
|
import { useDatasourceActions, useDatasourceItem } from '../../../state';
|
|
12
12
|
import { editType } from '../edit-type';
|
|
@@ -39,10 +39,7 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
39
39
|
var item = useDatasourceItem({
|
|
40
40
|
id: ari
|
|
41
41
|
});
|
|
42
|
-
var
|
|
43
|
-
var _useDatasourceTableFl = useDatasourceTableFlag({
|
|
44
|
-
url: url
|
|
45
|
-
}),
|
|
42
|
+
var _useDatasourceTableFl = useDatasourceTableFlag(),
|
|
46
43
|
showErrorFlag = _useDatasourceTableFl.showErrorFlag;
|
|
47
44
|
var _useDatasourceActions = useDatasourceActions(),
|
|
48
45
|
onUpdateItem = _useDatasourceActions.onUpdateItem;
|
|
@@ -59,7 +56,10 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
59
56
|
}
|
|
60
57
|
onUpdateItem(ari, newItem);
|
|
61
58
|
execute(value).catch(function (error) {
|
|
62
|
-
|
|
59
|
+
var status = error && _typeof(error) === 'object' ? error.status : undefined;
|
|
60
|
+
showErrorFlag({
|
|
61
|
+
status: status
|
|
62
|
+
});
|
|
63
63
|
onUpdateItem(ari, existingData);
|
|
64
64
|
});
|
|
65
65
|
setIsEditing(false);
|
|
@@ -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 {};
|
|
@@ -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 {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.6",
|
|
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",
|
|
@@ -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",
|
|
@@ -1,18 +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.getResourceUrl = void 0;
|
|
8
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
-
var isLink = function isLink(data) {
|
|
10
|
-
return (0, _typeof2.default)(data) === 'object' && 'url' in data;
|
|
11
|
-
};
|
|
12
|
-
var getLinkTypeUrl = function getLinkTypeUrl(data) {
|
|
13
|
-
return isLink(data) ? data.url : undefined;
|
|
14
|
-
};
|
|
15
|
-
var getResourceUrl = exports.getResourceUrl = function getResourceUrl(data) {
|
|
16
|
-
var _data$key, _data$title;
|
|
17
|
-
return getLinkTypeUrl(data === null || data === void 0 || (_data$key = data['key']) === null || _data$key === void 0 ? void 0 : _data$key.data) || getLinkTypeUrl(data === null || data === void 0 || (_data$title = data['title']) === null || _data$title === void 0 ? void 0 : _data$title.data);
|
|
18
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const isLink = data => typeof data === 'object' && 'url' in data;
|
|
2
|
-
const getLinkTypeUrl = data => isLink(data) ? data.url : undefined;
|
|
3
|
-
export const getResourceUrl = data => {
|
|
4
|
-
var _data$key, _data$title;
|
|
5
|
-
return getLinkTypeUrl(data === null || data === void 0 ? void 0 : (_data$key = data['key']) === null || _data$key === void 0 ? void 0 : _data$key.data) || getLinkTypeUrl(data === null || data === void 0 ? void 0 : (_data$title = data['title']) === null || _data$title === void 0 ? void 0 : _data$title.data);
|
|
6
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
-
var isLink = function isLink(data) {
|
|
3
|
-
return _typeof(data) === 'object' && 'url' in data;
|
|
4
|
-
};
|
|
5
|
-
var getLinkTypeUrl = function getLinkTypeUrl(data) {
|
|
6
|
-
return isLink(data) ? data.url : undefined;
|
|
7
|
-
};
|
|
8
|
-
export var getResourceUrl = function getResourceUrl(data) {
|
|
9
|
-
var _data$key, _data$title;
|
|
10
|
-
return getLinkTypeUrl(data === null || data === void 0 || (_data$key = data['key']) === null || _data$key === void 0 ? void 0 : _data$key.data) || getLinkTypeUrl(data === null || data === void 0 || (_data$title = data['title']) === null || _data$title === void 0 ? void 0 : _data$title.data);
|
|
11
|
-
};
|