@kineticdata/react 6.0.5 → 6.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.
Files changed (151) hide show
  1. package/README.md +110 -110
  2. package/assets/task/icons/defer.svg +12 -12
  3. package/assets/task/icons/drag-handle.svg +3 -3
  4. package/assets/task/icons/filter.svg +11 -11
  5. package/assets/task/icons/loop.svg +10 -10
  6. package/assets/task/icons/plus_small.svg +5 -5
  7. package/assets/task/icons/routine.svg +9 -9
  8. package/assets/task/icons/scale-minus.svg +11 -11
  9. package/assets/task/icons/scale-plus.svg +13 -13
  10. package/assets/task/icons/start.svg +11 -11
  11. package/assets/task/icons/stop.svg +8 -8
  12. package/lib/apis/core/activity.js +4 -4
  13. package/lib/apis/core/attributeDefinitions.js +64 -6
  14. package/lib/apis/core/attributeDefinitions.test.js +7 -4
  15. package/lib/apis/core/authentication.js +12 -1
  16. package/lib/apis/core/bridgeModels.test.js +46 -23
  17. package/lib/apis/core/bridgedresources.js +41 -41
  18. package/lib/apis/core/fileResources.js +2 -6
  19. package/lib/apis/core/forms.js +51 -2
  20. package/lib/apis/core/forms.test.js +32 -19
  21. package/lib/apis/core/integrations.js +61 -0
  22. package/lib/apis/core/kapps.js +49 -0
  23. package/lib/apis/core/kapps.test.js +16 -10
  24. package/lib/apis/core/notices.js +7 -0
  25. package/lib/apis/core/securityPolicyDefinitions.test.js +7 -4
  26. package/lib/apis/core/space.js +18 -0
  27. package/lib/apis/core/space.test.js +16 -10
  28. package/lib/apis/core/submissionActivities.js +38 -0
  29. package/lib/apis/core/submissions.js +114 -15
  30. package/lib/apis/core/translations.test.js +126 -55
  31. package/lib/apis/core/userPreferences.js +59 -0
  32. package/lib/apis/core/webApis.js +32 -2
  33. package/lib/apis/core/webhooks.test.js +7 -4
  34. package/lib/apis/http.js +30 -5
  35. package/lib/apis/index.js +48 -0
  36. package/lib/apis/integrator/index.js +337 -0
  37. package/lib/apis/system/index.js +64 -12
  38. package/lib/apis/task/index.js +9 -2
  39. package/lib/components/agent/filestore/FilestoreForm.js +1 -1
  40. package/lib/components/common/AttributeSelect.js +11 -2
  41. package/lib/components/common/BridgeSelect.js +3 -1
  42. package/lib/components/common/ConnectionSelect.js +73 -0
  43. package/lib/components/common/FormSelect.js +3 -1
  44. package/lib/components/common/NodeSelect.js +1 -0
  45. package/lib/components/common/StaticSelect.js +16 -6
  46. package/lib/components/common/TableInput.js +4 -1
  47. package/lib/components/common/TeamSelect.js +3 -1
  48. package/lib/components/common/ToastContainer.js +34 -10
  49. package/lib/components/common/Typeahead.js +62 -23
  50. package/lib/components/common/UserSelect.js +3 -1
  51. package/lib/components/common/authentication/AuthenticationContainer.js +121 -55
  52. package/lib/components/common/authentication/RequestInterceptor.js +1 -1
  53. package/lib/components/common/preferences/PreferencesProvider.js +461 -0
  54. package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +10 -7
  55. package/lib/components/core/bridge_model/BridgeModelTable.js +19 -0
  56. package/lib/components/core/bridge_model_attribute/BridgeModelAttributeForm.js +6 -9
  57. package/lib/components/core/bridge_model_attribute/BridgeModelAttributeTable.js +0 -4
  58. package/lib/components/core/bridge_model_qualification/BridgeModelQualificationForm.js +7 -10
  59. package/lib/components/core/bridge_model_qualification/BridgeModelQualificationTable.js +2 -15
  60. package/lib/components/core/category/CategoryForm.js +4 -1
  61. package/lib/components/core/category/CategoryTable.js +2 -2
  62. package/lib/components/core/core_form/CoreForm.js +18 -10
  63. package/lib/components/core/field_definition/FieldDefinitionForm.js +3 -3
  64. package/lib/components/core/file_resource/FileResourceForm.js +2 -1
  65. package/lib/components/core/file_resource/FileResourceTable.js +14 -7
  66. package/lib/components/core/form/FormForm.js +42 -19
  67. package/lib/components/core/form/FormTable.js +13 -14
  68. package/lib/components/core/form_type/FormTypeForm.js +3 -0
  69. package/lib/components/core/i18n/Moment.js +1 -0
  70. package/lib/components/core/integration/IntegrationForm.js +232 -0
  71. package/lib/components/core/integration/IntegrationTable.js +142 -0
  72. package/lib/components/core/kapp/KappForm.js +18 -5
  73. package/lib/components/core/kapp/KappTable.js +3 -3
  74. package/lib/components/core/log/LogTable.js +1 -1
  75. package/lib/components/core/security_definition/SecurityDefinitionForm.js +48 -10
  76. package/lib/components/core/space/SpaceForm.js +17 -36
  77. package/lib/components/core/submission/DatastoreSubmissionTable.js +4 -4
  78. package/lib/components/core/submission/FormSubmissionTable.js +12 -7
  79. package/lib/components/core/submission/KappSubmissionTable.js +4 -4
  80. package/lib/components/core/submission/SubmissionActivityForm.js +79 -0
  81. package/lib/components/core/submission/SubmissionForm.js +15 -3
  82. package/lib/components/core/team/TeamTable.js +17 -7
  83. package/lib/components/core/translation/EntryTable.js +8 -7
  84. package/lib/components/core/user/UserForm.js +2 -0
  85. package/lib/components/core/user/UserTable.js +22 -22
  86. package/lib/components/core/webapi/WebApiForm.js +5 -2
  87. package/lib/components/core/webapi/WebApiTable.js +2 -2
  88. package/lib/components/core/webhook/WebhookForm.js +43 -33
  89. package/lib/components/core/webhook/WebhookTable.js +16 -16
  90. package/lib/components/core/webhook_job/WebhookJobTable.js +17 -6
  91. package/lib/components/form/Form.helpers.js +10 -4
  92. package/lib/components/form/Form.js +264 -171
  93. package/lib/components/form/Form.models.js +6 -1
  94. package/lib/components/form/FormState.js +9 -5
  95. package/lib/components/form/SimpleForm.js +2 -2
  96. package/lib/components/form/defaults/CodeField.js +44 -1
  97. package/lib/components/index.js +152 -3
  98. package/lib/components/integrator/connection/ConnectionForm.js +156 -0
  99. package/lib/components/integrator/connection/ConnectionTable.js +82 -0
  100. package/lib/components/integrator/connection/config_fields/http.js +570 -0
  101. package/lib/components/integrator/connection/config_fields/sql.js +123 -0
  102. package/lib/components/integrator/integrationTypes.js +120 -0
  103. package/lib/components/integrator/operation/OperationForm.js +148 -0
  104. package/lib/components/integrator/operation/OperationTable.js +62 -0
  105. package/lib/components/integrator/operation/config_fields/http.js +185 -0
  106. package/lib/components/integrator/operation/config_fields/sql.js +81 -0
  107. package/lib/components/system/SystemSecurityForm.js +1 -1
  108. package/lib/components/system/SystemTaskAdapterForm.js +9 -9
  109. package/lib/components/system/SystemUserForm.js +2 -0
  110. package/lib/components/system/helpers.js +123 -100
  111. package/lib/components/system/spaces/SystemSpaceForm.js +9 -37
  112. package/lib/components/system/spaces/SystemTenantForm.js +276 -104
  113. package/lib/components/system/spaces/SystemTenantMigrateForm.js +449 -0
  114. package/lib/components/system/spaces/SystemTenantTable.js +20 -16
  115. package/lib/components/table/Table.js +75 -15
  116. package/lib/components/table/Table.redux.js +297 -73
  117. package/lib/components/table/defaults/FilterControl.js +24 -0
  118. package/lib/components/table/defaults/index.js +2 -0
  119. package/lib/components/table/tests/Table.test.js +22 -22
  120. package/lib/components/table/tests/components.js +9 -2
  121. package/lib/components/task/builder/Connector.js +51 -41
  122. package/lib/components/task/builder/ConnectorForm.js +11 -7
  123. package/lib/components/task/builder/Node.js +31 -35
  124. package/lib/components/task/builder/NodeForm.js +93 -22
  125. package/lib/components/task/builder/NodeParametersForm.js +29 -17
  126. package/lib/components/task/builder/SvgCanvas.js +3 -17
  127. package/lib/components/task/builder/TaskDefinitionConfigForm.js +18 -50
  128. package/lib/components/task/builder/TreeBuilder.js +23 -3
  129. package/lib/components/task/builder/builder.redux.js +342 -197
  130. package/lib/components/task/builder/constants.js +10 -2
  131. package/lib/components/task/builder/helpers.js +231 -81
  132. package/lib/components/task/builder/models.js +7 -6
  133. package/lib/components/task/category/TaskCategoryTable.js +3 -3
  134. package/lib/components/task/common/UsageTable.js +9 -2
  135. package/lib/components/task/handlers/HandlerTable.js +44 -37
  136. package/lib/components/task/policy_rule/PolicyRuleTable.js +3 -3
  137. package/lib/components/task/runs/CreateManualTriggerForm.js +2 -0
  138. package/lib/components/task/runs/RunTable.js +10 -14
  139. package/lib/components/task/runs/RunTaskTable.js +1 -1
  140. package/lib/components/task/sources/SourceTable.js +2 -2
  141. package/lib/components/task/triggers/TriggerTable.js +2 -2
  142. package/lib/components/task/workflows/LinkedWorkflowTable.js +16 -11
  143. package/lib/components/task/workflows/WorkflowForm.js +27 -8
  144. package/lib/components/task/workflows/WorkflowTable.js +27 -26
  145. package/lib/helpers/index.js +307 -74
  146. package/lib/index.js +2 -1
  147. package/lib/saga.js +4 -4
  148. package/lib/store.js +2 -1
  149. package/package.json +7 -6
  150. package/proxyhelper.js +201 -176
  151. package/CHANGELOG.md +0 -94
@@ -13,6 +13,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inhe
13
13
  var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createSuper"));
14
14
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
16
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
16
17
  var _react = _interopRequireWildcard(require("react"));
17
18
  var _propTypes = _interopRequireDefault(require("prop-types"));
18
19
  var _lodash = _interopRequireDefault(require("lodash.isplainobject"));
@@ -28,8 +29,14 @@ var _ComponentConfigContext = require("../../common/ComponentConfigContext");
28
29
  var _defaults = require("./defaults");
29
30
  var _excluded = ["init", "poller"],
30
31
  _excluded2 = ["components"];
31
- var submissionIncludes = 'values,form,form.fields,form.attributesMap,form.kapp,form.kapp.attributesMap,form.kapp.space,form.kapp.space.attributesMap';
32
- var formIncludes = 'fields,attributesMap,kapp,kapp.attributesMap,kapp.space,kapp.space.attributesMap';
32
+ var submissionIncludes = function submissionIncludes() {
33
+ var addSubmissionIncludes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
34
+ return ['values', 'form', 'form.fields', 'form.attributesMap', 'form.kapp', 'form.kapp.attributesMap', 'form.kapp.space', 'form.kapp.space.attributesMap'].concat((0, _toConsumableArray2["default"])(addSubmissionIncludes)).join(',');
35
+ };
36
+ var formIncludes = function formIncludes() {
37
+ var addFormIncludes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
38
+ return ['fields', 'attributesMap', 'kapp', 'kapp.attributesMap', 'kapp.space', 'kapp.space.attributesMap'].concat((0, _toConsumableArray2["default"])(addFormIncludes)).join(',');
39
+ };
33
40
  var getNumericAttributeValue = function getNumericAttributeValue(form, name) {
34
41
  var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
35
42
  var kapp = form ? form.kapp : null;
@@ -82,7 +89,7 @@ var lockSubmission = exports.lockSubmission = function lockSubmission(_ref) {
82
89
  return (0, _apis.fetchSubmission)({
83
90
  id: id,
84
91
  datastore: !!datastore,
85
- include: submissionIncludes
92
+ include: submissionIncludes(options.addSubmissionIncludes)
86
93
  }).then(function (_ref2) {
87
94
  var _values;
88
95
  var submission = _ref2.submission,
@@ -109,7 +116,7 @@ var lockSubmission = exports.lockSubmission = function lockSubmission(_ref) {
109
116
  var lockTime = getNumericAttributeValue(submission.form, options.lockTimeAttribute || _defaults.LOCK_TIME_ATTRIBUTE, _defaults.LOCK_TIME_DEFAULT_VALUE);
110
117
  return (0, _apis.updateSubmission)({
111
118
  id: submission.id,
112
- include: submissionIncludes,
119
+ include: submissionIncludes(options.addSubmissionIncludes),
113
120
  values: (_values = {}, (0, _defineProperty2["default"])(_values, options.lockedByField || _defaults.LOCKED_BY_FIELD, _helpers.bundle.identity()), (0, _defineProperty2["default"])(_values, options.lockedUntilField || _defaults.LOCKED_UNTIL_FIELD, new Date(new Date().getTime() + lockTime * 1000).toISOString()), _values)
114
121
  }).then(function (response) {
115
122
  return (0, _objectSpread2["default"])({
@@ -127,7 +134,7 @@ var unlockSubmission = exports.unlockSubmission = function unlockSubmission(_ref
127
134
  return (0, _apis.fetchSubmission)({
128
135
  id: id,
129
136
  datastore: !!datastore,
130
- include: submissionIncludes
137
+ include: submissionIncludes(options.addSubmissionIncludes)
131
138
  }).then(function (_ref4) {
132
139
  var _values2;
133
140
  var submission = _ref4.submission,
@@ -160,7 +167,7 @@ var unlockSubmission = exports.unlockSubmission = function unlockSubmission(_ref
160
167
  }
161
168
  return (0, _apis.updateSubmission)({
162
169
  id: submission.id,
163
- include: submissionIncludes,
170
+ include: submissionIncludes(options.addSubmissionIncludes),
164
171
  values: (_values2 = {}, (0, _defineProperty2["default"])(_values2, options.lockedByField || _defaults.LOCKED_BY_FIELD, ''), (0, _defineProperty2["default"])(_values2, options.lockedUntilField || _defaults.LOCKED_UNTIL_FIELD, ''), _values2)
165
172
  }).then(function (response) {
166
173
  return (0, _objectSpread2["default"])({
@@ -369,7 +376,7 @@ var CoreFormComponent = exports.CoreFormComponent = /*#__PURE__*/function (_Comp
369
376
  return this.props.submission ? (0, _apis.fetchSubmission)({
370
377
  id: this.props.submission,
371
378
  datastore: !!this.props.datastore,
372
- include: submissionIncludes,
379
+ include: submissionIncludes(this.props.addSubmissionIncludes),
373
380
  "public": this.props["public"]
374
381
  }).then(function (_ref7) {
375
382
  var submission = _ref7.submission,
@@ -383,7 +390,7 @@ var CoreFormComponent = exports.CoreFormComponent = /*#__PURE__*/function (_Comp
383
390
  datastore: !!this.props.datastore,
384
391
  kappSlug: this.props.kapp,
385
392
  formSlug: this.props.form,
386
- include: formIncludes,
393
+ include: formIncludes(this.props.addFormIncludes),
387
394
  "public": this.props["public"]
388
395
  }).then(function (_ref8) {
389
396
  var form = _ref8.form,
@@ -401,7 +408,7 @@ var CoreFormComponent = exports.CoreFormComponent = /*#__PURE__*/function (_Comp
401
408
  return this.props.submission ? (0, _apis.fetchSubmission)({
402
409
  id: this.props.submission,
403
410
  datastore: !!this.props.datastore,
404
- include: submissionIncludes
411
+ include: submissionIncludes(this.props.addSubmissionIncludes)
405
412
  }).then(function (_ref9) {
406
413
  var submission = _ref9.submission,
407
414
  error = _ref9.error;
@@ -700,7 +707,8 @@ var CoreFormComponent = exports.CoreFormComponent = /*#__PURE__*/function (_Comp
700
707
  actions: actions,
701
708
  lockMessage: lockMessage,
702
709
  reviewPaginationControl: reviewPaginationControl,
703
- lock: init ? lockProps : undefined
710
+ lock: init ? lockProps : undefined,
711
+ renderProps: this.props.renderProps
704
712
  }) : content;
705
713
  }
706
714
  }]);
@@ -112,9 +112,9 @@ var fields = function fields(_ref6) {
112
112
  };
113
113
  };
114
114
 
115
- /**
116
- * @component
117
- * A form for creating and updating Field Definitions within the Kinetic Platform
115
+ /**
116
+ * @component
117
+ * A form for creating and updating Field Definitions within the Kinetic Platform
118
118
  */
119
119
  var FieldDefinitionForm = exports.FieldDefinitionForm = (0, _Form.generateForm)({
120
120
  formOptions: ['kappSlug', 'name'],
@@ -139,7 +139,8 @@ var fields = function fields(_ref4) {
139
139
  }).map(function (definition) {
140
140
  return (0, _immutable.Map)({
141
141
  value: definition.get('name'),
142
- label: definition.get('name')
142
+ label: definition.get('name'),
143
+ type: definition.get('type')
143
144
  });
144
145
  }) : [];
145
146
  },
@@ -40,29 +40,36 @@ var dataSource = function dataSource() {
40
40
  var columns = [{
41
41
  value: 'slug',
42
42
  title: 'Slug',
43
- sortable: true
43
+ sortable: true,
44
+ toggleable: false
44
45
  }, {
45
46
  value: 'agentSlug',
46
47
  title: 'Agent Slug',
47
- sortable: true
48
+ sortable: true,
49
+ toggleable: true
48
50
  }, {
49
51
  value: 'filestoreSlug',
50
- title: 'File Store Slug',
51
- sortable: true
52
+ title: 'Filestore Slug',
53
+ sortable: true,
54
+ toggleable: true
52
55
  }, {
53
56
  value: 'createdAt',
54
- title: 'Created',
55
- sortable: true
57
+ title: 'Created At',
58
+ sortable: true,
59
+ toggleable: true
56
60
  }, {
57
61
  value: 'createdBy',
58
- title: 'Created By'
62
+ title: 'Created By',
63
+ toggleable: true
59
64
  }, {
60
65
  value: 'updatedAt',
61
66
  title: 'Updated At',
67
+ toggleable: true,
62
68
  sortable: true
63
69
  }, {
64
70
  value: 'updatedBy',
65
71
  title: 'Updated By',
72
+ toggleable: true,
66
73
  sortable: true
67
74
  }];
68
75
  var FileResourceTable = exports.FileResourceTable = (0, _Table.generateTable)({
@@ -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,20 @@ 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
+ type: 'text',
118
+ toggleable: true
119
+ }, {
120
+ value: 'status',
121
+ title: 'Status',
122
+ sortable: true,
123
+ toggleable: true
113
124
  }, {
114
125
  value: 'createdAt',
115
- title: 'Created',
126
+ title: 'Created At',
116
127
  sortable: true,
117
128
  toggleable: true
118
129
  }, {
@@ -121,7 +132,7 @@ var columns = [{
121
132
  toggleable: true
122
133
  }, {
123
134
  value: 'updatedAt',
124
- title: 'Updated',
135
+ title: 'Updated At',
125
136
  sortable: true,
126
137
  toggleable: true
127
138
  }, {
@@ -133,18 +144,6 @@ var columns = [{
133
144
  value: 'notes',
134
145
  title: 'Notes',
135
146
  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
147
  }, {
149
148
  value: 'submissionLabelExpression',
150
149
  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';