@kineticdata/react 5.1.0-rc.2 → 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.
Files changed (37) hide show
  1. package/lib/apis/core/authentication.js +2 -2
  2. package/lib/apis/core/securityPolicyDefinitions.test.js +4 -4
  3. package/lib/apis/http.js +9 -2
  4. package/lib/apis/system/index.js +86 -1
  5. package/lib/apis/task/index.js +10 -8
  6. package/lib/components/common/BridgeSelect.js +2 -1
  7. package/lib/components/common/FormSelect.js +2 -1
  8. package/lib/components/common/TableInput.js +74 -29
  9. package/lib/components/common/TeamSelect.js +2 -1
  10. package/lib/components/common/UserSelect.js +2 -1
  11. package/lib/components/common/authentication/AuthenticationContainer.js +50 -27
  12. package/lib/components/core/file_resource/FileResourceForm.js +2 -2
  13. package/lib/components/core/space/SpaceForm.js +37 -8
  14. package/lib/components/core/submission/SubmissionForm.js +124 -0
  15. package/lib/components/core/webapi/WebApiForm.js +111 -126
  16. package/lib/components/form/Form.helpers.js +1 -1
  17. package/lib/components/form/Form.js +198 -142
  18. package/lib/components/index.js +5 -1
  19. package/lib/components/system/SystemBackgroundTasksTable.js +83 -0
  20. package/lib/components/system/SystemSecurityForm.js +69 -0
  21. package/lib/components/system/spaces/SystemSpaceForm.js +44 -16
  22. package/lib/components/task/builder/Connector.js +19 -8
  23. package/lib/components/task/builder/ConnectorForm.js +1 -1
  24. package/lib/components/task/builder/Node.js +10 -3
  25. package/lib/components/task/builder/NodeForm.js +51 -22
  26. package/lib/components/task/builder/NodeParametersForm.js +5 -2
  27. package/lib/components/task/builder/SvgCanvas.js +13 -4
  28. package/lib/components/task/builder/TaskDefinitionConfigForm.js +113 -0
  29. package/lib/components/task/builder/TreeBuilder.js +25 -7
  30. package/lib/components/task/builder/builder.redux.js +159 -52
  31. package/lib/components/task/builder/helpers.js +5 -3
  32. package/lib/components/task/builder/models.js +84 -12
  33. package/lib/components/task/errors/RunErrorTable.js +1 -1
  34. package/lib/components/task/runs/CreateManualTriggerForm.js +15 -24
  35. package/lib/components/task/workflows/WorkflowForm.js +67 -85
  36. package/lib/index.js +1 -0
  37. package/package.json +2 -2
@@ -4,7 +4,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
4
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
5
  import axios from 'axios';
6
6
  import { bundle } from '../../helpers';
7
- import { fetchProfile } from '../../apis';
7
+ import { fetchProfile } from './profile';
8
8
  import { handleErrors } from '../http';
9
9
  export var login = function login(_ref) {
10
10
  var username = _ref.username,
@@ -20,7 +20,7 @@ export var logoutDirect = function logoutDirect() {
20
20
  return axios.get("".concat(bundle.spaceLocation(), "/app/logout"));
21
21
  };
22
22
  var checkedOrigin = process.env.REACT_APP_API_HOST ? process.env.REACT_APP_API_HOST : typeof window !== 'undefined' ? window.location.origin : null;
23
- var clientId = process.env.REACT_APP_OAUTH_CLIENT_ID || 'system';
23
+ var clientId = process.env.REACT_APP_OAUTH_CLIENT_ID ? process.env.REACT_APP_OAUTH_CLIENT_ID : process.env.NODE_ENV === 'production' ? 'system' : 'system-dev';
24
24
  export var retrieveJwt = function retrieveJwt() {
25
25
  return new Promise(function (resolve) {
26
26
  var iframe = document.createElement('iframe');
@@ -31,7 +31,7 @@ describe('securityPolicyDefinitions api', function () {
31
31
  securityPolicyDefinitions: [{
32
32
  message: 'Must be an administrator.',
33
33
  name: 'Admins',
34
- rule: "/* \n * Space admins are allowed access regardless of the the result of security \n * policies. Returning 'false' denies anyone but a space access. \n */\nfalse",
34
+ rule: "/* \n * Space admins are allowed access regardless of the result of security \n * policies. Returning 'false' denies anyone but a space access. \n */\nfalse",
35
35
  type: 'Space'
36
36
  }, {
37
37
  message: 'Must be authenticated.',
@@ -61,7 +61,7 @@ describe('securityPolicyDefinitions api', function () {
61
61
  securityPolicyDefinitions: [{
62
62
  message: 'Must be an administrator.',
63
63
  name: 'Admins',
64
- rule: "/* \n * Space admins are allowed access regardless of the the result of security \n * policies. Returning 'false' denies anyone but a space access. \n */\nfalse",
64
+ rule: "/* \n * Space admins are allowed access regardless of the result of security \n * policies. Returning 'false' denies anyone but a space access. \n */\nfalse",
65
65
  type: 'Space'
66
66
  }, {
67
67
  message: 'Must be authenticated.',
@@ -95,7 +95,7 @@ describe('securityPolicyDefinitions api', function () {
95
95
  securityPolicyDefinitions: [{
96
96
  message: 'Must be an administrator.',
97
97
  name: 'Admins',
98
- rule: "/* \n * Space admins are allowed access regardless of the the result of security \n * policies. Returning 'false' denies anyone but a space access. \n */\nfalse",
98
+ rule: "/* \n * Space admins are allowed access regardless of the result of security \n * policies. Returning 'false' denies anyone but a space access. \n */\nfalse",
99
99
  type: 'Kapp'
100
100
  }, {
101
101
  message: 'Must be authenticated.',
@@ -132,7 +132,7 @@ describe('securityPolicyDefinitions api', function () {
132
132
  securityPolicyDefinitions: [{
133
133
  message: 'Must be an administrator.',
134
134
  name: 'Admins',
135
- rule: "/* \n * Space admins are allowed access regardless of the the result of security \n * policies. Returning 'false' denies anyone but a space access. \n */\nfalse",
135
+ rule: "/* \n * Space admins are allowed access regardless of the result of security \n * policies. Returning 'false' denies anyone but a space access. \n */\nfalse",
136
136
  type: 'Kapp'
137
137
  }, {
138
138
  message: 'Must be authenticated.',
package/lib/apis/http.js CHANGED
@@ -24,7 +24,8 @@ export var handleErrors = function handleErrors(error) {
24
24
  _error$response$data = _error$response.data,
25
25
  data = _error$response$data === void 0 ? {} : _error$response$data,
26
26
  statusCode = _error$response.status,
27
- statusText = _error$response.statusText;
27
+ statusText = _error$response.statusText,
28
+ headers = _error$response.headers;
28
29
  var type = types[statusCode];
29
30
 
30
31
  var errorMessage = data.error,
@@ -33,7 +34,13 @@ export var handleErrors = function handleErrors(error) {
33
34
  message = data.message,
34
35
  rest = _objectWithoutProperties(data, ["error", "errorKey", "message"]);
35
36
 
36
- var result = typeof data === 'string' ? {
37
+ var result = headers && !headers['content-type'].startsWith('application/json') ? {
38
+ message: 'An unexpected error occurred.',
39
+ statusCode: statusCode
40
+ } : statusCode === 503 ? {
41
+ statusCode: statusCode,
42
+ message: 'The platform component you are using is not available. Please contact your administrator.'
43
+ } : typeof data === 'string' ? {
37
44
  message: data,
38
45
  statusCode: statusCode,
39
46
  key: key
@@ -269,7 +269,7 @@ export var updateSystemFilestore = function updateSystemFilestore() {
269
269
  };
270
270
  })["catch"](handleErrors);
271
271
  };
272
- var VALID_RESTARTABLE_COMPONENTS = ['agent', 'core', 'discussions', 'loghub', 'topics'];
272
+ var VALID_RESTARTABLE_COMPONENTS = ['agent', 'core', 'discussions', 'loghub', 'topics', 'indexer'];
273
273
  export var postPlatformComponentRestart = function postPlatformComponentRestart() {
274
274
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
275
275
 
@@ -336,6 +336,34 @@ export var fetchElasticSearchConfig = function fetchElasticSearchConfig() {
336
336
  };
337
337
  })["catch"](handleErrors);
338
338
  };
339
+ export var fetchSystemSecurity = function fetchSystemSecurity() {
340
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
341
+ return axios.get('/app/system-coordinator/api/v1/platform/system-security', {}, {
342
+ params: paramBuilder(options),
343
+ headers: headerBuilder(options)
344
+ }).then(function (response) {
345
+ return {
346
+ systemSecurity: response.data
347
+ };
348
+ })["catch"](handleErrors);
349
+ };
350
+ export var updateSystemSecurity = function updateSystemSecurity() {
351
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
352
+ var systemSecurity = options.systemSecurity;
353
+
354
+ if (!systemSecurity) {
355
+ throw new Error('updateSystemSecurity failed! The option "systemSecurity" is required.');
356
+ }
357
+
358
+ return axios.put("/app/system-coordinator/api/v1/platform/system-security", systemSecurity, {
359
+ params: paramBuilder(options),
360
+ headers: headerBuilder(options)
361
+ }).then(function (response) {
362
+ return {
363
+ systemSecurity: response.data
364
+ };
365
+ })["catch"](handleErrors);
366
+ };
339
367
  export var fetchSystemLicense = function fetchSystemLicense() {
340
368
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
341
369
  return axios.get('/app/system-coordinator/components/core/app/api/v1/license', {
@@ -406,4 +434,61 @@ export var fetchSystemLicenseCheck = function fetchSystemLicenseCheck() {
406
434
  system: response.data
407
435
  };
408
436
  })["catch"](handleErrors);
437
+ };
438
+ export var fetchSystemBackgroundTasks = function fetchSystemBackgroundTasks() {
439
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
440
+ return axios.get('/app/system-coordinator/api/v1/backgroundTasks', {
441
+ params: paramBuilder(options),
442
+ headers: headerBuilder(options)
443
+ }).then(function (response) {
444
+ return {
445
+ backgroundTasks: response.data.backgroundTasks
446
+ };
447
+ })["catch"](handleErrors);
448
+ };
449
+ export var fetchSystemBackgroundTask = function fetchSystemBackgroundTask() {
450
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
451
+ var id = options.id;
452
+
453
+ if (!id) {
454
+ throw new Error('fetchSystemBackgroundTask failed! The option "id" is required.');
455
+ }
456
+
457
+ return axios.get("/app/system-coordinator/api/v1/backgroundTasks/".concat(id), {
458
+ params: paramBuilder(options),
459
+ headers: headerBuilder(options)
460
+ }).then(function (response) {
461
+ return {
462
+ backgroundTask: response.data.backgroundTask
463
+ };
464
+ })["catch"](handleErrors);
465
+ };
466
+ export var deleteSystemBackgroundTask = function deleteSystemBackgroundTask() {
467
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
468
+ var id = options.id;
469
+
470
+ if (!id) {
471
+ throw new Error('deleteSystemBackgroundTask failed! The option "id" is required.');
472
+ }
473
+
474
+ return axios["delete"]("/app/system-coordinator/api/v1/backgroundTasks/".concat(id), {
475
+ params: paramBuilder(options),
476
+ headers: headerBuilder(options)
477
+ }).then(function (response) {
478
+ return {
479
+ backgroundTask: response.data.backgroundTask
480
+ };
481
+ })["catch"](handleErrors);
482
+ };
483
+ export var rotateEncryptionKey = function rotateEncryptionKey() {
484
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
485
+ var spaceSlug = options.spaceSlug;
486
+ return axios.post(spaceSlug ? "/app/system-coordinator/api/v1/tenants/".concat(spaceSlug, "/rotateEncryptionKey") : '/app/system-coordinator/api/v1/platform/rotateEncryptionKey', {}, {
487
+ params: paramBuilder(options),
488
+ headers: headerBuilder(options)
489
+ }).then(function (response) {
490
+ return {
491
+ system: response.data
492
+ };
493
+ })["catch"](handleErrors);
409
494
  };
@@ -1,4 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
1
  import axios from 'axios';
3
2
  import { get } from 'immutable';
4
3
  import { handleErrors, validateOptions } from '../http';
@@ -628,7 +627,9 @@ export var fetchTaskRuns = function fetchTaskRuns() {
628
627
  direction: options.direction,
629
628
  count: get(options, 'count'),
630
629
  start: options.start || undefined,
631
- end: options.end || undefined
630
+ end: options.end || undefined,
631
+ afterId: options.afterId || undefined,
632
+ beforeId: options.beforeId || undefined
632
633
  }
633
634
  }).then(function (response) {
634
635
  return {
@@ -772,16 +773,17 @@ export var fetchTaskRunError = function fetchTaskRunError() {
772
773
  };
773
774
  export var updateRunTaskResults = function updateRunTaskResults() {
774
775
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
775
- validateOptions('updateRunTaskResults', ['runId', 'taskId', 'results'], options);
776
- var resultKey = options.type || 'results';
777
- return axios.put("".concat(bundle.spaceLocation(), "/app/components/task/app/api/v2/runs/").concat(options.runId, "/tasks/").concat(options.taskId), _defineProperty({}, resultKey, options.results), {
776
+ validateOptions('updateRunTaskResults', ['runId', 'taskId'], options);
777
+ return axios.put("".concat(bundle.spaceLocation(), "/app/components/task/app/api/v2/runs/").concat(options.runId, "/tasks/").concat(options.taskId), {
778
+ deferredResults: options.deferredResults,
779
+ results: options.results,
780
+ message: options.message
781
+ }, {
778
782
  params: {
779
783
  include: options.include
780
784
  }
781
785
  }).then(function (response) {
782
- return {
783
- message: response.data
784
- };
786
+ return response.data;
785
787
  })["catch"](handleErrors);
786
788
  };
787
789
  export var resolveTaskErrors = function resolveTaskErrors() {
@@ -20,7 +20,8 @@ var searchOptions = function searchOptions(_ref) {
20
20
  var name = _ref2.name,
21
21
  staticValue = _ref2.value;
22
22
  return _objectSpread(_objectSpread({}, values), {}, _defineProperty({}, name, staticValue || value));
23
- }, {})
23
+ }, {}),
24
+ "public": !!search.get('public')
24
25
  }).then(function (_ref3) {
25
26
  var records = _ref3.records,
26
27
  error = _ref3.error;
@@ -75,7 +75,8 @@ var searchForms = function searchForms(_ref3) {
75
75
  kappSlug: search.get('kappSlug'),
76
76
  q: buildQuery(searchFields, value),
77
77
  include: search.get('include') || (search.get('datastore') ? '' : 'categorizations.category'),
78
- limit: search.get('limit') || 25
78
+ limit: search.get('limit') || 25,
79
+ "public": !!search.get('public')
79
80
  }).then(function (_ref4) {
80
81
  var forms = _ref4.forms,
81
82
  error = _ref4.error,
@@ -1,6 +1,7 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import React, { Fragment } from 'react';
3
- import { OrderedMap, Map } from 'immutable';
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.reduce(function (row, config) {
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
- var fields = options.reduce(function (fields, config) {
101
- var Field = fieldFromConfig(config, appliedComponents);
102
- var value = row.get(config.get('name'));
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
- fields: fields,
120
- options: options,
121
- onDelete: handleDeleteRow
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(TableLayout, {
125
- rows: fieldRows,
126
- onAdd: handleAddRow,
127
- options: options
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,
@@ -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/system';
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 = 30;
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
- csrfToken = _yield$call4$session.csrfToken;
402
- isAuthenticated = _yield$call4$session.isAuthenticated;
403
- spaceSlug = _yield$call4.spaceSlug;
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
- if (!isAuthenticated) {
406
- _context4.next = 23;
419
+ case 21:
420
+ if (!(isAuthenticated && !skipInit)) {
421
+ _context4.next = 27;
407
422
  break;
408
423
  }
409
424
 
410
- _context4.next = 20;
425
+ _context4.next = 24;
411
426
  return call(retrieveJwt);
412
427
 
413
- case 20:
428
+ case 24:
414
429
  _context4.t0 = _context4.sent;
415
- _context4.next = 24;
430
+ _context4.next = 28;
416
431
  break;
417
432
 
418
- case 23:
433
+ case 27:
419
434
  _context4.t0 = null;
420
435
 
421
- case 24:
436
+ case 28:
422
437
  _token = _context4.t0;
423
438
 
424
439
  if (!(socket && _token)) {
425
- _context4.next = 28;
440
+ _context4.next = 32;
426
441
  break;
427
442
  }
428
443
 
429
- _context4.next = 28;
444
+ _context4.next = 32;
430
445
  return call(socketIdentify, _token);
431
446
 
432
- case 28:
433
- _context4.next = 30;
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 30:
443
- _context4.next = 35;
457
+ case 34:
458
+ _context4.next = 39;
444
459
  break;
445
460
 
446
- case 32:
447
- _context4.prev = 32;
461
+ case 36:
462
+ _context4.prev = 36;
448
463
  _context4.t1 = _context4["catch"](1);
449
464
  console.error(_context4.t1);
450
465
 
451
- case 35:
466
+ case 39:
452
467
  case "end":
453
468
  return _context4.stop();
454
469
  }
455
470
  }
456
- }, _callee4, null, [[1, 32]]);
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 };
@@ -121,7 +121,7 @@ var fields = function fields(_ref4) {
121
121
  var filestores = _ref8.filestores;
122
122
  return filestores;
123
123
  }
124
- }].concat(_toConsumableArray(fileResourceSlug ? Object.entries(securityEndpoints).map(function (_ref9) {
124
+ }].concat(_toConsumableArray(Object.entries(securityEndpoints).map(function (_ref9) {
125
125
  var _ref10 = _slicedToArray(_ref9, 2),
126
126
  endpointFieldName = _ref10[0],
127
127
  endpoint = _ref10[1];
@@ -146,7 +146,7 @@ var fields = function fields(_ref4) {
146
146
  }, null, Map({})).get('name', '') : '',
147
147
  "transient": true
148
148
  };
149
- }) : []), [{
149
+ })), [{
150
150
  name: 'securityPolicies',
151
151
  label: 'Security Policies',
152
152
  type: null,