@kineticdata/react 6.0.2 → 6.0.4
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 +86 -0
- package/lib/apis/core/authentication.js +1 -1
- package/lib/apis/core/submissions.js +2 -2
- package/lib/apis/task/index.js +4 -2
- package/lib/components/core/form/FormForm.js +3 -2
- package/lib/components/form/FormState.js +2 -1
- package/lib/components/form/tests/Form.test.js +1432 -1194
- package/lib/components/form/tests/components.js +71 -61
- package/lib/components/table/{Table.redux.test.js → tests/Table.redux.test.js} +1 -1
- package/lib/components/table/tests/Table.test.js +767 -0
- package/lib/components/table/tests/components.js +182 -0
- package/lib/components/task/builder/TreeBuilder.js +4 -1
- package/lib/components/task/builder/builder.redux.js +25 -13
- package/lib/components/task/builder/models.js +5 -0
- package/lib/components/task/category/TaskCategoryForm.js +6 -3
- package/lib/components/task/workflows/WorkflowForm.js +90 -39
- package/package.json +2 -2
- package/lib/components/table/Table.test.js +0 -700
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.mockTableConfig = exports.TableViewMock = void 0;
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _excluded = ["header", "body", "footer"],
|
|
11
|
+
_excluded2 = ["headerRow"],
|
|
12
|
+
_excluded3 = ["columnHeaders"],
|
|
13
|
+
_excluded4 = ["title", "columnControl"],
|
|
14
|
+
_excluded5 = ["tableRows"],
|
|
15
|
+
_excluded6 = ["cells"],
|
|
16
|
+
_excluded7 = ["value"],
|
|
17
|
+
_excluded8 = ["footerRow"],
|
|
18
|
+
_excluded9 = ["cells"],
|
|
19
|
+
_excluded10 = ["filters"],
|
|
20
|
+
_excluded11 = ["fields", "error", "buttons"],
|
|
21
|
+
_excluded12 = ["table", "pagination", "filter", "columnControl"];
|
|
22
|
+
var stringifyProps = function stringifyProps(props) {
|
|
23
|
+
return JSON.stringify(props,
|
|
24
|
+
// Make sure functions are stringified to an empty function string
|
|
25
|
+
// instead of being omitted
|
|
26
|
+
function (k, v) {
|
|
27
|
+
return typeof v === 'function' ? '() => {}' : v;
|
|
28
|
+
}, 2);
|
|
29
|
+
};
|
|
30
|
+
var mockTableConfig = exports.mockTableConfig = {
|
|
31
|
+
TableLayout: function TableLayout(_ref) {
|
|
32
|
+
var header = _ref.header,
|
|
33
|
+
body = _ref.body,
|
|
34
|
+
footer = _ref.footer,
|
|
35
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
36
|
+
return /*#__PURE__*/_react["default"].createElement("table", {
|
|
37
|
+
"data-testid": "TableLayoutMock",
|
|
38
|
+
"data-props": stringifyProps(props)
|
|
39
|
+
}, header, body, footer);
|
|
40
|
+
},
|
|
41
|
+
Header: function Header(_ref2) {
|
|
42
|
+
var headerRow = _ref2.headerRow,
|
|
43
|
+
props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
|
|
44
|
+
return /*#__PURE__*/_react["default"].createElement("thead", {
|
|
45
|
+
"data-testid": "HeaderMock",
|
|
46
|
+
"data-props": stringifyProps(props)
|
|
47
|
+
}, headerRow);
|
|
48
|
+
},
|
|
49
|
+
HeaderRow: function HeaderRow(_ref3) {
|
|
50
|
+
var columnHeaders = _ref3.columnHeaders,
|
|
51
|
+
props = (0, _objectWithoutProperties2["default"])(_ref3, _excluded3);
|
|
52
|
+
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
53
|
+
"data-testid": "HeaderRowMock",
|
|
54
|
+
"data-props": stringifyProps(props)
|
|
55
|
+
}, columnHeaders);
|
|
56
|
+
},
|
|
57
|
+
HeaderCell: function HeaderCell(_ref4) {
|
|
58
|
+
var title = _ref4.title,
|
|
59
|
+
columnControl = _ref4.columnControl,
|
|
60
|
+
props = (0, _objectWithoutProperties2["default"])(_ref4, _excluded4);
|
|
61
|
+
return /*#__PURE__*/_react["default"].createElement("th", {
|
|
62
|
+
"data-testid": "HeaderCellMock",
|
|
63
|
+
"data-props": stringifyProps(props)
|
|
64
|
+
}, title);
|
|
65
|
+
},
|
|
66
|
+
Body: function Body(_ref5) {
|
|
67
|
+
var tableRows = _ref5.tableRows,
|
|
68
|
+
props = (0, _objectWithoutProperties2["default"])(_ref5, _excluded5);
|
|
69
|
+
return /*#__PURE__*/_react["default"].createElement("tbody", {
|
|
70
|
+
"data-testid": "BodyMock",
|
|
71
|
+
"data-props": stringifyProps(props)
|
|
72
|
+
}, tableRows);
|
|
73
|
+
},
|
|
74
|
+
BodyRow: function BodyRow(_ref6) {
|
|
75
|
+
var cells = _ref6.cells,
|
|
76
|
+
props = (0, _objectWithoutProperties2["default"])(_ref6, _excluded6);
|
|
77
|
+
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
78
|
+
"data-testid": "BodyRowMock",
|
|
79
|
+
"data-props": stringifyProps(props)
|
|
80
|
+
}, cells);
|
|
81
|
+
},
|
|
82
|
+
BodyCell: function BodyCell(_ref7) {
|
|
83
|
+
var value = _ref7.value,
|
|
84
|
+
props = (0, _objectWithoutProperties2["default"])(_ref7, _excluded7);
|
|
85
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
86
|
+
"data-testid": "BodyCellMock",
|
|
87
|
+
"data-props": stringifyProps(props)
|
|
88
|
+
}, value);
|
|
89
|
+
},
|
|
90
|
+
Footer: function Footer(_ref8) {
|
|
91
|
+
var footerRow = _ref8.footerRow,
|
|
92
|
+
props = (0, _objectWithoutProperties2["default"])(_ref8, _excluded8);
|
|
93
|
+
return /*#__PURE__*/_react["default"].createElement("tfoot", {
|
|
94
|
+
"data-testid": "FooterMock",
|
|
95
|
+
"data-props": stringifyProps(props)
|
|
96
|
+
}, footerRow);
|
|
97
|
+
},
|
|
98
|
+
FooterRow: function FooterRow(_ref9) {
|
|
99
|
+
var cells = _ref9.cells,
|
|
100
|
+
props = (0, _objectWithoutProperties2["default"])(_ref9, _excluded9);
|
|
101
|
+
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
102
|
+
"data-testid": "FooterRowMock",
|
|
103
|
+
"data-props": stringifyProps(props)
|
|
104
|
+
}, cells);
|
|
105
|
+
},
|
|
106
|
+
FooterCell: function FooterCell(props) {
|
|
107
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
108
|
+
"data-testid": "FooterCellMock",
|
|
109
|
+
"data-props": stringifyProps(props)
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
EmptyBodyRow: function EmptyBodyRow(props) {
|
|
113
|
+
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
114
|
+
"data-testid": "EmptyBodyRowMock",
|
|
115
|
+
"data-props": stringifyProps(props)
|
|
116
|
+
}, /*#__PURE__*/_react["default"].createElement("td", {
|
|
117
|
+
className: "text-center",
|
|
118
|
+
colSpan: props.colSpan
|
|
119
|
+
}, /*#__PURE__*/_react["default"].createElement("em", null, "No data found.")));
|
|
120
|
+
},
|
|
121
|
+
PaginationControl: function PaginationControl(props) {
|
|
122
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
123
|
+
"data-testid": "PaginationControlMock",
|
|
124
|
+
"data-props": stringifyProps(props)
|
|
125
|
+
}, /*#__PURE__*/_react["default"].createElement("button", null, "Previous"), /*#__PURE__*/_react["default"].createElement("button", null, "Next"));
|
|
126
|
+
},
|
|
127
|
+
FilterLayout: function FilterLayout(_ref10) {
|
|
128
|
+
var filters = _ref10.filters,
|
|
129
|
+
props = (0, _objectWithoutProperties2["default"])(_ref10, _excluded10);
|
|
130
|
+
return /*#__PURE__*/_react["default"].createElement("form", {
|
|
131
|
+
"data-testid": "FilterLayoutMock",
|
|
132
|
+
"data-props": stringifyProps(props)
|
|
133
|
+
}, filters.map(function (filter, name) {
|
|
134
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
|
|
135
|
+
key: name
|
|
136
|
+
}, filter);
|
|
137
|
+
}).toIndexedSeq().toList(), /*#__PURE__*/_react["default"].createElement("button", {
|
|
138
|
+
type: "submit"
|
|
139
|
+
}, "Search"));
|
|
140
|
+
},
|
|
141
|
+
TextFilter: function TextFilter(props) {
|
|
142
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
143
|
+
"data-testid": "TextFilterMock",
|
|
144
|
+
"data-props": stringifyProps(props)
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
BooleanFilter: function BooleanFilter(props) {
|
|
148
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
149
|
+
"data-testid": "BooleanFilterMock",
|
|
150
|
+
"data-props": stringifyProps(props)
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
ColumnControl: function ColumnControl(props) {
|
|
154
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
155
|
+
"data-testid": "ColumnControlMock",
|
|
156
|
+
"data-props": stringifyProps(props)
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
fields: {
|
|
160
|
+
FormLayout: function FormLayout(_ref11) {
|
|
161
|
+
var fields = _ref11.fields,
|
|
162
|
+
error = _ref11.error,
|
|
163
|
+
buttons = _ref11.buttons,
|
|
164
|
+
props = (0, _objectWithoutProperties2["default"])(_ref11, _excluded11);
|
|
165
|
+
return /*#__PURE__*/_react["default"].createElement("form", {
|
|
166
|
+
"data-testid": "FormLayoutMock",
|
|
167
|
+
"data-props": stringifyProps(props)
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
var TableViewMock = exports.TableViewMock = function TableViewMock(_ref12) {
|
|
173
|
+
var table = _ref12.table,
|
|
174
|
+
pagination = _ref12.pagination,
|
|
175
|
+
filter = _ref12.filter,
|
|
176
|
+
columnControl = _ref12.columnControl,
|
|
177
|
+
props = (0, _objectWithoutProperties2["default"])(_ref12, _excluded12);
|
|
178
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
179
|
+
"data-testid": "TableViewMock",
|
|
180
|
+
"data-props": stringifyProps(props)
|
|
181
|
+
}, table, pagination, filter, columnControl);
|
|
182
|
+
};
|
|
@@ -275,6 +275,7 @@ var TreeBuilderComponent = exports.TreeBuilderComponent = /*#__PURE__*/function
|
|
|
275
275
|
saving = treeBuilderState.saving,
|
|
276
276
|
tasks = treeBuilderState.tasks,
|
|
277
277
|
tree = treeBuilderState.tree,
|
|
278
|
+
kappSlug = treeBuilderState.kappSlug,
|
|
278
279
|
undoStack = treeBuilderState.undoStack,
|
|
279
280
|
webApi = treeBuilderState.webApi;
|
|
280
281
|
return this.props.children({
|
|
@@ -357,6 +358,7 @@ var TreeBuilderComponent = exports.TreeBuilderComponent = /*#__PURE__*/function
|
|
|
357
358
|
sidebarRef: this.sidebarRef,
|
|
358
359
|
tasks: tasks,
|
|
359
360
|
tree: tree,
|
|
361
|
+
kappSlug: kappSlug,
|
|
360
362
|
treeBuilder: tree && /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement(_SvgCanvas.SvgCanvas, {
|
|
361
363
|
ref: this.canvasRef
|
|
362
364
|
}, tree.connectors.map(function (connector) {
|
|
@@ -414,7 +416,8 @@ var TreeBuilderComponent = exports.TreeBuilderComponent = /*#__PURE__*/function
|
|
|
414
416
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
415
417
|
return {
|
|
416
418
|
treeBuilderState: state.getIn(['trees', props.treeKey]),
|
|
417
|
-
tree: state.getIn(['trees', props.treeKey, 'tree'])
|
|
419
|
+
tree: state.getIn(['trees', props.treeKey, 'tree']),
|
|
420
|
+
kappSlug: state.getIn(['trees', props.treeKey, 'kappSlug'])
|
|
418
421
|
};
|
|
419
422
|
};
|
|
420
423
|
var TreeBuilder = exports.TreeBuilder = (0, _store.connect)(mapStateToProps)(TreeBuilderComponent);
|
|
@@ -43,7 +43,7 @@ var remember = function remember(state, treeKey) {
|
|
|
43
43
|
(0, _store.regSaga)((0, _effects.takeEvery)('TREE_CONFIGURE', function (_ref) {
|
|
44
44
|
var payload = _ref.payload;
|
|
45
45
|
return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
46
|
-
var name, sourceGroup, sourceName, treeKey, webApiProps, _yield$all, _yield$all2, tree, categories, webApi, platformItem, result;
|
|
46
|
+
var _getPlatformItemSlugs, name, sourceGroup, sourceName, treeKey, webApiProps, _yield$all, _yield$all2, tree, categories, webApi, platformItem, result, _yield$call, workflow;
|
|
47
47
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
48
48
|
while (1) switch (_context.prev = _context.next) {
|
|
49
49
|
case 0:
|
|
@@ -69,7 +69,7 @@ var remember = function remember(state, treeKey) {
|
|
|
69
69
|
webApi = _yield$all2[2].webApi;
|
|
70
70
|
platformItem = null;
|
|
71
71
|
if (!tree.event) {
|
|
72
|
-
_context.next =
|
|
72
|
+
_context.next = 21;
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
75
|
_context.next = 14;
|
|
@@ -80,35 +80,44 @@ var remember = function remember(state, treeKey) {
|
|
|
80
80
|
case 14:
|
|
81
81
|
result = _context.sent;
|
|
82
82
|
platformItem = result.platformItem;
|
|
83
|
-
case 16:
|
|
84
83
|
_context.next = 18;
|
|
84
|
+
return (0, _effects.call)(_apis.fetchWorkflow, (0, _objectSpread2["default"])({
|
|
85
|
+
workflowId: sourceGroup
|
|
86
|
+
}, getPlatformItemSlugs(platformItem)));
|
|
87
|
+
case 18:
|
|
88
|
+
_yield$call = _context.sent;
|
|
89
|
+
workflow = _yield$call.workflow;
|
|
90
|
+
// Add workflow filter from core to the tree to be used in the Settings > WorkflowForm
|
|
91
|
+
tree['filter'] = workflow ? workflow.filter : '';
|
|
92
|
+
case 21:
|
|
93
|
+
_context.next = 23;
|
|
85
94
|
return (0, _effects.put)((0, _store.action)('TREE_LOADED', {
|
|
86
95
|
categories: categories,
|
|
87
|
-
kappSlug: webApiProps && webApiProps.kappSlug,
|
|
96
|
+
kappSlug: webApiProps && webApiProps.kappSlug || ((_getPlatformItemSlugs = getPlatformItemSlugs(platformItem)) === null || _getPlatformItemSlugs === void 0 ? void 0 : _getPlatformItemSlugs.kappSlug),
|
|
88
97
|
platformItem: platformItem,
|
|
89
98
|
treeKey: treeKey,
|
|
90
99
|
tree: (0, _models.deserializeTree)(tree),
|
|
91
100
|
webApi: webApiProps && (0, _models.deserializeWebApi)(webApi, webApiProps.kappSlug)
|
|
92
101
|
}));
|
|
93
|
-
case
|
|
94
|
-
_context.next =
|
|
102
|
+
case 23:
|
|
103
|
+
_context.next = 28;
|
|
95
104
|
break;
|
|
96
|
-
case
|
|
97
|
-
_context.prev =
|
|
105
|
+
case 25:
|
|
106
|
+
_context.prev = 25;
|
|
98
107
|
_context.t0 = _context["catch"](0);
|
|
99
108
|
console.error('Caught error loading tree', _context.t0);
|
|
100
|
-
case
|
|
109
|
+
case 28:
|
|
101
110
|
case "end":
|
|
102
111
|
return _context.stop();
|
|
103
112
|
}
|
|
104
|
-
}, _callee, null, [[0,
|
|
113
|
+
}, _callee, null, [[0, 25]]);
|
|
105
114
|
})();
|
|
106
115
|
}));
|
|
107
116
|
var getPlatformItemSlugs = function getPlatformItemSlugs(platformItem) {
|
|
108
|
-
return platformItem.kapp ? {
|
|
117
|
+
return platformItem !== null && platformItem !== void 0 && platformItem.kapp ? {
|
|
109
118
|
formSlug: platformItem.slug,
|
|
110
119
|
kappSlug: platformItem.kapp.slug
|
|
111
|
-
} : platformItem.space ? {
|
|
120
|
+
} : platformItem !== null && platformItem !== void 0 && platformItem.space ? {
|
|
112
121
|
kappSlug: platformItem.slug
|
|
113
122
|
} : {};
|
|
114
123
|
};
|
|
@@ -148,7 +157,10 @@ var getPlatformItemSlugs = function getPlatformItemSlugs(platformItem) {
|
|
|
148
157
|
tree: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, (0, _models.serializeTree)(tree, true)), {}, {
|
|
149
158
|
name: newName
|
|
150
159
|
})
|
|
151
|
-
}) : (0, _effects.call)(_apis.
|
|
160
|
+
}) : tree.event ? (0, _effects.call)(_apis.updateWorkflow, (0, _objectSpread2["default"])({
|
|
161
|
+
workflowId: sourceGroup,
|
|
162
|
+
workflow: (0, _models.serializeTree)(tree, overwrite)
|
|
163
|
+
}, getPlatformItemSlugs(platformItem))) : (0, _effects.call)(_apis.updateTree, {
|
|
152
164
|
name: name,
|
|
153
165
|
sourceGroup: sourceGroup,
|
|
154
166
|
sourceName: sourceName,
|
|
@@ -33,6 +33,7 @@ var Tree = exports.Tree = (0, _immutable.Record)({
|
|
|
33
33
|
connectors: (0, _immutable.OrderedMap)(),
|
|
34
34
|
definitionId: null,
|
|
35
35
|
event: null,
|
|
36
|
+
filter: null,
|
|
36
37
|
guid: null,
|
|
37
38
|
inputs: null,
|
|
38
39
|
name: '',
|
|
@@ -179,6 +180,7 @@ var deserializeTree = exports.deserializeTree = function deserializeTree(_ref4)
|
|
|
179
180
|
categories = _ref4.categories,
|
|
180
181
|
definitionId = _ref4.definitionId,
|
|
181
182
|
event = _ref4.event,
|
|
183
|
+
filter = _ref4.filter,
|
|
182
184
|
guid = _ref4.guid,
|
|
183
185
|
inputs = _ref4.inputs,
|
|
184
186
|
name = _ref4.name,
|
|
@@ -203,6 +205,7 @@ var deserializeTree = exports.deserializeTree = function deserializeTree(_ref4)
|
|
|
203
205
|
})),
|
|
204
206
|
definitionId: definitionId,
|
|
205
207
|
event: event,
|
|
208
|
+
filter: filter,
|
|
206
209
|
guid: guid,
|
|
207
210
|
inputs: (0, _immutable.List)(inputs).map(_immutable.Map),
|
|
208
211
|
name: name,
|
|
@@ -229,6 +232,7 @@ var serializeTree = exports.serializeTree = function serializeTree(_ref5) {
|
|
|
229
232
|
categories = _ref5.categories,
|
|
230
233
|
definitionId = _ref5.definitionId,
|
|
231
234
|
event = _ref5.event,
|
|
235
|
+
filter = _ref5.filter,
|
|
232
236
|
inputs = _ref5.inputs,
|
|
233
237
|
name = _ref5.name,
|
|
234
238
|
nextNodeId = _ref5.nextNodeId,
|
|
@@ -248,6 +252,7 @@ var serializeTree = exports.serializeTree = function serializeTree(_ref5) {
|
|
|
248
252
|
categories: categories,
|
|
249
253
|
definitionId: definitionId,
|
|
250
254
|
event: event,
|
|
255
|
+
filter: filter,
|
|
251
256
|
inputs: inputs,
|
|
252
257
|
name: name,
|
|
253
258
|
notes: notes,
|
|
@@ -25,7 +25,8 @@ var dataSources = function dataSources(_ref) {
|
|
|
25
25
|
handlers: {
|
|
26
26
|
fn: _apis.fetchHandlers,
|
|
27
27
|
params: [{
|
|
28
|
-
include: 'details'
|
|
28
|
+
include: 'details',
|
|
29
|
+
limit: 0
|
|
29
30
|
}],
|
|
30
31
|
transform: function transform(result) {
|
|
31
32
|
return result.handlers;
|
|
@@ -35,7 +36,8 @@ var dataSources = function dataSources(_ref) {
|
|
|
35
36
|
fn: _apis.fetchTrees,
|
|
36
37
|
params: [{
|
|
37
38
|
type: 'Global Routine',
|
|
38
|
-
include: 'details'
|
|
39
|
+
include: 'details',
|
|
40
|
+
limit: 0
|
|
39
41
|
}],
|
|
40
42
|
transform: function transform(result) {
|
|
41
43
|
return result.trees;
|
|
@@ -45,7 +47,8 @@ var dataSources = function dataSources(_ref) {
|
|
|
45
47
|
fn: _apis.fetchPolicyRules,
|
|
46
48
|
params: [{
|
|
47
49
|
type: 'Category Access',
|
|
48
|
-
include: 'details'
|
|
50
|
+
include: 'details',
|
|
51
|
+
limit: 0
|
|
49
52
|
}],
|
|
50
53
|
transform: function transform(result) {
|
|
51
54
|
return result.policyRules;
|
|
@@ -9,6 +9,10 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _apis = require("../../../apis");
|
|
10
10
|
var _Form = require("../../form/Form");
|
|
11
11
|
var _immutable = require("immutable");
|
|
12
|
+
var _helpers = require("../../../helpers");
|
|
13
|
+
var SPACE_INCLUDES = 'formAttributeDefinitions,spaceAttributeDefinitions,teamAttributeDefinitions,userAttributeDefinitions,userProfileAttributeDefinitions';
|
|
14
|
+
var KAPP_INCLUDES = 'formAttributeDefinitions,kappAttributeDefinitions,fields';
|
|
15
|
+
|
|
12
16
|
// bulids a definition id based on a name (similar to slugify)
|
|
13
17
|
var buildDefinitionId = function buildDefinitionId(text) {
|
|
14
18
|
return text.trim()
|
|
@@ -19,12 +23,14 @@ var buildDefinitionId = function buildDefinitionId(text) {
|
|
|
19
23
|
// Remove unwanted chars
|
|
20
24
|
.replace(/[^A-Za-z0-9_]+/g, '');
|
|
21
25
|
};
|
|
22
|
-
var dataSources = function dataSources() {
|
|
26
|
+
var dataSources = function dataSources(_ref) {
|
|
27
|
+
var kappSlug = _ref.kappSlug,
|
|
28
|
+
workflow = _ref.workflow;
|
|
23
29
|
return {
|
|
24
30
|
selectedSource: {
|
|
25
31
|
fn: _apis.fetchSource,
|
|
26
|
-
params: function params(
|
|
27
|
-
var values =
|
|
32
|
+
params: function params(_ref2) {
|
|
33
|
+
var values = _ref2.values;
|
|
28
34
|
return values && values.get('sourceName') && [{
|
|
29
35
|
sourceName: values.get('sourceName'),
|
|
30
36
|
include: 'predefinedSourceGroups,predefinedTreeNames'
|
|
@@ -52,18 +58,37 @@ var dataSources = function dataSources() {
|
|
|
52
58
|
transform: function transform(result) {
|
|
53
59
|
return result.categories;
|
|
54
60
|
}
|
|
61
|
+
},
|
|
62
|
+
space: {
|
|
63
|
+
fn: _apis.fetchSpace,
|
|
64
|
+
params: [{
|
|
65
|
+
include: SPACE_INCLUDES
|
|
66
|
+
}],
|
|
67
|
+
transform: function transform(result) {
|
|
68
|
+
return result.space;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
kapp: {
|
|
72
|
+
fn: _apis.fetchKapp,
|
|
73
|
+
params: kappSlug && [{
|
|
74
|
+
kappSlug: kappSlug,
|
|
75
|
+
include: KAPP_INCLUDES
|
|
76
|
+
}],
|
|
77
|
+
transform: function transform(result) {
|
|
78
|
+
return result.kapp;
|
|
79
|
+
}
|
|
55
80
|
}
|
|
56
81
|
};
|
|
57
82
|
};
|
|
58
|
-
var handleSubmit = function handleSubmit(
|
|
59
|
-
var workflow =
|
|
83
|
+
var handleSubmit = function handleSubmit(_ref3) {
|
|
84
|
+
var workflow = _ref3.workflow;
|
|
60
85
|
return function (values) {
|
|
61
86
|
if (!workflow) {
|
|
62
87
|
return (0, _apis.createTree)({
|
|
63
88
|
tree: values.toJS()
|
|
64
|
-
}).then(function (
|
|
65
|
-
var tree =
|
|
66
|
-
error =
|
|
89
|
+
}).then(function (_ref4) {
|
|
90
|
+
var tree = _ref4.tree,
|
|
91
|
+
error = _ref4.error;
|
|
67
92
|
if (error) {
|
|
68
93
|
throw error.statusCode === 400 && error.message || 'There was an error saving the workflow';
|
|
69
94
|
} else {
|
|
@@ -75,19 +100,19 @@ var handleSubmit = function handleSubmit(_ref2) {
|
|
|
75
100
|
}
|
|
76
101
|
};
|
|
77
102
|
};
|
|
78
|
-
var fields = function fields(
|
|
79
|
-
var name =
|
|
80
|
-
workflow =
|
|
81
|
-
workflowType =
|
|
82
|
-
return function (
|
|
83
|
-
var categories =
|
|
103
|
+
var fields = function fields(_ref5) {
|
|
104
|
+
var name = _ref5.name,
|
|
105
|
+
workflow = _ref5.workflow,
|
|
106
|
+
workflowType = _ref5.workflowType;
|
|
107
|
+
return function (_ref6) {
|
|
108
|
+
var categories = _ref6.categories;
|
|
84
109
|
return (!name || workflow) && categories && [{
|
|
85
110
|
name: 'sourceName',
|
|
86
111
|
label: 'Source',
|
|
87
112
|
type: 'select',
|
|
88
113
|
required: true,
|
|
89
|
-
options: function options(
|
|
90
|
-
var sources =
|
|
114
|
+
options: function options(_ref7) {
|
|
115
|
+
var sources = _ref7.sources;
|
|
91
116
|
return sources;
|
|
92
117
|
},
|
|
93
118
|
initialValue: workflow ? workflow.get('sourceName') : workflowType === 'routines' ? '-' : '',
|
|
@@ -98,8 +123,8 @@ var fields = function fields(_ref4) {
|
|
|
98
123
|
label: 'Source Group',
|
|
99
124
|
type: 'text',
|
|
100
125
|
required: true,
|
|
101
|
-
options: function options(
|
|
102
|
-
var selectedSource =
|
|
126
|
+
options: function options(_ref8) {
|
|
127
|
+
var selectedSource = _ref8.selectedSource;
|
|
103
128
|
return selectedSource ? selectedSource.get('predefinedSourceGroups').map(function (g) {
|
|
104
129
|
return (0, _immutable.Map)({
|
|
105
130
|
label: g,
|
|
@@ -118,13 +143,35 @@ var fields = function fields(_ref4) {
|
|
|
118
143
|
required: workflow && !!workflow.get('event'),
|
|
119
144
|
visible: workflow && !!workflow.get('event'),
|
|
120
145
|
enabled: false
|
|
146
|
+
}, {
|
|
147
|
+
name: 'filter',
|
|
148
|
+
label: 'Filter',
|
|
149
|
+
type: 'code',
|
|
150
|
+
language: 'js',
|
|
151
|
+
initialValue: workflow ? workflow.get('filter') : '',
|
|
152
|
+
required: false,
|
|
153
|
+
// use event to show filter on linked workflows
|
|
154
|
+
visible: workflow && !!workflow.get('event'),
|
|
155
|
+
options: function options(_ref9) {
|
|
156
|
+
var space = _ref9.space,
|
|
157
|
+
kapp = _ref9.kapp,
|
|
158
|
+
values = _ref9.values;
|
|
159
|
+
var type = ['File Resource', 'Kapp', 'Form', 'Submission', 'Team', 'User'].find(function (scope) {
|
|
160
|
+
return values.get('event').includes(scope);
|
|
161
|
+
});
|
|
162
|
+
return (0, _helpers.buildBindings)({
|
|
163
|
+
space: space,
|
|
164
|
+
kapp: kapp,
|
|
165
|
+
scope: type
|
|
166
|
+
});
|
|
167
|
+
}
|
|
121
168
|
}, {
|
|
122
169
|
name: 'name',
|
|
123
170
|
label: 'Name',
|
|
124
171
|
type: 'text',
|
|
125
172
|
required: true,
|
|
126
|
-
options: function options(
|
|
127
|
-
var selectedSource =
|
|
173
|
+
options: function options(_ref10) {
|
|
174
|
+
var selectedSource = _ref10.selectedSource;
|
|
128
175
|
return selectedSource ? selectedSource.get('predefinedTreeNames').map(function (n) {
|
|
129
176
|
return (0, _immutable.Map)({
|
|
130
177
|
label: n,
|
|
@@ -132,9 +179,9 @@ var fields = function fields(_ref4) {
|
|
|
132
179
|
});
|
|
133
180
|
}) : (0, _immutable.List)();
|
|
134
181
|
},
|
|
135
|
-
onChange: function onChange(
|
|
136
|
-
var values =
|
|
137
|
-
var setValue =
|
|
182
|
+
onChange: function onChange(_ref11, _ref12) {
|
|
183
|
+
var values = _ref11.values;
|
|
184
|
+
var setValue = _ref12.setValue;
|
|
138
185
|
if (values.has('definitionId') && values.get('linked')) {
|
|
139
186
|
setValue('definitionId', buildDefinitionId(values.get('name')), false);
|
|
140
187
|
}
|
|
@@ -154,14 +201,14 @@ var fields = function fields(_ref4) {
|
|
|
154
201
|
type: 'text',
|
|
155
202
|
enabled: !name && !workflow,
|
|
156
203
|
required: true,
|
|
157
|
-
onChange: function onChange(_bindings,
|
|
158
|
-
var setValue =
|
|
204
|
+
onChange: function onChange(_bindings, _ref13) {
|
|
205
|
+
var setValue = _ref13.setValue;
|
|
159
206
|
setValue('linked', false);
|
|
160
207
|
},
|
|
161
208
|
initialValue: (0, _immutable.get)(workflow, 'definitionId', '') || '',
|
|
162
209
|
helpText: 'Definition ID is generated by the system and used for API requests',
|
|
163
|
-
serialize: function serialize(
|
|
164
|
-
var values =
|
|
210
|
+
serialize: function serialize(_ref14) {
|
|
211
|
+
var values = _ref14.values;
|
|
165
212
|
return name || workflow ? values.get('definitionId') : "routine_".concat(values.get('definitionId'));
|
|
166
213
|
}
|
|
167
214
|
}, {
|
|
@@ -253,17 +300,19 @@ var fields = function fields(_ref4) {
|
|
|
253
300
|
}];
|
|
254
301
|
};
|
|
255
302
|
};
|
|
256
|
-
var WorkflowForm = exports.WorkflowForm = function WorkflowForm(
|
|
257
|
-
var addFields =
|
|
258
|
-
alterFields =
|
|
259
|
-
fieldSet =
|
|
260
|
-
formKey =
|
|
261
|
-
components =
|
|
262
|
-
onSave =
|
|
263
|
-
onError =
|
|
264
|
-
children =
|
|
265
|
-
workflow =
|
|
266
|
-
workflowType =
|
|
303
|
+
var WorkflowForm = exports.WorkflowForm = function WorkflowForm(_ref15) {
|
|
304
|
+
var addFields = _ref15.addFields,
|
|
305
|
+
alterFields = _ref15.alterFields,
|
|
306
|
+
fieldSet = _ref15.fieldSet,
|
|
307
|
+
formKey = _ref15.formKey,
|
|
308
|
+
components = _ref15.components,
|
|
309
|
+
onSave = _ref15.onSave,
|
|
310
|
+
onError = _ref15.onError,
|
|
311
|
+
children = _ref15.children,
|
|
312
|
+
workflow = _ref15.workflow,
|
|
313
|
+
workflowType = _ref15.workflowType,
|
|
314
|
+
uncontrolled = _ref15.uncontrolled,
|
|
315
|
+
kappSlug = _ref15.kappSlug;
|
|
267
316
|
return /*#__PURE__*/_react["default"].createElement(_Form.Form, {
|
|
268
317
|
addFields: addFields,
|
|
269
318
|
alterFields: alterFields,
|
|
@@ -276,8 +325,10 @@ var WorkflowForm = exports.WorkflowForm = function WorkflowForm(_ref13) {
|
|
|
276
325
|
dataSources: dataSources,
|
|
277
326
|
fields: fields,
|
|
278
327
|
formOptions: {
|
|
328
|
+
kappSlug: kappSlug,
|
|
279
329
|
workflow: workflow,
|
|
280
330
|
workflowType: workflowType
|
|
281
|
-
}
|
|
331
|
+
},
|
|
332
|
+
uncontrolled: uncontrolled
|
|
282
333
|
}, children);
|
|
283
334
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kineticdata/react",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.4",
|
|
4
4
|
"description": "A React library for the Kinetic Platform",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"classNameTemplate": "{classname}",
|
|
78
78
|
"titleTemplate": "{title}"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "cd94ee7c16756e39778c7c80ed1d47fd63fdee4c"
|
|
81
81
|
}
|