@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
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.updateTenant = exports.updateSystemUser = exports.updateSystemSecurity = exports.updateSystemIngress = exports.updateSystemFilestore = exports.updateSystemDefaultTaskDbAdapter = exports.updateSystemDefaultSmtpAdapter = exports.updateSystem = exports.updateElasticSearchConfig = exports.updateCassandraConfig = exports.systemLogin = exports.rotateEncryptionKey = exports.restartResources = exports.resetSystemLicense = exports.refreshSystemToken = exports.postPlatformComponentRestart = exports.importSystemLicense = exports.fetchTrustedCertificates = exports.fetchTenants = exports.fetchTenant = exports.fetchTaskDbAdapters = exports.fetchTaskDbAdapter = exports.fetchSystemUser = exports.fetchSystemSecurity = exports.fetchSystemLicenseStats = exports.fetchSystemLicenseCheck = exports.fetchSystemLicense = exports.fetchSystemIngress = exports.fetchSystemFilestore = exports.fetchSystemDefaultTaskDbAdapter = exports.fetchSystemDefaultSmtpAdapter = exports.fetchSystemBackgroundTasks = exports.fetchSystemBackgroundTask = exports.fetchSystem = exports.fetchPlatformComponentStatus = exports.fetchNotifications = exports.fetchNotificationLabels = exports.fetchElasticSearchConfig = exports.fetchCassandraConfig = exports.deleteTrustedCertificate = exports.deleteTenant = exports.deleteSystemLicense = exports.deleteSystemBackgroundTask = exports.createTrustedCertificate = exports.createTenant = void 0;
7
+ exports.updateTenant = exports.updateSystemUser = exports.updateSystemSecurity = exports.updateSystemIngress = exports.updateSystemFilestore = exports.updateSystemDefaultSmtpAdapter = exports.updateSystemDefaultSQLDbAdapter = exports.updateSystem = exports.updateElasticSearchConfig = exports.updateCassandraConfig = exports.systemLogin = exports.rotateEncryptionKey = exports.restartTenantDeployments = exports.restartResources = exports.resetSystemLicense = exports.refreshSystemToken = exports.postPlatformComponentRestart = exports.migrateTenant = exports.importSystemLicense = exports.fetchTrustedCertificates = exports.fetchTenants = exports.fetchTenantDeploymentStatus = exports.fetchTenant = exports.fetchTaskDbAdapters = exports.fetchTaskDbAdapter = exports.fetchSystemUser = exports.fetchSystemSecurity = exports.fetchSystemLicenseStats = exports.fetchSystemLicenseCheck = exports.fetchSystemLicense = exports.fetchSystemIngress = exports.fetchSystemFilestore = exports.fetchSystemDefaultSmtpAdapter = exports.fetchSystemDefaultSQLDbAdapter = exports.fetchSystemBackgroundTasks = exports.fetchSystemBackgroundTask = exports.fetchSystem = exports.fetchPlatformComponentStatus = exports.fetchNotifications = exports.fetchNotificationLabels = exports.fetchElasticSearchConfig = exports.fetchCassandraConfig = exports.deleteTrustedCertificate = exports.deleteTenant = exports.deleteSystemLicense = exports.deleteSystemBackgroundTask = exports.createTrustedCertificate = exports.createTenant = void 0;
8
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
9
9
  var _axios = _interopRequireDefault(require("axios"));
10
10
  var _http = require("../http");
@@ -73,6 +73,26 @@ var createTenant = exports.createTenant = function createTenant() {
73
73
  };
74
74
  })["catch"](_http.handleErrors);
75
75
  };
76
+ var migrateTenant = exports.migrateTenant = function migrateTenant() {
77
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
78
+ var slug = options.slug,
79
+ tenant = options.tenant,
80
+ multipart = options.multipart;
81
+ if (!tenant) {
82
+ throw new Error('migrateTenant failed! The option "tenant" is required.');
83
+ }
84
+ if (!slug) {
85
+ throw new Error('migrateTenant failed! The option "slug" is required.');
86
+ }
87
+ return _axios["default"].post("/app/system-coordinator/api/v1/tenants/".concat(slug), !multipart ? tenant : (0, _http.formDataBuilder)(tenant), {
88
+ params: (0, _http.paramBuilder)(options),
89
+ headers: (0, _http.headerBuilder)(options)
90
+ }).then(function (response) {
91
+ return {
92
+ tenant: response.data.tenant
93
+ };
94
+ })["catch"](_http.handleErrors);
95
+ };
76
96
  var deleteTenant = exports.deleteTenant = function deleteTenant() {
77
97
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
78
98
  var slug = options.slug;
@@ -90,6 +110,38 @@ var deleteTenant = exports.deleteTenant = function deleteTenant() {
90
110
  };
91
111
  })["catch"](_http.handleErrors);
92
112
  };
113
+ var fetchTenantDeploymentStatus = exports.fetchTenantDeploymentStatus = function fetchTenantDeploymentStatus() {
114
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
115
+ var slug = options.slug,
116
+ deployment = options.deployment;
117
+ if (!slug) {
118
+ throw new Error('fetchTenantTaskStatus failed! The option "slug" is required.');
119
+ }
120
+ if (!deployment) {
121
+ throw new Error('fetchTenantTaskStatus failed! The option "deployment" is required.');
122
+ }
123
+ return _axios["default"].get("/app/system-coordinator/api/v1/tenants/".concat(slug, "/deployments/").concat(deployment, "/status")).then(function (_ref) {
124
+ var data = _ref.data;
125
+ return {
126
+ deployment: data
127
+ };
128
+ })["catch"](_http.handleErrors);
129
+ };
130
+
131
+ // Restarts deployments for tenant(s).
132
+ // If `slug` is omitted, all tenants will have their deployment(s) restarted.
133
+ // If `deployment` is omitted, all deployments will be restarted.
134
+ var restartTenantDeployments = exports.restartTenantDeployments = function restartTenantDeployments() {
135
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
136
+ var slug = options.slug,
137
+ deployment = options.deployment;
138
+ return _axios["default"].post("/app/system-coordinator/api/v1/tenants/".concat(slug ? "".concat(slug, "/") : '', "deployments/").concat(deployment ? "".concat(deployment, "/") : '', "restart"), {
139
+ params: (0, _http.paramBuilder)(options),
140
+ headers: (0, _http.headerBuilder)(options)
141
+ }).then(function (response) {
142
+ return response.data;
143
+ })["catch"](_http.handleErrors);
144
+ };
93
145
  var fetchSystem = exports.fetchSystem = function fetchSystem() {
94
146
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
95
147
  // Build URL and fetch the system config.
@@ -193,7 +245,7 @@ var fetchTaskDbAdapter = exports.fetchTaskDbAdapter = function fetchTaskDbAdapte
193
245
  };
194
246
  })["catch"](_http.handleErrors);
195
247
  };
196
- var fetchSystemDefaultTaskDbAdapter = exports.fetchSystemDefaultTaskDbAdapter = function fetchSystemDefaultTaskDbAdapter() {
248
+ var fetchSystemDefaultSQLDbAdapter = exports.fetchSystemDefaultSQLDbAdapter = function fetchSystemDefaultSQLDbAdapter() {
197
249
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
198
250
  // Build URL and fetch the space.
199
251
  return _axios["default"].get("/app/system-coordinator/api/v1/platform/default-task-db-adapter", {
@@ -205,12 +257,12 @@ var fetchSystemDefaultTaskDbAdapter = exports.fetchSystemDefaultTaskDbAdapter =
205
257
  };
206
258
  })["catch"](_http.handleErrors);
207
259
  };
208
- var updateSystemDefaultTaskDbAdapter = exports.updateSystemDefaultTaskDbAdapter = function updateSystemDefaultTaskDbAdapter() {
260
+ var updateSystemDefaultSQLDbAdapter = exports.updateSystemDefaultSQLDbAdapter = function updateSystemDefaultSQLDbAdapter() {
209
261
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
210
262
  var adapter = options.adapter,
211
263
  multipart = options.multipart;
212
264
  if (!adapter) {
213
- throw new Error('updateSystemDefaultTaskDbAdapter failed! The option "adapter" is required.');
265
+ throw new Error('updateSystemDefaultSQLDbAdapter failed! The option "adapter" is required.');
214
266
  }
215
267
  return _axios["default"].put("/app/system-coordinator/api/v1/platform/default-task-db-adapter", !multipart ? adapter : (0, _http.formDataBuilder)(adapter), {
216
268
  params: (0, _http.paramBuilder)(options),
@@ -279,8 +331,8 @@ var postPlatformComponentRestart = exports.postPlatformComponentRestart = functi
279
331
  if (!options.component || !VALID_RESTARTABLE_COMPONENTS.includes(options.component)) {
280
332
  throw new Error('postPlatformComponentRestart failed! The "component" option was missing or invalid.');
281
333
  }
282
- return _axios["default"].post("/app/system-coordinator/api/v1/platform/components/".concat(options.component, "/restart")).then(function (_ref) {
283
- var data = _ref.data;
334
+ return _axios["default"].post("/app/system-coordinator/api/v1/platform/components/".concat(options.component, "/restart")).then(function (_ref2) {
335
+ var data = _ref2.data;
284
336
  return {
285
337
  component: data.component,
286
338
  message: data.message
@@ -289,8 +341,8 @@ var postPlatformComponentRestart = exports.postPlatformComponentRestart = functi
289
341
  };
290
342
  var fetchPlatformComponentStatus = exports.fetchPlatformComponentStatus = function fetchPlatformComponentStatus() {
291
343
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
292
- return _axios["default"].get('/app/system-coordinator/api/v1/platform/components').then(function (_ref2) {
293
- var data = _ref2.data;
344
+ return _axios["default"].get('/app/system-coordinator/api/v1/platform/components').then(function (_ref3) {
345
+ var data = _ref3.data;
294
346
  return {
295
347
  components: data.components
296
348
  };
@@ -582,10 +634,10 @@ var fetchNotificationLabels = exports.fetchNotificationLabels = function fetchNo
582
634
  };
583
635
  })["catch"](_http.handleErrors);
584
636
  };
585
- var restartResources = exports.restartResources = function restartResources(_ref3) {
586
- var _ref3$options = _ref3.options,
587
- options = _ref3$options === void 0 ? {} : _ref3$options,
588
- notification = _ref3.notification;
637
+ var restartResources = exports.restartResources = function restartResources(_ref4) {
638
+ var _ref4$options = _ref4.options,
639
+ options = _ref4$options === void 0 ? {} : _ref4$options,
640
+ notification = _ref4.notification;
589
641
  return _axios["default"].post('/app/system-coordinator/api/v1/platform/restartResources', (0, _objectSpread2["default"])({}, notification), {
590
642
  params: (0, _http.paramBuilder)(options),
591
643
  headers: (0, _http.headerBuilder)(options)
@@ -435,11 +435,18 @@ var fetchHandlers = exports.fetchHandlers = function fetchHandlers() {
435
435
  return _axios["default"].get("".concat(_helpers.bundle.spaceLocation(), "/app/components/task/app/api/v2/handlers"), {
436
436
  params: {
437
437
  include: options.include,
438
- limit: options.limit
438
+ limit: options.limit,
439
+ offset: options.offset,
440
+ name: options.name || undefined,
441
+ status: options.status || undefined,
442
+ direction: options.direction || undefined,
443
+ orderBy: options.orderBy || undefined
439
444
  }
440
445
  }).then(function (response) {
441
446
  return {
442
- handlers: response.data.handlers
447
+ handlers: response.data.handlers,
448
+ count: response.data.count,
449
+ nextPageToken: generateNextPageToken(response.data)
443
450
  };
444
451
  })["catch"](_http.handleErrors);
445
452
  };
@@ -99,7 +99,7 @@ var fields = function fields(_ref4) {
99
99
  required: true,
100
100
  initialValue: (0, _immutable.get)(filestore, 'slug', ''),
101
101
  pattern: /^[a-z\d-]+$/,
102
- patternMessage: 'File Store Slug may only contain letters, numbers, and dashes',
102
+ patternMessage: 'Filestore Slug may only contain letters, numbers, and dashes',
103
103
  helpText: 'Unique name used in the bridge path.'
104
104
  }, {
105
105
  name: 'adapterClass',
@@ -23,9 +23,15 @@ var optionToValue = function optionToValue(option) {
23
23
  var getStatusProps = function getStatusProps(props) {
24
24
  return {
25
25
  info: props["short"] ? 'Type to find an attribute.' : props.pending ? 'Searching…' : null,
26
- warning: props.error || props.empty || props.more ? props.error ? props.error : props.more ? 'Too many results, first 50 shown. Please refine your search.' : props.empty ? 'No matches found.' : null : null
26
+ warning: props.error || props.empty || props.more ? props.error ? props.error : props.more ? 'Too many results, first 50 shown. Please refine your search.' : props.empty ? 'No matching attributes found.' : null : null
27
27
  };
28
28
  };
29
+ var actionOptions = function actionOptions(props) {
30
+ return props.onNew ? {
31
+ label: 'Add New Attribute Definition',
32
+ fn: props.onNew
33
+ } : undefined;
34
+ };
29
35
  var AttributeSelect = exports.AttributeSelect = function AttributeSelect(props) {
30
36
  return /*#__PURE__*/_react["default"].createElement(_Typeahead.Typeahead, {
31
37
  components: props.components || {},
@@ -39,6 +45,9 @@ var AttributeSelect = exports.AttributeSelect = function AttributeSelect(props)
39
45
  onBlur: props.onBlur,
40
46
  placeholder: props.placeholder,
41
47
  id: props.id,
42
- form: props.form
48
+ name: props.name,
49
+ form: props.form,
50
+ invalid: props.invalid,
51
+ action: actionOptions(props)
43
52
  });
44
53
  };
@@ -100,6 +100,8 @@ var BridgeSelect = exports.BridgeSelect = function BridgeSelect(props) {
100
100
  onBlur: props.onBlur,
101
101
  placeholder: props.placeholder,
102
102
  id: props.id,
103
- form: props.form
103
+ name: props.name,
104
+ form: props.form,
105
+ invalid: props.invalid
104
106
  });
105
107
  };
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ConnectionSelect = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _Typeahead = require("./Typeahead");
10
+ var _apis = require("../../apis");
11
+ var _immutable = require("immutable");
12
+ var searchConnections = function searchConnections(_ref) {
13
+ var _ref$search = _ref.search,
14
+ search = _ref$search === void 0 ? (0, _immutable.Map)() : _ref$search;
15
+ return function (field, value, callback) {
16
+ return (0, _apis.fetchConnections)({
17
+ type: search.getIn(['config', 'configType'])
18
+ }).then(function (_ref2) {
19
+ var connections = _ref2.connections,
20
+ error = _ref2.error,
21
+ nextPageToken = _ref2.nextPageToken;
22
+ return {
23
+ suggestions: connections || [],
24
+ error: error,
25
+ nextPageToken: nextPageToken
26
+ };
27
+ }).then(callback);
28
+ };
29
+ };
30
+ var connectionToValue = function connectionToValue(connection) {
31
+ return connection && connection.get('id') || '';
32
+ };
33
+ var getStatusProps = function getStatusProps(_ref3) {
34
+ var _ref3$search = _ref3.search,
35
+ search = _ref3$search === void 0 ? (0, _immutable.Map)() : _ref3$search,
36
+ _ref3$messages = _ref3.messages,
37
+ _ref3$messages2 = _ref3$messages === void 0 ? {} : _ref3$messages,
38
+ _ref3$messages2$short = _ref3$messages2["short"],
39
+ _short = _ref3$messages2$short === void 0 ? 'Type to find a connection.' : _ref3$messages2$short,
40
+ _ref3$messages2$empty = _ref3$messages2.empty,
41
+ empty = _ref3$messages2$empty === void 0 ? 'No matching connections.' : _ref3$messages2$empty,
42
+ _ref3$messages2$pendi = _ref3$messages2.pending,
43
+ pending = _ref3$messages2$pendi === void 0 ? 'Searching...' : _ref3$messages2$pendi,
44
+ _ref3$messages2$more = _ref3$messages2.more,
45
+ more = _ref3$messages2$more === void 0 ? "Too many connections, first ".concat(search.get('limit') || 25, " shown. Please refine your search.") : _ref3$messages2$more,
46
+ _ref3$messages2$error = _ref3$messages2.error,
47
+ error = _ref3$messages2$error === void 0 ? 'There was an error fetching connections.' : _ref3$messages2$error;
48
+ return function (props) {
49
+ return {
50
+ info: props["short"] ? _short : props.pending ? pending : null,
51
+ warning: props.error || props.empty || props.more ? props.error ? error : props.more ? more : props.empty ? empty : null : null
52
+ };
53
+ };
54
+ };
55
+ var ConnectionSelect = exports.ConnectionSelect = function ConnectionSelect(props) {
56
+ return /*#__PURE__*/_react["default"].createElement(_Typeahead.Typeahead, {
57
+ components: props.components || {},
58
+ disabled: props.disabled,
59
+ multiple: props.multiple,
60
+ search: searchConnections(props),
61
+ minSearchLength: props.minSearchLength,
62
+ getSuggestionValue: connectionToValue,
63
+ getStatusProps: getStatusProps(props),
64
+ value: props.value,
65
+ onChange: props.onChange,
66
+ onFocus: props.onFocus,
67
+ onBlur: props.onBlur,
68
+ placeholder: props.placeholder,
69
+ id: props.id,
70
+ name: props.name,
71
+ form: props.form
72
+ });
73
+ };
@@ -157,6 +157,8 @@ var FormSelect = exports.FormSelect = function FormSelect(props) {
157
157
  onBlur: props.onBlur,
158
158
  placeholder: props.placeholder,
159
159
  id: props.id,
160
- form: props.form
160
+ name: props.name,
161
+ form: props.form,
162
+ invalid: props.invalid
161
163
  });
162
164
  };
@@ -58,6 +58,7 @@ var NodeSelect = exports.NodeSelect = function NodeSelect(props) {
58
58
  onBlur: props.onBlur,
59
59
  placeholder: props.placeholder,
60
60
  id: props.id,
61
+ name: props.name,
61
62
  form: props.form
62
63
  });
63
64
  };
@@ -44,7 +44,8 @@ var searchOptions = function searchOptions(_ref3) {
44
44
  var allowNew = _ref3.allowNew,
45
45
  options = _ref3.options,
46
46
  _ref3$search = _ref3.search,
47
- search = _ref3$search === void 0 ? (0, _immutable.Map)() : _ref3$search;
47
+ search = _ref3$search === void 0 ? (0, _immutable.Map)() : _ref3$search,
48
+ messages = _ref3.messages;
48
49
  return function (field, value, callback) {
49
50
  // Determine the fields config
50
51
  var searchFields = _immutable.Map.isMap(search) && search.has('fields') && !search.get('fields').isEmpty() ? search.get('fields').toJS() : fields;
@@ -62,9 +63,9 @@ var searchOptions = function searchOptions(_ref3) {
62
63
  nextPageToken: suggestions.length > limit
63
64
  });
64
65
  } else {
65
- // If no options provided, return error message
66
+ // If no options provided, return empty message
66
67
  return callback({
67
- error: 'No options provided.',
68
+ error: messages.empty || 'No options found.',
68
69
  suggestions: []
69
70
  });
70
71
  }
@@ -99,9 +100,9 @@ var getStatusProps = function getStatusProps(_ref7) {
99
100
  _ref7$messages2$short = _ref7$messages2["short"],
100
101
  _short = _ref7$messages2$short === void 0 ? 'Type to find an option.' : _ref7$messages2$short,
101
102
  _ref7$messages2$empty = _ref7$messages2.empty,
102
- empty = _ref7$messages2$empty === void 0 ? 'No matches found.' : _ref7$messages2$empty,
103
+ empty = _ref7$messages2$empty === void 0 ? 'No options found.' : _ref7$messages2$empty,
103
104
  _ref7$messages2$custo = _ref7$messages2.custom,
104
- custom = _ref7$messages2$custo === void 0 ? 'No matches found. Type to enter a custom option.' : _ref7$messages2$custo,
105
+ custom = _ref7$messages2$custo === void 0 ? 'No options found. Type to enter a custom option.' : _ref7$messages2$custo,
105
106
  _ref7$messages2$pendi = _ref7$messages2.pending,
106
107
  pending = _ref7$messages2$pendi === void 0 ? 'Searching...' : _ref7$messages2$pendi,
107
108
  _ref7$messages2$more = _ref7$messages2.more,
@@ -113,6 +114,12 @@ var getStatusProps = function getStatusProps(_ref7) {
113
114
  };
114
115
  };
115
116
  };
117
+ var actionOptions = function actionOptions(props) {
118
+ return props.onNew ? {
119
+ label: props.onNewLabel || 'Add New Option',
120
+ fn: props.onNew
121
+ } : undefined;
122
+ };
116
123
  var StaticSelect = exports.StaticSelect = function StaticSelect(props) {
117
124
  return /*#__PURE__*/_react["default"].createElement(_Typeahead.Typeahead, {
118
125
  components: props.components || {},
@@ -129,6 +136,9 @@ var StaticSelect = exports.StaticSelect = function StaticSelect(props) {
129
136
  onBlur: props.onBlur,
130
137
  placeholder: props.placeholder,
131
138
  id: props.id,
132
- form: props.form
139
+ name: props.name,
140
+ form: props.form,
141
+ invalid: props.invalid,
142
+ action: actionOptions(props)
133
143
  });
134
144
  };
@@ -31,6 +31,7 @@ var TextInput = function TextInput(props) {
31
31
  form: props.form
32
32
  });
33
33
  };
34
+ var CodeInput = TextInput;
34
35
  var SelectInput = function SelectInput(props) {
35
36
  return /*#__PURE__*/_react["default"].createElement("select", {
36
37
  id: props.id,
@@ -114,6 +115,7 @@ var RowLayout = function RowLayout(_ref3) {
114
115
  }, "Delete")));
115
116
  };
116
117
  var typeToComponent = {
118
+ code: 'CodeInput',
117
119
  drag: 'DragHandle',
118
120
  display: 'TextDisplay',
119
121
  checkbox: 'CheckboxInput',
@@ -127,7 +129,8 @@ var defaultComponents = {
127
129
  TextDisplay: TextDisplay,
128
130
  CheckboxInput: CheckboxInput,
129
131
  SelectInput: SelectInput,
130
- TextInput: TextInput
132
+ TextInput: TextInput,
133
+ CodeInput: CodeInput
131
134
  };
132
135
  var fieldFromConfig = function fieldFromConfig(config) {
133
136
  var components = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -107,6 +107,8 @@ var TeamSelect = exports.TeamSelect = function TeamSelect(props) {
107
107
  onBlur: props.onBlur,
108
108
  placeholder: props.placeholder,
109
109
  id: props.id,
110
- form: props.form
110
+ name: props.name,
111
+ form: props.form,
112
+ invalid: props.invalid
111
113
  });
112
114
  };
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.showToast = exports.hideToast = exports.clearToasts = exports.ToastState = exports.ToastContainer = void 0;
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
10
11
  var _react = _interopRequireWildcard(require("react"));
11
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
13
  var _store = require("../../store");
@@ -51,22 +52,40 @@ var ToastState = exports.ToastState = (0, _immutable.Record)({
51
52
  }
52
53
  });
53
54
 
54
- // Adds toast to state and shows it after 100ms delay to trigger animation
55
- var showToast = exports.showToast = function showToast(toast) {
55
+ /**
56
+ * @param {object} toast Options for the toast
57
+ * @param {'success'|'error'} [presetType] Preset for styles
58
+ */
59
+ var showToast = exports.showToast = function showToast(toast, presetType) {
60
+ // If presetType is provided, add some default toast properties
61
+ if (presetType) return showToast((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, presetType === 'success' ? {
62
+ color: 'success',
63
+ icon: 'check-circle'
64
+ } : presetType === 'error' ? {
65
+ color: 'danger',
66
+ icon: 'alert-circle'
67
+ } : {}), toast));
56
68
  var toastKey = (0, _react2.generateKey)();
57
- (0, _store.dispatch)('ADD_TOAST', {
69
+ var payload = {
58
70
  containerKey: toast.containerKey,
59
71
  toast: ToastState(toast).update(
60
72
  // Make sure duration is a number, or set to a default numeric value
61
73
  'duration', function (duration) {
62
- return typeof duration === 'number' ? Math.max(duration, 4000) : toast.content ? 7000 : 4000;
74
+ return typeof duration === 'number' ? Math.max(duration, 4000) : toast.title && toast.content ? 7000 : 4000;
63
75
  }),
64
76
  toastKey: toastKey,
65
77
  show: false
66
- });
78
+ };
79
+ // Use set timeout so that if we're redirecting and showing a toast, the
80
+ // toast is added second so that it's not immediately cleared by the redirect
67
81
  setTimeout(function () {
68
- (0, _store.dispatch)('SHOW_TOAST', toastKey);
69
- }, 100);
82
+ (0, _store.dispatch)('ADD_TOAST', payload);
83
+ // Use set timeout to delay showing the toast by 100ms so that it renders
84
+ // into the dom before being shown so it animates correctly
85
+ setTimeout(function () {
86
+ (0, _store.dispatch)('SHOW_TOAST', toastKey);
87
+ }, 100);
88
+ }, 0);
70
89
  return toastKey;
71
90
  };
72
91
 
@@ -103,13 +122,18 @@ var ToastWrapper = function ToastWrapper(_ref) {
103
122
  }), content);
104
123
  };
105
124
  var ToastContainerComponent = function ToastContainerComponent(_ref2) {
106
- var components = _ref2.components,
125
+ var containerKey = _ref2.containerKey,
126
+ components = _ref2.components,
107
127
  toasts = _ref2.toasts,
108
128
  persistentToasts = _ref2.persistentToasts;
109
129
  (0, _react.useEffect)(function () {
110
130
  (0, _store.dispatch)('INIT_TOASTS');
111
- return function () {};
112
- }, []);
131
+ return function () {
132
+ if (containerKey) {
133
+ (0, _store.dispatch)('CLEAR_TOASTS', containerKey);
134
+ }
135
+ };
136
+ }, [containerKey]);
113
137
  return /*#__PURE__*/_react["default"].createElement(_ComponentConfigContext.ComponentConfigContext.Consumer, null, function (componentConfig) {
114
138
  var component = (0, _immutable.get)(components, 'Toast', componentConfig.get('Toast'));
115
139
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.Typeahead = void 0;
9
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
10
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
11
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
12
13
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));
@@ -64,6 +65,7 @@ var Typeahead = exports.Typeahead = /*#__PURE__*/function (_React$Component) {
64
65
  error = _ref2.error,
65
66
  nextPageToken = _ref2.nextPageToken;
66
67
  if (searchedValue === _this.state.searchValue) {
68
+ var _this$props$action;
67
69
  // when multiple mode is enabled we don't want to allow the same
68
70
  // suggestion to be selected twice, we compare existing selections to
69
71
  // suggestions using the getSuggestionValue function that returns a string
@@ -81,11 +83,17 @@ var Typeahead = exports.Typeahead = /*#__PURE__*/function (_React$Component) {
81
83
  filtered.filter(function (suggestion) {
82
84
  return _this.props.getSuggestionValue(suggestion) === _this.state.searchValue;
83
85
  }).length === 0 && (0, _immutable.fromJS)(_this.props.custom(_this.state.searchValue));
86
+
87
+ // If an action object was provided, create a suggestion that will be
88
+ // used to trigger this action
89
+ var actionSuggestion = typeof ((_this$props$action = _this.props.action) === null || _this$props$action === void 0 ? void 0 : _this$props$action.fn) === 'function' && (0, _immutable.fromJS)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _this.props.action), {}, {
90
+ __isAction: true
91
+ }));
84
92
  _this.setState({
85
93
  result: {
86
94
  error: error,
87
95
  nextPageToken: nextPageToken,
88
- suggestions: customSuggestion ? [].concat((0, _toConsumableArray2["default"])(filtered), [customSuggestion]) : filtered,
96
+ suggestions: [].concat((0, _toConsumableArray2["default"])(filtered), [customSuggestion, actionSuggestion]).filter(Boolean),
89
97
  customSuggestion: customSuggestion
90
98
  }
91
99
  });
@@ -109,7 +117,7 @@ var Typeahead = exports.Typeahead = /*#__PURE__*/function (_React$Component) {
109
117
  editing: true,
110
118
  searchValue: searchValue
111
119
  });
112
- } else if (!_this.props.multiple) {
120
+ } else if (!_this.props.multiple && !!searchValue) {
113
121
  _this.setState({
114
122
  refocus: true
115
123
  });
@@ -145,7 +153,13 @@ var Typeahead = exports.Typeahead = /*#__PURE__*/function (_React$Component) {
145
153
  searchValue: ''
146
154
  } : initialState);
147
155
  }
148
- _this.props.onChange(_this.props.multiple ? _this.props.value.push(suggestion) : suggestion);
156
+ // If this is an action suggestion, trigger the action and skip triggering
157
+ // the on change event
158
+ if (suggestion.get('__isAction')) {
159
+ suggestion.get('fn')();
160
+ } else {
161
+ _this.props.onChange(_this.props.multiple ? _this.props.value.push(suggestion) : suggestion);
162
+ }
149
163
  };
150
164
  _this.state = initialState;
151
165
  _this.autosuggest = /*#__PURE__*/(0, _react.createRef)();
@@ -214,6 +228,7 @@ var Typeahead = exports.Typeahead = /*#__PURE__*/function (_React$Component) {
214
228
  selection: this.props.value,
215
229
  placeholder: this.props.placeholder,
216
230
  id: this.props.id,
231
+ name: this.props.name,
217
232
  form: this.props.form
218
233
  },
219
234
  onSuggestionHighlighted: this.onHighlight,
@@ -240,6 +255,7 @@ function renderSuggestionsContainer(_ref5) {
240
255
  var containerProps = _ref5.containerProps,
241
256
  children = _ref5.children;
242
257
  var _this$props2 = this.props,
258
+ action = _this$props2.action,
243
259
  _this$props2$componen = _this$props2.components,
244
260
  _this$props2$componen2 = _this$props2$componen.Status,
245
261
  Status = _this$props2$componen2 === void 0 ? StatusDefault : _this$props2$componen2,
@@ -258,11 +274,14 @@ function renderSuggestionsContainer(_ref5) {
258
274
  setSearchField: setSearchField,
259
275
  error: state.result && state.result.error,
260
276
  value: state.searchValue,
261
- empty: state.result && state.result.suggestions.length === 0,
277
+ empty: state.result && !state.result.suggestions.some(function (suggestion) {
278
+ return !suggestion.get('__isAction');
279
+ }),
262
280
  more: state.result && !!state.result.nextPageToken,
263
281
  "short": minSearchLength && state.searchValue.length < minSearchLength,
264
282
  pending: !state.result,
265
- custom: !!custom
283
+ custom: !!custom,
284
+ action: !!action
266
285
  })), children);
267
286
  }
268
287
 
@@ -270,24 +289,38 @@ function renderSuggestionsContainer(_ref5) {
270
289
  function renderSuggestion(suggestion, _ref6) {
271
290
  var isHighlighted = _ref6.isHighlighted;
272
291
  var _this$props3 = this.props,
273
- _this$props3$componen = _this$props3.components.Suggestion,
274
- Suggestion = _this$props3$componen === void 0 ? SuggestionDefault : _this$props3$componen,
292
+ _this$props3$componen = _this$props3.components,
293
+ _this$props3$componen2 = _this$props3$componen.Suggestion,
294
+ Suggestion = _this$props3$componen2 === void 0 ? SuggestionDefault : _this$props3$componen2,
295
+ _this$props3$componen3 = _this$props3$componen.SuggestionAction,
296
+ SuggestionAction = _this$props3$componen3 === void 0 ? SuggestionDefault : _this$props3$componen3,
275
297
  getSuggestionValue = _this$props3.getSuggestionValue;
276
298
  var custom = this.state.result && this.state.result.customSuggestion === suggestion;
277
- return /*#__PURE__*/_react["default"].createElement(Suggestion, {
299
+ var action = !!suggestion.get('__isAction');
300
+ return !action ? /*#__PURE__*/_react["default"].createElement(Suggestion, {
278
301
  active: isHighlighted,
279
302
  custom: custom,
280
303
  suggestion: suggestion,
281
304
  suggestionValue: getSuggestionValue(suggestion)
282
- });
305
+ }) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("hr", null), /*#__PURE__*/_react["default"].createElement(SuggestionAction, {
306
+ active: isHighlighted,
307
+ custom: custom,
308
+ suggestion: suggestion,
309
+ suggestionValue: suggestion.get('label')
310
+ }));
283
311
  }
284
312
 
285
313
  // https://github.com/moroshko/react-autosuggest#renderinputcomponent-optional
286
314
  function renderInputComponent(inputProps) {
287
- var _this$props$component2 = this.props.components.Input,
288
- Input = _this$props$component2 === void 0 ? TypeaheadInputDefault : _this$props$component2;
315
+ var _this$props4 = this.props,
316
+ _this$props4$componen = _this$props4.components.Input,
317
+ Input = _this$props4$componen === void 0 ? TypeaheadInputDefault : _this$props4$componen,
318
+ invalid = _this$props4.invalid,
319
+ minSearchLength = _this$props4.minSearchLength;
289
320
  return /*#__PURE__*/_react["default"].createElement(Input, {
290
- inputProps: inputProps
321
+ inputProps: inputProps,
322
+ invalid: invalid,
323
+ minSearchLength: minSearchLength
291
324
  });
292
325
  }
293
326
 
@@ -296,16 +329,19 @@ function renderInputComponent(inputProps) {
296
329
  function renderSelections() {
297
330
  var edit = this.edit,
298
331
  focusRef = this.focusRef,
299
- _this$props4 = this.props,
300
- _this$props4$componen = _this$props4.components.Selection,
301
- Selection = _this$props4$componen === void 0 ? SelectionDefault : _this$props4$componen,
302
- disabled = _this$props4.disabled,
303
- getSuggestionValue = _this$props4.getSuggestionValue,
304
- multiple = _this$props4.multiple,
305
- value = _this$props4.value,
306
- placeholder = _this$props4.placeholder,
307
- id = _this$props4.id,
308
- form = _this$props4.form,
332
+ _this$props5 = this.props,
333
+ _this$props5$componen = _this$props5.components.Selection,
334
+ Selection = _this$props5$componen === void 0 ? SelectionDefault : _this$props5$componen,
335
+ disabled = _this$props5.disabled,
336
+ getSuggestionValue = _this$props5.getSuggestionValue,
337
+ multiple = _this$props5.multiple,
338
+ value = _this$props5.value,
339
+ placeholder = _this$props5.placeholder,
340
+ id = _this$props5.id,
341
+ name = _this$props5.name,
342
+ form = _this$props5.form,
343
+ invalid = _this$props5.invalid,
344
+ minSearchLength = _this$props5.minSearchLength,
309
345
  remove = this.remove;
310
346
  return (multiple ? value : _immutable.List.of(value)).map(function (selection, i) {
311
347
  var suggestionValue = getSuggestionValue(selection);
@@ -319,7 +355,10 @@ function renderSelections() {
319
355
  suggestionValue: suggestionValue,
320
356
  placeholder: !multiple ? placeholder : null,
321
357
  id: !multiple ? id : null,
322
- form: form
358
+ name: name,
359
+ invalid: invalid,
360
+ form: form,
361
+ minSearchLength: minSearchLength
323
362
  });
324
363
  });
325
364
  }