@atlaskit/link-datasource 3.6.16 → 3.8.0
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/state/actions/index.js +36 -9
- package/dist/cjs/ui/issue-like-table/edit-type/index.js +19 -7
- package/dist/cjs/ui/issue-like-table/edit-type/status/index.js +131 -0
- package/dist/cjs/ui/issue-like-table/styled.js +1 -2
- package/dist/cjs/ui/issue-like-table/table-cell-content/index.js +3 -1
- package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +10 -1
- package/dist/es2019/state/actions/index.js +39 -8
- package/dist/es2019/ui/issue-like-table/edit-type/index.js +18 -7
- package/dist/es2019/ui/issue-like-table/edit-type/status/index.js +89 -0
- package/dist/es2019/ui/issue-like-table/styled.js +1 -2
- package/dist/es2019/ui/issue-like-table/table-cell-content/index.js +3 -1
- package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +13 -1
- package/dist/esm/state/actions/index.js +36 -9
- package/dist/esm/ui/issue-like-table/edit-type/index.js +19 -7
- package/dist/esm/ui/issue-like-table/edit-type/status/index.js +121 -0
- package/dist/esm/ui/issue-like-table/styled.js +1 -2
- package/dist/esm/ui/issue-like-table/table-cell-content/index.js +3 -1
- package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +10 -1
- package/dist/types/state/actions/index.d.ts +12 -7
- package/dist/types/ui/issue-like-table/edit-type/index.d.ts +2 -1
- package/dist/types/ui/issue-like-table/edit-type/status/index.d.ts +10 -0
- package/dist/types/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
- package/dist/types-ts4.5/state/actions/index.d.ts +12 -7
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/status/index.d.ts +10 -0
- package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
- package/examples-helpers/buildIssueLikeTable.tsx +13 -14
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 3.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#159818](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/159818)
|
|
8
|
+
[`93569e5cdfe71`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/93569e5cdfe71) -
|
|
9
|
+
EDM-10970 updating useAtomicAction to return executeFetch for actions
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 3.7.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#159162](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/159162)
|
|
20
|
+
[`bfd053853f59d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bfd053853f59d) -
|
|
21
|
+
[ux] Enable updating jira issue statues in datasource list view via inline edit.
|
|
22
|
+
|
|
3
23
|
## 3.6.16
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -159,15 +159,18 @@ var useDiscoverActions = exports.useDiscoverActions = function useDiscoverAction
|
|
|
159
159
|
};
|
|
160
160
|
};
|
|
161
161
|
var getFieldUpdateActionByAri = function getFieldUpdateActionByAri(state, _ref4) {
|
|
162
|
-
var _state$permissions$ar, _state$actionsByInteg;
|
|
162
|
+
var _state$permissions$ar, _state$actionsByInteg, _state$actionsByInteg2;
|
|
163
163
|
var ari = _ref4.ari,
|
|
164
164
|
fieldKey = _ref4.fieldKey,
|
|
165
165
|
integrationKey = _ref4.integrationKey;
|
|
166
166
|
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;
|
|
167
167
|
if (!isEditable) {
|
|
168
|
-
return;
|
|
168
|
+
return {};
|
|
169
169
|
}
|
|
170
|
-
return
|
|
170
|
+
return {
|
|
171
|
+
schema: (_state$actionsByInteg = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg === void 0 ? void 0 : _state$actionsByInteg[fieldKey],
|
|
172
|
+
fetchSchema: (_state$actionsByInteg2 = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg2 === void 0 ? void 0 : _state$actionsByInteg2[fieldKey].fetchAction
|
|
173
|
+
};
|
|
171
174
|
};
|
|
172
175
|
|
|
173
176
|
/**
|
|
@@ -198,7 +201,9 @@ var useExecuteAtomicAction = exports.useExecuteAtomicAction = function useExecut
|
|
|
198
201
|
integrationKey: integrationKey
|
|
199
202
|
}),
|
|
200
203
|
_useAtomicUpdateActio2 = (0, _slicedToArray2.default)(_useAtomicUpdateActio, 1),
|
|
201
|
-
|
|
204
|
+
_useAtomicUpdateActio3 = _useAtomicUpdateActio2[0],
|
|
205
|
+
schema = _useAtomicUpdateActio3.schema,
|
|
206
|
+
fetchSchema = _useAtomicUpdateActio3.fetchSchema;
|
|
202
207
|
var _useDatasourceClientE2 = (0, _linkClientExtension.useDatasourceClientExtension)(),
|
|
203
208
|
executeAction = _useDatasourceClientE2.executeAtomicAction,
|
|
204
209
|
invalidateDatasourceDataCacheByAri = _useDatasourceClientE2.invalidateDatasourceDataCacheByAri;
|
|
@@ -235,10 +240,32 @@ var useExecuteAtomicAction = exports.useExecuteAtomicAction = function useExecut
|
|
|
235
240
|
throw error;
|
|
236
241
|
});
|
|
237
242
|
}, [schema, executeAction, integrationKey, fieldKey, ari, invalidateDatasourceDataCacheByAri, fireEvent, captureError]);
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
243
|
+
var executeFetch = (0, _react.useCallback)(function (inputs) {
|
|
244
|
+
if (!fetchSchema) {
|
|
245
|
+
throw new Error('No supporting action schema found.');
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// A generic type can allow us here to define the inputs and outputs
|
|
249
|
+
return executeAction({
|
|
250
|
+
integrationKey: integrationKey,
|
|
251
|
+
actionKey: fetchSchema.actionKey,
|
|
252
|
+
parameters: {
|
|
253
|
+
inputs: inputs,
|
|
254
|
+
target: {
|
|
255
|
+
ari: ari
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}).then(function (resp) {
|
|
259
|
+
return resp;
|
|
260
|
+
}).catch(function (error) {
|
|
261
|
+
captureError('actionExecution', error); // fetchActionExecution
|
|
262
|
+
// Rethrow up to component for flags and other handling
|
|
263
|
+
throw error;
|
|
264
|
+
});
|
|
265
|
+
}, [fetchSchema, executeAction, integrationKey, ari, captureError]);
|
|
266
|
+
return _objectSpread(_objectSpread({}, schema && {
|
|
242
267
|
execute: execute
|
|
243
|
-
}
|
|
268
|
+
}), fetchSchema && {
|
|
269
|
+
executeFetch: executeFetch
|
|
270
|
+
});
|
|
244
271
|
};
|
|
@@ -9,6 +9,8 @@ exports.isEditTypeSupported = exports.editType = void 0;
|
|
|
9
9
|
var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
+
var _status = _interopRequireDefault(require("./status"));
|
|
12
14
|
var _text = _interopRequireWildcard(require("./text"));
|
|
13
15
|
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); }
|
|
14
16
|
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 && {}.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; }
|
|
@@ -17,7 +19,8 @@ var ACTIVE_INLINE_EDIT_ID = 'sllv-active-inline-edit';
|
|
|
17
19
|
var editType = exports.editType = function editType(_ref) {
|
|
18
20
|
var defaultValue = _ref.defaultValue,
|
|
19
21
|
currentValue = _ref.currentValue,
|
|
20
|
-
setEditValues = _ref.setEditValues
|
|
22
|
+
setEditValues = _ref.setEditValues,
|
|
23
|
+
executeFetch = _ref.executeFetch;
|
|
21
24
|
switch (defaultValue.type) {
|
|
22
25
|
case 'string':
|
|
23
26
|
return {
|
|
@@ -31,6 +34,19 @@ var editType = exports.editType = function editType(_ref) {
|
|
|
31
34
|
}));
|
|
32
35
|
}
|
|
33
36
|
};
|
|
37
|
+
case 'status':
|
|
38
|
+
return {
|
|
39
|
+
defaultValue: (0, _text.toTextValue)(defaultValue),
|
|
40
|
+
editView: function editView(_ref3) {
|
|
41
|
+
var fieldProps = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(_ref3), _ref3));
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_status.default, (0, _extends2.default)({}, fieldProps, {
|
|
43
|
+
currentValue: currentValue,
|
|
44
|
+
setEditValues: setEditValues,
|
|
45
|
+
id: ACTIVE_INLINE_EDIT_ID,
|
|
46
|
+
executeFetch: executeFetch
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
};
|
|
34
50
|
default:
|
|
35
51
|
return {
|
|
36
52
|
defaultValue: '',
|
|
@@ -41,10 +57,6 @@ var editType = exports.editType = function editType(_ref) {
|
|
|
41
57
|
}
|
|
42
58
|
};
|
|
43
59
|
var isEditTypeSupported = exports.isEditTypeSupported = function isEditTypeSupported(type) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return true;
|
|
47
|
-
default:
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
60
|
+
var supportedEditType = (0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync-statuses') ? ['string', 'status'] : ['string'];
|
|
61
|
+
return supportedEditType.includes(type);
|
|
50
62
|
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _linkingTypes = require("@atlaskit/linking-types");
|
|
16
|
+
var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
|
|
17
|
+
var _select = _interopRequireDefault(require("@atlaskit/select"));
|
|
18
|
+
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); }
|
|
19
|
+
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 && {}.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; }
|
|
20
|
+
// FilterOptionOption is used in the filterOption function which is part of the public API, but the type itself is not exported
|
|
21
|
+
// eslint-disable-next-line import/no-extraneous-dependencies,no-restricted-imports
|
|
22
|
+
|
|
23
|
+
var StatusEditType = function StatusEditType(props) {
|
|
24
|
+
var _currentValue$values;
|
|
25
|
+
var currentValue = props.currentValue,
|
|
26
|
+
executeFetch = props.executeFetch;
|
|
27
|
+
var _useStatusOptions = useStatusOptions(currentValue, executeFetch),
|
|
28
|
+
options = _useStatusOptions.options,
|
|
29
|
+
isLoading = _useStatusOptions.isLoading;
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({}, props, {
|
|
31
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides -- Ignored via go/DSP-18766
|
|
32
|
+
className: "single-select",
|
|
33
|
+
testId: "inline-edit-status",
|
|
34
|
+
autoFocus: true,
|
|
35
|
+
defaultMenuIsOpen: true,
|
|
36
|
+
blurInputOnSelect: true,
|
|
37
|
+
getOptionValue: function getOptionValue(option) {
|
|
38
|
+
return option.text;
|
|
39
|
+
},
|
|
40
|
+
options: options,
|
|
41
|
+
isLoading: isLoading,
|
|
42
|
+
defaultValue: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
|
|
43
|
+
filterOption: filterOption,
|
|
44
|
+
formatOptionLabel: function formatOptionLabel(option) {
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement(_lozenge.default, (0, _extends2.default)({
|
|
46
|
+
testId: "inline-edit-status-option-".concat(option.text)
|
|
47
|
+
}, option.style), option.text);
|
|
48
|
+
},
|
|
49
|
+
onChange: function onChange(e) {
|
|
50
|
+
return props.setEditValues({
|
|
51
|
+
type: 'status',
|
|
52
|
+
values: e ? [e] : []
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
})));
|
|
56
|
+
};
|
|
57
|
+
var filterOption = function filterOption(option, inputValue) {
|
|
58
|
+
return option.data.text.toLowerCase().includes(inputValue.toLowerCase());
|
|
59
|
+
};
|
|
60
|
+
var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
|
|
61
|
+
var _useState = (0, _react.useState)({
|
|
62
|
+
isLoading: true,
|
|
63
|
+
options: []
|
|
64
|
+
}),
|
|
65
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
66
|
+
_useState2$ = _useState2[0],
|
|
67
|
+
options = _useState2$.options,
|
|
68
|
+
isLoading = _useState2$.isLoading,
|
|
69
|
+
setOptions = _useState2[1];
|
|
70
|
+
(0, _react.useEffect)(function () {
|
|
71
|
+
var isMounted = true;
|
|
72
|
+
loadOptions(currentValue, executeFetch).then(function (options) {
|
|
73
|
+
if (isMounted) {
|
|
74
|
+
setOptions({
|
|
75
|
+
isLoading: false,
|
|
76
|
+
options: options
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return function () {
|
|
81
|
+
isMounted = false;
|
|
82
|
+
};
|
|
83
|
+
}, [currentValue, executeFetch]);
|
|
84
|
+
return {
|
|
85
|
+
options: options,
|
|
86
|
+
isLoading: isLoading
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
var loadOptions = /*#__PURE__*/function () {
|
|
90
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(currentValue, executeFetch) {
|
|
91
|
+
var result, operationStatus, entities;
|
|
92
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
93
|
+
while (1) switch (_context.prev = _context.next) {
|
|
94
|
+
case 0:
|
|
95
|
+
if (!executeFetch) {
|
|
96
|
+
_context.next = 7;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
_context.next = 3;
|
|
100
|
+
return executeFetch((0, _defineProperty2.default)({}, currentValue.type, currentValue.values[0]));
|
|
101
|
+
case 3:
|
|
102
|
+
result = _context.sent;
|
|
103
|
+
operationStatus = result.operationStatus, entities = result.entities;
|
|
104
|
+
if (!(operationStatus === _linkingTypes.ActionOperationStatus.SUCCESS && entities)) {
|
|
105
|
+
_context.next = 7;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
return _context.abrupt("return", new Promise(function (resolve) {
|
|
109
|
+
setTimeout(function () {
|
|
110
|
+
return resolve(entities.map(function (entity) {
|
|
111
|
+
return {
|
|
112
|
+
id: entity.id,
|
|
113
|
+
text: entity.text,
|
|
114
|
+
style: entity.style
|
|
115
|
+
};
|
|
116
|
+
}));
|
|
117
|
+
}, 1000);
|
|
118
|
+
}));
|
|
119
|
+
case 7:
|
|
120
|
+
return _context.abrupt("return", []);
|
|
121
|
+
case 8:
|
|
122
|
+
case "end":
|
|
123
|
+
return _context.stop();
|
|
124
|
+
}
|
|
125
|
+
}, _callee);
|
|
126
|
+
}));
|
|
127
|
+
return function loadOptions(_x, _x2) {
|
|
128
|
+
return _ref.apply(this, arguments);
|
|
129
|
+
};
|
|
130
|
+
}();
|
|
131
|
+
var _default = exports.default = StatusEditType;
|
|
@@ -109,8 +109,7 @@ var InlineEditableTableCell = exports.InlineEditableTableCell = _styled.default.
|
|
|
109
109
|
verticalAlign: 'inherit',
|
|
110
110
|
boxSizing: 'content-box',
|
|
111
111
|
borderRight: "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border, ".concat(_colors.N40, ")")),
|
|
112
|
-
borderBottom: "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border, ".concat(_colors.N40, ")"))
|
|
113
|
-
overflow: 'hidden'
|
|
112
|
+
borderBottom: "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border, ".concat(_colors.N40, ")"))
|
|
114
113
|
}), (0, _defineProperty2.default)(_styled$td2, "".concat(withTablePluginBodyPrefix('&:last-child')), {
|
|
115
114
|
borderRight: 0
|
|
116
115
|
}), (0, _defineProperty2.default)(_styled$td2, "& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span", {
|
|
@@ -91,7 +91,8 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
91
91
|
fieldKey: columnKey,
|
|
92
92
|
integrationKey: integrationKey
|
|
93
93
|
}),
|
|
94
|
-
execute = _useExecuteAtomicActi.execute
|
|
94
|
+
execute = _useExecuteAtomicActi.execute,
|
|
95
|
+
executeFetch = _useExecuteAtomicActi.executeFetch;
|
|
95
96
|
var isEditable = !!execute;
|
|
96
97
|
var readView = /*#__PURE__*/_react.default.createElement(TooltipWrapper, {
|
|
97
98
|
columnKey: columnKey,
|
|
@@ -109,6 +110,7 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
109
110
|
return /*#__PURE__*/_react.default.createElement(_inlineEdit.InlineEdit, {
|
|
110
111
|
ari: ari,
|
|
111
112
|
execute: execute,
|
|
113
|
+
executeFetch: executeFetch,
|
|
112
114
|
readView: readView,
|
|
113
115
|
columnKey: columnKey,
|
|
114
116
|
datasourceTypeWithValues: values
|
|
@@ -26,9 +26,12 @@ var editContainerStyles = (0, _primitives.xcss)({
|
|
|
26
26
|
marginBlockStart: 'space.negative.100'
|
|
27
27
|
});
|
|
28
28
|
var getBackendUpdateValue = function getBackendUpdateValue(typedNewValue) {
|
|
29
|
+
var _typedNewValue$values;
|
|
29
30
|
switch (typedNewValue.type) {
|
|
30
31
|
case 'string':
|
|
31
32
|
return typedNewValue.values[0] || '';
|
|
33
|
+
case 'status':
|
|
34
|
+
return ((_typedNewValue$values = typedNewValue.values[0]) === null || _typedNewValue$values === void 0 ? void 0 : _typedNewValue$values.id) || '';
|
|
32
35
|
}
|
|
33
36
|
throw new Error("Datasource 2 way sync Backend update value not implemented for type ".concat(typedNewValue.type));
|
|
34
37
|
};
|
|
@@ -38,6 +41,10 @@ var mapUpdatedItem = function mapUpdatedItem(existingItem, columnKey, newValue)
|
|
|
38
41
|
return _objectSpread(_objectSpread({}, existingItem), {}, (0, _defineProperty2.default)({}, columnKey, {
|
|
39
42
|
data: newValue.values[0] || ''
|
|
40
43
|
}));
|
|
44
|
+
case 'status':
|
|
45
|
+
return newValue.values[0] ? _objectSpread(_objectSpread({}, existingItem), {}, (0, _defineProperty2.default)({}, columnKey, {
|
|
46
|
+
data: newValue.values[0]
|
|
47
|
+
})) : existingItem;
|
|
41
48
|
default:
|
|
42
49
|
}
|
|
43
50
|
return null;
|
|
@@ -62,6 +69,7 @@ var useRefreshDatasourceItem = function useRefreshDatasourceItem(item) {
|
|
|
62
69
|
var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
63
70
|
var ari = _ref.ari,
|
|
64
71
|
execute = _ref.execute,
|
|
72
|
+
executeFetch = _ref.executeFetch,
|
|
65
73
|
_readView = _ref.readView,
|
|
66
74
|
columnKey = _ref.columnKey,
|
|
67
75
|
datasourceTypeWithValues = _ref.datasourceTypeWithValues;
|
|
@@ -133,7 +141,8 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
|
133
141
|
}, /*#__PURE__*/_react.default.createElement(_inlineEdit.default, (0, _extends2.default)({}, (0, _editType.editType)({
|
|
134
142
|
defaultValue: datasourceTypeWithValues,
|
|
135
143
|
currentValue: editValues,
|
|
136
|
-
setEditValues: setEditValues
|
|
144
|
+
setEditValues: setEditValues,
|
|
145
|
+
executeFetch: executeFetch
|
|
137
146
|
}), {
|
|
138
147
|
hideActionButtons: true,
|
|
139
148
|
readView: function readView() {
|
|
@@ -144,12 +144,15 @@ const getFieldUpdateActionByAri = (state, {
|
|
|
144
144
|
fieldKey,
|
|
145
145
|
integrationKey
|
|
146
146
|
}) => {
|
|
147
|
-
var _state$permissions$ar, _state$permissions$ar2, _state$actionsByInteg;
|
|
147
|
+
var _state$permissions$ar, _state$permissions$ar2, _state$actionsByInteg, _state$actionsByInteg2;
|
|
148
148
|
const isEditable = (_state$permissions$ar = state.permissions[ari]) === null || _state$permissions$ar === void 0 ? void 0 : (_state$permissions$ar2 = _state$permissions$ar[fieldKey]) === null || _state$permissions$ar2 === void 0 ? void 0 : _state$permissions$ar2.isEditable;
|
|
149
149
|
if (!isEditable) {
|
|
150
|
-
return;
|
|
150
|
+
return {};
|
|
151
151
|
}
|
|
152
|
-
return
|
|
152
|
+
return {
|
|
153
|
+
schema: (_state$actionsByInteg = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg === void 0 ? void 0 : _state$actionsByInteg[fieldKey],
|
|
154
|
+
fetchSchema: (_state$actionsByInteg2 = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg2 === void 0 ? void 0 : _state$actionsByInteg2[fieldKey].fetchAction
|
|
155
|
+
};
|
|
153
156
|
};
|
|
154
157
|
|
|
155
158
|
/**
|
|
@@ -175,7 +178,10 @@ export const useExecuteAtomicAction = ({
|
|
|
175
178
|
fieldKey,
|
|
176
179
|
integrationKey
|
|
177
180
|
}) => {
|
|
178
|
-
const [
|
|
181
|
+
const [{
|
|
182
|
+
schema,
|
|
183
|
+
fetchSchema
|
|
184
|
+
}] = useAtomicUpdateActionSchema({
|
|
179
185
|
ari,
|
|
180
186
|
fieldKey,
|
|
181
187
|
integrationKey
|
|
@@ -221,10 +227,35 @@ export const useExecuteAtomicAction = ({
|
|
|
221
227
|
throw error;
|
|
222
228
|
});
|
|
223
229
|
}, [schema, executeAction, integrationKey, fieldKey, ari, invalidateDatasourceDataCacheByAri, fireEvent, captureError]);
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
230
|
+
const executeFetch = useCallback(inputs => {
|
|
231
|
+
if (!fetchSchema) {
|
|
232
|
+
throw new Error('No supporting action schema found.');
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// A generic type can allow us here to define the inputs and outputs
|
|
236
|
+
return executeAction({
|
|
237
|
+
integrationKey,
|
|
238
|
+
actionKey: fetchSchema.actionKey,
|
|
239
|
+
parameters: {
|
|
240
|
+
inputs,
|
|
241
|
+
target: {
|
|
242
|
+
ari
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}).then(resp => {
|
|
246
|
+
return resp;
|
|
247
|
+
}).catch(error => {
|
|
248
|
+
captureError('actionExecution', error); // fetchActionExecution
|
|
249
|
+
// Rethrow up to component for flags and other handling
|
|
250
|
+
throw error;
|
|
251
|
+
});
|
|
252
|
+
}, [fetchSchema, executeAction, integrationKey, ari, captureError]);
|
|
227
253
|
return {
|
|
228
|
-
|
|
254
|
+
...(schema && {
|
|
255
|
+
execute
|
|
256
|
+
}),
|
|
257
|
+
...(fetchSchema && {
|
|
258
|
+
executeFetch
|
|
259
|
+
})
|
|
229
260
|
};
|
|
230
261
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import StatusEditType from './status';
|
|
3
5
|
import TextEditType, { toTextValue } from './text';
|
|
4
6
|
|
|
5
7
|
// This is used in editor-card-plugin to identify if any type of inline edit is active.
|
|
@@ -7,7 +9,8 @@ const ACTIVE_INLINE_EDIT_ID = 'sllv-active-inline-edit';
|
|
|
7
9
|
export const editType = ({
|
|
8
10
|
defaultValue,
|
|
9
11
|
currentValue,
|
|
10
|
-
setEditValues
|
|
12
|
+
setEditValues,
|
|
13
|
+
executeFetch
|
|
11
14
|
}) => {
|
|
12
15
|
switch (defaultValue.type) {
|
|
13
16
|
case 'string':
|
|
@@ -21,6 +24,18 @@ export const editType = ({
|
|
|
21
24
|
id: ACTIVE_INLINE_EDIT_ID
|
|
22
25
|
}))
|
|
23
26
|
};
|
|
27
|
+
case 'status':
|
|
28
|
+
return {
|
|
29
|
+
defaultValue: toTextValue(defaultValue),
|
|
30
|
+
editView: ({
|
|
31
|
+
...fieldProps
|
|
32
|
+
}) => /*#__PURE__*/React.createElement(StatusEditType, _extends({}, fieldProps, {
|
|
33
|
+
currentValue: currentValue,
|
|
34
|
+
setEditValues: setEditValues,
|
|
35
|
+
id: ACTIVE_INLINE_EDIT_ID,
|
|
36
|
+
executeFetch: executeFetch
|
|
37
|
+
}))
|
|
38
|
+
};
|
|
24
39
|
default:
|
|
25
40
|
return {
|
|
26
41
|
defaultValue: '',
|
|
@@ -29,10 +44,6 @@ export const editType = ({
|
|
|
29
44
|
}
|
|
30
45
|
};
|
|
31
46
|
export const isEditTypeSupported = type => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return true;
|
|
35
|
-
default:
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
47
|
+
const supportedEditType = fg('platform-datasources-enable-two-way-sync-statuses') ? ['string', 'status'] : ['string'];
|
|
48
|
+
return supportedEditType.includes(type);
|
|
38
49
|
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { ActionOperationStatus } from '@atlaskit/linking-types';
|
|
4
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
5
|
+
// FilterOptionOption is used in the filterOption function which is part of the public API, but the type itself is not exported
|
|
6
|
+
// eslint-disable-next-line import/no-extraneous-dependencies,no-restricted-imports
|
|
7
|
+
|
|
8
|
+
import Select from '@atlaskit/select';
|
|
9
|
+
const StatusEditType = props => {
|
|
10
|
+
var _currentValue$values;
|
|
11
|
+
const {
|
|
12
|
+
currentValue,
|
|
13
|
+
executeFetch
|
|
14
|
+
} = props;
|
|
15
|
+
const {
|
|
16
|
+
options,
|
|
17
|
+
isLoading
|
|
18
|
+
} = useStatusOptions(currentValue, executeFetch);
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
|
|
20
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides -- Ignored via go/DSP-18766
|
|
21
|
+
className: "single-select",
|
|
22
|
+
testId: "inline-edit-status",
|
|
23
|
+
autoFocus: true,
|
|
24
|
+
defaultMenuIsOpen: true,
|
|
25
|
+
blurInputOnSelect: true,
|
|
26
|
+
getOptionValue: option => option.text,
|
|
27
|
+
options: options,
|
|
28
|
+
isLoading: isLoading,
|
|
29
|
+
defaultValue: currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
|
|
30
|
+
filterOption: filterOption,
|
|
31
|
+
formatOptionLabel: option => /*#__PURE__*/React.createElement(Lozenge, _extends({
|
|
32
|
+
testId: `inline-edit-status-option-${option.text}`
|
|
33
|
+
}, option.style), option.text),
|
|
34
|
+
onChange: e => props.setEditValues({
|
|
35
|
+
type: 'status',
|
|
36
|
+
values: e ? [e] : []
|
|
37
|
+
})
|
|
38
|
+
})));
|
|
39
|
+
};
|
|
40
|
+
const filterOption = (option, inputValue) => option.data.text.toLowerCase().includes(inputValue.toLowerCase());
|
|
41
|
+
const useStatusOptions = (currentValue, executeFetch) => {
|
|
42
|
+
const [{
|
|
43
|
+
options,
|
|
44
|
+
isLoading
|
|
45
|
+
}, setOptions] = useState({
|
|
46
|
+
isLoading: true,
|
|
47
|
+
options: []
|
|
48
|
+
});
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
let isMounted = true;
|
|
51
|
+
loadOptions(currentValue, executeFetch).then(options => {
|
|
52
|
+
if (isMounted) {
|
|
53
|
+
setOptions({
|
|
54
|
+
isLoading: false,
|
|
55
|
+
options
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return () => {
|
|
60
|
+
isMounted = false;
|
|
61
|
+
};
|
|
62
|
+
}, [currentValue, executeFetch]);
|
|
63
|
+
return {
|
|
64
|
+
options,
|
|
65
|
+
isLoading
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
const loadOptions = async (currentValue, executeFetch) => {
|
|
69
|
+
if (executeFetch) {
|
|
70
|
+
const result = await executeFetch({
|
|
71
|
+
[currentValue.type]: currentValue.values[0]
|
|
72
|
+
});
|
|
73
|
+
const {
|
|
74
|
+
operationStatus,
|
|
75
|
+
entities
|
|
76
|
+
} = result;
|
|
77
|
+
if (operationStatus === ActionOperationStatus.SUCCESS && entities) {
|
|
78
|
+
return new Promise(resolve => {
|
|
79
|
+
setTimeout(() => resolve(entities.map(entity => ({
|
|
80
|
+
id: entity.id,
|
|
81
|
+
text: entity.text,
|
|
82
|
+
style: entity.style
|
|
83
|
+
}))), 1000);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return [];
|
|
88
|
+
};
|
|
89
|
+
export default StatusEditType;
|
|
@@ -126,8 +126,7 @@ export const InlineEditableTableCell = styled.td({
|
|
|
126
126
|
verticalAlign: 'inherit',
|
|
127
127
|
boxSizing: 'content-box',
|
|
128
128
|
borderRight: `${"var(--ds-border-width, 1px)"} solid ${`var(--ds-border, ${N40})`}`,
|
|
129
|
-
borderBottom: `${"var(--ds-border-width, 1px)"} solid ${`var(--ds-border, ${N40})`}
|
|
130
|
-
overflow: 'hidden'
|
|
129
|
+
borderBottom: `${"var(--ds-border-width, 1px)"} solid ${`var(--ds-border, ${N40})`}`
|
|
131
130
|
},
|
|
132
131
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
133
132
|
[`${withTablePluginBodyPrefix('&:last-child')}`]: {
|
|
@@ -79,7 +79,8 @@ const InlineEditableCell = ({
|
|
|
79
79
|
}) => {
|
|
80
80
|
// Execute fn is only returned when the field is editable and the action schema exists
|
|
81
81
|
const {
|
|
82
|
-
execute
|
|
82
|
+
execute,
|
|
83
|
+
executeFetch
|
|
83
84
|
} = useExecuteAtomicAction({
|
|
84
85
|
ari,
|
|
85
86
|
fieldKey: columnKey,
|
|
@@ -102,6 +103,7 @@ const InlineEditableCell = ({
|
|
|
102
103
|
return /*#__PURE__*/React.createElement(InlineEdit, {
|
|
103
104
|
ari: ari,
|
|
104
105
|
execute: execute,
|
|
106
|
+
executeFetch: executeFetch,
|
|
105
107
|
readView: readView,
|
|
106
108
|
columnKey: columnKey,
|
|
107
109
|
datasourceTypeWithValues: values
|
|
@@ -11,9 +11,12 @@ const editContainerStyles = xcss({
|
|
|
11
11
|
marginBlockStart: 'space.negative.100'
|
|
12
12
|
});
|
|
13
13
|
const getBackendUpdateValue = typedNewValue => {
|
|
14
|
+
var _typedNewValue$values;
|
|
14
15
|
switch (typedNewValue.type) {
|
|
15
16
|
case 'string':
|
|
16
17
|
return typedNewValue.values[0] || '';
|
|
18
|
+
case 'status':
|
|
19
|
+
return ((_typedNewValue$values = typedNewValue.values[0]) === null || _typedNewValue$values === void 0 ? void 0 : _typedNewValue$values.id) || '';
|
|
17
20
|
}
|
|
18
21
|
throw new Error(`Datasource 2 way sync Backend update value not implemented for type ${typedNewValue.type}`);
|
|
19
22
|
};
|
|
@@ -26,6 +29,13 @@ const mapUpdatedItem = (existingItem, columnKey, newValue) => {
|
|
|
26
29
|
data: newValue.values[0] || ''
|
|
27
30
|
}
|
|
28
31
|
};
|
|
32
|
+
case 'status':
|
|
33
|
+
return newValue.values[0] ? {
|
|
34
|
+
...existingItem,
|
|
35
|
+
[columnKey]: {
|
|
36
|
+
data: newValue.values[0]
|
|
37
|
+
}
|
|
38
|
+
} : existingItem;
|
|
29
39
|
default:
|
|
30
40
|
}
|
|
31
41
|
return null;
|
|
@@ -50,6 +60,7 @@ const useRefreshDatasourceItem = item => {
|
|
|
50
60
|
export const InlineEdit = ({
|
|
51
61
|
ari,
|
|
52
62
|
execute,
|
|
63
|
+
executeFetch,
|
|
53
64
|
readView,
|
|
54
65
|
columnKey,
|
|
55
66
|
datasourceTypeWithValues
|
|
@@ -120,7 +131,8 @@ export const InlineEdit = ({
|
|
|
120
131
|
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType({
|
|
121
132
|
defaultValue: datasourceTypeWithValues,
|
|
122
133
|
currentValue: editValues,
|
|
123
|
-
setEditValues
|
|
134
|
+
setEditValues,
|
|
135
|
+
executeFetch
|
|
124
136
|
}), {
|
|
125
137
|
hideActionButtons: true,
|
|
126
138
|
readView: () => readView,
|
|
@@ -153,15 +153,18 @@ export var useDiscoverActions = function useDiscoverActions(_ref3) {
|
|
|
153
153
|
};
|
|
154
154
|
};
|
|
155
155
|
var getFieldUpdateActionByAri = function getFieldUpdateActionByAri(state, _ref4) {
|
|
156
|
-
var _state$permissions$ar, _state$actionsByInteg;
|
|
156
|
+
var _state$permissions$ar, _state$actionsByInteg, _state$actionsByInteg2;
|
|
157
157
|
var ari = _ref4.ari,
|
|
158
158
|
fieldKey = _ref4.fieldKey,
|
|
159
159
|
integrationKey = _ref4.integrationKey;
|
|
160
160
|
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;
|
|
161
161
|
if (!isEditable) {
|
|
162
|
-
return;
|
|
162
|
+
return {};
|
|
163
163
|
}
|
|
164
|
-
return
|
|
164
|
+
return {
|
|
165
|
+
schema: (_state$actionsByInteg = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg === void 0 ? void 0 : _state$actionsByInteg[fieldKey],
|
|
166
|
+
fetchSchema: (_state$actionsByInteg2 = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg2 === void 0 ? void 0 : _state$actionsByInteg2[fieldKey].fetchAction
|
|
167
|
+
};
|
|
165
168
|
};
|
|
166
169
|
|
|
167
170
|
/**
|
|
@@ -192,7 +195,9 @@ export var useExecuteAtomicAction = function useExecuteAtomicAction(_ref5) {
|
|
|
192
195
|
integrationKey: integrationKey
|
|
193
196
|
}),
|
|
194
197
|
_useAtomicUpdateActio2 = _slicedToArray(_useAtomicUpdateActio, 1),
|
|
195
|
-
|
|
198
|
+
_useAtomicUpdateActio3 = _useAtomicUpdateActio2[0],
|
|
199
|
+
schema = _useAtomicUpdateActio3.schema,
|
|
200
|
+
fetchSchema = _useAtomicUpdateActio3.fetchSchema;
|
|
196
201
|
var _useDatasourceClientE2 = useDatasourceClientExtension(),
|
|
197
202
|
executeAction = _useDatasourceClientE2.executeAtomicAction,
|
|
198
203
|
invalidateDatasourceDataCacheByAri = _useDatasourceClientE2.invalidateDatasourceDataCacheByAri;
|
|
@@ -229,10 +234,32 @@ export var useExecuteAtomicAction = function useExecuteAtomicAction(_ref5) {
|
|
|
229
234
|
throw error;
|
|
230
235
|
});
|
|
231
236
|
}, [schema, executeAction, integrationKey, fieldKey, ari, invalidateDatasourceDataCacheByAri, fireEvent, captureError]);
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
237
|
+
var executeFetch = useCallback(function (inputs) {
|
|
238
|
+
if (!fetchSchema) {
|
|
239
|
+
throw new Error('No supporting action schema found.');
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// A generic type can allow us here to define the inputs and outputs
|
|
243
|
+
return executeAction({
|
|
244
|
+
integrationKey: integrationKey,
|
|
245
|
+
actionKey: fetchSchema.actionKey,
|
|
246
|
+
parameters: {
|
|
247
|
+
inputs: inputs,
|
|
248
|
+
target: {
|
|
249
|
+
ari: ari
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}).then(function (resp) {
|
|
253
|
+
return resp;
|
|
254
|
+
}).catch(function (error) {
|
|
255
|
+
captureError('actionExecution', error); // fetchActionExecution
|
|
256
|
+
// Rethrow up to component for flags and other handling
|
|
257
|
+
throw error;
|
|
258
|
+
});
|
|
259
|
+
}, [fetchSchema, executeAction, integrationKey, ari, captureError]);
|
|
260
|
+
return _objectSpread(_objectSpread({}, schema && {
|
|
236
261
|
execute: execute
|
|
237
|
-
}
|
|
262
|
+
}), fetchSchema && {
|
|
263
|
+
executeFetch: executeFetch
|
|
264
|
+
});
|
|
238
265
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import StatusEditType from './status';
|
|
4
6
|
import TextEditType, { toTextValue } from './text';
|
|
5
7
|
|
|
6
8
|
// This is used in editor-card-plugin to identify if any type of inline edit is active.
|
|
@@ -8,7 +10,8 @@ var ACTIVE_INLINE_EDIT_ID = 'sllv-active-inline-edit';
|
|
|
8
10
|
export var editType = function editType(_ref) {
|
|
9
11
|
var defaultValue = _ref.defaultValue,
|
|
10
12
|
currentValue = _ref.currentValue,
|
|
11
|
-
setEditValues = _ref.setEditValues
|
|
13
|
+
setEditValues = _ref.setEditValues,
|
|
14
|
+
executeFetch = _ref.executeFetch;
|
|
12
15
|
switch (defaultValue.type) {
|
|
13
16
|
case 'string':
|
|
14
17
|
return {
|
|
@@ -22,6 +25,19 @@ export var editType = function editType(_ref) {
|
|
|
22
25
|
}));
|
|
23
26
|
}
|
|
24
27
|
};
|
|
28
|
+
case 'status':
|
|
29
|
+
return {
|
|
30
|
+
defaultValue: toTextValue(defaultValue),
|
|
31
|
+
editView: function editView(_ref3) {
|
|
32
|
+
var fieldProps = _extends({}, (_objectDestructuringEmpty(_ref3), _ref3));
|
|
33
|
+
return /*#__PURE__*/React.createElement(StatusEditType, _extends({}, fieldProps, {
|
|
34
|
+
currentValue: currentValue,
|
|
35
|
+
setEditValues: setEditValues,
|
|
36
|
+
id: ACTIVE_INLINE_EDIT_ID,
|
|
37
|
+
executeFetch: executeFetch
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
25
41
|
default:
|
|
26
42
|
return {
|
|
27
43
|
defaultValue: '',
|
|
@@ -32,10 +48,6 @@ export var editType = function editType(_ref) {
|
|
|
32
48
|
}
|
|
33
49
|
};
|
|
34
50
|
export var isEditTypeSupported = function isEditTypeSupported(type) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return true;
|
|
38
|
-
default:
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
51
|
+
var supportedEditType = fg('platform-datasources-enable-two-way-sync-statuses') ? ['string', 'status'] : ['string'];
|
|
52
|
+
return supportedEditType.includes(type);
|
|
41
53
|
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
|
+
import React, { useEffect, useState } from 'react';
|
|
7
|
+
import { ActionOperationStatus } from '@atlaskit/linking-types';
|
|
8
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
9
|
+
// FilterOptionOption is used in the filterOption function which is part of the public API, but the type itself is not exported
|
|
10
|
+
// eslint-disable-next-line import/no-extraneous-dependencies,no-restricted-imports
|
|
11
|
+
|
|
12
|
+
import Select from '@atlaskit/select';
|
|
13
|
+
var StatusEditType = function StatusEditType(props) {
|
|
14
|
+
var _currentValue$values;
|
|
15
|
+
var currentValue = props.currentValue,
|
|
16
|
+
executeFetch = props.executeFetch;
|
|
17
|
+
var _useStatusOptions = useStatusOptions(currentValue, executeFetch),
|
|
18
|
+
options = _useStatusOptions.options,
|
|
19
|
+
isLoading = _useStatusOptions.isLoading;
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
|
|
21
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides -- Ignored via go/DSP-18766
|
|
22
|
+
className: "single-select",
|
|
23
|
+
testId: "inline-edit-status",
|
|
24
|
+
autoFocus: true,
|
|
25
|
+
defaultMenuIsOpen: true,
|
|
26
|
+
blurInputOnSelect: true,
|
|
27
|
+
getOptionValue: function getOptionValue(option) {
|
|
28
|
+
return option.text;
|
|
29
|
+
},
|
|
30
|
+
options: options,
|
|
31
|
+
isLoading: isLoading,
|
|
32
|
+
defaultValue: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
|
|
33
|
+
filterOption: filterOption,
|
|
34
|
+
formatOptionLabel: function formatOptionLabel(option) {
|
|
35
|
+
return /*#__PURE__*/React.createElement(Lozenge, _extends({
|
|
36
|
+
testId: "inline-edit-status-option-".concat(option.text)
|
|
37
|
+
}, option.style), option.text);
|
|
38
|
+
},
|
|
39
|
+
onChange: function onChange(e) {
|
|
40
|
+
return props.setEditValues({
|
|
41
|
+
type: 'status',
|
|
42
|
+
values: e ? [e] : []
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
})));
|
|
46
|
+
};
|
|
47
|
+
var filterOption = function filterOption(option, inputValue) {
|
|
48
|
+
return option.data.text.toLowerCase().includes(inputValue.toLowerCase());
|
|
49
|
+
};
|
|
50
|
+
var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
|
|
51
|
+
var _useState = useState({
|
|
52
|
+
isLoading: true,
|
|
53
|
+
options: []
|
|
54
|
+
}),
|
|
55
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
56
|
+
_useState2$ = _useState2[0],
|
|
57
|
+
options = _useState2$.options,
|
|
58
|
+
isLoading = _useState2$.isLoading,
|
|
59
|
+
setOptions = _useState2[1];
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
var isMounted = true;
|
|
62
|
+
loadOptions(currentValue, executeFetch).then(function (options) {
|
|
63
|
+
if (isMounted) {
|
|
64
|
+
setOptions({
|
|
65
|
+
isLoading: false,
|
|
66
|
+
options: options
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return function () {
|
|
71
|
+
isMounted = false;
|
|
72
|
+
};
|
|
73
|
+
}, [currentValue, executeFetch]);
|
|
74
|
+
return {
|
|
75
|
+
options: options,
|
|
76
|
+
isLoading: isLoading
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
var loadOptions = /*#__PURE__*/function () {
|
|
80
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(currentValue, executeFetch) {
|
|
81
|
+
var result, operationStatus, entities;
|
|
82
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
83
|
+
while (1) switch (_context.prev = _context.next) {
|
|
84
|
+
case 0:
|
|
85
|
+
if (!executeFetch) {
|
|
86
|
+
_context.next = 7;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
_context.next = 3;
|
|
90
|
+
return executeFetch(_defineProperty({}, currentValue.type, currentValue.values[0]));
|
|
91
|
+
case 3:
|
|
92
|
+
result = _context.sent;
|
|
93
|
+
operationStatus = result.operationStatus, entities = result.entities;
|
|
94
|
+
if (!(operationStatus === ActionOperationStatus.SUCCESS && entities)) {
|
|
95
|
+
_context.next = 7;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
return _context.abrupt("return", new Promise(function (resolve) {
|
|
99
|
+
setTimeout(function () {
|
|
100
|
+
return resolve(entities.map(function (entity) {
|
|
101
|
+
return {
|
|
102
|
+
id: entity.id,
|
|
103
|
+
text: entity.text,
|
|
104
|
+
style: entity.style
|
|
105
|
+
};
|
|
106
|
+
}));
|
|
107
|
+
}, 1000);
|
|
108
|
+
}));
|
|
109
|
+
case 7:
|
|
110
|
+
return _context.abrupt("return", []);
|
|
111
|
+
case 8:
|
|
112
|
+
case "end":
|
|
113
|
+
return _context.stop();
|
|
114
|
+
}
|
|
115
|
+
}, _callee);
|
|
116
|
+
}));
|
|
117
|
+
return function loadOptions(_x, _x2) {
|
|
118
|
+
return _ref.apply(this, arguments);
|
|
119
|
+
};
|
|
120
|
+
}();
|
|
121
|
+
export default StatusEditType;
|
|
@@ -103,8 +103,7 @@ export var InlineEditableTableCell = styled.td((_styled$td2 = {}, _definePropert
|
|
|
103
103
|
verticalAlign: 'inherit',
|
|
104
104
|
boxSizing: 'content-box',
|
|
105
105
|
borderRight: "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border, ".concat(N40, ")")),
|
|
106
|
-
borderBottom: "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border, ".concat(N40, ")"))
|
|
107
|
-
overflow: 'hidden'
|
|
106
|
+
borderBottom: "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border, ".concat(N40, ")"))
|
|
108
107
|
}), _defineProperty(_styled$td2, "".concat(withTablePluginBodyPrefix('&:last-child')), {
|
|
109
108
|
borderRight: 0
|
|
110
109
|
}), _defineProperty(_styled$td2, "& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span", {
|
|
@@ -84,7 +84,8 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
84
84
|
fieldKey: columnKey,
|
|
85
85
|
integrationKey: integrationKey
|
|
86
86
|
}),
|
|
87
|
-
execute = _useExecuteAtomicActi.execute
|
|
87
|
+
execute = _useExecuteAtomicActi.execute,
|
|
88
|
+
executeFetch = _useExecuteAtomicActi.executeFetch;
|
|
88
89
|
var isEditable = !!execute;
|
|
89
90
|
var readView = /*#__PURE__*/React.createElement(TooltipWrapper, {
|
|
90
91
|
columnKey: columnKey,
|
|
@@ -102,6 +103,7 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
102
103
|
return /*#__PURE__*/React.createElement(InlineEdit, {
|
|
103
104
|
ari: ari,
|
|
104
105
|
execute: execute,
|
|
106
|
+
executeFetch: executeFetch,
|
|
105
107
|
readView: readView,
|
|
106
108
|
columnKey: columnKey,
|
|
107
109
|
datasourceTypeWithValues: values
|
|
@@ -16,9 +16,12 @@ var editContainerStyles = xcss({
|
|
|
16
16
|
marginBlockStart: 'space.negative.100'
|
|
17
17
|
});
|
|
18
18
|
var getBackendUpdateValue = function getBackendUpdateValue(typedNewValue) {
|
|
19
|
+
var _typedNewValue$values;
|
|
19
20
|
switch (typedNewValue.type) {
|
|
20
21
|
case 'string':
|
|
21
22
|
return typedNewValue.values[0] || '';
|
|
23
|
+
case 'status':
|
|
24
|
+
return ((_typedNewValue$values = typedNewValue.values[0]) === null || _typedNewValue$values === void 0 ? void 0 : _typedNewValue$values.id) || '';
|
|
22
25
|
}
|
|
23
26
|
throw new Error("Datasource 2 way sync Backend update value not implemented for type ".concat(typedNewValue.type));
|
|
24
27
|
};
|
|
@@ -28,6 +31,10 @@ var mapUpdatedItem = function mapUpdatedItem(existingItem, columnKey, newValue)
|
|
|
28
31
|
return _objectSpread(_objectSpread({}, existingItem), {}, _defineProperty({}, columnKey, {
|
|
29
32
|
data: newValue.values[0] || ''
|
|
30
33
|
}));
|
|
34
|
+
case 'status':
|
|
35
|
+
return newValue.values[0] ? _objectSpread(_objectSpread({}, existingItem), {}, _defineProperty({}, columnKey, {
|
|
36
|
+
data: newValue.values[0]
|
|
37
|
+
})) : existingItem;
|
|
31
38
|
default:
|
|
32
39
|
}
|
|
33
40
|
return null;
|
|
@@ -52,6 +59,7 @@ var useRefreshDatasourceItem = function useRefreshDatasourceItem(item) {
|
|
|
52
59
|
export var InlineEdit = function InlineEdit(_ref) {
|
|
53
60
|
var ari = _ref.ari,
|
|
54
61
|
execute = _ref.execute,
|
|
62
|
+
executeFetch = _ref.executeFetch,
|
|
55
63
|
_readView = _ref.readView,
|
|
56
64
|
columnKey = _ref.columnKey,
|
|
57
65
|
datasourceTypeWithValues = _ref.datasourceTypeWithValues;
|
|
@@ -123,7 +131,8 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
123
131
|
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType({
|
|
124
132
|
defaultValue: datasourceTypeWithValues,
|
|
125
133
|
currentValue: editValues,
|
|
126
|
-
setEditValues: setEditValues
|
|
134
|
+
setEditValues: setEditValues,
|
|
135
|
+
executeFetch: executeFetch
|
|
127
136
|
}), {
|
|
128
137
|
hideActionButtons: true,
|
|
129
138
|
readView: function readView() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Action } from 'react-sweet-state';
|
|
2
2
|
import { useDatasourceClientExtension } from '@atlaskit/link-client-extension';
|
|
3
|
-
import type { ActionsDiscoveryRequest, AtomicActionInterface } from '@atlaskit/linking-types';
|
|
3
|
+
import type { ActionsDiscoveryRequest, AtomicActionExecuteResponse, AtomicActionInterface } from '@atlaskit/linking-types';
|
|
4
4
|
import { type DatasourceOperationFailedAttributesType, type EventKey } from '../../../src/analytics/generated/analytics.types';
|
|
5
5
|
import type createEventPayload from '../../../src/analytics/generated/create-event-payload';
|
|
6
6
|
type IntegrationKey = string;
|
|
@@ -81,9 +81,15 @@ export declare const useDiscoverActions: ({ captureError, fireEvent }: UseDiscov
|
|
|
81
81
|
/**
|
|
82
82
|
* Retrieves the action schema for a given ARI + fieldKey + integrationKey
|
|
83
83
|
*/
|
|
84
|
-
export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<{
|
|
85
|
+
schema?: undefined;
|
|
86
|
+
fetchSchema?: undefined;
|
|
87
|
+
} | {
|
|
88
|
+
schema: Pick<AtomicActionInterface, "actionKey" | "type" | "description"> & {
|
|
89
|
+
fetchAction?: Pick<AtomicActionInterface, "actionKey" | "type" | "inputs"> | undefined;
|
|
90
|
+
};
|
|
91
|
+
fetchSchema: Pick<AtomicActionInterface, "actionKey" | "type" | "inputs"> | undefined;
|
|
92
|
+
}, import("react-sweet-state").BoundActions<ActionsStoreState, {
|
|
87
93
|
discoverActions: (captureError: AnalyticsCaptureError, fireEvent: AnalyticsFireEvent, api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
88
94
|
}>, {
|
|
89
95
|
ari: string;
|
|
@@ -106,8 +112,7 @@ export declare const useExecuteAtomicAction: ({ ari, fieldKey, integrationKey, }
|
|
|
106
112
|
fieldKey: string;
|
|
107
113
|
integrationKey: string;
|
|
108
114
|
}) => {
|
|
109
|
-
execute?: undefined;
|
|
110
|
-
|
|
111
|
-
execute: (value: string | number) => Promise<import("@atlaskit/linking-types").AtomicActionExecuteResponse<unknown>>;
|
|
115
|
+
execute?: ((value: (string | number)) => Promise<AtomicActionExecuteResponse<unknown>>) | undefined;
|
|
116
|
+
executeFetch?: (<E>(inputs: any) => Promise<E>) | undefined;
|
|
112
117
|
};
|
|
113
118
|
export {};
|
|
@@ -2,9 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import type InlineEdit from '@atlaskit/inline-edit';
|
|
3
3
|
import type { DatasourceType } from '@atlaskit/linking-types';
|
|
4
4
|
import { type DatasourceTypeWithOnlyValues } from '../types';
|
|
5
|
-
export declare const editType: ({ defaultValue, currentValue, setEditValues, }: {
|
|
5
|
+
export declare const editType: ({ defaultValue, currentValue, setEditValues, executeFetch }: {
|
|
6
6
|
defaultValue: DatasourceTypeWithOnlyValues;
|
|
7
7
|
currentValue: DatasourceTypeWithOnlyValues;
|
|
8
8
|
setEditValues: React.Dispatch<React.SetStateAction<DatasourceTypeWithOnlyValues>>;
|
|
9
|
+
executeFetch?: (<E>(inputs: any) => Promise<E>) | undefined;
|
|
9
10
|
}) => Pick<React.ComponentProps<typeof InlineEdit>, 'defaultValue' | 'editView'>;
|
|
10
11
|
export declare const isEditTypeSupported: (type: DatasourceType['type']) => boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type FieldProps } from '@atlaskit/form';
|
|
3
|
+
import type { DatasourceTypeWithOnlyValues } from '../../types';
|
|
4
|
+
interface Props extends Omit<FieldProps<string>, 'value'> {
|
|
5
|
+
currentValue: DatasourceTypeWithOnlyValues;
|
|
6
|
+
setEditValues: React.Dispatch<React.SetStateAction<DatasourceTypeWithOnlyValues>>;
|
|
7
|
+
executeFetch?: <E>(inputs: any) => Promise<E>;
|
|
8
|
+
}
|
|
9
|
+
declare const StatusEditType: (props: Props) => JSX.Element;
|
|
10
|
+
export default StatusEditType;
|
|
@@ -7,6 +7,7 @@ interface InlineEditProps {
|
|
|
7
7
|
readView: React.ReactNode;
|
|
8
8
|
datasourceTypeWithValues: DatasourceTypeWithOnlyValues;
|
|
9
9
|
execute: (value: string | number) => Promise<AtomicActionExecuteResponse>;
|
|
10
|
+
executeFetch?: <E>(inputs: any) => Promise<E>;
|
|
10
11
|
}
|
|
11
|
-
export declare const InlineEdit: ({ ari, execute, readView, columnKey, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
|
|
12
|
+
export declare const InlineEdit: ({ ari, execute, executeFetch, readView, columnKey, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Action } from 'react-sweet-state';
|
|
2
2
|
import { useDatasourceClientExtension } from '@atlaskit/link-client-extension';
|
|
3
|
-
import type { ActionsDiscoveryRequest, AtomicActionInterface } from '@atlaskit/linking-types';
|
|
3
|
+
import type { ActionsDiscoveryRequest, AtomicActionExecuteResponse, AtomicActionInterface } from '@atlaskit/linking-types';
|
|
4
4
|
import { type DatasourceOperationFailedAttributesType, type EventKey } from '../../../src/analytics/generated/analytics.types';
|
|
5
5
|
import type createEventPayload from '../../../src/analytics/generated/create-event-payload';
|
|
6
6
|
type IntegrationKey = string;
|
|
@@ -81,9 +81,15 @@ export declare const useDiscoverActions: ({ captureError, fireEvent }: UseDiscov
|
|
|
81
81
|
/**
|
|
82
82
|
* Retrieves the action schema for a given ARI + fieldKey + integrationKey
|
|
83
83
|
*/
|
|
84
|
-
export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<{
|
|
85
|
+
schema?: undefined;
|
|
86
|
+
fetchSchema?: undefined;
|
|
87
|
+
} | {
|
|
88
|
+
schema: Pick<AtomicActionInterface, "actionKey" | "type" | "description"> & {
|
|
89
|
+
fetchAction?: Pick<AtomicActionInterface, "actionKey" | "type" | "inputs"> | undefined;
|
|
90
|
+
};
|
|
91
|
+
fetchSchema: Pick<AtomicActionInterface, "actionKey" | "type" | "inputs"> | undefined;
|
|
92
|
+
}, import("react-sweet-state").BoundActions<ActionsStoreState, {
|
|
87
93
|
discoverActions: (captureError: AnalyticsCaptureError, fireEvent: AnalyticsFireEvent, api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
|
|
88
94
|
}>, {
|
|
89
95
|
ari: string;
|
|
@@ -106,8 +112,7 @@ export declare const useExecuteAtomicAction: ({ ari, fieldKey, integrationKey, }
|
|
|
106
112
|
fieldKey: string;
|
|
107
113
|
integrationKey: string;
|
|
108
114
|
}) => {
|
|
109
|
-
execute?: undefined;
|
|
110
|
-
|
|
111
|
-
execute: (value: string | number) => Promise<import("@atlaskit/linking-types").AtomicActionExecuteResponse<unknown>>;
|
|
115
|
+
execute?: ((value: (string | number)) => Promise<AtomicActionExecuteResponse<unknown>>) | undefined;
|
|
116
|
+
executeFetch?: (<E>(inputs: any) => Promise<E>) | undefined;
|
|
112
117
|
};
|
|
113
118
|
export {};
|
|
@@ -2,9 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import type InlineEdit from '@atlaskit/inline-edit';
|
|
3
3
|
import type { DatasourceType } from '@atlaskit/linking-types';
|
|
4
4
|
import { type DatasourceTypeWithOnlyValues } from '../types';
|
|
5
|
-
export declare const editType: ({ defaultValue, currentValue, setEditValues, }: {
|
|
5
|
+
export declare const editType: ({ defaultValue, currentValue, setEditValues, executeFetch }: {
|
|
6
6
|
defaultValue: DatasourceTypeWithOnlyValues;
|
|
7
7
|
currentValue: DatasourceTypeWithOnlyValues;
|
|
8
8
|
setEditValues: React.Dispatch<React.SetStateAction<DatasourceTypeWithOnlyValues>>;
|
|
9
|
+
executeFetch?: (<E>(inputs: any) => Promise<E>) | undefined;
|
|
9
10
|
}) => Pick<React.ComponentProps<typeof InlineEdit>, 'defaultValue' | 'editView'>;
|
|
10
11
|
export declare const isEditTypeSupported: (type: DatasourceType['type']) => boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type FieldProps } from '@atlaskit/form';
|
|
3
|
+
import type { DatasourceTypeWithOnlyValues } from '../../types';
|
|
4
|
+
interface Props extends Omit<FieldProps<string>, 'value'> {
|
|
5
|
+
currentValue: DatasourceTypeWithOnlyValues;
|
|
6
|
+
setEditValues: React.Dispatch<React.SetStateAction<DatasourceTypeWithOnlyValues>>;
|
|
7
|
+
executeFetch?: <E>(inputs: any) => Promise<E>;
|
|
8
|
+
}
|
|
9
|
+
declare const StatusEditType: (props: Props) => JSX.Element;
|
|
10
|
+
export default StatusEditType;
|
|
@@ -7,6 +7,7 @@ interface InlineEditProps {
|
|
|
7
7
|
readView: React.ReactNode;
|
|
8
8
|
datasourceTypeWithValues: DatasourceTypeWithOnlyValues;
|
|
9
9
|
execute: (value: string | number) => Promise<AtomicActionExecuteResponse>;
|
|
10
|
+
executeFetch?: <E>(inputs: any) => Promise<E>;
|
|
10
11
|
}
|
|
11
|
-
export declare const InlineEdit: ({ ari, execute, readView, columnKey, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
|
|
12
|
+
export declare const InlineEdit: ({ ari, execute, executeFetch, readView, columnKey, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -30,6 +30,7 @@ interface Props {
|
|
|
30
30
|
canControlWrapping?: boolean;
|
|
31
31
|
skipIntl?: boolean;
|
|
32
32
|
forceLoading?: boolean;
|
|
33
|
+
visibleColumnKeys?: string[];
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled -- To migrate as part of go/ui-styling-standard
|
|
@@ -46,6 +47,7 @@ const ExampleBody = ({
|
|
|
46
47
|
canResizeColumns = true,
|
|
47
48
|
canControlWrapping = true,
|
|
48
49
|
forceLoading = false,
|
|
50
|
+
visibleColumnKeys: overrideVisibleColumnKeys,
|
|
49
51
|
}: Props) => {
|
|
50
52
|
const parameters = useMemo<JiraIssueDatasourceParameters>(
|
|
51
53
|
() => ({
|
|
@@ -85,10 +87,17 @@ const ExampleBody = ({
|
|
|
85
87
|
});
|
|
86
88
|
|
|
87
89
|
useEffect(() => {
|
|
88
|
-
if (
|
|
90
|
+
if (overrideVisibleColumnKeys) {
|
|
91
|
+
onVisibleColumnKeysChange(overrideVisibleColumnKeys);
|
|
92
|
+
} else if (visibleColumnKeys.length === 0 && defaultVisibleColumnKeys.length > 0) {
|
|
89
93
|
onVisibleColumnKeysChange(defaultVisibleColumnKeys);
|
|
90
94
|
}
|
|
91
|
-
}, [
|
|
95
|
+
}, [
|
|
96
|
+
visibleColumnKeys,
|
|
97
|
+
defaultVisibleColumnKeys,
|
|
98
|
+
onVisibleColumnKeysChange,
|
|
99
|
+
overrideVisibleColumnKeys,
|
|
100
|
+
]);
|
|
92
101
|
|
|
93
102
|
return (
|
|
94
103
|
<TableViewWrapper>
|
|
@@ -116,22 +125,12 @@ const ExampleBody = ({
|
|
|
116
125
|
);
|
|
117
126
|
};
|
|
118
127
|
|
|
119
|
-
export const ExampleIssueLikeTable = ({
|
|
120
|
-
isReadonly,
|
|
121
|
-
canResizeColumns,
|
|
122
|
-
canControlWrapping,
|
|
123
|
-
forceLoading,
|
|
124
|
-
}: Props) => {
|
|
128
|
+
export const ExampleIssueLikeTable = (props: Props) => {
|
|
125
129
|
return (
|
|
126
130
|
<DatasourceExperienceIdProvider>
|
|
127
131
|
<IntlMessagesProvider loaderFn={fetchMessagesForLocale}>
|
|
128
132
|
<SmartCardProvider client={new SmartLinkClient()}>
|
|
129
|
-
<ExampleBody
|
|
130
|
-
isReadonly={isReadonly}
|
|
131
|
-
canResizeColumns={canResizeColumns}
|
|
132
|
-
canControlWrapping={canControlWrapping}
|
|
133
|
-
forceLoading={forceLoading}
|
|
134
|
-
/>
|
|
133
|
+
<ExampleBody {...props} />
|
|
135
134
|
</SmartCardProvider>
|
|
136
135
|
</IntlMessagesProvider>
|
|
137
136
|
</DatasourceExperienceIdProvider>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -72,13 +72,13 @@
|
|
|
72
72
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
73
73
|
"@atlaskit/primitives": "^13.0.0",
|
|
74
74
|
"@atlaskit/select": "^18.4.0",
|
|
75
|
-
"@atlaskit/smart-card": "^30.
|
|
75
|
+
"@atlaskit/smart-card": "^30.2.0",
|
|
76
76
|
"@atlaskit/smart-user-picker": "6.11.1",
|
|
77
77
|
"@atlaskit/spinner": "^16.3.0",
|
|
78
78
|
"@atlaskit/tag": "^12.6.0",
|
|
79
79
|
"@atlaskit/textfield": "6.5.4",
|
|
80
80
|
"@atlaskit/theme": "^14.0.0",
|
|
81
|
-
"@atlaskit/tokens": "^2.
|
|
81
|
+
"@atlaskit/tokens": "^2.1.0",
|
|
82
82
|
"@atlaskit/tooltip": "^18.8.0",
|
|
83
83
|
"@atlaskit/ufo": "^0.3.0",
|
|
84
84
|
"@atlaskit/width-detector": "^4.3.0",
|
|
@@ -164,6 +164,9 @@
|
|
|
164
164
|
"enable_datasource_supporting_actions": {
|
|
165
165
|
"type": "boolean"
|
|
166
166
|
},
|
|
167
|
+
"platform-datasources-enable-two-way-sync-statuses": {
|
|
168
|
+
"type": "boolean"
|
|
169
|
+
},
|
|
167
170
|
"platform.linking-platform.datasource-assets_add_version_parameter": {
|
|
168
171
|
"type": "boolean"
|
|
169
172
|
},
|