@atlaskit/link-datasource 3.7.0 → 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 +12 -0
- package/dist/cjs/state/actions/index.js +36 -9
- package/dist/cjs/ui/issue-like-table/edit-type/index.js +4 -2
- package/dist/cjs/ui/issue-like-table/edit-type/status/index.js +46 -32
- 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 +3 -1
- package/dist/es2019/state/actions/index.js +39 -8
- package/dist/es2019/ui/issue-like-table/edit-type/index.js +4 -2
- package/dist/es2019/ui/issue-like-table/edit-type/status/index.js +42 -31
- 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 +3 -1
- package/dist/esm/state/actions/index.js +36 -9
- package/dist/esm/ui/issue-like-table/edit-type/index.js +4 -2
- package/dist/esm/ui/issue-like-table/edit-type/status/index.js +46 -32
- 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 +3 -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 +1 -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 +1 -0
- package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
3
15
|
## 3.7.0
|
|
4
16
|
|
|
5
17
|
### Minor 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
|
};
|
|
@@ -19,7 +19,8 @@ var ACTIVE_INLINE_EDIT_ID = 'sllv-active-inline-edit';
|
|
|
19
19
|
var editType = exports.editType = function editType(_ref) {
|
|
20
20
|
var defaultValue = _ref.defaultValue,
|
|
21
21
|
currentValue = _ref.currentValue,
|
|
22
|
-
setEditValues = _ref.setEditValues
|
|
22
|
+
setEditValues = _ref.setEditValues,
|
|
23
|
+
executeFetch = _ref.executeFetch;
|
|
23
24
|
switch (defaultValue.type) {
|
|
24
25
|
case 'string':
|
|
25
26
|
return {
|
|
@@ -41,7 +42,8 @@ var editType = exports.editType = function editType(_ref) {
|
|
|
41
42
|
return /*#__PURE__*/_react.default.createElement(_status.default, (0, _extends2.default)({}, fieldProps, {
|
|
42
43
|
currentValue: currentValue,
|
|
43
44
|
setEditValues: setEditValues,
|
|
44
|
-
id: ACTIVE_INLINE_EDIT_ID
|
|
45
|
+
id: ACTIVE_INLINE_EDIT_ID,
|
|
46
|
+
executeFetch: executeFetch
|
|
45
47
|
}));
|
|
46
48
|
}
|
|
47
49
|
};
|
|
@@ -7,10 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _linkingTypes = require("@atlaskit/linking-types");
|
|
14
16
|
var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
|
|
15
17
|
var _select = _interopRequireDefault(require("@atlaskit/select"));
|
|
16
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,8 +21,10 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
19
21
|
// eslint-disable-next-line import/no-extraneous-dependencies,no-restricted-imports
|
|
20
22
|
|
|
21
23
|
var StatusEditType = function StatusEditType(props) {
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
+
var _currentValue$values;
|
|
25
|
+
var currentValue = props.currentValue,
|
|
26
|
+
executeFetch = props.executeFetch;
|
|
27
|
+
var _useStatusOptions = useStatusOptions(currentValue, executeFetch),
|
|
24
28
|
options = _useStatusOptions.options,
|
|
25
29
|
isLoading = _useStatusOptions.isLoading;
|
|
26
30
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({}, props, {
|
|
@@ -35,7 +39,7 @@ var StatusEditType = function StatusEditType(props) {
|
|
|
35
39
|
},
|
|
36
40
|
options: options,
|
|
37
41
|
isLoading: isLoading,
|
|
38
|
-
defaultValue:
|
|
42
|
+
defaultValue: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
|
|
39
43
|
filterOption: filterOption,
|
|
40
44
|
formatOptionLabel: function formatOptionLabel(option) {
|
|
41
45
|
return /*#__PURE__*/_react.default.createElement(_lozenge.default, (0, _extends2.default)({
|
|
@@ -53,7 +57,7 @@ var StatusEditType = function StatusEditType(props) {
|
|
|
53
57
|
var filterOption = function filterOption(option, inputValue) {
|
|
54
58
|
return option.data.text.toLowerCase().includes(inputValue.toLowerCase());
|
|
55
59
|
};
|
|
56
|
-
var useStatusOptions = function useStatusOptions() {
|
|
60
|
+
var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
|
|
57
61
|
var _useState = (0, _react.useState)({
|
|
58
62
|
isLoading: true,
|
|
59
63
|
options: []
|
|
@@ -64,53 +68,63 @@ var useStatusOptions = function useStatusOptions() {
|
|
|
64
68
|
isLoading = _useState2$.isLoading,
|
|
65
69
|
setOptions = _useState2[1];
|
|
66
70
|
(0, _react.useEffect)(function () {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
var isMounted = true;
|
|
72
|
+
loadOptions(currentValue, executeFetch).then(function (options) {
|
|
73
|
+
if (isMounted) {
|
|
74
|
+
setOptions({
|
|
75
|
+
isLoading: false,
|
|
76
|
+
options: options
|
|
77
|
+
});
|
|
78
|
+
}
|
|
72
79
|
});
|
|
73
|
-
|
|
80
|
+
return function () {
|
|
81
|
+
isMounted = false;
|
|
82
|
+
};
|
|
83
|
+
}, [currentValue, executeFetch]);
|
|
74
84
|
return {
|
|
75
85
|
options: options,
|
|
76
86
|
isLoading: isLoading
|
|
77
87
|
};
|
|
78
88
|
};
|
|
79
89
|
var loadOptions = /*#__PURE__*/function () {
|
|
80
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
90
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(currentValue, executeFetch) {
|
|
91
|
+
var result, operationStatus, entities;
|
|
81
92
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
82
93
|
while (1) switch (_context.prev = _context.next) {
|
|
83
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
|
+
}
|
|
84
108
|
return _context.abrupt("return", new Promise(function (resolve) {
|
|
85
109
|
setTimeout(function () {
|
|
86
|
-
return resolve(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
text: 'In Progress',
|
|
94
|
-
id: '1',
|
|
95
|
-
style: {
|
|
96
|
-
appearance: 'inprogress'
|
|
97
|
-
}
|
|
98
|
-
}, {
|
|
99
|
-
text: 'Done',
|
|
100
|
-
id: '2',
|
|
101
|
-
style: {
|
|
102
|
-
appearance: 'success'
|
|
103
|
-
}
|
|
104
|
-
}]);
|
|
110
|
+
return resolve(entities.map(function (entity) {
|
|
111
|
+
return {
|
|
112
|
+
id: entity.id,
|
|
113
|
+
text: entity.text,
|
|
114
|
+
style: entity.style
|
|
115
|
+
};
|
|
116
|
+
}));
|
|
105
117
|
}, 1000);
|
|
106
118
|
}));
|
|
107
|
-
case
|
|
119
|
+
case 7:
|
|
120
|
+
return _context.abrupt("return", []);
|
|
121
|
+
case 8:
|
|
108
122
|
case "end":
|
|
109
123
|
return _context.stop();
|
|
110
124
|
}
|
|
111
125
|
}, _callee);
|
|
112
126
|
}));
|
|
113
|
-
return function loadOptions() {
|
|
127
|
+
return function loadOptions(_x, _x2) {
|
|
114
128
|
return _ref.apply(this, arguments);
|
|
115
129
|
};
|
|
116
130
|
}();
|
|
@@ -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
|
|
@@ -69,6 +69,7 @@ var useRefreshDatasourceItem = function useRefreshDatasourceItem(item) {
|
|
|
69
69
|
var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
70
70
|
var ari = _ref.ari,
|
|
71
71
|
execute = _ref.execute,
|
|
72
|
+
executeFetch = _ref.executeFetch,
|
|
72
73
|
_readView = _ref.readView,
|
|
73
74
|
columnKey = _ref.columnKey,
|
|
74
75
|
datasourceTypeWithValues = _ref.datasourceTypeWithValues;
|
|
@@ -140,7 +141,8 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
|
140
141
|
}, /*#__PURE__*/_react.default.createElement(_inlineEdit.default, (0, _extends2.default)({}, (0, _editType.editType)({
|
|
141
142
|
defaultValue: datasourceTypeWithValues,
|
|
142
143
|
currentValue: editValues,
|
|
143
|
-
setEditValues: setEditValues
|
|
144
|
+
setEditValues: setEditValues,
|
|
145
|
+
executeFetch: executeFetch
|
|
144
146
|
}), {
|
|
145
147
|
hideActionButtons: true,
|
|
146
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
|
};
|
|
@@ -9,7 +9,8 @@ const ACTIVE_INLINE_EDIT_ID = 'sllv-active-inline-edit';
|
|
|
9
9
|
export const editType = ({
|
|
10
10
|
defaultValue,
|
|
11
11
|
currentValue,
|
|
12
|
-
setEditValues
|
|
12
|
+
setEditValues,
|
|
13
|
+
executeFetch
|
|
13
14
|
}) => {
|
|
14
15
|
switch (defaultValue.type) {
|
|
15
16
|
case 'string':
|
|
@@ -31,7 +32,8 @@ export const editType = ({
|
|
|
31
32
|
}) => /*#__PURE__*/React.createElement(StatusEditType, _extends({}, fieldProps, {
|
|
32
33
|
currentValue: currentValue,
|
|
33
34
|
setEditValues: setEditValues,
|
|
34
|
-
id: ACTIVE_INLINE_EDIT_ID
|
|
35
|
+
id: ACTIVE_INLINE_EDIT_ID,
|
|
36
|
+
executeFetch: executeFetch
|
|
35
37
|
}))
|
|
36
38
|
};
|
|
37
39
|
default:
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { ActionOperationStatus } from '@atlaskit/linking-types';
|
|
3
4
|
import Lozenge from '@atlaskit/lozenge';
|
|
4
5
|
// FilterOptionOption is used in the filterOption function which is part of the public API, but the type itself is not exported
|
|
5
6
|
// eslint-disable-next-line import/no-extraneous-dependencies,no-restricted-imports
|
|
6
7
|
|
|
7
8
|
import Select from '@atlaskit/select';
|
|
8
9
|
const StatusEditType = props => {
|
|
9
|
-
var
|
|
10
|
+
var _currentValue$values;
|
|
11
|
+
const {
|
|
12
|
+
currentValue,
|
|
13
|
+
executeFetch
|
|
14
|
+
} = props;
|
|
10
15
|
const {
|
|
11
16
|
options,
|
|
12
17
|
isLoading
|
|
13
|
-
} = useStatusOptions();
|
|
18
|
+
} = useStatusOptions(currentValue, executeFetch);
|
|
14
19
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
|
|
15
20
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides -- Ignored via go/DSP-18766
|
|
16
21
|
className: "single-select",
|
|
@@ -21,7 +26,7 @@ const StatusEditType = props => {
|
|
|
21
26
|
getOptionValue: option => option.text,
|
|
22
27
|
options: options,
|
|
23
28
|
isLoading: isLoading,
|
|
24
|
-
defaultValue:
|
|
29
|
+
defaultValue: currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
|
|
25
30
|
filterOption: filterOption,
|
|
26
31
|
formatOptionLabel: option => /*#__PURE__*/React.createElement(Lozenge, _extends({
|
|
27
32
|
testId: `inline-edit-status-option-${option.text}`
|
|
@@ -33,7 +38,7 @@ const StatusEditType = props => {
|
|
|
33
38
|
})));
|
|
34
39
|
};
|
|
35
40
|
const filterOption = (option, inputValue) => option.data.text.toLowerCase().includes(inputValue.toLowerCase());
|
|
36
|
-
const useStatusOptions = () => {
|
|
41
|
+
const useStatusOptions = (currentValue, executeFetch) => {
|
|
37
42
|
const [{
|
|
38
43
|
options,
|
|
39
44
|
isLoading
|
|
@@ -42,37 +47,43 @@ const useStatusOptions = () => {
|
|
|
42
47
|
options: []
|
|
43
48
|
});
|
|
44
49
|
useEffect(() => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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]);
|
|
50
63
|
return {
|
|
51
64
|
options,
|
|
52
65
|
isLoading
|
|
53
66
|
};
|
|
54
67
|
};
|
|
55
|
-
const loadOptions = async () => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}]), 1000);
|
|
76
|
-
});
|
|
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 [];
|
|
77
88
|
};
|
|
78
89
|
export default StatusEditType;
|
|
@@ -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
|
|
@@ -60,6 +60,7 @@ const useRefreshDatasourceItem = item => {
|
|
|
60
60
|
export const InlineEdit = ({
|
|
61
61
|
ari,
|
|
62
62
|
execute,
|
|
63
|
+
executeFetch,
|
|
63
64
|
readView,
|
|
64
65
|
columnKey,
|
|
65
66
|
datasourceTypeWithValues
|
|
@@ -130,7 +131,8 @@ export const InlineEdit = ({
|
|
|
130
131
|
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType({
|
|
131
132
|
defaultValue: datasourceTypeWithValues,
|
|
132
133
|
currentValue: editValues,
|
|
133
|
-
setEditValues
|
|
134
|
+
setEditValues,
|
|
135
|
+
executeFetch
|
|
134
136
|
}), {
|
|
135
137
|
hideActionButtons: true,
|
|
136
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
|
};
|
|
@@ -10,7 +10,8 @@ var ACTIVE_INLINE_EDIT_ID = 'sllv-active-inline-edit';
|
|
|
10
10
|
export var editType = function editType(_ref) {
|
|
11
11
|
var defaultValue = _ref.defaultValue,
|
|
12
12
|
currentValue = _ref.currentValue,
|
|
13
|
-
setEditValues = _ref.setEditValues
|
|
13
|
+
setEditValues = _ref.setEditValues,
|
|
14
|
+
executeFetch = _ref.executeFetch;
|
|
14
15
|
switch (defaultValue.type) {
|
|
15
16
|
case 'string':
|
|
16
17
|
return {
|
|
@@ -32,7 +33,8 @@ export var editType = function editType(_ref) {
|
|
|
32
33
|
return /*#__PURE__*/React.createElement(StatusEditType, _extends({}, fieldProps, {
|
|
33
34
|
currentValue: currentValue,
|
|
34
35
|
setEditValues: setEditValues,
|
|
35
|
-
id: ACTIVE_INLINE_EDIT_ID
|
|
36
|
+
id: ACTIVE_INLINE_EDIT_ID,
|
|
37
|
+
executeFetch: executeFetch
|
|
36
38
|
}));
|
|
37
39
|
}
|
|
38
40
|
};
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
4
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
6
|
import React, { useEffect, useState } from 'react';
|
|
7
|
+
import { ActionOperationStatus } from '@atlaskit/linking-types';
|
|
6
8
|
import Lozenge from '@atlaskit/lozenge';
|
|
7
9
|
// FilterOptionOption is used in the filterOption function which is part of the public API, but the type itself is not exported
|
|
8
10
|
// eslint-disable-next-line import/no-extraneous-dependencies,no-restricted-imports
|
|
9
11
|
|
|
10
12
|
import Select from '@atlaskit/select';
|
|
11
13
|
var StatusEditType = function StatusEditType(props) {
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
+
var _currentValue$values;
|
|
15
|
+
var currentValue = props.currentValue,
|
|
16
|
+
executeFetch = props.executeFetch;
|
|
17
|
+
var _useStatusOptions = useStatusOptions(currentValue, executeFetch),
|
|
14
18
|
options = _useStatusOptions.options,
|
|
15
19
|
isLoading = _useStatusOptions.isLoading;
|
|
16
20
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
|
|
@@ -25,7 +29,7 @@ var StatusEditType = function StatusEditType(props) {
|
|
|
25
29
|
},
|
|
26
30
|
options: options,
|
|
27
31
|
isLoading: isLoading,
|
|
28
|
-
defaultValue:
|
|
32
|
+
defaultValue: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
|
|
29
33
|
filterOption: filterOption,
|
|
30
34
|
formatOptionLabel: function formatOptionLabel(option) {
|
|
31
35
|
return /*#__PURE__*/React.createElement(Lozenge, _extends({
|
|
@@ -43,7 +47,7 @@ var StatusEditType = function StatusEditType(props) {
|
|
|
43
47
|
var filterOption = function filterOption(option, inputValue) {
|
|
44
48
|
return option.data.text.toLowerCase().includes(inputValue.toLowerCase());
|
|
45
49
|
};
|
|
46
|
-
var useStatusOptions = function useStatusOptions() {
|
|
50
|
+
var useStatusOptions = function useStatusOptions(currentValue, executeFetch) {
|
|
47
51
|
var _useState = useState({
|
|
48
52
|
isLoading: true,
|
|
49
53
|
options: []
|
|
@@ -54,53 +58,63 @@ var useStatusOptions = function useStatusOptions() {
|
|
|
54
58
|
isLoading = _useState2$.isLoading,
|
|
55
59
|
setOptions = _useState2[1];
|
|
56
60
|
useEffect(function () {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
var isMounted = true;
|
|
62
|
+
loadOptions(currentValue, executeFetch).then(function (options) {
|
|
63
|
+
if (isMounted) {
|
|
64
|
+
setOptions({
|
|
65
|
+
isLoading: false,
|
|
66
|
+
options: options
|
|
67
|
+
});
|
|
68
|
+
}
|
|
62
69
|
});
|
|
63
|
-
|
|
70
|
+
return function () {
|
|
71
|
+
isMounted = false;
|
|
72
|
+
};
|
|
73
|
+
}, [currentValue, executeFetch]);
|
|
64
74
|
return {
|
|
65
75
|
options: options,
|
|
66
76
|
isLoading: isLoading
|
|
67
77
|
};
|
|
68
78
|
};
|
|
69
79
|
var loadOptions = /*#__PURE__*/function () {
|
|
70
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
80
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(currentValue, executeFetch) {
|
|
81
|
+
var result, operationStatus, entities;
|
|
71
82
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
72
83
|
while (1) switch (_context.prev = _context.next) {
|
|
73
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
|
+
}
|
|
74
98
|
return _context.abrupt("return", new Promise(function (resolve) {
|
|
75
99
|
setTimeout(function () {
|
|
76
|
-
return resolve(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
text: 'In Progress',
|
|
84
|
-
id: '1',
|
|
85
|
-
style: {
|
|
86
|
-
appearance: 'inprogress'
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
text: 'Done',
|
|
90
|
-
id: '2',
|
|
91
|
-
style: {
|
|
92
|
-
appearance: 'success'
|
|
93
|
-
}
|
|
94
|
-
}]);
|
|
100
|
+
return resolve(entities.map(function (entity) {
|
|
101
|
+
return {
|
|
102
|
+
id: entity.id,
|
|
103
|
+
text: entity.text,
|
|
104
|
+
style: entity.style
|
|
105
|
+
};
|
|
106
|
+
}));
|
|
95
107
|
}, 1000);
|
|
96
108
|
}));
|
|
97
|
-
case
|
|
109
|
+
case 7:
|
|
110
|
+
return _context.abrupt("return", []);
|
|
111
|
+
case 8:
|
|
98
112
|
case "end":
|
|
99
113
|
return _context.stop();
|
|
100
114
|
}
|
|
101
115
|
}, _callee);
|
|
102
116
|
}));
|
|
103
|
-
return function loadOptions() {
|
|
117
|
+
return function loadOptions(_x, _x2) {
|
|
104
118
|
return _ref.apply(this, arguments);
|
|
105
119
|
};
|
|
106
120
|
}();
|
|
@@ -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
|
|
@@ -59,6 +59,7 @@ var useRefreshDatasourceItem = function useRefreshDatasourceItem(item) {
|
|
|
59
59
|
export var InlineEdit = function InlineEdit(_ref) {
|
|
60
60
|
var ari = _ref.ari,
|
|
61
61
|
execute = _ref.execute,
|
|
62
|
+
executeFetch = _ref.executeFetch,
|
|
62
63
|
_readView = _ref.readView,
|
|
63
64
|
columnKey = _ref.columnKey,
|
|
64
65
|
datasourceTypeWithValues = _ref.datasourceTypeWithValues;
|
|
@@ -130,7 +131,8 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
130
131
|
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType({
|
|
131
132
|
defaultValue: datasourceTypeWithValues,
|
|
132
133
|
currentValue: editValues,
|
|
133
|
-
setEditValues: setEditValues
|
|
134
|
+
setEditValues: setEditValues,
|
|
135
|
+
executeFetch: executeFetch
|
|
134
136
|
}), {
|
|
135
137
|
hideActionButtons: true,
|
|
136
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;
|
|
@@ -4,6 +4,7 @@ import type { DatasourceTypeWithOnlyValues } from '../../types';
|
|
|
4
4
|
interface Props extends Omit<FieldProps<string>, 'value'> {
|
|
5
5
|
currentValue: DatasourceTypeWithOnlyValues;
|
|
6
6
|
setEditValues: React.Dispatch<React.SetStateAction<DatasourceTypeWithOnlyValues>>;
|
|
7
|
+
executeFetch?: <E>(inputs: any) => Promise<E>;
|
|
7
8
|
}
|
|
8
9
|
declare const StatusEditType: (props: Props) => JSX.Element;
|
|
9
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;
|
|
@@ -4,6 +4,7 @@ import type { DatasourceTypeWithOnlyValues } from '../../types';
|
|
|
4
4
|
interface Props extends Omit<FieldProps<string>, 'value'> {
|
|
5
5
|
currentValue: DatasourceTypeWithOnlyValues;
|
|
6
6
|
setEditValues: React.Dispatch<React.SetStateAction<DatasourceTypeWithOnlyValues>>;
|
|
7
|
+
executeFetch?: <E>(inputs: any) => Promise<E>;
|
|
7
8
|
}
|
|
8
9
|
declare const StatusEditType: (props: Props) => JSX.Element;
|
|
9
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 {};
|
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",
|