@kineticdata/react 5.0.16 → 5.1.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/lib/apis/core/attributeDefinitions.js +3 -2
- package/lib/apis/core/authentication.js +13 -5
- package/lib/apis/core/backgroundJobs.js +22 -39
- package/lib/apis/core/fileResources.js +36 -0
- package/lib/apis/core/filestores.js +40 -0
- package/lib/apis/core/forms.js +21 -36
- package/lib/apis/core/forms.test.js +51 -278
- package/lib/apis/core/securityPolicyDefinitions.test.js +4 -4
- package/lib/apis/core/submissions.js +46 -30
- package/lib/apis/core/webhooks.js +1 -2
- package/lib/apis/discussions/index.js +2 -1
- package/lib/apis/http.js +28 -13
- package/lib/apis/http.test.js +13 -15
- package/lib/apis/index.js +2 -0
- package/lib/apis/system/index.js +86 -1
- package/lib/apis/task/index.js +22 -14
- package/lib/components/agent/filestore/FilestoreForm.js +132 -0
- package/lib/components/agent/filestore/FilestoreTable.js +53 -0
- package/lib/components/common/BridgeSelect.js +2 -1
- package/lib/components/common/FormSelect.js +2 -1
- package/lib/components/common/Scroller.js +6 -6
- package/lib/components/common/TableInput.js +74 -29
- package/lib/components/common/TeamSelect.js +2 -1
- package/lib/components/common/Typeahead.js +7 -4
- package/lib/components/common/UserSelect.js +2 -1
- package/lib/components/common/authentication/AuthenticationContainer.js +50 -27
- package/lib/components/common/code_input/languageHelpers.test.js +1 -1
- package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +1 -1
- package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +1 -1
- package/lib/components/core/core_form/CoreForm.js +10 -10
- package/lib/components/core/field_definition/FieldDefinitionForm.js +130 -0
- package/lib/components/core/field_definition/FieldDefinitionTable.js +86 -0
- package/lib/components/core/file_resource/FileResourceForm.js +180 -0
- package/lib/components/core/file_resource/FileResourceTable.js +71 -0
- package/lib/components/core/form/FormForm.js +12 -17
- package/lib/components/core/form/FormTable.js +3 -8
- package/lib/components/core/i18n/I18n.js +15 -15
- package/lib/components/core/index_definition/IndexDefinitionForm.js +32 -19
- package/lib/components/core/index_definition/IndexDefinitionTable.js +15 -24
- package/lib/components/core/index_job/IndexJobTable.js +12 -9
- package/lib/components/core/security_definition/SecurityDefinitionForm.js +1 -1
- package/lib/components/core/space/SpaceForm.js +59 -10
- package/lib/components/core/submission/DatastoreSubmissionTable.js +31 -1
- package/lib/components/core/submission/FormSubmissionFilters.js +378 -0
- package/lib/components/core/submission/FormSubmissionTable.js +116 -0
- package/lib/components/core/submission/KappSubmissionTable.js +250 -0
- package/lib/components/core/submission/SubmissionForm.js +124 -0
- package/lib/components/core/submission/SubmissionTable.js +35 -249
- package/lib/components/core/submission/helpers.js +95 -0
- package/lib/components/core/submission/helpers.test.js +96 -0
- package/lib/components/core/translation/ContextTable.js +1 -1
- package/lib/components/core/user/UserForm.js +2 -2
- package/lib/components/core/webapi/WebApiForm.js +111 -126
- package/lib/components/core/webhook/WebhookForm.js +1 -1
- package/lib/components/form/Form.helpers.js +1 -1
- package/lib/components/form/Form.js +200 -144
- package/lib/components/index.js +16 -6
- package/lib/components/system/SystemBackgroundTasksTable.js +83 -0
- package/lib/components/system/SystemSecurityForm.js +69 -0
- package/lib/components/system/helpers.js +20 -6
- package/lib/components/system/spaces/SystemSpaceForm.js +44 -16
- package/lib/components/system/spaces/SystemTenantForm.js +15 -9
- package/lib/components/system/spaces/SystemTenantTable.js +21 -16
- package/lib/components/table/Table.js +37 -10
- package/lib/components/table/Table.redux.js +228 -57
- package/lib/components/table/Table.redux.test.js +73 -2
- package/lib/components/task/builder/Connector.js +21 -10
- package/lib/components/task/builder/ConnectorForm.js +1 -1
- package/lib/components/task/builder/Node.js +10 -3
- package/lib/components/task/builder/NodeForm.js +54 -22
- package/lib/components/task/builder/NodeParametersForm.js +5 -2
- package/lib/components/task/builder/SvgCanvas.js +13 -4
- package/lib/components/task/builder/TaskDefinitionConfigForm.js +113 -0
- package/lib/components/task/builder/TreeBuilder.js +27 -9
- package/lib/components/task/builder/builder.redux.js +159 -52
- package/lib/components/task/builder/helpers.js +5 -3
- package/lib/components/task/builder/models.js +84 -12
- package/lib/components/task/errors/RunErrorTable.js +1 -1
- package/lib/components/task/runs/CreateManualTriggerForm.js +15 -24
- package/lib/components/task/runs/RunTable.js +5 -3
- package/lib/components/task/triggers/TriggerTable.js +3 -2
- package/lib/components/task/workflows/WorkflowForm.js +67 -85
- package/lib/helpers/index.js +19 -2
- package/lib/index.js +1 -0
- package/lib/models/discussions.js +18 -2
- package/lib/models/index.js +1 -1
- package/package.json +3 -3
- package/proxyhelper.js +19 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import React, { Fragment } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { Map } from 'immutable';
|
|
4
|
+
import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
|
|
4
5
|
|
|
5
6
|
var TextInput = function TextInput(props) {
|
|
6
7
|
return /*#__PURE__*/React.createElement("input", {
|
|
@@ -26,6 +27,10 @@ var CheckboxInput = function CheckboxInput(props) {
|
|
|
26
27
|
});
|
|
27
28
|
};
|
|
28
29
|
|
|
30
|
+
var DragHandle = function DragHandle(props) {
|
|
31
|
+
return /*#__PURE__*/React.createElement("span", props, "\u2195");
|
|
32
|
+
};
|
|
33
|
+
|
|
29
34
|
export var TableLayout = function TableLayout(_ref) {
|
|
30
35
|
var rows = _ref.rows,
|
|
31
36
|
onAdd = _ref.onAdd,
|
|
@@ -54,6 +59,7 @@ var RowLayout = function RowLayout(_ref2) {
|
|
|
54
59
|
};
|
|
55
60
|
|
|
56
61
|
var typeToComponent = {
|
|
62
|
+
drag: 'DragHandle',
|
|
57
63
|
text: 'TextInput',
|
|
58
64
|
checkbox: 'CheckboxInput'
|
|
59
65
|
};
|
|
@@ -61,7 +67,8 @@ var defaultComponents = {
|
|
|
61
67
|
TableLayout: TableLayout,
|
|
62
68
|
RowLayout: RowLayout,
|
|
63
69
|
TextInput: TextInput,
|
|
64
|
-
CheckboxInput: CheckboxInput
|
|
70
|
+
CheckboxInput: CheckboxInput,
|
|
71
|
+
DragHandle: DragHandle
|
|
65
72
|
};
|
|
66
73
|
|
|
67
74
|
var fieldFromConfig = function fieldFromConfig(config) {
|
|
@@ -85,45 +92,83 @@ export var TableInput = function TableInput(props) {
|
|
|
85
92
|
|
|
86
93
|
var handleAddRow = function handleAddRow(e) {
|
|
87
94
|
e.preventDefault();
|
|
88
|
-
var newRow = options.
|
|
95
|
+
var newRow = options.filter(function (config) {
|
|
96
|
+
return config.get('type') !== 'drag';
|
|
97
|
+
}).reduce(function (row, config) {
|
|
89
98
|
return row.set(config.get('name'), config.get('type') === 'checkbox' ? false : '');
|
|
90
99
|
}, Map());
|
|
91
100
|
onChange(rows.push(newRow));
|
|
92
101
|
};
|
|
93
102
|
|
|
103
|
+
var onDragEnd = function onDragEnd(e) {
|
|
104
|
+
if (e.source && e.destination) {
|
|
105
|
+
onChange(rows["delete"](e.source.index).insert(e.destination.index, rows.get(e.source.index)));
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
var isDragDisabled = !options.some(function (option) {
|
|
110
|
+
return option.get('type') === 'drag';
|
|
111
|
+
});
|
|
94
112
|
var fieldRows = props.rows.map(function (row, index) {
|
|
95
113
|
var handleDeleteRow = function handleDeleteRow(e) {
|
|
96
114
|
e.preventDefault();
|
|
97
115
|
onChange(rows["delete"](index));
|
|
98
116
|
};
|
|
99
117
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
var handleChangeField = function handleChangeField(e) {
|
|
105
|
-
var value = config.get('type') === 'checkbox' ? e.target.checked : e.target.value;
|
|
106
|
-
return onChange(rows.setIn([index, config.get('name')], value));
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
return fields.set(config.get('name'), /*#__PURE__*/React.createElement(Field, {
|
|
110
|
-
value: value,
|
|
111
|
-
onChange: handleChangeField,
|
|
112
|
-
label: config.get('label'),
|
|
113
|
-
onBlur: onBlur,
|
|
114
|
-
onFocus: onFocus
|
|
115
|
-
}));
|
|
116
|
-
}, OrderedMap());
|
|
117
|
-
return /*#__PURE__*/React.createElement(RowLayout, {
|
|
118
|
+
return /*#__PURE__*/React.createElement(Draggable, {
|
|
119
|
+
draggableId: "draggable".concat(index),
|
|
120
|
+
index: index,
|
|
118
121
|
key: index,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
isDragDisabled: isDragDisabled
|
|
123
|
+
}, function (provided, snapshot) {
|
|
124
|
+
// For each of the options specified for the field, we render a table
|
|
125
|
+
// cell with a field in it. The field type is determined by the type
|
|
126
|
+
// of the option.
|
|
127
|
+
var fields = options.toOrderedMap().mapKeys(function (_, config) {
|
|
128
|
+
return config.get('name');
|
|
129
|
+
}).map(function (config) {
|
|
130
|
+
var Field = fieldFromConfig(config, appliedComponents);
|
|
131
|
+
|
|
132
|
+
var _config$toObject = config.toObject(),
|
|
133
|
+
label = _config$toObject.label,
|
|
134
|
+
name = _config$toObject.name,
|
|
135
|
+
type = _config$toObject.type;
|
|
136
|
+
|
|
137
|
+
var fieldOnChange = function fieldOnChange(e) {
|
|
138
|
+
return onChange(rows.setIn([index, name], type === 'checkbox' ? e.target.checked : e.target.value));
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
var value = row.get(name);
|
|
142
|
+
var props = type === 'drag' ? provided.dragHandleProps : {
|
|
143
|
+
label: label,
|
|
144
|
+
onBlur: onBlur,
|
|
145
|
+
onChange: fieldOnChange,
|
|
146
|
+
onFocus: onFocus,
|
|
147
|
+
value: value
|
|
148
|
+
};
|
|
149
|
+
return /*#__PURE__*/React.createElement(Field, props);
|
|
150
|
+
});
|
|
151
|
+
return /*#__PURE__*/React.createElement(RowLayout, {
|
|
152
|
+
draggableRef: provided.innerRef,
|
|
153
|
+
draggableProps: provided.draggableProps,
|
|
154
|
+
dragging: snapshot.isDragging,
|
|
155
|
+
fields: fields,
|
|
156
|
+
options: options,
|
|
157
|
+
onDelete: handleDeleteRow
|
|
158
|
+
});
|
|
122
159
|
});
|
|
123
160
|
});
|
|
124
|
-
return /*#__PURE__*/React.createElement(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
})
|
|
161
|
+
return /*#__PURE__*/React.createElement(DragDropContext, {
|
|
162
|
+
onDragEnd: onDragEnd
|
|
163
|
+
}, /*#__PURE__*/React.createElement(Droppable, {
|
|
164
|
+
droppableId: "droppable"
|
|
165
|
+
}, function (provided) {
|
|
166
|
+
return /*#__PURE__*/React.createElement(TableLayout, {
|
|
167
|
+
droppableRef: provided.innerRef,
|
|
168
|
+
rows: fieldRows,
|
|
169
|
+
onAdd: handleAddRow,
|
|
170
|
+
options: options,
|
|
171
|
+
placeholder: provided.placeholder
|
|
172
|
+
});
|
|
173
|
+
}));
|
|
129
174
|
};
|
|
@@ -19,7 +19,8 @@ var searchTeams = function searchTeams(_ref) {
|
|
|
19
19
|
return "".concat(field, " =* \"").concat(value, "\"");
|
|
20
20
|
}).join(' OR '),
|
|
21
21
|
limit: search.get('limit') || 25,
|
|
22
|
-
include: search.get('include') || ''
|
|
22
|
+
include: search.get('include') || '',
|
|
23
|
+
"public": !!search.get('public')
|
|
23
24
|
}).then(function (_ref2) {
|
|
24
25
|
var teams = _ref2.teams,
|
|
25
26
|
error = _ref2.error,
|
|
@@ -135,11 +135,14 @@ export var Typeahead = /*#__PURE__*/function (_React$Component) {
|
|
|
135
135
|
// Prevent form submission if enter key is used to select suggestion.
|
|
136
136
|
if (method === 'enter') {
|
|
137
137
|
event.preventDefault();
|
|
138
|
-
}
|
|
138
|
+
} // Update state if single search or query is multiple and should be cleared
|
|
139
|
+
|
|
139
140
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
if (!_this.props.multiple || !event.ctrlKey && !event.metaKey && !event.shiftKey) {
|
|
142
|
+
_this.setState(_this.props.multiple ? {
|
|
143
|
+
searchValue: ''
|
|
144
|
+
} : initialState);
|
|
145
|
+
}
|
|
143
146
|
|
|
144
147
|
_this.props.onChange(_this.props.multiple ? _this.props.value.push(suggestion) : suggestion);
|
|
145
148
|
};
|
|
@@ -26,7 +26,8 @@ var searchUsers = function searchUsers(_ref) {
|
|
|
26
26
|
return "".concat(field, " =* \"").concat(value, "\"");
|
|
27
27
|
}).join(' OR '),
|
|
28
28
|
limit: search.get('limit') || 25,
|
|
29
|
-
include: search.get('include') || ''
|
|
29
|
+
include: search.get('include') || '',
|
|
30
|
+
"public": !!search.get('public')
|
|
30
31
|
}).then(function (_ref2) {
|
|
31
32
|
var users = _ref2.users,
|
|
32
33
|
error = _ref2.error,
|
|
@@ -11,7 +11,7 @@ import moment from 'moment';
|
|
|
11
11
|
import { action, regHandlers, connect, dispatch, regSaga, store } from '../../../store';
|
|
12
12
|
import { login, logoutDirect, retrieveJwt, singleSignOn, fetchSpaMeta, systemLogin } from '../../../apis';
|
|
13
13
|
import { socketIdentify } from '../../../apis/socket';
|
|
14
|
-
import { refreshSystemToken } from '../../../apis
|
|
14
|
+
import { refreshSystemToken } from '../../../apis';
|
|
15
15
|
var defaultLoginProps = {
|
|
16
16
|
error: null,
|
|
17
17
|
password: '',
|
|
@@ -52,6 +52,9 @@ regHandlers({
|
|
|
52
52
|
system: action.payload.system
|
|
53
53
|
}).set('login', defaultLoginProps);
|
|
54
54
|
},
|
|
55
|
+
SET_SERVER_ERROR: function SET_SERVER_ERROR(state, action) {
|
|
56
|
+
return state.set('serverError', action.payload);
|
|
57
|
+
},
|
|
55
58
|
SET_ERROR: function SET_ERROR(state, action) {
|
|
56
59
|
return state.mergeIn(['login'], {
|
|
57
60
|
error: action.payload,
|
|
@@ -357,13 +360,13 @@ regSaga(takeEvery('SINGLE_SIGN_ON', /*#__PURE__*/_regeneratorRuntime.mark(functi
|
|
|
357
360
|
})));
|
|
358
361
|
var SYSTEM_TOKEN = 'kd-system';
|
|
359
362
|
regSaga(takeEvery('INITIALIZE', /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref3) {
|
|
360
|
-
var _ref3$payload, system, socket, token, localToken, parsedToken, isValid, _yield$call4, securityStrategies, _yield$call4$session, csrfToken, isAuthenticated, spaceSlug, _token;
|
|
363
|
+
var _ref3$payload, system, socket, skipInit, token, localToken, parsedToken, isValid, _yield$call4, securityStrategies, _yield$call4$session, csrfToken, isAuthenticated, spaceSlug, error, _token;
|
|
361
364
|
|
|
362
365
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
363
366
|
while (1) {
|
|
364
367
|
switch (_context4.prev = _context4.next) {
|
|
365
368
|
case 0:
|
|
366
|
-
_ref3$payload = _ref3.payload, system = _ref3$payload.system, socket = _ref3$payload.socket;
|
|
369
|
+
_ref3$payload = _ref3.payload, system = _ref3$payload.system, socket = _ref3$payload.socket, skipInit = _ref3$payload.skipInit;
|
|
367
370
|
_context4.prev = 1;
|
|
368
371
|
|
|
369
372
|
if (!system) {
|
|
@@ -387,7 +390,7 @@ regSaga(takeEvery('INITIALIZE', /*#__PURE__*/_regeneratorRuntime.mark(function _
|
|
|
387
390
|
}));
|
|
388
391
|
|
|
389
392
|
case 7:
|
|
390
|
-
_context4.next =
|
|
393
|
+
_context4.next = 34;
|
|
391
394
|
break;
|
|
392
395
|
|
|
393
396
|
case 9:
|
|
@@ -398,39 +401,51 @@ regSaga(takeEvery('INITIALIZE', /*#__PURE__*/_regeneratorRuntime.mark(function _
|
|
|
398
401
|
_yield$call4 = _context4.sent;
|
|
399
402
|
securityStrategies = _yield$call4.securityStrategies;
|
|
400
403
|
_yield$call4$session = _yield$call4.session;
|
|
401
|
-
|
|
402
|
-
isAuthenticated = _yield$call4$session.isAuthenticated;
|
|
403
|
-
|
|
404
|
+
_yield$call4$session = _yield$call4$session === void 0 ? {} : _yield$call4$session;
|
|
405
|
+
csrfToken = _yield$call4$session.csrfToken, isAuthenticated = _yield$call4$session.isAuthenticated, spaceSlug = _yield$call4.spaceSlug, error = _yield$call4.error;
|
|
406
|
+
|
|
407
|
+
if (!error) {
|
|
408
|
+
_context4.next = 21;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
_context4.next = 19;
|
|
413
|
+
return put(action('SET_SERVER_ERROR', error));
|
|
414
|
+
|
|
415
|
+
case 19:
|
|
416
|
+
_context4.next = 34;
|
|
417
|
+
break;
|
|
404
418
|
|
|
405
|
-
|
|
406
|
-
|
|
419
|
+
case 21:
|
|
420
|
+
if (!(isAuthenticated && !skipInit)) {
|
|
421
|
+
_context4.next = 27;
|
|
407
422
|
break;
|
|
408
423
|
}
|
|
409
424
|
|
|
410
|
-
_context4.next =
|
|
425
|
+
_context4.next = 24;
|
|
411
426
|
return call(retrieveJwt);
|
|
412
427
|
|
|
413
|
-
case
|
|
428
|
+
case 24:
|
|
414
429
|
_context4.t0 = _context4.sent;
|
|
415
|
-
_context4.next =
|
|
430
|
+
_context4.next = 28;
|
|
416
431
|
break;
|
|
417
432
|
|
|
418
|
-
case
|
|
433
|
+
case 27:
|
|
419
434
|
_context4.t0 = null;
|
|
420
435
|
|
|
421
|
-
case
|
|
436
|
+
case 28:
|
|
422
437
|
_token = _context4.t0;
|
|
423
438
|
|
|
424
439
|
if (!(socket && _token)) {
|
|
425
|
-
_context4.next =
|
|
440
|
+
_context4.next = 32;
|
|
426
441
|
break;
|
|
427
442
|
}
|
|
428
443
|
|
|
429
|
-
_context4.next =
|
|
444
|
+
_context4.next = 32;
|
|
430
445
|
return call(socketIdentify, _token);
|
|
431
446
|
|
|
432
|
-
case
|
|
433
|
-
_context4.next =
|
|
447
|
+
case 32:
|
|
448
|
+
_context4.next = 34;
|
|
434
449
|
return put(action('SET_INITIALIZED', {
|
|
435
450
|
csrfToken: csrfToken,
|
|
436
451
|
securityStrategies: securityStrategies,
|
|
@@ -439,21 +454,21 @@ regSaga(takeEvery('INITIALIZE', /*#__PURE__*/_regeneratorRuntime.mark(function _
|
|
|
439
454
|
token: _token
|
|
440
455
|
}));
|
|
441
456
|
|
|
442
|
-
case
|
|
443
|
-
_context4.next =
|
|
457
|
+
case 34:
|
|
458
|
+
_context4.next = 39;
|
|
444
459
|
break;
|
|
445
460
|
|
|
446
|
-
case
|
|
447
|
-
_context4.prev =
|
|
461
|
+
case 36:
|
|
462
|
+
_context4.prev = 36;
|
|
448
463
|
_context4.t1 = _context4["catch"](1);
|
|
449
464
|
console.error(_context4.t1);
|
|
450
465
|
|
|
451
|
-
case
|
|
466
|
+
case 39:
|
|
452
467
|
case "end":
|
|
453
468
|
return _context4.stop();
|
|
454
469
|
}
|
|
455
470
|
}
|
|
456
|
-
}, _callee4, null, [[1,
|
|
471
|
+
}, _callee4, null, [[1, 36]]);
|
|
457
472
|
})));
|
|
458
473
|
regSaga(takeEvery('LOGOUT_START', /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref4) {
|
|
459
474
|
var payload, system, loggedIn;
|
|
@@ -580,6 +595,10 @@ var getToken = function getToken() {
|
|
|
580
595
|
return store.getState().getIn(['session', 'token']);
|
|
581
596
|
};
|
|
582
597
|
|
|
598
|
+
var getCsrfToken = function getCsrfToken() {
|
|
599
|
+
return store.getState().getIn(['session', 'csrfToken']);
|
|
600
|
+
};
|
|
601
|
+
|
|
583
602
|
export var AuthenticationComponent = /*#__PURE__*/function (_Component) {
|
|
584
603
|
_inherits(AuthenticationComponent, _Component);
|
|
585
604
|
|
|
@@ -601,7 +620,8 @@ export var AuthenticationComponent = /*#__PURE__*/function (_Component) {
|
|
|
601
620
|
});
|
|
602
621
|
} else {
|
|
603
622
|
dispatch('INITIALIZE', {
|
|
604
|
-
socket: !this.props.noSocket
|
|
623
|
+
socket: !this.props.noSocket,
|
|
624
|
+
skipInit: this.props.skipInit
|
|
605
625
|
});
|
|
606
626
|
}
|
|
607
627
|
}
|
|
@@ -613,9 +633,11 @@ export var AuthenticationComponent = /*#__PURE__*/function (_Component) {
|
|
|
613
633
|
loggedIn = _this$props.loggedIn,
|
|
614
634
|
login = _this$props.login,
|
|
615
635
|
securityStrategies = _this$props.securityStrategies,
|
|
636
|
+
serverError = _this$props.serverError,
|
|
616
637
|
spaceSlug = _this$props.spaceSlug,
|
|
617
638
|
token = _this$props.token;
|
|
618
639
|
return this.props.children({
|
|
640
|
+
serverError: serverError,
|
|
619
641
|
initialized: initialized,
|
|
620
642
|
timedOut: loggedIn && !token,
|
|
621
643
|
loggedIn: loggedIn,
|
|
@@ -644,9 +666,10 @@ var mapStateToProps = function mapStateToProps(state) {
|
|
|
644
666
|
token: state.getIn(['session', 'token'], null),
|
|
645
667
|
login: state.get('login', defaultLoginProps),
|
|
646
668
|
spaceSlug: state.getIn(['session', 'spaceSlug'], ''),
|
|
647
|
-
securityStrategies: state.getIn(['session', 'securityStrategies'], [])
|
|
669
|
+
securityStrategies: state.getIn(['session', 'securityStrategies'], []),
|
|
670
|
+
serverError: state.get('serverError')
|
|
648
671
|
};
|
|
649
672
|
};
|
|
650
673
|
|
|
651
674
|
var AuthenticationContainer = connect(mapStateToProps)(AuthenticationComponent);
|
|
652
|
-
export { AuthenticationContainer, getToken, logout, timedOut };
|
|
675
|
+
export { AuthenticationContainer, getCsrfToken, getToken, logout, timedOut };
|
|
@@ -36,7 +36,7 @@ describe('processJavaScriptTemplate', function () {
|
|
|
36
36
|
});
|
|
37
37
|
test('add some objects inside to test curly behavior', function () {
|
|
38
38
|
// eslint-disable-next-line no-template-curly-in-string
|
|
39
|
-
expect(processJavaScriptTemplate('Hello ${{foo:{"bar":2}}}')).toEqual([['Hello '], ['${', 'opening-interpolation', 'js-template'], ['{', 'punctuation', 'js-template'], ['foo', 'js-template'], [':', '
|
|
39
|
+
expect(processJavaScriptTemplate('Hello ${{foo:{"bar":2}}}')).toEqual([['Hello '], ['${', 'opening-interpolation', 'js-template'], ['{', 'punctuation', 'js-template'], ['foo', 'js-template'], [':', 'operator', 'js-template'], ['{', 'punctuation', 'js-template'], ['"bar"', 'string', 'js-template'], [':', 'operator', 'js-template'], ['2', 'number', 'js-template'], ['}', 'punctuation', 'js-template'], ['}', 'punctuation', 'js-template'], ['}', 'closing-interpolation', 'js-template'], ['']]);
|
|
40
40
|
});
|
|
41
41
|
test('multiple interpolations', function () {
|
|
42
42
|
// eslint-disable-next-line no-template-curly-in-string
|
|
@@ -92,7 +92,7 @@ AttributeDefinitionForm.defaultProps = {
|
|
|
92
92
|
};
|
|
93
93
|
AttributeDefinitionForm.propTypes = {
|
|
94
94
|
/** The type of attribute definition. */
|
|
95
|
-
attributeType: t.oneOf(['spaceAttributeDefinitions', 'teamAttributeDefinitions', 'userAttributeDefinitions', 'userProfileAttributeDefinitions', 'categoryAttributeDefinitions', 'kappAttributeDefinitions', 'formAttributeDefinitions'
|
|
95
|
+
attributeType: t.oneOf(['spaceAttributeDefinitions', 'teamAttributeDefinitions', 'userAttributeDefinitions', 'userProfileAttributeDefinitions', 'categoryAttributeDefinitions', 'kappAttributeDefinitions', 'formAttributeDefinitions']).isRequired,
|
|
96
96
|
|
|
97
97
|
/** The name of the attribute (assumes new if not null). */
|
|
98
98
|
attributeName: t.string,
|
|
@@ -60,7 +60,7 @@ AttributeDefinitionTable.propTypes = {
|
|
|
60
60
|
kappSlug: t.string,
|
|
61
61
|
|
|
62
62
|
/** The type of attribute definition to display. */
|
|
63
|
-
attributeType: t.oneOf(['space', 'team', 'user', 'userProfile', 'category', 'kapp', 'form'
|
|
63
|
+
attributeType: t.oneOf(['space', 'team', 'user', 'userProfile', 'category', 'kapp', 'form']).isRequired,
|
|
64
64
|
|
|
65
65
|
/** The columns that should be displayed. */
|
|
66
66
|
columnSet: t.arrayOf(t.string)
|
|
@@ -286,16 +286,16 @@ export var CoreFormComponent = /*#__PURE__*/function (_Component) {
|
|
|
286
286
|
}));
|
|
287
287
|
} // If pending and error state has just been set, call error callback
|
|
288
288
|
else if (this.state.pending && this.state.error && !prevState.error) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
289
|
+
if (this.state.error.statusCode === 401) {
|
|
290
|
+
applyGuard(this.props.onUnauthorized || this.props.unauthorized);
|
|
291
|
+
} else if (this.state.error.statusCode === 403) {
|
|
292
|
+
applyGuard(this.props.onForbidden || this.props.forbidden);
|
|
293
|
+
} else if (this.state.error.statusCode === 404) {
|
|
294
|
+
applyGuard(this.props.onNotFound || this.props.onNotFound);
|
|
295
|
+
} else {
|
|
296
|
+
applyGuard(this.props.onError || this.props.error);
|
|
297
|
+
}
|
|
298
|
+
} // If locking is turned on and has been initalized
|
|
299
299
|
|
|
300
300
|
|
|
301
301
|
if (this.state.lock && this.state.lock.init) {
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { generateForm } from '../../form/Form';
|
|
2
|
+
import { fetchKapp, fetchSpace, updateKapp, updateSpace } from '../../../apis';
|
|
3
|
+
import { FIELD_DATA_TYPES } from './FieldDefinitionTable';
|
|
4
|
+
|
|
5
|
+
var dataSources = function dataSources(_ref) {
|
|
6
|
+
var kappSlug = _ref.kappSlug,
|
|
7
|
+
name = _ref.name;
|
|
8
|
+
return {
|
|
9
|
+
form: {
|
|
10
|
+
fn: kappSlug ? fetchKapp : fetchSpace,
|
|
11
|
+
params: [{
|
|
12
|
+
kappSlug: kappSlug,
|
|
13
|
+
include: 'fields'
|
|
14
|
+
}],
|
|
15
|
+
transform: function transform(result) {
|
|
16
|
+
return kappSlug ? result.kapp : result.space;
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
fieldDefinition: {
|
|
20
|
+
fn: function fn(form, name) {
|
|
21
|
+
return form.get('fields').find(function (f) {
|
|
22
|
+
return f.get('name') === name;
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
params: function params(_ref2) {
|
|
26
|
+
var form = _ref2.form;
|
|
27
|
+
return form && name && [form, name];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var handleSubmit = function handleSubmit(_ref3) {
|
|
34
|
+
var kappSlug = _ref3.kappSlug,
|
|
35
|
+
name = _ref3.name;
|
|
36
|
+
return function (values, _ref4) {
|
|
37
|
+
var form = _ref4.form;
|
|
38
|
+
var dataType = FIELD_DATA_TYPES.find(function (fdt) {
|
|
39
|
+
return fdt.value === values.get('renderType');
|
|
40
|
+
}).dataType;
|
|
41
|
+
var field = values.set('dataType', dataType);
|
|
42
|
+
var fields = name ? form.get('fields').map(function (fd) {
|
|
43
|
+
return fd.get('name') === name ? field : fd;
|
|
44
|
+
}) : form.get('fields').push(field);
|
|
45
|
+
return (kappSlug ? updateKapp({
|
|
46
|
+
kapp: {
|
|
47
|
+
fields: fields
|
|
48
|
+
},
|
|
49
|
+
kappSlug: kappSlug
|
|
50
|
+
}) : updateSpace({
|
|
51
|
+
space: {
|
|
52
|
+
fields: fields
|
|
53
|
+
}
|
|
54
|
+
})).then(function (_ref5) {
|
|
55
|
+
var kapp = _ref5.kapp,
|
|
56
|
+
space = _ref5.space,
|
|
57
|
+
error = _ref5.error;
|
|
58
|
+
|
|
59
|
+
if (error) {
|
|
60
|
+
throw error.statusCode === 400 && error.message || 'There was an error saving the field definition';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return kappSlug ? kapp : space;
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var fields = function fields(_ref6) {
|
|
69
|
+
var name = _ref6.name;
|
|
70
|
+
return function (_ref7) {
|
|
71
|
+
var form = _ref7.form,
|
|
72
|
+
fieldDefinition = _ref7.fieldDefinition;
|
|
73
|
+
return (!name || fieldDefinition) && form && [{
|
|
74
|
+
name: 'name',
|
|
75
|
+
label: 'Name',
|
|
76
|
+
type: 'text',
|
|
77
|
+
required: true,
|
|
78
|
+
initialValue: fieldDefinition ? fieldDefinition.get('name') : ''
|
|
79
|
+
}, {
|
|
80
|
+
name: 'renderType',
|
|
81
|
+
label: 'Type',
|
|
82
|
+
type: 'select',
|
|
83
|
+
required: true,
|
|
84
|
+
options: FIELD_DATA_TYPES,
|
|
85
|
+
initialValue: fieldDefinition ? fieldDefinition.get('renderType') : ''
|
|
86
|
+
}, {
|
|
87
|
+
name: 'createdAt',
|
|
88
|
+
label: 'Created At',
|
|
89
|
+
type: 'text',
|
|
90
|
+
visible: false,
|
|
91
|
+
initialValue: fieldDefinition ? fieldDefinition.get('createdAt') : '2020-08-24T22:06:20.572Z'
|
|
92
|
+
}, {
|
|
93
|
+
name: 'createdBy',
|
|
94
|
+
label: 'Created By',
|
|
95
|
+
type: 'text',
|
|
96
|
+
visible: false,
|
|
97
|
+
initialValue: fieldDefinition ? fieldDefinition.get('createdBy') : 'admin'
|
|
98
|
+
}, {
|
|
99
|
+
name: 'updatedAt',
|
|
100
|
+
label: 'Updated At',
|
|
101
|
+
type: 'text',
|
|
102
|
+
visible: false,
|
|
103
|
+
initialValue: fieldDefinition ? fieldDefinition.get('updatedAt') : '2020-08-24T22:06:20.572Z'
|
|
104
|
+
}, {
|
|
105
|
+
name: 'updatedBy',
|
|
106
|
+
label: 'Updated By',
|
|
107
|
+
type: 'text',
|
|
108
|
+
visible: false,
|
|
109
|
+
initialValue: fieldDefinition ? fieldDefinition.get('updatedBy') : 'admin'
|
|
110
|
+
}];
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* @component
|
|
115
|
+
* A form for creating and updating Field Definitions within the Kinetic Platform
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
export var FieldDefinitionForm = generateForm({
|
|
120
|
+
formOptions: ['kappSlug', 'name'],
|
|
121
|
+
dataSources: dataSources,
|
|
122
|
+
fields: fields,
|
|
123
|
+
handleSubmit: handleSubmit
|
|
124
|
+
});
|
|
125
|
+
FieldDefinitionForm.displayName = 'FieldDefinitionForm'; // Specifies the default values for props:
|
|
126
|
+
|
|
127
|
+
FieldDefinitionForm.defaultProps = {
|
|
128
|
+
fieldName: null,
|
|
129
|
+
kappSlug: null
|
|
130
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { generateTable } from '../../table/Table';
|
|
2
|
+
import { fetchKapp, fetchSpace } from '../../../apis';
|
|
3
|
+
import { defineFilter } from '../../../helpers';
|
|
4
|
+
export var FIELD_DATA_TYPES = [{
|
|
5
|
+
value: 'checkbox',
|
|
6
|
+
label: 'Checkbox',
|
|
7
|
+
dataType: 'json'
|
|
8
|
+
}, {
|
|
9
|
+
value: 'date',
|
|
10
|
+
label: 'Date',
|
|
11
|
+
dataType: 'string'
|
|
12
|
+
}, {
|
|
13
|
+
value: 'datetime',
|
|
14
|
+
label: 'Date/Time',
|
|
15
|
+
dataType: 'string'
|
|
16
|
+
}, {
|
|
17
|
+
value: 'dropdown',
|
|
18
|
+
label: 'Dropdown',
|
|
19
|
+
dataType: 'string'
|
|
20
|
+
}, {
|
|
21
|
+
value: 'radio',
|
|
22
|
+
label: 'Radio',
|
|
23
|
+
dataType: 'string'
|
|
24
|
+
}, {
|
|
25
|
+
value: 'text',
|
|
26
|
+
label: 'Text',
|
|
27
|
+
dataType: 'string'
|
|
28
|
+
}, {
|
|
29
|
+
value: 'time',
|
|
30
|
+
label: 'Time',
|
|
31
|
+
dataType: 'string'
|
|
32
|
+
}];
|
|
33
|
+
var clientSide = defineFilter(true).startsWith('name', 'name').end();
|
|
34
|
+
|
|
35
|
+
var dataSource = function dataSource(_ref) {
|
|
36
|
+
var kappSlug = _ref.kappSlug;
|
|
37
|
+
return {
|
|
38
|
+
fn: kappSlug ? fetchKapp : fetchSpace,
|
|
39
|
+
clientSide: clientSide,
|
|
40
|
+
params: function params() {
|
|
41
|
+
return [{
|
|
42
|
+
kappSlug: kappSlug,
|
|
43
|
+
include: 'fields'
|
|
44
|
+
}];
|
|
45
|
+
},
|
|
46
|
+
transform: function transform(result) {
|
|
47
|
+
return {
|
|
48
|
+
data: kappSlug ? result.kapp.fields : result.space.fields
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var filters = function filters() {
|
|
55
|
+
return function () {
|
|
56
|
+
return [{
|
|
57
|
+
name: 'name',
|
|
58
|
+
label: 'Name',
|
|
59
|
+
type: 'text'
|
|
60
|
+
}];
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var columns = [{
|
|
65
|
+
value: 'name',
|
|
66
|
+
title: 'Name'
|
|
67
|
+
}, {
|
|
68
|
+
value: 'renderType',
|
|
69
|
+
title: 'Render Type'
|
|
70
|
+
}, {
|
|
71
|
+
value: 'dataType',
|
|
72
|
+
title: 'Data Type'
|
|
73
|
+
}, {
|
|
74
|
+
value: 'updatedAt',
|
|
75
|
+
title: 'Updated At'
|
|
76
|
+
}, {
|
|
77
|
+
value: 'updatedBy',
|
|
78
|
+
title: 'Updated By'
|
|
79
|
+
}];
|
|
80
|
+
export var FieldDefinitionTable = generateTable({
|
|
81
|
+
tableOptions: ['kappSlug'],
|
|
82
|
+
columns: columns,
|
|
83
|
+
filters: filters,
|
|
84
|
+
dataSource: dataSource
|
|
85
|
+
});
|
|
86
|
+
FieldDefinitionTable.displayName = 'FieldDefinitionTable';
|