@kineticdata/react 5.1.0-rc.1 → 5.1.1
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 +11 -9
- package/lib/apis/core/attributeDefinitions.test.js +1 -1
- package/lib/apis/core/authentication.js +13 -5
- package/lib/apis/core/backgroundJobs.js +2 -1
- package/lib/apis/core/bridgeModelAttributeMappings.js +1 -1
- package/lib/apis/core/bridgeModelAttributes.js +15 -12
- package/lib/apis/core/bridgeModelMappings.js +1 -1
- package/lib/apis/core/bridgeModelQualificationMappings.js +2 -2
- package/lib/apis/core/bridgeModelQualifications.js +2 -2
- package/lib/apis/core/bridgeModels.js +14 -8
- package/lib/apis/core/bridgedresources.js +3 -2
- package/lib/apis/core/fileResources.js +36 -0
- package/lib/apis/core/filestores.js +40 -0
- package/lib/apis/core/formTypes.js +18 -21
- package/lib/apis/core/oauthClients.js +11 -5
- package/lib/apis/core/securityPolicyDefinitions.js +1 -1
- package/lib/apis/core/securityPolicyDefinitions.test.js +4 -4
- package/lib/apis/core/submissions.js +68 -0
- package/lib/apis/core/webhooks.js +1 -1
- package/lib/apis/core/webhooks.test.js +2 -2
- package/lib/apis/http.js +17 -3
- package/lib/apis/index.js +2 -0
- package/lib/apis/system/index.js +86 -1
- package/lib/apis/task/index.js +20 -13
- 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/core/core_form/CoreForm.js +10 -10
- package/lib/components/core/file_resource/FileResourceForm.js +180 -0
- package/lib/components/core/file_resource/FileResourceTable.js +71 -0
- package/lib/components/core/i18n/I18n.js +14 -14
- package/lib/components/core/security_definition/SecurityDefinitionForm.js +1 -1
- package/lib/components/core/space/SpaceForm.js +37 -8
- package/lib/components/core/submission/FormSubmissionFilters.js +3 -11
- package/lib/components/core/submission/FormSubmissionTable.js +4 -2
- package/lib/components/core/submission/SubmissionForm.js +124 -0
- package/lib/components/core/submission/helpers.js +2 -2
- package/lib/components/core/user/UserForm.js +2 -2
- package/lib/components/core/webapi/WebApiForm.js +111 -126
- package/lib/components/form/Form.helpers.js +1 -1
- package/lib/components/form/Form.js +200 -144
- package/lib/components/index.js +14 -6
- package/lib/components/system/SystemBackgroundTasksTable.js +83 -0
- package/lib/components/system/SystemSecurityForm.js +69 -0
- package/lib/components/system/helpers.js +2 -2
- 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 +15 -10
- package/lib/components/table/Table.js +9 -6
- 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 +51 -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/workflows/WorkflowForm.js +67 -85
- package/lib/helpers/index.js +4 -1
- package/lib/index.js +1 -0
- package/package.json +2 -2
- 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 };
|
|
@@ -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,180 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
import { get, Map } from 'immutable';
|
|
4
|
+
import { createFileResource, fetchAgentComponents, fetchFileResource, fetchFilestores, fetchSecurityPolicyDefinitions, updateFileResource } from '../../../apis';
|
|
5
|
+
import { generateForm } from '../../form/Form';
|
|
6
|
+
import { handleFormErrors } from '../../form/Form.helpers';
|
|
7
|
+
|
|
8
|
+
var dataSources = function dataSources(_ref) {
|
|
9
|
+
var fileResourceSlug = _ref.fileResourceSlug;
|
|
10
|
+
return {
|
|
11
|
+
fileResource: {
|
|
12
|
+
fn: fetchFileResource,
|
|
13
|
+
params: fileResourceSlug && [{
|
|
14
|
+
fileResourceSlug: fileResourceSlug,
|
|
15
|
+
include: 'details,securityPolicies'
|
|
16
|
+
}],
|
|
17
|
+
transform: function transform(result) {
|
|
18
|
+
return result.fileResource;
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
agents: {
|
|
22
|
+
fn: fetchAgentComponents,
|
|
23
|
+
params: [],
|
|
24
|
+
transform: function transform(result) {
|
|
25
|
+
return [{
|
|
26
|
+
label: 'System',
|
|
27
|
+
value: 'system'
|
|
28
|
+
}].concat(_toConsumableArray(get(result, 'agents', []).map(function (agent) {
|
|
29
|
+
return {
|
|
30
|
+
label: agent.name,
|
|
31
|
+
value: agent.slug
|
|
32
|
+
};
|
|
33
|
+
})));
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
filestores: {
|
|
37
|
+
fn: function fn(options) {
|
|
38
|
+
return options && options.agentSlug ? fetchFilestores(options) : Promise.resolve([]);
|
|
39
|
+
},
|
|
40
|
+
params: function params(_ref2) {
|
|
41
|
+
var values = _ref2.values;
|
|
42
|
+
return [{
|
|
43
|
+
agentSlug: get(values, 'agentSlug', 'system')
|
|
44
|
+
}];
|
|
45
|
+
},
|
|
46
|
+
transform: function transform(result) {
|
|
47
|
+
return get(result, 'filestores', []).map(function (agent) {
|
|
48
|
+
return {
|
|
49
|
+
label: agent.name,
|
|
50
|
+
value: agent.slug
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
securityPolicyDefinitions: {
|
|
56
|
+
fn: fetchSecurityPolicyDefinitions,
|
|
57
|
+
params: [],
|
|
58
|
+
transform: function transform(result) {
|
|
59
|
+
return result.securityPolicyDefinitions;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var handleSubmit = function handleSubmit(_ref3) {
|
|
66
|
+
var fileResourceSlug = _ref3.fileResourceSlug;
|
|
67
|
+
return function (values) {
|
|
68
|
+
return (fileResourceSlug ? updateFileResource : createFileResource)({
|
|
69
|
+
fileResourceSlug: fileResourceSlug,
|
|
70
|
+
fileResource: values.toJS()
|
|
71
|
+
}).then(handleFormErrors('fileResource', 'There was a problem saving the File Resource.'));
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var securityEndpoints = {
|
|
76
|
+
fileAccess: {
|
|
77
|
+
endpoint: 'File Access',
|
|
78
|
+
label: 'File Access',
|
|
79
|
+
types: ['Space', 'File Resource']
|
|
80
|
+
},
|
|
81
|
+
fileModification: {
|
|
82
|
+
endpoint: 'File Modification',
|
|
83
|
+
label: 'File Modification',
|
|
84
|
+
types: ['Space', 'File Resource']
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
var fields = function fields(_ref4) {
|
|
89
|
+
var fileResourceSlug = _ref4.fileResourceSlug;
|
|
90
|
+
return function (_ref5) {
|
|
91
|
+
var fileResource = _ref5.fileResource,
|
|
92
|
+
agents = _ref5.agents,
|
|
93
|
+
securityPolicyDefinitions = _ref5.securityPolicyDefinitions;
|
|
94
|
+
return (!fileResourceSlug || fileResource) && securityPolicyDefinitions && agents && [{
|
|
95
|
+
name: 'slug',
|
|
96
|
+
label: 'Slug',
|
|
97
|
+
type: 'text',
|
|
98
|
+
required: true,
|
|
99
|
+
initialValue: get(fileResource, 'slug', '')
|
|
100
|
+
}, {
|
|
101
|
+
name: 'agentSlug',
|
|
102
|
+
label: 'Agent Slug',
|
|
103
|
+
type: 'select',
|
|
104
|
+
required: true,
|
|
105
|
+
initialValue: get(fileResource, 'agentSlug', 'system'),
|
|
106
|
+
options: function options(_ref6) {
|
|
107
|
+
var agents = _ref6.agents;
|
|
108
|
+
return agents;
|
|
109
|
+
},
|
|
110
|
+
onChange: function onChange(_, _ref7) {
|
|
111
|
+
var setValue = _ref7.setValue;
|
|
112
|
+
return setValue('filestoreSlug', '');
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
name: 'filestoreSlug',
|
|
116
|
+
label: 'Filestore Slug',
|
|
117
|
+
type: 'select',
|
|
118
|
+
required: true,
|
|
119
|
+
initialValue: get(fileResource, 'filestoreSlug', ''),
|
|
120
|
+
options: function options(_ref8) {
|
|
121
|
+
var filestores = _ref8.filestores;
|
|
122
|
+
return filestores;
|
|
123
|
+
}
|
|
124
|
+
}].concat(_toConsumableArray(Object.entries(securityEndpoints).map(function (_ref9) {
|
|
125
|
+
var _ref10 = _slicedToArray(_ref9, 2),
|
|
126
|
+
endpointFieldName = _ref10[0],
|
|
127
|
+
endpoint = _ref10[1];
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
name: endpointFieldName,
|
|
131
|
+
label: endpoint.label,
|
|
132
|
+
type: 'select',
|
|
133
|
+
options: function options(_ref11) {
|
|
134
|
+
var securityPolicyDefinitions = _ref11.securityPolicyDefinitions;
|
|
135
|
+
return securityPolicyDefinitions ? securityPolicyDefinitions.filter(function (definition) {
|
|
136
|
+
return endpoint.types.includes(definition.get('type'));
|
|
137
|
+
}).map(function (definition) {
|
|
138
|
+
return Map({
|
|
139
|
+
value: definition.get('name'),
|
|
140
|
+
label: definition.get('name')
|
|
141
|
+
});
|
|
142
|
+
}) : [];
|
|
143
|
+
},
|
|
144
|
+
initialValue: fileResource ? fileResource.get('securityPolicies').find(function (pol) {
|
|
145
|
+
return pol.get('endpoint') === endpoint.endpoint;
|
|
146
|
+
}, null, Map({})).get('name', '') : '',
|
|
147
|
+
"transient": true
|
|
148
|
+
};
|
|
149
|
+
})), [{
|
|
150
|
+
name: 'securityPolicies',
|
|
151
|
+
label: 'Security Policies',
|
|
152
|
+
type: null,
|
|
153
|
+
visible: false,
|
|
154
|
+
serialize: function serialize(_ref12) {
|
|
155
|
+
var values = _ref12.values;
|
|
156
|
+
return Object.entries(securityEndpoints).map(function (_ref13) {
|
|
157
|
+
var _ref14 = _slicedToArray(_ref13, 2),
|
|
158
|
+
endpointFieldName = _ref14[0],
|
|
159
|
+
policy = _ref14[1];
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
endpoint: policy.endpoint,
|
|
163
|
+
name: values.get(endpointFieldName)
|
|
164
|
+
};
|
|
165
|
+
}).filter(function (endpoint) {
|
|
166
|
+
return endpoint.name !== '';
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
initialValue: get(fileResource, 'securityPolicies')
|
|
170
|
+
}]);
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export var FileResourceForm = generateForm({
|
|
175
|
+
formOptions: ['fileResourceSlug'],
|
|
176
|
+
dataSources: dataSources,
|
|
177
|
+
fields: fields,
|
|
178
|
+
handleSubmit: handleSubmit
|
|
179
|
+
});
|
|
180
|
+
FileResourceForm.displayName = 'FileResourceForm';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import { defineKqlQuery } from '../../../helpers';
|
|
3
|
+
import { fetchFileResources } from '../../../apis';
|
|
4
|
+
import { generatePaginationParams, generateSortParams } from '../../../apis/http';
|
|
5
|
+
import { generateTable } from '../../table/Table';
|
|
6
|
+
|
|
7
|
+
var filters = function filters() {
|
|
8
|
+
return function () {
|
|
9
|
+
return [{
|
|
10
|
+
name: 'slug',
|
|
11
|
+
label: 'Slug',
|
|
12
|
+
type: 'text'
|
|
13
|
+
}];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var fileResourceQuery = defineKqlQuery().matches('agentSlug', 'agentSlug').matches('filestoreSlug', 'filestoreSlug').matches('slug', 'slug').end();
|
|
18
|
+
|
|
19
|
+
var dataSource = function dataSource() {
|
|
20
|
+
return {
|
|
21
|
+
fn: fetchFileResources,
|
|
22
|
+
params: function params(paramData) {
|
|
23
|
+
return [_objectSpread(_objectSpread(_objectSpread({}, generateSortParams(paramData)), generatePaginationParams(paramData)), {}, {
|
|
24
|
+
q: fileResourceQuery(paramData.filters.toJS()),
|
|
25
|
+
include: 'details'
|
|
26
|
+
})];
|
|
27
|
+
},
|
|
28
|
+
transform: function transform(result) {
|
|
29
|
+
return {
|
|
30
|
+
data: result.fileResources,
|
|
31
|
+
nextPageToken: result.nextPageToken
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var columns = [{
|
|
38
|
+
value: 'slug',
|
|
39
|
+
title: 'Slug',
|
|
40
|
+
sortable: true
|
|
41
|
+
}, {
|
|
42
|
+
value: 'agentSlug',
|
|
43
|
+
title: 'Agent Slug',
|
|
44
|
+
sortable: true
|
|
45
|
+
}, {
|
|
46
|
+
value: 'filestoreSlug',
|
|
47
|
+
title: 'File Store Slug',
|
|
48
|
+
sortable: true
|
|
49
|
+
}, {
|
|
50
|
+
value: 'createdAt',
|
|
51
|
+
title: 'Created',
|
|
52
|
+
sortable: true
|
|
53
|
+
}, {
|
|
54
|
+
value: 'createdBy',
|
|
55
|
+
title: 'Created By'
|
|
56
|
+
}, {
|
|
57
|
+
value: 'updatedAt',
|
|
58
|
+
title: 'Updated At',
|
|
59
|
+
sortable: true
|
|
60
|
+
}, {
|
|
61
|
+
value: 'updatedBy',
|
|
62
|
+
title: 'Updated By',
|
|
63
|
+
sortable: true
|
|
64
|
+
}];
|
|
65
|
+
export var FileResourceTable = generateTable({
|
|
66
|
+
tableOptions: [],
|
|
67
|
+
columns: columns,
|
|
68
|
+
filters: filters,
|
|
69
|
+
dataSource: dataSource
|
|
70
|
+
});
|
|
71
|
+
FileResourceTable.displayName = 'FileResourceTable';
|