@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.
Files changed (88) hide show
  1. package/lib/apis/core/attributeDefinitions.js +3 -2
  2. package/lib/apis/core/authentication.js +13 -5
  3. package/lib/apis/core/backgroundJobs.js +22 -39
  4. package/lib/apis/core/fileResources.js +36 -0
  5. package/lib/apis/core/filestores.js +40 -0
  6. package/lib/apis/core/forms.js +21 -36
  7. package/lib/apis/core/forms.test.js +51 -278
  8. package/lib/apis/core/securityPolicyDefinitions.test.js +4 -4
  9. package/lib/apis/core/submissions.js +46 -30
  10. package/lib/apis/core/webhooks.js +1 -2
  11. package/lib/apis/discussions/index.js +2 -1
  12. package/lib/apis/http.js +28 -13
  13. package/lib/apis/http.test.js +13 -15
  14. package/lib/apis/index.js +2 -0
  15. package/lib/apis/system/index.js +86 -1
  16. package/lib/apis/task/index.js +22 -14
  17. package/lib/components/agent/filestore/FilestoreForm.js +132 -0
  18. package/lib/components/agent/filestore/FilestoreTable.js +53 -0
  19. package/lib/components/common/BridgeSelect.js +2 -1
  20. package/lib/components/common/FormSelect.js +2 -1
  21. package/lib/components/common/Scroller.js +6 -6
  22. package/lib/components/common/TableInput.js +74 -29
  23. package/lib/components/common/TeamSelect.js +2 -1
  24. package/lib/components/common/Typeahead.js +7 -4
  25. package/lib/components/common/UserSelect.js +2 -1
  26. package/lib/components/common/authentication/AuthenticationContainer.js +50 -27
  27. package/lib/components/common/code_input/languageHelpers.test.js +1 -1
  28. package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +1 -1
  29. package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +1 -1
  30. package/lib/components/core/core_form/CoreForm.js +10 -10
  31. package/lib/components/core/field_definition/FieldDefinitionForm.js +130 -0
  32. package/lib/components/core/field_definition/FieldDefinitionTable.js +86 -0
  33. package/lib/components/core/file_resource/FileResourceForm.js +180 -0
  34. package/lib/components/core/file_resource/FileResourceTable.js +71 -0
  35. package/lib/components/core/form/FormForm.js +12 -17
  36. package/lib/components/core/form/FormTable.js +3 -8
  37. package/lib/components/core/i18n/I18n.js +15 -15
  38. package/lib/components/core/index_definition/IndexDefinitionForm.js +32 -19
  39. package/lib/components/core/index_definition/IndexDefinitionTable.js +15 -24
  40. package/lib/components/core/index_job/IndexJobTable.js +12 -9
  41. package/lib/components/core/security_definition/SecurityDefinitionForm.js +1 -1
  42. package/lib/components/core/space/SpaceForm.js +59 -10
  43. package/lib/components/core/submission/DatastoreSubmissionTable.js +31 -1
  44. package/lib/components/core/submission/FormSubmissionFilters.js +378 -0
  45. package/lib/components/core/submission/FormSubmissionTable.js +116 -0
  46. package/lib/components/core/submission/KappSubmissionTable.js +250 -0
  47. package/lib/components/core/submission/SubmissionForm.js +124 -0
  48. package/lib/components/core/submission/SubmissionTable.js +35 -249
  49. package/lib/components/core/submission/helpers.js +95 -0
  50. package/lib/components/core/submission/helpers.test.js +96 -0
  51. package/lib/components/core/translation/ContextTable.js +1 -1
  52. package/lib/components/core/user/UserForm.js +2 -2
  53. package/lib/components/core/webapi/WebApiForm.js +111 -126
  54. package/lib/components/core/webhook/WebhookForm.js +1 -1
  55. package/lib/components/form/Form.helpers.js +1 -1
  56. package/lib/components/form/Form.js +200 -144
  57. package/lib/components/index.js +16 -6
  58. package/lib/components/system/SystemBackgroundTasksTable.js +83 -0
  59. package/lib/components/system/SystemSecurityForm.js +69 -0
  60. package/lib/components/system/helpers.js +20 -6
  61. package/lib/components/system/spaces/SystemSpaceForm.js +44 -16
  62. package/lib/components/system/spaces/SystemTenantForm.js +15 -9
  63. package/lib/components/system/spaces/SystemTenantTable.js +21 -16
  64. package/lib/components/table/Table.js +37 -10
  65. package/lib/components/table/Table.redux.js +228 -57
  66. package/lib/components/table/Table.redux.test.js +73 -2
  67. package/lib/components/task/builder/Connector.js +21 -10
  68. package/lib/components/task/builder/ConnectorForm.js +1 -1
  69. package/lib/components/task/builder/Node.js +10 -3
  70. package/lib/components/task/builder/NodeForm.js +54 -22
  71. package/lib/components/task/builder/NodeParametersForm.js +5 -2
  72. package/lib/components/task/builder/SvgCanvas.js +13 -4
  73. package/lib/components/task/builder/TaskDefinitionConfigForm.js +113 -0
  74. package/lib/components/task/builder/TreeBuilder.js +27 -9
  75. package/lib/components/task/builder/builder.redux.js +159 -52
  76. package/lib/components/task/builder/helpers.js +5 -3
  77. package/lib/components/task/builder/models.js +84 -12
  78. package/lib/components/task/errors/RunErrorTable.js +1 -1
  79. package/lib/components/task/runs/CreateManualTriggerForm.js +15 -24
  80. package/lib/components/task/runs/RunTable.js +5 -3
  81. package/lib/components/task/triggers/TriggerTable.js +3 -2
  82. package/lib/components/task/workflows/WorkflowForm.js +67 -85
  83. package/lib/helpers/index.js +19 -2
  84. package/lib/index.js +1 -0
  85. package/lib/models/discussions.js +18 -2
  86. package/lib/models/index.js +1 -1
  87. package/package.json +3 -3
  88. package/proxyhelper.js +19 -6
@@ -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';
@@ -5,19 +5,17 @@ import { generateForm } from '../../form/Form';
5
5
  import { fetchForm, fetchKapp, updateForm, createForm, fetchAttributeDefinitions, fetchSecurityPolicyDefinitions, fetchCategories, fetchSpace } from '../../../apis';
6
6
  import { buildBindings, slugify } from '../../../helpers';
7
7
  var FORM_STATUSES = ['New', 'Active', 'Inactive', 'Delete'];
8
- var FORM_INCLUDES = 'details,attributesMap,securityPolicies,indexDefinitions,backgroundJobs,fields,categorizations';
8
+ var FORM_INCLUDES = 'details,attributesMap,securityPolicies,backgroundJobs,fields,categorizations';
9
9
  var KAPP_INCLUDES = 'fields,formTypes,formAttributeDefinitions,kappAttributeDefinitions,securityPolicies';
10
- var SPACE_INCLUDES = 'spaceAttributeDefinitions,datastoreFormAttributeDefinitions';
10
+ var SPACE_INCLUDES = 'spaceAttributeDefinitions,formAttributeDefinitions,securityPolicies';
11
11
 
12
12
  var dataSources = function dataSources(_ref) {
13
13
  var formSlug = _ref.formSlug,
14
- kappSlug = _ref.kappSlug,
15
- datastore = _ref.datastore;
14
+ kappSlug = _ref.kappSlug;
16
15
  return {
17
16
  form: {
18
17
  fn: fetchForm,
19
18
  params: formSlug && [{
20
- datastore: datastore,
21
19
  formSlug: formSlug,
22
20
  kappSlug: kappSlug,
23
21
  include: FORM_INCLUDES
@@ -50,7 +48,7 @@ var dataSources = function dataSources(_ref) {
50
48
  params: [{
51
49
  kappSlug: kappSlug,
52
50
  formSlug: formSlug,
53
- attributeType: datastore ? 'datastoreFormAttributeDefinitions' : 'formAttributeDefinitions'
51
+ attributeType: 'formAttributeDefinitions'
54
52
  }],
55
53
  transform: function transform(result) {
56
54
  return result.attributeDefinitions;
@@ -80,11 +78,9 @@ var dataSources = function dataSources(_ref) {
80
78
 
81
79
  var handleSubmit = function handleSubmit(_ref2) {
82
80
  var formSlug = _ref2.formSlug,
83
- kappSlug = _ref2.kappSlug,
84
- datastore = _ref2.datastore;
81
+ kappSlug = _ref2.kappSlug;
85
82
  return function (values) {
86
83
  return (formSlug ? updateForm : createForm)({
87
- datastore: datastore,
88
84
  kappSlug: kappSlug,
89
85
  formSlug: formSlug,
90
86
  form: values.toJS()
@@ -131,22 +127,22 @@ var securityEndpoints = {
131
127
  formDisplay: {
132
128
  endpoint: 'Display',
133
129
  label: 'Form Display',
134
- types: ['Space', 'Kapp', 'Form', 'Datastore Form']
130
+ types: ['Space', 'Kapp', 'Form']
135
131
  },
136
132
  formModification: {
137
133
  endpoint: 'Modification',
138
134
  label: 'Form Modification',
139
- types: ['Space', 'Kapp', 'Form', 'Datastore Form']
135
+ types: ['Space', 'Kapp', 'Form']
140
136
  },
141
137
  submissionAccess: {
142
138
  endpoint: 'Submission Access',
143
139
  label: 'Submission Access',
144
- types: ['Space', 'Kapp', 'Form', 'Datastore Form', 'Submission', 'Datastore Submission']
140
+ types: ['Space', 'Kapp', 'Form', 'Submission']
145
141
  },
146
142
  submissionModification: {
147
143
  endpoint: 'Submission Modification',
148
144
  label: 'Submission Modification',
149
- types: ['Space', 'Kapp', 'Form', 'Datastore Form', 'Submission', 'Datastore Submission']
145
+ types: ['Space', 'Kapp', 'Form', 'Submission']
150
146
  }
151
147
  };
152
148
 
@@ -154,8 +150,7 @@ var fields = function fields(_ref5) {
154
150
  var formSlug = _ref5.formSlug,
155
151
  kappSlug = _ref5.kappSlug;
156
152
  return function (_ref6) {
157
- var form = _ref6.form,
158
- kapp = _ref6.kapp;
153
+ var form = _ref6.form;
159
154
  return (!formSlug || form) && [!!kappSlug && {
160
155
  name: 'anonymous',
161
156
  label: 'Anonymous',
@@ -233,7 +228,7 @@ var fields = function fields(_ref5) {
233
228
  space: space,
234
229
  kapp: kapp,
235
230
  form: form,
236
- scope: kappSlug ? 'Submission' : 'Datastore Submission'
231
+ scope: kappSlug ? 'Submission' : 'Submission'
237
232
  });
238
233
  }
239
234
  }, !!kappSlug && {
@@ -343,7 +338,7 @@ var fields = function fields(_ref5) {
343
338
  };
344
339
 
345
340
  export var FormForm = generateForm({
346
- formOptions: ['formSlug', 'kappSlug', 'datastore'],
341
+ formOptions: ['formSlug', 'kappSlug'],
347
342
  dataSources: dataSources,
348
343
  fields: fields,
349
344
  handleSubmit: handleSubmit
@@ -72,7 +72,6 @@ var formQuery = defineKqlQuery().matches('name', 'name').matches('slug', 'slug')
72
72
  var dataSource = function dataSource(_ref5) {
73
73
  var _ref5$kappSlug = _ref5.kappSlug,
74
74
  kappSlug = _ref5$kappSlug === void 0 ? null : _ref5$kappSlug,
75
- datastore = _ref5.datastore,
76
75
  _ref5$manage = _ref5.manage,
77
76
  manage = _ref5$manage === void 0 ? false : _ref5$manage,
78
77
  _ref5$surveyList = _ref5.surveyList,
@@ -82,8 +81,7 @@ var dataSource = function dataSource(_ref5) {
82
81
  params: function params(paramData) {
83
82
  return [_objectSpread(_objectSpread(_objectSpread({}, generateSortParams(paramData)), generatePaginationParams(paramData)), {}, {
84
83
  q: formQuery(paramData.filters.toJS()),
85
- include: "details".concat(datastore ? ',indexDefinitions,backgroundJobs' : ''),
86
- datastore: datastore,
84
+ include: 'details,indexDefinitions,backgroundJobs',
87
85
  kappSlug: kappSlug,
88
86
  manage: manage
89
87
  })];
@@ -140,7 +138,7 @@ var columns = [{
140
138
  title: 'Submission Label'
141
139
  }];
142
140
  export var FormTable = generateTable({
143
- tableOptions: ['kappSlug', 'datastore', 'manage', 'surveyList'],
141
+ tableOptions: ['kappSlug', 'manage', 'surveyList'],
144
142
  columns: columns,
145
143
  filters: filters,
146
144
  filterDataSources: filterDataSources,
@@ -150,8 +148,5 @@ FormTable.defaultProps = {};
150
148
  FormTable.displayName = 'FormTable';
151
149
  FormTable.propTypes = {
152
150
  /** Kapp Slug of associated forms to render. */
153
- kappSlug: t.string,
154
-
155
- /** If datastore forms should be rendered. */
156
- datastore: t.bool
151
+ kappSlug: t.string
157
152
  };
@@ -52,7 +52,7 @@ export var I18n = /*#__PURE__*/function (_React$Component) {
52
52
  }).then(function (_ref) {
53
53
  var submission = _ref.submission;
54
54
  // Build context using submission data
55
- var context = submission ? !!_this2.props.datastore ? "datastore.forms.".concat(submission.form.slug) : "kapps.".concat(submission.form.kapp.slug, ".forms.").concat(submission.form.slug) : null; // Store the context for the submissionId
55
+ var context = submission ? !submission.form.kapp.slug ? "forms.".concat(submission.form.slug) : "kapps.".concat(submission.form.kapp.slug, ".forms.").concat(submission.form.slug) : null; // Store the context for the submissionId
56
56
 
57
57
  submissionContexts[_this2.props.submissionId] = context; // Update loading state to false and set correct context
58
58
 
@@ -99,24 +99,24 @@ export var I18n = /*#__PURE__*/function (_React$Component) {
99
99
  }, _this3.props.children);
100
100
  } // Otherwise wrap children in a new instance of I18nProvider with the new context
101
101
  else if (_this3.state.context) {
102
- return /*#__PURE__*/React.createElement(I18nContext.Provider, {
103
- value: {
104
- context: _this3.state.context,
105
- locale: locale,
106
- translations: translations,
107
- loadTranslations: loadTranslations
108
- }
109
- }, /*#__PURE__*/React.createElement(I18nTranslate, {
102
+ return /*#__PURE__*/React.createElement(I18nContext.Provider, {
103
+ value: {
110
104
  context: _this3.state.context,
111
105
  locale: locale,
112
106
  translations: translations,
113
- loadTranslations: loadTranslations,
114
- "public": _this3.props["public"]
115
- }, _this3.props.children));
116
- } // Otherwise return children
117
- else {
118
- return _this3.props.children;
107
+ loadTranslations: loadTranslations
119
108
  }
109
+ }, /*#__PURE__*/React.createElement(I18nTranslate, {
110
+ context: _this3.state.context,
111
+ locale: locale,
112
+ translations: translations,
113
+ loadTranslations: loadTranslations,
114
+ "public": _this3.props["public"]
115
+ }, _this3.props.children));
116
+ } // Otherwise return children
117
+ else {
118
+ return _this3.props.children;
119
+ }
120
120
  }) : null;
121
121
  }
122
122
  }]);
@@ -1,6 +1,6 @@
1
- import { fetchForm, updateForm } from '../../../apis';
1
+ import { fetchForm, fetchKapp, fetchSpace, updateForm, updateSpace, updateKapp } from '../../../apis';
2
2
  import { generateForm } from '../../form/Form';
3
- var staticParts = ['createdAt', 'createdBy', 'handle', 'submittedAt', 'submittedBy', 'updatedAt', 'updatedBy'];
3
+ import { INDEX_STATIC_PARTS } from '../../../helpers';
4
4
 
5
5
  var getFields = function getFields(form) {
6
6
  return form.get('fields');
@@ -13,19 +13,19 @@ var getIndexDefinition = function getIndexDefinition(form, indexName) {
13
13
  };
14
14
 
15
15
  var dataSources = function dataSources(_ref) {
16
- var formSlug = _ref.formSlug,
16
+ var kappSlug = _ref.kappSlug,
17
+ formSlug = _ref.formSlug,
17
18
  indexName = _ref.indexName;
18
19
  return {
19
20
  form: {
20
- fn: fetchForm,
21
+ fn: !kappSlug && !formSlug ? fetchSpace : kappSlug && !formSlug ? fetchKapp : fetchForm,
21
22
  params: [{
22
- datastore: true,
23
- kappSlug: null,
23
+ kappSlug: kappSlug,
24
24
  formSlug: formSlug,
25
- include: 'fields,indexDefinitions'
25
+ include: 'fields,indexDefinitions,indexDefinitions.unpopulatedForms,indexDefinitions.detachedForms'
26
26
  }],
27
27
  transform: function transform(result) {
28
- return result.form;
28
+ return !kappSlug && !formSlug ? result.space : kappSlug && !formSlug ? result.kapp : result.form;
29
29
  }
30
30
  },
31
31
  fields: {
@@ -47,27 +47,39 @@ var dataSources = function dataSources(_ref) {
47
47
 
48
48
  var handleSubmit = function handleSubmit(_ref4) {
49
49
  var formSlug = _ref4.formSlug,
50
+ kappSlug = _ref4.kappSlug,
50
51
  indexName = _ref4.indexName;
51
52
  return function (values, _ref5) {
52
53
  var form = _ref5.form;
53
- return updateForm({
54
- datastore: true,
55
- kappSlug: null,
54
+ var indexDefinitions = indexName ? form.get('indexDefinitions').map(function (indexDefinition) {
55
+ return indexDefinition.get('name') === indexName ? values : indexDefinition;
56
+ }).toJS() : form.get('indexDefinitions').push(values).toJS();
57
+ return (!kappSlug && !formSlug ? updateSpace({
58
+ space: {
59
+ indexDefinitions: indexDefinitions
60
+ }
61
+ }) : kappSlug && !formSlug ? updateKapp({
62
+ kappSlug: kappSlug,
63
+ kapp: {
64
+ indexDefinitions: indexDefinitions
65
+ }
66
+ }) : updateForm({
67
+ kappSlug: kappSlug,
56
68
  formSlug: formSlug,
57
69
  form: {
58
- indexDefinitions: indexName ? form.get('indexDefinitions').map(function (indexDefinition) {
59
- return indexDefinition.get('name') === indexName ? values : indexDefinition;
60
- }).toJS() : form.get('indexDefinitions').push(values).toJS()
70
+ indexDefinitions: indexDefinitions
61
71
  }
62
- }).then(function (_ref6) {
72
+ })).then(function (_ref6) {
63
73
  var form = _ref6.form,
74
+ kapp = _ref6.kapp,
75
+ space = _ref6.space,
64
76
  error = _ref6.error;
65
77
 
66
78
  if (error) {
67
79
  throw error.statusCode === 400 && error.message || 'There was an error saving the index definition';
68
80
  }
69
81
 
70
- return form;
82
+ return !kappSlug && !formSlug ? space : kappSlug && !formSlug ? kapp : form;
71
83
  });
72
84
  };
73
85
  };
@@ -86,7 +98,7 @@ var fields = function fields(_ref7) {
86
98
  var fields = _ref9.fields;
87
99
  return fields ? fields.map(function (field) {
88
100
  return "values[".concat(field.get('name'), "]");
89
- }).sort().concat(staticParts).map(function (name) {
101
+ }).sort().concat(INDEX_STATIC_PARTS).map(function (name) {
90
102
  return {
91
103
  label: name,
92
104
  value: name
@@ -98,13 +110,14 @@ var fields = function fields(_ref7) {
98
110
  name: 'unique',
99
111
  label: 'Unique',
100
112
  type: 'checkbox',
101
- initialValue: indexDefinition ? indexDefinition.get('unique') : false
113
+ initialValue: indexDefinition ? indexDefinition.get('unique') : false,
114
+ visible: !!formSlug
102
115
  }];
103
116
  };
104
117
  };
105
118
 
106
119
  export var IndexDefinitionForm = generateForm({
107
- formOptions: ['formSlug', 'indexName'],
120
+ formOptions: ['kappSlug', 'formSlug', 'indexName'],
108
121
  dataSources: dataSources,
109
122
  fields: fields,
110
123
  handleSubmit: handleSubmit
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { generateTable } from '../../table/Table';
3
- import { fetchForm } from '../../../apis';
3
+ import { fetchForm, fetchKapp, fetchSpace } from '../../../apis';
4
4
  import { defineFilter } from '../../../helpers';
5
5
  var clientSide = defineFilter(true).startsWith('name', 'name').equals('status', 'status').equals('unique', 'unique').end(); // const indexStatuses = ['New', 'Building', 'Built', 'Failed'];
6
6
 
@@ -9,40 +9,25 @@ var BooleanYesNoCell = function BooleanYesNoCell(props) {
9
9
  };
10
10
 
11
11
  var dataSource = function dataSource(_ref) {
12
- var formSlug = _ref.formSlug;
12
+ var kappSlug = _ref.kappSlug,
13
+ formSlug = _ref.formSlug;
13
14
  return {
14
- fn: fetchForm,
15
+ fn: !kappSlug && !formSlug ? fetchSpace : kappSlug && !formSlug ? fetchKapp : fetchForm,
15
16
  clientSide: clientSide,
16
17
  params: function params() {
17
18
  return [{
18
- datastore: true,
19
- kappSlug: null,
19
+ kappSlug: kappSlug,
20
20
  formSlug: formSlug,
21
- include: 'indexDefinitions'
21
+ include: 'indexDefinitions,indexDefinitions.details,indexDefinitions.detachedForms,indexDefinitions.unpopulatedForms'
22
22
  }];
23
23
  },
24
24
  transform: function transform(result) {
25
25
  return {
26
- data: result.form.indexDefinitions
26
+ data: (!kappSlug && !formSlug ? result.space : kappSlug && !formSlug ? result.kapp : result.form).indexDefinitions
27
27
  };
28
28
  }
29
29
  };
30
- }; // const filters = () => () => [
31
- // { name: 'name', label: 'Name', type: 'text' },
32
- // {
33
- // name: 'status',
34
- // label: 'Status',
35
- // type: 'select',
36
- // options: indexStatuses.map(el => ({ value: el, label: el })),
37
- // },
38
- // {
39
- // name: 'unique',
40
- // label: 'Unique',
41
- // type: 'select',
42
- // options: ['Yes', 'No'].map(el => ({ value: el, label: el })),
43
- // },
44
- // ];
45
-
30
+ };
46
31
 
47
32
  var columns = [{
48
33
  value: 'name',
@@ -59,9 +44,15 @@ var columns = [{
59
44
  }, {
60
45
  value: 'parts',
61
46
  title: 'Parts'
47
+ }, {
48
+ value: 'unpopulatedForms',
49
+ title: 'Unpopulated Forms'
50
+ }, {
51
+ value: 'detatchedForms',
52
+ title: 'Detatched Forms'
62
53
  }];
63
54
  export var IndexDefinitionTable = generateTable({
64
- tableOptions: ['formSlug'],
55
+ tableOptions: ['kappSlug', 'formSlug'],
65
56
  sortable: false,
66
57
  columns: columns,
67
58
  // filters,
@@ -1,19 +1,22 @@
1
1
  import React from 'react';
2
- import { fetchBackgroundJobs, fetchForm } from '../../../apis';
2
+ import { fetchBackgroundJobs } from '../../../apis';
3
3
  import { generateTable } from '../../table/Table';
4
4
  import { defineFilter } from '../../../helpers';
5
5
  var clientSide = defineFilter(true).equals('status', 'status').between('startedAt', 'minStartedAt', 'maxStartedAt').end();
6
6
  var indexJobStatuses = ['Running', 'Paused'];
7
7
 
8
8
  var dataSource = function dataSource(_ref) {
9
- var formSlug = _ref.formSlug;
9
+ var formSlug = _ref.formSlug,
10
+ kappSlug = _ref.kappSlug,
11
+ _ref$completed = _ref.completed,
12
+ completed = _ref$completed === void 0 ? false : _ref$completed;
10
13
  return {
11
14
  fn: function fn() {
12
- return formSlug ? fetchForm({
13
- datastore: true,
15
+ return fetchBackgroundJobs({
14
16
  formSlug: formSlug,
15
- include: 'backgroundJobs'
16
- }) : fetchBackgroundJobs();
17
+ kappSlug: kappSlug,
18
+ completed: completed
19
+ });
17
20
  },
18
21
  clientSide: clientSide,
19
22
  params: function params() {
@@ -21,7 +24,7 @@ var dataSource = function dataSource(_ref) {
21
24
  },
22
25
  transform: function transform(result) {
23
26
  return {
24
- data: formSlug ? result.form.backgroundJobs : result.backgroundJobs
27
+ data: result.backgroundJobs
25
28
  };
26
29
  }
27
30
  };
@@ -81,7 +84,7 @@ var columns = [{
81
84
  title: 'Progress',
82
85
  components: {
83
86
  BodyCell: function BodyCell(props) {
84
- return /*#__PURE__*/React.createElement("td", null, props.value && props.value.get('count') ? "".concat(props.value.get('count'), " submissions") : 'None');
87
+ return /*#__PURE__*/React.createElement("td", null, "".concat(props.value));
85
88
  }
86
89
  }
87
90
  }, {
@@ -98,7 +101,7 @@ var columns = [{
98
101
  title: 'Type'
99
102
  }];
100
103
  export var IndexJobTable = generateTable({
101
- tableOptions: ['formSlug'],
104
+ tableOptions: ['formSlug', 'kappSlug', 'completed'],
102
105
  dataSource: dataSource,
103
106
  columns: columns,
104
107
  filters: filters,
@@ -1,7 +1,7 @@
1
1
  import { generateForm } from '../../form/Form';
2
2
  import { fetchSecurityPolicyDefinition, createSecurityPolicyDefinition, updateSecurityPolicyDefinition, fetchSpace, fetchKapp, fetchProfile } from '../../../apis';
3
3
  import { buildBindings } from '../../../helpers';
4
- export var SPACE_SECURITY_DEFINITION_TYPES = ['Space', 'Datastore Form', 'Datastore Submission', 'Team', 'User'];
4
+ export var SPACE_SECURITY_DEFINITION_TYPES = ['Space', 'File Resource', 'Team', 'User'];
5
5
  export var KAPP_SECURITY_DEFINITION_TYPES = ['Kapp', 'Form', 'Submission'];
6
6
  var SPACE_INCLUDES = 'datastoreFormAttributeDefinitions,spaceAttributeDefinitions,teamAttributeDefinitions,userAttributeDefinitions,userProfileAttributeDefinitions';
7
7
  var KAPP_INCLUDES = 'formAttributeDefinitions,kappAttributeDefinitions,fields';