@kineticdata/react 6.0.4 → 6.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 (100) hide show
  1. package/CHANGELOG.md +116 -86
  2. package/lib/apis/core/attributeDefinitions.js +9 -6
  3. package/lib/apis/core/integrations.js +61 -0
  4. package/lib/apis/core/submissions.js +52 -15
  5. package/lib/apis/http.js +16 -2
  6. package/lib/apis/index.js +24 -0
  7. package/lib/apis/integrator/index.js +262 -0
  8. package/lib/apis/system/index.js +64 -12
  9. package/lib/apis/task/index.js +9 -2
  10. package/lib/components/agent/filestore/FilestoreForm.js +1 -1
  11. package/lib/components/common/AttributeSelect.js +10 -2
  12. package/lib/components/common/BridgeSelect.js +2 -1
  13. package/lib/components/common/ConnectionSelect.js +72 -0
  14. package/lib/components/common/FormSelect.js +2 -1
  15. package/lib/components/common/StaticSelect.js +15 -6
  16. package/lib/components/common/TableInput.js +4 -1
  17. package/lib/components/common/TeamSelect.js +2 -1
  18. package/lib/components/common/ToastContainer.js +34 -10
  19. package/lib/components/common/Typeahead.js +59 -23
  20. package/lib/components/common/UserSelect.js +2 -1
  21. package/lib/components/common/authentication/RequestInterceptor.js +1 -1
  22. package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +3 -0
  23. package/lib/components/core/bridge_model/BridgeModelTable.js +19 -0
  24. package/lib/components/core/bridge_model_attribute/BridgeModelAttributeForm.js +6 -9
  25. package/lib/components/core/bridge_model_attribute/BridgeModelAttributeTable.js +0 -4
  26. package/lib/components/core/bridge_model_qualification/BridgeModelQualificationForm.js +7 -10
  27. package/lib/components/core/bridge_model_qualification/BridgeModelQualificationTable.js +2 -15
  28. package/lib/components/core/category/CategoryForm.js +4 -1
  29. package/lib/components/core/category/CategoryTable.js +2 -2
  30. package/lib/components/core/core_form/CoreForm.js +18 -10
  31. package/lib/components/core/file_resource/FileResourceForm.js +2 -1
  32. package/lib/components/core/file_resource/FileResourceTable.js +14 -7
  33. package/lib/components/core/form/FormForm.js +42 -19
  34. package/lib/components/core/form/FormTable.js +14 -14
  35. package/lib/components/core/form_type/FormTypeForm.js +3 -0
  36. package/lib/components/core/i18n/Moment.js +1 -0
  37. package/lib/components/core/integration/IntegrationForm.js +232 -0
  38. package/lib/components/core/integration/IntegrationTable.js +139 -0
  39. package/lib/components/core/kapp/KappForm.js +56 -67
  40. package/lib/components/core/kapp/KappTable.js +3 -3
  41. package/lib/components/core/log/LogTable.js +1 -1
  42. package/lib/components/core/security_definition/SecurityDefinitionForm.js +48 -10
  43. package/lib/components/core/space/SpaceForm.js +97 -111
  44. package/lib/components/core/submission/DatastoreSubmissionTable.js +4 -4
  45. package/lib/components/core/submission/FormSubmissionTable.js +12 -7
  46. package/lib/components/core/submission/KappSubmissionTable.js +4 -4
  47. package/lib/components/core/submission/SubmissionForm.js +3 -1
  48. package/lib/components/core/team/TeamTable.js +17 -7
  49. package/lib/components/core/user/UserTable.js +18 -18
  50. package/lib/components/core/webapi/WebApiForm.js +5 -2
  51. package/lib/components/core/webapi/WebApiTable.js +2 -2
  52. package/lib/components/core/webhook/WebhookForm.js +43 -33
  53. package/lib/components/core/webhook/WebhookTable.js +16 -16
  54. package/lib/components/core/webhook_job/WebhookJobTable.js +17 -6
  55. package/lib/components/form/Form.helpers.js +10 -4
  56. package/lib/components/form/Form.js +250 -168
  57. package/lib/components/form/Form.models.js +6 -1
  58. package/lib/components/form/FormState.js +9 -5
  59. package/lib/components/form/defaults/CodeField.js +44 -1
  60. package/lib/components/index.js +84 -3
  61. package/lib/components/integrator/connection/ConnectionForm.js +112 -0
  62. package/lib/components/integrator/connection/ConnectionTable.js +80 -0
  63. package/lib/components/integrator/connection/config_fields/http.js +570 -0
  64. package/lib/components/integrator/integrationTypes.js +98 -0
  65. package/lib/components/integrator/operation/OperationForm.js +128 -0
  66. package/lib/components/integrator/operation/OperationTable.js +64 -0
  67. package/lib/components/integrator/operation/config_fields/http.js +184 -0
  68. package/lib/components/system/SystemSecurityForm.js +1 -1
  69. package/lib/components/system/SystemTaskAdapterForm.js +9 -9
  70. package/lib/components/system/helpers.js +123 -100
  71. package/lib/components/system/spaces/SystemSpaceForm.js +9 -37
  72. package/lib/components/system/spaces/SystemTenantForm.js +276 -104
  73. package/lib/components/system/spaces/SystemTenantMigrateForm.js +449 -0
  74. package/lib/components/system/spaces/SystemTenantTable.js +20 -16
  75. package/lib/components/table/Table.redux.js +1 -1
  76. package/lib/components/task/builder/ConnectorForm.js +11 -7
  77. package/lib/components/task/builder/Node.js +11 -2
  78. package/lib/components/task/builder/NodeForm.js +93 -22
  79. package/lib/components/task/builder/NodeParametersForm.js +29 -17
  80. package/lib/components/task/builder/TaskDefinitionConfigForm.js +18 -50
  81. package/lib/components/task/builder/TreeBuilder.js +32 -5
  82. package/lib/components/task/builder/builder.redux.js +399 -205
  83. package/lib/components/task/builder/constants.js +10 -2
  84. package/lib/components/task/builder/helpers.js +199 -79
  85. package/lib/components/task/builder/models.js +11 -9
  86. package/lib/components/task/category/TaskCategoryTable.js +3 -3
  87. package/lib/components/task/common/UsageTable.js +1 -1
  88. package/lib/components/task/handlers/HandlerTable.js +35 -19
  89. package/lib/components/task/policy_rule/PolicyRuleTable.js +3 -3
  90. package/lib/components/task/runs/CreateManualTriggerForm.js +2 -0
  91. package/lib/components/task/runs/RunTable.js +4 -4
  92. package/lib/components/task/runs/RunTaskTable.js +1 -1
  93. package/lib/components/task/sources/SourceTable.js +2 -2
  94. package/lib/components/task/triggers/TriggerTable.js +2 -2
  95. package/lib/components/task/workflows/LinkedWorkflowTable.js +2 -2
  96. package/lib/components/task/workflows/WorkflowForm.js +29 -9
  97. package/lib/components/task/workflows/WorkflowTable.js +2 -2
  98. package/lib/helpers/index.js +289 -72
  99. package/package.json +5 -3
  100. package/proxyhelper.js +28 -3
@@ -12,9 +12,9 @@ var _Form = require("../../form/Form");
12
12
  var _apis = require("../../../apis");
13
13
  var _helpers = require("../../../helpers");
14
14
  var FORM_STATUSES = ['New', 'Active', 'Inactive', 'Delete'];
15
- var FORM_INCLUDES = 'details,attributesMap,securityPolicies,backgroundJobs,fields,categorizations';
15
+ var FORM_INCLUDES = 'details,attributesMap,securityPolicies,backgroundJobs,fields,categorizations,categorizations.category,categorizations.category.attributes[Parent]';
16
16
  var KAPP_INCLUDES = 'fields,formTypes,formAttributeDefinitions,kappAttributeDefinitions,securityPolicies';
17
- var SPACE_INCLUDES = 'spaceAttributeDefinitions,formAttributeDefinitions,securityPolicies';
17
+ var SPACE_INCLUDES = 'spaceAttributeDefinitions,securityPolicies';
18
18
  var dataSources = function dataSources(_ref) {
19
19
  var formSlug = _ref.formSlug,
20
20
  kappSlug = _ref.kappSlug;
@@ -102,7 +102,8 @@ var handleSubmit = function handleSubmit(_ref2) {
102
102
  var buildLabel = function buildLabel(_ref4) {
103
103
  var name = _ref4.name,
104
104
  category = _ref4.category,
105
- categories = _ref4.categories;
105
+ categories = _ref4.categories,
106
+ loading = _ref4.loading;
106
107
  var match = null;
107
108
  if (category.get('attributes').size) {
108
109
  category.get('attributes').map(function (c) {
@@ -113,8 +114,9 @@ var buildLabel = function buildLabel(_ref4) {
113
114
  name = match ? buildLabel({
114
115
  name: "".concat(match.get('name'), "::").concat(name),
115
116
  category: match,
116
- categories: categories
117
- }) : "(Missing Category ".concat(c.getIn(['values', 0]), ")::").concat(name);
117
+ categories: categories,
118
+ loading: loading
119
+ }) : loading ? "".concat(c.getIn(['values', 0]), "::").concat(name) : "(Missing Category ".concat(c.getIn(['values', 0]), ")::").concat(name);
118
120
  }
119
121
  return name;
120
122
  });
@@ -125,22 +127,22 @@ var securityEndpoints = {
125
127
  formDisplay: {
126
128
  endpoint: 'Display',
127
129
  label: 'Form Display',
128
- types: ['Space', 'Kapp', 'Form']
130
+ types: ['Kapp', 'Form']
129
131
  },
130
132
  formModification: {
131
133
  endpoint: 'Modification',
132
134
  label: 'Form Modification',
133
- types: ['Space', 'Kapp', 'Form']
135
+ types: ['Kapp', 'Form']
134
136
  },
135
137
  submissionAccess: {
136
138
  endpoint: 'Submission Access',
137
139
  label: 'Submission Access',
138
- types: ['Space', 'Kapp', 'Form', 'Submission']
140
+ types: ['Kapp', 'Form', 'Submission']
139
141
  },
140
142
  submissionModification: {
141
143
  endpoint: 'Submission Modification',
142
144
  label: 'Submission Modification',
143
- types: ['Space', 'Kapp', 'Form', 'Submission']
145
+ types: ['Kapp', 'Form', 'Submission']
144
146
  }
145
147
  };
146
148
  var fields = function fields(_ref5) {
@@ -221,12 +223,24 @@ var fields = function fields(_ref5) {
221
223
  options: function options(_ref10) {
222
224
  var space = _ref10.space,
223
225
  kapp = _ref10.kapp,
224
- form = _ref10.form;
225
- return (0, _helpers.buildBindings)({
226
- space: space,
227
- kapp: kapp,
228
- form: form,
229
- scope: kappSlug ? 'Submission' : 'Submission'
226
+ form = _ref10.form,
227
+ attributeDefinitions = _ref10.attributeDefinitions;
228
+ return (0, _helpers.buildCodeEditorBindings)({
229
+ space: {
230
+ attributeDefinitions: space === null || space === void 0 ? void 0 : space.get('spaceAttributeDefinitions')
231
+ },
232
+ kapp: {
233
+ attributeDefinitions: kapp === null || kapp === void 0 ? void 0 : kapp.get('kappAttributeDefinitions')
234
+ },
235
+ form: {
236
+ attributeDefinitions: attributeDefinitions
237
+ },
238
+ submission: {
239
+ detailed: true
240
+ },
241
+ values: (form === null || form === void 0 ? void 0 : form.get('fields').size) > 0 && {
242
+ data: form.get('fields')
243
+ }
230
244
  });
231
245
  }
232
246
  }, !!kappSlug && {
@@ -259,7 +273,8 @@ var fields = function fields(_ref5) {
259
273
  }).map(function (definition) {
260
274
  return (0, _immutable.Map)({
261
275
  value: definition.get('name'),
262
- label: definition.get('name')
276
+ label: definition.get('name'),
277
+ type: definition.get('type')
263
278
  });
264
279
  }) : [];
265
280
  },
@@ -304,13 +319,21 @@ var fields = function fields(_ref5) {
304
319
  label: 'Categories',
305
320
  type: 'select-multi',
306
321
  options: function options(_ref19) {
307
- var categories = _ref19.categories;
308
- return categories ? categories.map(function (category) {
322
+ var categories = _ref19.categories,
323
+ form = _ref19.form;
324
+ // Until categories are fetched, use the data from the form's
325
+ // categories to build options to minimize the flash of the slug values
326
+ // changing to the names
327
+ var categoriesList = categories || (form === null || form === void 0 ? void 0 : form.get('categorizations').map(function (c) {
328
+ return c.get('category');
329
+ }));
330
+ return categoriesList ? categoriesList.map(function (category) {
309
331
  return (0, _immutable.Map)({
310
332
  label: buildLabel({
311
333
  name: category.get('name'),
312
334
  category: category,
313
- categories: categories
335
+ categories: categoriesList,
336
+ loading: !categories
314
337
  }),
315
338
  value: category.get('slug')
316
339
  });
@@ -110,9 +110,21 @@ var columns = [{
110
110
  title: 'Slug',
111
111
  sortable: true,
112
112
  toggleable: true
113
+ }, {
114
+ value: 'type',
115
+ title: 'Type',
116
+ sortable: true,
117
+ filter: 'startsWith',
118
+ type: 'text',
119
+ toggleable: true
120
+ }, {
121
+ value: 'status',
122
+ title: 'Status',
123
+ sortable: true,
124
+ toggleable: true
113
125
  }, {
114
126
  value: 'createdAt',
115
- title: 'Created',
127
+ title: 'Created At',
116
128
  sortable: true,
117
129
  toggleable: true
118
130
  }, {
@@ -121,7 +133,7 @@ var columns = [{
121
133
  toggleable: true
122
134
  }, {
123
135
  value: 'updatedAt',
124
- title: 'Updated',
136
+ title: 'Updated At',
125
137
  sortable: true,
126
138
  toggleable: true
127
139
  }, {
@@ -133,18 +145,6 @@ var columns = [{
133
145
  value: 'notes',
134
146
  title: 'Notes',
135
147
  toggleable: true
136
- }, {
137
- value: 'status',
138
- title: 'Status',
139
- sortable: true,
140
- toggleable: true
141
- }, {
142
- value: 'type',
143
- title: 'Type',
144
- sortable: true,
145
- filter: 'startsWith',
146
- type: 'text',
147
- toggleable: true
148
148
  }, {
149
149
  value: 'submissionLabelExpression',
150
150
  title: 'Submission Label',
@@ -19,6 +19,9 @@ var dataSources = function dataSources(_ref) {
19
19
  }],
20
20
  transform: function transform(result) {
21
21
  return result.formType;
22
+ },
23
+ errorTransform: function errorTransform(result) {
24
+ return result.error;
22
25
  }
23
26
  }
24
27
  };
@@ -171,6 +171,7 @@ Moment.formats = {
171
171
  dateShort: 'll',
172
172
  dateWithDayShort: 'ddd, ll',
173
173
  dateTime: 'LLL',
174
+ dateTimeWithSeconds: 'LL LTS',
174
175
  dateTimeNumeric: 'L LT',
175
176
  dateTimeShort: 'lll',
176
177
  dateTimeWithDay: 'LLLL',
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.IntegrationForm = void 0;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
11
+ var _Form = require("../../form/Form");
12
+ var _apis = require("../../../apis");
13
+ var _immutable = require("immutable");
14
+ var _integrationTypes = _interopRequireWildcard(require("../../integrator/integrationTypes"));
15
+ var dataSources = function dataSources(_ref) {
16
+ var kappSlug = _ref.kappSlug,
17
+ name = _ref.name;
18
+ return {
19
+ integration: {
20
+ fn: _apis.fetchIntegration,
21
+ params: name && [{
22
+ kappSlug: kappSlug,
23
+ name: name,
24
+ include: 'securityPolicies'
25
+ }],
26
+ transform: function transform(result) {
27
+ return result.integration;
28
+ },
29
+ errorTransform: function errorTransform(result) {
30
+ return result.error;
31
+ }
32
+ },
33
+ connections: {
34
+ fn: _apis.fetchConnections,
35
+ params: [],
36
+ transform: function transform(result) {
37
+ return result.connections;
38
+ }
39
+ },
40
+ operations: {
41
+ fn: _apis.fetchOperations,
42
+ params: function params(_ref2) {
43
+ var values = _ref2.values,
44
+ integration = _ref2.integration;
45
+ var connectionId = (values === null || values === void 0 ? void 0 : values.get('connectionId')) || (integration === null || integration === void 0 ? void 0 : integration.get('connectionId'));
46
+ return connectionId && [{
47
+ connectionId: connectionId
48
+ }];
49
+ },
50
+ transform: function transform(result) {
51
+ return result.operations;
52
+ }
53
+ },
54
+ parameters: {
55
+ fn: function fn(options) {
56
+ return !!options.operationId ? (0, _apis.inspectOperation)(options) : Promise.resolve({});
57
+ },
58
+ params: function params(_ref3) {
59
+ var values = _ref3.values;
60
+ return [{
61
+ operationId: values === null || values === void 0 ? void 0 : values.get('operationId')
62
+ }];
63
+ }
64
+ },
65
+ securityPolicyDefinitions: {
66
+ fn: _apis.fetchSecurityPolicyDefinitions,
67
+ params: kappSlug && [{
68
+ kappSlug: kappSlug
69
+ }],
70
+ transform: function transform(result) {
71
+ return result.securityPolicyDefinitions;
72
+ }
73
+ }
74
+ };
75
+ };
76
+ var handleSubmit = function handleSubmit(_ref4) {
77
+ var kappSlug = _ref4.kappSlug,
78
+ name = _ref4.name;
79
+ return function (values) {
80
+ return (name ? _apis.updateIntegration : _apis.createIntegration)({
81
+ integration: values.toJS(),
82
+ kappSlug: kappSlug,
83
+ name: name
84
+ }).then(function (_ref5) {
85
+ var integration = _ref5.integration,
86
+ error = _ref5.error;
87
+ if (error) {
88
+ throw error.statusCode === 400 && error.message || 'There was an error saving the integration';
89
+ }
90
+ return integration;
91
+ });
92
+ };
93
+ };
94
+ var securityEndpoints = {
95
+ execution: {
96
+ endpoint: 'Execution',
97
+ label: 'Execution Security Policy',
98
+ types: ['Kapp']
99
+ }
100
+ };
101
+ var fields = function fields(_ref6) {
102
+ var name = _ref6.name;
103
+ return function (_ref7) {
104
+ var integration = _ref7.integration,
105
+ connections = _ref7.connections,
106
+ operations = _ref7.operations;
107
+ return (!name || integration) && connections && (!(integration !== null && integration !== void 0 && integration.get('connectionId')) || operations) && [{
108
+ name: 'name',
109
+ label: 'Name',
110
+ type: 'text',
111
+ pattern: /^[a-z\d-]+[a-z\d\s-]*$/i,
112
+ patternMessage: 'Name can only contain alpha-numeric characters, spaces, and hyphens, and cannot start with spaces.',
113
+ required: true,
114
+ initialValue: integration ? integration.get('name') : ''
115
+ }, {
116
+ name: 'connectionId',
117
+ label: 'Connection',
118
+ type: 'select',
119
+ required: true,
120
+ initialValue: integration ? integration.get('connectionId') : '',
121
+ options: function options(_ref8) {
122
+ var connections = _ref8.connections;
123
+ return connections.map(function (conn) {
124
+ var _getConnectionMetadat;
125
+ return (0, _immutable.Map)({
126
+ value: conn.get('id'),
127
+ label: conn.get('name'),
128
+ type: _integrationTypes["default"].getLabel(conn.get('type')),
129
+ detail: (_getConnectionMetadat = (0, _integrationTypes.getConnectionMetadata)(conn)) === null || _getConnectionMetadat === void 0 ? void 0 : _getConnectionMetadat.optionDetail
130
+ });
131
+ });
132
+ },
133
+ onChange: function onChange(bindings, _ref9) {
134
+ var setValue = _ref9.setValue;
135
+ setValue('operationId', '');
136
+ setValue('inputMappings', {});
137
+ }
138
+ }, {
139
+ name: 'operationId',
140
+ label: 'Operation',
141
+ type: 'select',
142
+ required: true,
143
+ initialValue: integration ? integration.get('operationId') : '',
144
+ options: function options(_ref10) {
145
+ var operations = _ref10.operations,
146
+ values = _ref10.values;
147
+ return (operations || (0, _immutable.List)()
148
+ // Make sure we only show correct operations while waiting on data to
149
+ // be fetched
150
+ ).filter(function (op) {
151
+ return op.get('connectionId') === values.get('connectionId');
152
+ }).map(function (op) {
153
+ var _getOperationMetadata;
154
+ return (0, _immutable.Map)({
155
+ value: op.get('id'),
156
+ label: op.get('name'),
157
+ detail: (_getOperationMetadata = (0, _integrationTypes.getOperationMetadata)(op)) === null || _getOperationMetadata === void 0 ? void 0 : _getOperationMetadata.optionDetail
158
+ });
159
+ });
160
+ },
161
+ enabled: function enabled(_ref11) {
162
+ var values = _ref11.values;
163
+ return !!values.get('connectionId');
164
+ },
165
+ placeholder: function placeholder(_ref12) {
166
+ var values = _ref12.values;
167
+ return !values.get('connectionId') ? 'Select a connection' : undefined;
168
+ }
169
+ }, {
170
+ name: 'inputMappings',
171
+ label: 'Parameter Mappings',
172
+ type: 'map',
173
+ initialValue: integration ? integration.get('inputMappings') : {},
174
+ enabled: function enabled(_ref13) {
175
+ var values = _ref13.values;
176
+ return !!values.get('operationId');
177
+ }
178
+ }].concat((0, _toConsumableArray2["default"])(Object.entries(securityEndpoints).map(function (_ref14) {
179
+ var _ref15 = (0, _slicedToArray2["default"])(_ref14, 2),
180
+ endpointFieldName = _ref15[0],
181
+ endpoint = _ref15[1];
182
+ return {
183
+ name: endpointFieldName,
184
+ label: endpoint.label,
185
+ type: 'select',
186
+ options: function options(_ref16) {
187
+ var securityPolicyDefinitions = _ref16.securityPolicyDefinitions;
188
+ return securityPolicyDefinitions ? securityPolicyDefinitions.filter(function (definition) {
189
+ return endpoint.types.includes(definition.get('type'));
190
+ }).map(function (definition) {
191
+ return (0, _immutable.Map)({
192
+ value: definition.get('name'),
193
+ label: definition.get('name'),
194
+ type: definition.get('type')
195
+ });
196
+ }) : [];
197
+ },
198
+ initialValue: integration ? integration.get('securityPolicies').find(function (pol) {
199
+ return pol.get('endpoint') === endpoint.endpoint;
200
+ }, null, (0, _immutable.Map)({})).get('name', '') : '',
201
+ "transient": true
202
+ };
203
+ })), [{
204
+ name: 'securityPolicies',
205
+ label: 'Security Policies',
206
+ type: null,
207
+ visible: false,
208
+ serialize: function serialize(_ref17) {
209
+ var values = _ref17.values;
210
+ return Object.entries(securityEndpoints).map(function (_ref18) {
211
+ var _ref19 = (0, _slicedToArray2["default"])(_ref18, 2),
212
+ endpointFieldName = _ref19[0],
213
+ policy = _ref19[1];
214
+ return {
215
+ endpoint: policy.endpoint,
216
+ name: values.get(endpointFieldName)
217
+ };
218
+ }).filter(function (endpoint) {
219
+ return endpoint.name !== '';
220
+ });
221
+ },
222
+ initialValue: integration ? integration.get('securityPolicies') : []
223
+ }]);
224
+ };
225
+ };
226
+ var IntegrationForm = exports.IntegrationForm = (0, _Form.generateForm)({
227
+ formOptions: ['kappSlug', 'name'],
228
+ dataSources: dataSources,
229
+ fields: fields,
230
+ handleSubmit: handleSubmit
231
+ });
232
+ IntegrationForm.displayName = 'IntegrationForm';
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.IntegrationTable = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
11
+ var _Table = require("../../table/Table");
12
+ var _apis = require("../../../apis");
13
+ var _http = require("../../../apis/http");
14
+ var _excluded = ["integrations"];
15
+ var fetchIntegrationsWithSupportingData = function fetchIntegrationsWithSupportingData(options) {
16
+ return (0, _apis.fetchIntegrations)(options).then(function (_ref) {
17
+ var integrations = _ref.integrations,
18
+ response = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
19
+ // Get ids of all operations in the table
20
+ var ids = integrations === null || integrations === void 0 ? void 0 : integrations.map(function (integration) {
21
+ return integration.operationId;
22
+ });
23
+ // Fetch supporting integrator data for the table
24
+ return Promise.all([
25
+ // Get all connections
26
+ (0, _apis.fetchConnections)(),
27
+ // Get the operations that are used in the integrations
28
+ (ids === null || ids === void 0 ? void 0 : ids.length) > 0 ? (0, _apis.fetchBulkOperations)({
29
+ ids: ids
30
+ }) : Promise.resolve({
31
+ operations: []
32
+ })]).then(function (_ref2) {
33
+ var _ref3 = (0, _slicedToArray2["default"])(_ref2, 2),
34
+ _ref3$ = _ref3[0],
35
+ connections = _ref3$.connections,
36
+ integratorError = _ref3$.error,
37
+ operations = _ref3[1].operations;
38
+ return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, response), {}, {
39
+ integrations: integrations.map(function (integration) {
40
+ var _connections$find, _operations$find;
41
+ return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, integration), {}, {
42
+ // Add the connection and operation names to the records
43
+ connectionName: connections === null || connections === void 0 ? void 0 : (_connections$find = connections.find(function (conn) {
44
+ return conn.id === integration.connectionId;
45
+ })) === null || _connections$find === void 0 ? void 0 : _connections$find.name,
46
+ operationName: operations === null || operations === void 0 ? void 0 : (_operations$find = operations.find(function (op) {
47
+ return op.id === integration.operationId;
48
+ })) === null || _operations$find === void 0 ? void 0 : _operations$find.name
49
+ });
50
+ }),
51
+ integratorError: integratorError
52
+ });
53
+ });
54
+ });
55
+ };
56
+ var dataSource = function dataSource(_ref4) {
57
+ var kappSlug = _ref4.kappSlug;
58
+ return {
59
+ fn: fetchIntegrationsWithSupportingData,
60
+ params: function params(paramData) {
61
+ return [(0, _objectSpread2["default"])((0, _objectSpread2["default"])({
62
+ include: 'details',
63
+ kappSlug: kappSlug
64
+ }, (0, _http.generateSortParams)(paramData)), (0, _http.generatePaginationParams)(paramData))];
65
+ },
66
+ transform: function transform(result) {
67
+ return {
68
+ data: result.integrations,
69
+ nextPageToken: result.nextPageToken,
70
+ extraData: {
71
+ integratorError: result.integratorError
72
+ }
73
+ };
74
+ }
75
+ };
76
+ };
77
+ var filters = function filters() {
78
+ return function () {
79
+ return [{
80
+ name: 'name',
81
+ label: 'Name',
82
+ type: 'text'
83
+ }];
84
+ };
85
+ };
86
+ var columns = [{
87
+ value: 'name',
88
+ title: 'Name',
89
+ sortable: true,
90
+ toggleable: false,
91
+ columnOrder: 'first'
92
+ }, {
93
+ value: 'connectionId',
94
+ title: 'Connection ID',
95
+ sortable: false,
96
+ toggleable: true
97
+ }, {
98
+ value: 'connectionName',
99
+ title: 'Connection',
100
+ sortable: false,
101
+ toggleable: true
102
+ }, {
103
+ value: 'operationId',
104
+ title: 'Operation ID',
105
+ sortable: false,
106
+ toggleable: true
107
+ }, {
108
+ value: 'operationName',
109
+ title: 'Operation',
110
+ sortable: false,
111
+ toggleable: true
112
+ }, {
113
+ value: 'createdAt',
114
+ title: 'Created At',
115
+ sortable: true,
116
+ toggleable: true
117
+ }, {
118
+ value: 'createdBy',
119
+ title: 'Created By',
120
+ sortable: true,
121
+ toggleable: true
122
+ }, {
123
+ value: 'updatedAt',
124
+ title: 'Updated At',
125
+ sortable: true,
126
+ toggleable: true
127
+ }, {
128
+ value: 'updatedBy',
129
+ title: 'Updated By',
130
+ sortable: true,
131
+ toggleable: true
132
+ }];
133
+ var IntegrationTable = exports.IntegrationTable = (0, _Table.generateTable)({
134
+ tableOptions: ['kappSlug'],
135
+ columns: columns,
136
+ filters: filters,
137
+ dataSource: dataSource
138
+ });
139
+ IntegrationTable.displayName = 'IntegrationTable';