@kineticdata/react 6.1.0 → 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.
- package/README.md +110 -110
- package/assets/task/icons/defer.svg +12 -12
- package/assets/task/icons/drag-handle.svg +3 -3
- package/assets/task/icons/filter.svg +11 -11
- package/assets/task/icons/loop.svg +10 -10
- package/assets/task/icons/plus_small.svg +5 -5
- package/assets/task/icons/routine.svg +9 -9
- package/assets/task/icons/scale-minus.svg +11 -11
- package/assets/task/icons/scale-plus.svg +13 -13
- package/assets/task/icons/start.svg +11 -11
- package/assets/task/icons/stop.svg +8 -8
- package/lib/apis/core/activity.js +4 -4
- package/lib/apis/core/attributeDefinitions.js +55 -0
- package/lib/apis/core/attributeDefinitions.test.js +7 -4
- package/lib/apis/core/authentication.js +12 -1
- package/lib/apis/core/bridgeModels.test.js +46 -23
- package/lib/apis/core/bridgedresources.js +41 -41
- package/lib/apis/core/fileResources.js +2 -6
- package/lib/apis/core/forms.js +51 -2
- package/lib/apis/core/forms.test.js +32 -19
- package/lib/apis/core/kapps.js +49 -0
- package/lib/apis/core/kapps.test.js +16 -10
- package/lib/apis/core/notices.js +7 -0
- package/lib/apis/core/securityPolicyDefinitions.test.js +7 -4
- package/lib/apis/core/space.js +18 -0
- package/lib/apis/core/space.test.js +16 -10
- package/lib/apis/core/submissionActivities.js +38 -0
- package/lib/apis/core/submissions.js +62 -0
- package/lib/apis/core/translations.test.js +126 -55
- package/lib/apis/core/userPreferences.js +59 -0
- package/lib/apis/core/webApis.js +32 -2
- package/lib/apis/core/webhooks.test.js +7 -4
- package/lib/apis/http.js +22 -11
- package/lib/apis/index.js +24 -0
- package/lib/apis/integrator/index.js +95 -20
- package/lib/components/common/AttributeSelect.js +1 -0
- package/lib/components/common/BridgeSelect.js +1 -0
- package/lib/components/common/ConnectionSelect.js +2 -1
- package/lib/components/common/FormSelect.js +1 -0
- package/lib/components/common/NodeSelect.js +1 -0
- package/lib/components/common/StaticSelect.js +1 -0
- package/lib/components/common/TeamSelect.js +1 -0
- package/lib/components/common/ToastContainer.js +3 -3
- package/lib/components/common/Typeahead.js +3 -0
- package/lib/components/common/UserSelect.js +1 -0
- package/lib/components/common/authentication/AuthenticationContainer.js +121 -55
- package/lib/components/common/preferences/PreferencesProvider.js +461 -0
- package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +7 -7
- package/lib/components/core/field_definition/FieldDefinitionForm.js +3 -3
- package/lib/components/core/form/FormTable.js +0 -1
- package/lib/components/core/integration/IntegrationTable.js +3 -0
- package/lib/components/core/space/SpaceForm.js +14 -14
- package/lib/components/core/submission/SubmissionActivityForm.js +79 -0
- package/lib/components/core/submission/SubmissionForm.js +12 -2
- package/lib/components/core/translation/EntryTable.js +8 -7
- package/lib/components/core/user/UserForm.js +2 -0
- package/lib/components/core/user/UserTable.js +4 -4
- package/lib/components/form/Form.js +14 -3
- package/lib/components/form/FormState.js +1 -1
- package/lib/components/form/SimpleForm.js +2 -2
- package/lib/components/index.js +68 -0
- package/lib/components/integrator/connection/ConnectionForm.js +62 -18
- package/lib/components/integrator/connection/ConnectionTable.js +5 -3
- package/lib/components/integrator/connection/config_fields/http.js +19 -19
- package/lib/components/integrator/connection/config_fields/sql.js +123 -0
- package/lib/components/integrator/integrationTypes.js +27 -5
- package/lib/components/integrator/operation/OperationForm.js +24 -4
- package/lib/components/integrator/operation/OperationTable.js +3 -5
- package/lib/components/integrator/operation/config_fields/http.js +3 -2
- package/lib/components/integrator/operation/config_fields/sql.js +81 -0
- package/lib/components/system/SystemUserForm.js +2 -0
- package/lib/components/table/Table.js +75 -15
- package/lib/components/table/Table.redux.js +296 -72
- package/lib/components/table/defaults/FilterControl.js +24 -0
- package/lib/components/table/defaults/index.js +2 -0
- package/lib/components/table/tests/Table.test.js +22 -22
- package/lib/components/table/tests/components.js +9 -2
- package/lib/components/task/builder/Connector.js +51 -41
- package/lib/components/task/builder/Node.js +25 -38
- package/lib/components/task/builder/SvgCanvas.js +3 -17
- package/lib/components/task/builder/TreeBuilder.js +1 -2
- package/lib/components/task/builder/builder.redux.js +52 -32
- package/lib/components/task/builder/helpers.js +35 -5
- package/lib/components/task/common/UsageTable.js +8 -1
- package/lib/components/task/handlers/HandlerTable.js +9 -18
- package/lib/components/task/runs/RunTable.js +6 -10
- package/lib/components/task/workflows/LinkedWorkflowTable.js +14 -9
- package/lib/components/task/workflows/WorkflowTable.js +25 -24
- package/lib/helpers/index.js +18 -2
- package/lib/index.js +2 -1
- package/lib/saga.js +4 -4
- package/lib/store.js +2 -1
- package/package.json +5 -6
- package/proxyhelper.js +201 -201
- package/CHANGELOG.md +0 -116
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.serializeSQLConnectionConfigFields = exports.generateSQLConnectionConfigFields = void 0;
|
|
8
|
+
var _immutable = require("immutable");
|
|
9
|
+
var _integrationTypes = _interopRequireDefault(require("../../integrationTypes"));
|
|
10
|
+
var serializeSQLConnectionConfigFields = exports.serializeSQLConnectionConfigFields = function serializeSQLConnectionConfigFields(configFields) {
|
|
11
|
+
return function (_ref) {
|
|
12
|
+
var values = _ref.values;
|
|
13
|
+
return configFields.reduce(function (serialization, _ref2) {
|
|
14
|
+
var name = _ref2.name,
|
|
15
|
+
type = _ref2.type,
|
|
16
|
+
visible = _ref2.visible,
|
|
17
|
+
_transient = _ref2["transient"];
|
|
18
|
+
if (
|
|
19
|
+
// Field must not be transient
|
|
20
|
+
!_transient && (
|
|
21
|
+
// Field must be visible
|
|
22
|
+
typeof visible === 'function' ? visible({
|
|
23
|
+
values: values
|
|
24
|
+
}) : typeof visible === 'undefined' || !!visible)) {
|
|
25
|
+
// Set password fields to null if their toggle field is
|
|
26
|
+
// false, which means the password wasn't changed
|
|
27
|
+
if (type === 'password' && !values.get("".concat(name, ".toggle"))) {
|
|
28
|
+
return serialization.setIn(name.split('.'), null);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Set the following fields to null if they don't have a value
|
|
32
|
+
if (['caCert'].includes(name) && !values.get(name)) {
|
|
33
|
+
return serialization.setIn(name.split('.'), null);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Set the value into the correct structure
|
|
37
|
+
return serialization.setIn(name.split('.'), values.get(name));
|
|
38
|
+
}
|
|
39
|
+
return serialization;
|
|
40
|
+
}, (0, _immutable.Map)());
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
var generateSQLConnectionConfigFields = exports.generateSQLConnectionConfigFields = function generateSQLConnectionConfigFields(config, type, options) {
|
|
44
|
+
return [{
|
|
45
|
+
name: 'configType',
|
|
46
|
+
label: 'Type',
|
|
47
|
+
type: 'select',
|
|
48
|
+
options: _integrationTypes["default"],
|
|
49
|
+
initialValue: type,
|
|
50
|
+
required: true,
|
|
51
|
+
enabled: false
|
|
52
|
+
}, {
|
|
53
|
+
name: 'host',
|
|
54
|
+
label: 'Host',
|
|
55
|
+
type: 'text',
|
|
56
|
+
initialValue: (0, _immutable.get)(config, 'host'),
|
|
57
|
+
required: true
|
|
58
|
+
}, {
|
|
59
|
+
name: 'port',
|
|
60
|
+
label: 'Port',
|
|
61
|
+
type: 'text',
|
|
62
|
+
initialValue: String((0, _immutable.get)(config, 'port') || ''),
|
|
63
|
+
required: true,
|
|
64
|
+
pattern: /^\d*$/,
|
|
65
|
+
patternMessage: 'Port must be numeric'
|
|
66
|
+
}, {
|
|
67
|
+
name: 'database',
|
|
68
|
+
label: 'Database',
|
|
69
|
+
type: 'text',
|
|
70
|
+
initialValue: (0, _immutable.get)(config, 'database'),
|
|
71
|
+
required: true
|
|
72
|
+
}, {
|
|
73
|
+
name: 'poolSize',
|
|
74
|
+
label: 'Connection Pool',
|
|
75
|
+
type: 'number',
|
|
76
|
+
initialValue: (0, _immutable.get)(config, 'poolSize') || 5,
|
|
77
|
+
required: true,
|
|
78
|
+
constraint: function constraint(_ref3) {
|
|
79
|
+
var values = _ref3.values;
|
|
80
|
+
return typeof values.get('poolSize') === 'number' && values.get('poolSize') > 0;
|
|
81
|
+
},
|
|
82
|
+
constraintMessage: 'Connection Pool must be numeric and must be greater than 0'
|
|
83
|
+
}, {
|
|
84
|
+
name: 'username',
|
|
85
|
+
label: 'Username',
|
|
86
|
+
type: 'text',
|
|
87
|
+
initialValue: (0, _immutable.get)(config, 'username'),
|
|
88
|
+
required: true
|
|
89
|
+
}, {
|
|
90
|
+
name: 'password.toggle',
|
|
91
|
+
"transient": true,
|
|
92
|
+
label: 'Modify Password',
|
|
93
|
+
type: 'toggle',
|
|
94
|
+
initialValue: !config || !!options.isClone || !!options.isNewImport,
|
|
95
|
+
// Show if we're editing a connection
|
|
96
|
+
visible: function visible(_ref4) {
|
|
97
|
+
var connection = _ref4.connection;
|
|
98
|
+
return !!connection && !options.isClone;
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
name: 'password',
|
|
102
|
+
label: 'Password',
|
|
103
|
+
type: 'password',
|
|
104
|
+
initialValue: '',
|
|
105
|
+
// Enable if we're creating a new connection or the change toggle is true
|
|
106
|
+
enabled: function enabled(_ref5) {
|
|
107
|
+
var values = _ref5.values,
|
|
108
|
+
connection = _ref5.connection;
|
|
109
|
+
return !connection || options.isClone || !!values.get('password.toggle');
|
|
110
|
+
},
|
|
111
|
+
// Show the placeholder if there is a connection
|
|
112
|
+
placeholder: function placeholder(_ref6) {
|
|
113
|
+
var values = _ref6.values,
|
|
114
|
+
connection = _ref6.connection;
|
|
115
|
+
return !!connection && !options.isClone && !values.get('password.toggle') ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : undefined;
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
name: 'caCert',
|
|
119
|
+
label: 'Trusted CA Certificate',
|
|
120
|
+
type: 'text',
|
|
121
|
+
initialValue: (0, _immutable.get)(config, 'caCert') || ''
|
|
122
|
+
}];
|
|
123
|
+
};
|
|
@@ -8,10 +8,19 @@ var _immutable = require("immutable");
|
|
|
8
8
|
var integrationTypes = exports.integrationTypes = [{
|
|
9
9
|
label: 'HTTP',
|
|
10
10
|
value: 'http'
|
|
11
|
-
}
|
|
11
|
+
},
|
|
12
12
|
// { label: 'SMTP', value: 'smtp' },
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
{
|
|
14
|
+
label: 'PostgreSQL',
|
|
15
|
+
value: 'postgres',
|
|
16
|
+
group: 'sql',
|
|
17
|
+
groupLabel: 'SQL'
|
|
18
|
+
}, {
|
|
19
|
+
label: 'SQL Server',
|
|
20
|
+
value: 'mssql',
|
|
21
|
+
group: 'sql',
|
|
22
|
+
groupLabel: 'SQL'
|
|
23
|
+
}];
|
|
15
24
|
|
|
16
25
|
// Helper function for getting the label for a given type value
|
|
17
26
|
integrationTypes.getLabel = function (value) {
|
|
@@ -28,6 +37,7 @@ var getConnectionMetadata = exports.getConnectionMetadata = function getConnecti
|
|
|
28
37
|
return {
|
|
29
38
|
// Details content to render for each option in a list of connections
|
|
30
39
|
optionDetail: (0, _immutable.getIn)(connection, ['config', 'baseUrl']),
|
|
40
|
+
optionDetailLabel: 'Base URL',
|
|
31
41
|
// Documentation link
|
|
32
42
|
docsLink: (0, _immutable.getIn)(connection, ['documentationLink']),
|
|
33
43
|
// Properties to list in page/modal headings
|
|
@@ -38,7 +48,7 @@ var getConnectionMetadata = exports.getConnectionMetadata = function getConnecti
|
|
|
38
48
|
label: 'Auth',
|
|
39
49
|
value: {
|
|
40
50
|
basic: 'Basic',
|
|
41
|
-
client_credentials: '
|
|
51
|
+
client_credentials: 'OAuth 2.0',
|
|
42
52
|
http_bearer_token: 'HTTP Bearer Token',
|
|
43
53
|
raw_bearer_token: 'Raw Bearer Token'
|
|
44
54
|
}[(0, _immutable.getIn)(connection, ['config', 'auth', 'authType'])] || 'None'
|
|
@@ -47,7 +57,7 @@ var getConnectionMetadata = exports.getConnectionMetadata = function getConnecti
|
|
|
47
57
|
}),
|
|
48
58
|
// Table columns for the operations table of this type of connection.
|
|
49
59
|
// Objects define columns to add, and strings define default columns to
|
|
50
|
-
// show. The order of the items
|
|
60
|
+
// show. The order of the items defines the order of the columns.
|
|
51
61
|
operationColumns: [{
|
|
52
62
|
value: 'method',
|
|
53
63
|
title: 'Method',
|
|
@@ -57,6 +67,8 @@ var getConnectionMetadata = exports.getConnectionMetadata = function getConnecti
|
|
|
57
67
|
toggleable: true
|
|
58
68
|
}, 'name', 'updatedAt', 'actions']
|
|
59
69
|
};
|
|
70
|
+
case 'postgres':
|
|
71
|
+
case 'mssql':
|
|
60
72
|
default:
|
|
61
73
|
return {
|
|
62
74
|
headingData: [],
|
|
@@ -71,6 +83,8 @@ var getOperationMetadata = exports.getOperationMetadata = function getOperationM
|
|
|
71
83
|
return {
|
|
72
84
|
// Details content to render for each option in a list of operations
|
|
73
85
|
optionDetail: (0, _immutable.getIn)(operation, ['config', 'method']),
|
|
86
|
+
optionDetailLabel: 'Method',
|
|
87
|
+
optionDetailComponent: HTTPMethod,
|
|
74
88
|
// Documentation link
|
|
75
89
|
docsLink: (0, _immutable.getIn)(operation, ['documentationLink']),
|
|
76
90
|
// Properties to list in page/modal headings
|
|
@@ -84,6 +98,8 @@ var getOperationMetadata = exports.getOperationMetadata = function getOperationM
|
|
|
84
98
|
return o.value;
|
|
85
99
|
})
|
|
86
100
|
};
|
|
101
|
+
case 'postgres':
|
|
102
|
+
case 'mssql':
|
|
87
103
|
default:
|
|
88
104
|
return {
|
|
89
105
|
headingData: []
|
|
@@ -95,4 +111,10 @@ var HTTPMethodCell = function HTTPMethodCell(_ref) {
|
|
|
95
111
|
return /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", {
|
|
96
112
|
className: "badge badge-info"
|
|
97
113
|
}, row.getIn(['config', 'method'])));
|
|
114
|
+
};
|
|
115
|
+
var HTTPMethod = function HTTPMethod(_ref2) {
|
|
116
|
+
var value = _ref2.value;
|
|
117
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
118
|
+
className: "badge badge-info"
|
|
119
|
+
}, value);
|
|
98
120
|
};
|
|
@@ -7,10 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.OperationForm = void 0;
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
10
11
|
var _immutable = require("immutable");
|
|
11
12
|
var _Form = require("../../form/Form");
|
|
12
13
|
var _apis = require("../../../apis");
|
|
13
14
|
var _http = require("./config_fields/http");
|
|
15
|
+
var _sql = require("./config_fields/sql");
|
|
14
16
|
var dataSources = function dataSources(_ref) {
|
|
15
17
|
var id = _ref.id,
|
|
16
18
|
connectionId = _ref.connectionId;
|
|
@@ -55,6 +57,21 @@ var handleSubmit = function handleSubmit(_ref2) {
|
|
|
55
57
|
});
|
|
56
58
|
};
|
|
57
59
|
};
|
|
60
|
+
var getFieldConfigByType = function getFieldConfigByType(type, operation) {
|
|
61
|
+
switch (type) {
|
|
62
|
+
case 'http':
|
|
63
|
+
var configFieldsHTTP = (0, _http.generateHttpOperationConfigFields)((0, _immutable.get)(operation, 'config'));
|
|
64
|
+
return [configFieldsHTTP, (0, _http.serializeHttpOperationConfigFields)(configFieldsHTTP)];
|
|
65
|
+
case 'postgres':
|
|
66
|
+
var configFieldsPostgres = (0, _sql.generatePostgresOperationConfigFields)((0, _immutable.get)(operation, 'config'));
|
|
67
|
+
return [configFieldsPostgres, (0, _sql.serializeSQLOperationConfigFields)(configFieldsPostgres)];
|
|
68
|
+
case 'mssql':
|
|
69
|
+
var configFieldsMSSQL = (0, _sql.generateMSSQLOperationConfigFields)((0, _immutable.get)(operation, 'config'));
|
|
70
|
+
return [configFieldsMSSQL, (0, _sql.serializeSQLOperationConfigFields)(configFieldsMSSQL)];
|
|
71
|
+
default:
|
|
72
|
+
return [[], undefined];
|
|
73
|
+
}
|
|
74
|
+
};
|
|
58
75
|
var fields = function fields(_ref4) {
|
|
59
76
|
var id = _ref4.id,
|
|
60
77
|
clone = _ref4.clone;
|
|
@@ -63,8 +80,11 @@ var fields = function fields(_ref4) {
|
|
|
63
80
|
connection = _ref5.connection;
|
|
64
81
|
if (connection && (!id || operation)) {
|
|
65
82
|
// Set type from the operation if it exists, or from the connection
|
|
66
|
-
var typeValue = (0, _immutable.
|
|
67
|
-
var
|
|
83
|
+
var typeValue = (0, _immutable.getIn)(connection, ['config', 'configType']);
|
|
84
|
+
var _getFieldConfigByType = getFieldConfigByType(typeValue, operation),
|
|
85
|
+
_getFieldConfigByType2 = (0, _slicedToArray2["default"])(_getFieldConfigByType, 2),
|
|
86
|
+
configFields = _getFieldConfigByType2[0],
|
|
87
|
+
configSerialize = _getFieldConfigByType2[1];
|
|
68
88
|
return [{
|
|
69
89
|
name: 'name',
|
|
70
90
|
label: 'Operation Name',
|
|
@@ -74,7 +94,7 @@ var fields = function fields(_ref4) {
|
|
|
74
94
|
placeholder: !clone ? 'Enter a name to find your operation easily' : "Clone of ".concat((0, _immutable.get)(operation, 'name'))
|
|
75
95
|
}, {
|
|
76
96
|
name: 'documentationLink',
|
|
77
|
-
label: '
|
|
97
|
+
label: 'API Documentation Link',
|
|
78
98
|
type: 'text',
|
|
79
99
|
initialValue: (0, _immutable.get)(operation, 'documentationLink') || '',
|
|
80
100
|
placeholder: 'Optional (but recommended)'
|
|
@@ -110,7 +130,7 @@ var fields = function fields(_ref4) {
|
|
|
110
130
|
visible: false,
|
|
111
131
|
initialValue: (0, _immutable.get)(operation, 'config'),
|
|
112
132
|
// Serialize the transient config fields into a single config object
|
|
113
|
-
serialize:
|
|
133
|
+
serialize: configSerialize
|
|
114
134
|
}].concat((0, _toConsumableArray2["default"])(configFields.map(function (field) {
|
|
115
135
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, field), {}, {
|
|
116
136
|
"transient": true
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.OperationTable = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
9
7
|
var _apis = require("../../../apis");
|
|
10
8
|
var _Table = require("../../table/Table");
|
|
11
9
|
var _helpers = require("../../../helpers");
|
|
@@ -24,10 +22,10 @@ var dataSource = function dataSource(_ref) {
|
|
|
24
22
|
return {
|
|
25
23
|
fn: _apis.fetchOperations,
|
|
26
24
|
clientSide: clientSide,
|
|
27
|
-
params: function params(
|
|
28
|
-
return connectionId && [
|
|
25
|
+
params: function params() {
|
|
26
|
+
return connectionId && [{
|
|
29
27
|
connectionId: connectionId
|
|
30
|
-
}
|
|
28
|
+
}];
|
|
31
29
|
},
|
|
32
30
|
transform: function transform(result) {
|
|
33
31
|
return {
|
|
@@ -127,10 +127,11 @@ var generateHttpOperationConfigFields = exports.generateHttpOperationConfigField
|
|
|
127
127
|
label: 'Raw Body',
|
|
128
128
|
type: 'code',
|
|
129
129
|
language: function language(_ref4) {
|
|
130
|
+
var _values$get$find, _values$get$find$toLo;
|
|
130
131
|
var values = _ref4.values;
|
|
131
|
-
return getLanguageFromContentType(values.get('headers').find(function (_, header) {
|
|
132
|
+
return getLanguageFromContentType((_values$get$find = values.get('headers').find(function (_, header) {
|
|
132
133
|
return (header === null || header === void 0 ? void 0 : header.toLowerCase()) === 'content-type';
|
|
133
|
-
}));
|
|
134
|
+
})) === null || _values$get$find === void 0 ? void 0 : (_values$get$find$toLo = _values$get$find.toLowerCase) === null || _values$get$find$toLo === void 0 ? void 0 : _values$get$find$toLo.call(_values$get$find));
|
|
134
135
|
},
|
|
135
136
|
initialValue: (0, _immutable.getIn)(config, ['body', 'raw']),
|
|
136
137
|
visible: function visible(_ref5) {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.serializeSQLOperationConfigFields = exports.generatePostgresOperationConfigFields = exports.generateMSSQLOperationConfigFields = void 0;
|
|
8
|
+
var _immutable = require("immutable");
|
|
9
|
+
var _integrationTypes = _interopRequireDefault(require("../../integrationTypes"));
|
|
10
|
+
var serializeSQLOperationConfigFields = exports.serializeSQLOperationConfigFields = function serializeSQLOperationConfigFields(configFields) {
|
|
11
|
+
return function (_ref) {
|
|
12
|
+
var values = _ref.values;
|
|
13
|
+
return configFields.reduce(function (serialization, _ref2) {
|
|
14
|
+
var name = _ref2.name,
|
|
15
|
+
type = _ref2.type,
|
|
16
|
+
visible = _ref2.visible,
|
|
17
|
+
_transient = _ref2["transient"];
|
|
18
|
+
if (
|
|
19
|
+
// Field must not be transient
|
|
20
|
+
!_transient && (
|
|
21
|
+
// Field must be visible
|
|
22
|
+
typeof visible === 'function' ? visible({
|
|
23
|
+
values: values
|
|
24
|
+
}) : typeof visible === 'undefined' || !!visible)) {
|
|
25
|
+
// Set the value into the correct structure
|
|
26
|
+
return serialization.setIn(name.split('.'), values.get(name));
|
|
27
|
+
}
|
|
28
|
+
return serialization;
|
|
29
|
+
}, (0, _immutable.Map)());
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
var generatePostgresOperationConfigFields = exports.generatePostgresOperationConfigFields = function generatePostgresOperationConfigFields(config) {
|
|
33
|
+
return [{
|
|
34
|
+
name: 'configType',
|
|
35
|
+
label: 'Type',
|
|
36
|
+
type: 'select',
|
|
37
|
+
options: _integrationTypes["default"],
|
|
38
|
+
initialValue: 'postgres',
|
|
39
|
+
required: true,
|
|
40
|
+
enabled: false
|
|
41
|
+
}, {
|
|
42
|
+
name: 'statement',
|
|
43
|
+
label: 'Query',
|
|
44
|
+
type: 'code',
|
|
45
|
+
language: 'postgresql',
|
|
46
|
+
initialValue: (0, _immutable.get)(config, 'statement'),
|
|
47
|
+
required: true
|
|
48
|
+
}, {
|
|
49
|
+
name: 'parameters',
|
|
50
|
+
label: 'Query Parameters',
|
|
51
|
+
type: 'text-multi',
|
|
52
|
+
initialValue: (0, _immutable.get)(config, 'parameters'),
|
|
53
|
+
placeholder: 'Value',
|
|
54
|
+
helpText: /*#__PURE__*/React.createElement(React.Fragment, null, "Use the ", /*#__PURE__*/React.createElement("code", null, '{{parameter}}'), " format to create dynamic parameters.")
|
|
55
|
+
}];
|
|
56
|
+
};
|
|
57
|
+
var generateMSSQLOperationConfigFields = exports.generateMSSQLOperationConfigFields = function generateMSSQLOperationConfigFields(config) {
|
|
58
|
+
return [{
|
|
59
|
+
name: 'configType',
|
|
60
|
+
label: 'Type',
|
|
61
|
+
type: 'select',
|
|
62
|
+
options: _integrationTypes["default"],
|
|
63
|
+
initialValue: 'mssql',
|
|
64
|
+
required: true,
|
|
65
|
+
enabled: false
|
|
66
|
+
}, {
|
|
67
|
+
name: 'statement',
|
|
68
|
+
label: 'Query',
|
|
69
|
+
type: 'code',
|
|
70
|
+
language: 'mssql',
|
|
71
|
+
initialValue: (0, _immutable.get)(config, 'statement'),
|
|
72
|
+
required: true
|
|
73
|
+
}, {
|
|
74
|
+
name: 'parameters',
|
|
75
|
+
label: 'Query Parameters',
|
|
76
|
+
type: 'map',
|
|
77
|
+
initialValue: (0, _immutable.get)(config, 'parameters'),
|
|
78
|
+
placeholder: 'Key',
|
|
79
|
+
helpText: /*#__PURE__*/React.createElement(React.Fragment, null, "Use the ", /*#__PURE__*/React.createElement("code", null, '{{parameter}}'), " format to create dynamic parameters.")
|
|
80
|
+
}];
|
|
81
|
+
};
|
|
@@ -35,6 +35,8 @@ var fields = function fields() {
|
|
|
35
35
|
label: 'Username',
|
|
36
36
|
type: 'text',
|
|
37
37
|
required: true,
|
|
38
|
+
pattern: /^[^/&?=:%]*$/,
|
|
39
|
+
patternMessage: 'The characters / & ? = : % are not allowed.',
|
|
38
40
|
initialValue: (0, _immutable.get)(user, 'username') || ''
|
|
39
41
|
}, {
|
|
40
42
|
name: 'password',
|
|
@@ -20,6 +20,7 @@ var _store = require("../../store");
|
|
|
20
20
|
var _Table = require("./Table.redux");
|
|
21
21
|
var _helpers = require("../../helpers");
|
|
22
22
|
var _Form = require("../form/Form");
|
|
23
|
+
var _FormState = require("../form/FormState");
|
|
23
24
|
var _excluded = ["components", "tableKey"];
|
|
24
25
|
var fromColumnSet = function fromColumnSet(columns, columnSet) {
|
|
25
26
|
return columnSet.map(function (cs) {
|
|
@@ -46,10 +47,19 @@ var TableComponent = function TableComponent(props) {
|
|
|
46
47
|
count = props.count,
|
|
47
48
|
extraData = props.extraData;
|
|
48
49
|
var columnControl = buildColumnControl(props);
|
|
50
|
+
var filterControl = buildFilterControl(props);
|
|
49
51
|
var table = buildTable((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {
|
|
50
52
|
columnControl: columnControl
|
|
51
53
|
}));
|
|
52
|
-
var filter = components.FilterForm ? buildFilterForm(
|
|
54
|
+
var filter = components.FilterForm ? buildFilterForm((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {
|
|
55
|
+
renderers: {
|
|
56
|
+
filterControl: function filterControl(args) {
|
|
57
|
+
return buildFilterControl((0, _objectSpread2["default"])({
|
|
58
|
+
args: args
|
|
59
|
+
}, props));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
})) : buildFilterLayout(props);
|
|
53
63
|
var pagination = buildPaginationControl(props);
|
|
54
64
|
return children({
|
|
55
65
|
tableKey: tableKey,
|
|
@@ -59,6 +69,7 @@ var TableComponent = function TableComponent(props) {
|
|
|
59
69
|
appliedFilters: appliedFilters,
|
|
60
70
|
pagination: pagination,
|
|
61
71
|
columnControl: columnControl,
|
|
72
|
+
filterControl: filterControl,
|
|
62
73
|
initializing: initializing,
|
|
63
74
|
loading: loading,
|
|
64
75
|
rows: rows,
|
|
@@ -143,6 +154,7 @@ var buildFilterForm = function buildFilterForm(props) {
|
|
|
143
154
|
formKey: props.filterFormKey,
|
|
144
155
|
tableKey: props.tableKey,
|
|
145
156
|
components: components,
|
|
157
|
+
renderers: props.renderers,
|
|
146
158
|
alterFields: props.alterFilters,
|
|
147
159
|
fieldSet: props.filterSet,
|
|
148
160
|
onSave: props.onSearch,
|
|
@@ -323,6 +335,41 @@ var buildColumnControl = function buildColumnControl(props) {
|
|
|
323
335
|
extraData: extraData
|
|
324
336
|
});
|
|
325
337
|
};
|
|
338
|
+
var buildFilterControl = function buildFilterControl(_ref4) {
|
|
339
|
+
var tableKey = _ref4.tableKey,
|
|
340
|
+
filterSet = _ref4.filterSet,
|
|
341
|
+
appliedFilters = _ref4.appliedFilters,
|
|
342
|
+
components = _ref4.components,
|
|
343
|
+
_ref4$args = _ref4.args,
|
|
344
|
+
args = _ref4$args === void 0 ? {} : _ref4$args;
|
|
345
|
+
var FilterControl = components.FilterControl;
|
|
346
|
+
return /*#__PURE__*/_react["default"].createElement(_FormState.FormState, {
|
|
347
|
+
formKey: (0, _Table.filterFormKey)(tableKey),
|
|
348
|
+
selector: function selector(formState) {
|
|
349
|
+
var _formState$fields, _formState$fields$map;
|
|
350
|
+
return {
|
|
351
|
+
filterFields: formState === null || formState === void 0 ? void 0 : (_formState$fields = formState.fields) === null || _formState$fields === void 0 ? void 0 : (_formState$fields$map = _formState$fields.map(function (field, name) {
|
|
352
|
+
return (0, _immutable.Map)({
|
|
353
|
+
name: name,
|
|
354
|
+
label: field.get('label'),
|
|
355
|
+
value: field.get('value'),
|
|
356
|
+
options: field.get('options'),
|
|
357
|
+
checked: filterSet === null || filterSet === void 0 ? void 0 : filterSet.includes(name),
|
|
358
|
+
toggle: onToggleFilter(tableKey, name)
|
|
359
|
+
});
|
|
360
|
+
})) === null || _formState$fields$map === void 0 ? void 0 : _formState$fields$map.toList()
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
}, function (_ref5) {
|
|
364
|
+
var _appliedFilters$filte;
|
|
365
|
+
var filterFields = _ref5.filterFields;
|
|
366
|
+
return /*#__PURE__*/_react["default"].createElement(FilterControl, Object.assign({}, args, {
|
|
367
|
+
tableKey: tableKey,
|
|
368
|
+
filterFields: filterFields,
|
|
369
|
+
filterCount: appliedFilters === null || appliedFilters === void 0 ? void 0 : (_appliedFilters$filte = appliedFilters.filter(Boolean)) === null || _appliedFilters$filte === void 0 ? void 0 : _appliedFilters$filte.size
|
|
370
|
+
}));
|
|
371
|
+
});
|
|
372
|
+
};
|
|
326
373
|
var buildTable = exports.buildTable = function buildTable(props) {
|
|
327
374
|
var TableLayout = props.components.TableLayout;
|
|
328
375
|
var header = buildTableHeader(props);
|
|
@@ -557,6 +604,17 @@ var onToggleColumn = function onToggleColumn(tableKey, column) {
|
|
|
557
604
|
});
|
|
558
605
|
};
|
|
559
606
|
};
|
|
607
|
+
var onToggleFilter = function onToggleFilter(tableKey) {
|
|
608
|
+
for (var _len = arguments.length, filters = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
609
|
+
filters[_key - 1] = arguments[_key];
|
|
610
|
+
}
|
|
611
|
+
return function () {
|
|
612
|
+
return (0, _store.dispatch)('TOGGLE_FILTER', {
|
|
613
|
+
tableKey: tableKey,
|
|
614
|
+
filters: filters
|
|
615
|
+
});
|
|
616
|
+
};
|
|
617
|
+
};
|
|
560
618
|
var mapStateToProps = function mapStateToProps() {
|
|
561
619
|
return function (state, props) {
|
|
562
620
|
return state.getIn(['tables', props.tableKey], (0, _immutable.Map)()).toObject();
|
|
@@ -635,18 +693,18 @@ var extractColumnComponents = exports.extractColumnComponents = function extract
|
|
|
635
693
|
return result.set(current.get('value'), current.get('components'));
|
|
636
694
|
}, (0, _immutable.Map)());
|
|
637
695
|
};
|
|
638
|
-
var generateTable = exports.generateTable = function generateTable(
|
|
639
|
-
var
|
|
640
|
-
tableOptions =
|
|
641
|
-
|
|
642
|
-
filterDataSources =
|
|
696
|
+
var generateTable = exports.generateTable = function generateTable(_ref6) {
|
|
697
|
+
var _ref6$tableOptions = _ref6.tableOptions,
|
|
698
|
+
tableOptions = _ref6$tableOptions === void 0 ? [] : _ref6$tableOptions,
|
|
699
|
+
_ref6$filterDataSourc = _ref6.filterDataSources,
|
|
700
|
+
filterDataSources = _ref6$filterDataSourc === void 0 ? function () {
|
|
643
701
|
return {};
|
|
644
|
-
} :
|
|
645
|
-
filters =
|
|
646
|
-
columns =
|
|
647
|
-
dataSource =
|
|
648
|
-
sortable =
|
|
649
|
-
onValidateFilters =
|
|
702
|
+
} : _ref6$filterDataSourc,
|
|
703
|
+
filters = _ref6.filters,
|
|
704
|
+
columns = _ref6.columns,
|
|
705
|
+
dataSource = _ref6.dataSource,
|
|
706
|
+
sortable = _ref6.sortable,
|
|
707
|
+
onValidateFilters = _ref6.onValidateFilters;
|
|
650
708
|
return function (props) {
|
|
651
709
|
var tableOptionProps = tableOptions ? tableOptions.reduce(function (to, opt) {
|
|
652
710
|
to[opt] = props[opt];
|
|
@@ -658,8 +716,8 @@ var generateTable = exports.generateTable = function generateTable(_ref4) {
|
|
|
658
716
|
dataSources: filterDataSources,
|
|
659
717
|
fields: filters,
|
|
660
718
|
formOptions: ['tableKey'].concat((0, _toConsumableArray2["default"])(tableOptions)),
|
|
661
|
-
handleSubmit: function handleSubmit(
|
|
662
|
-
var tableKey =
|
|
719
|
+
handleSubmit: function handleSubmit(_ref7) {
|
|
720
|
+
var tableKey = _ref7.tableKey;
|
|
663
721
|
return function (values) {
|
|
664
722
|
(0, _store.dispatch)('APPLY_FILTER_FORM', {
|
|
665
723
|
tableKey: tableKey,
|
|
@@ -712,7 +770,9 @@ var generateTable = exports.generateTable = function generateTable(_ref4) {
|
|
|
712
770
|
filterForm: !!filters,
|
|
713
771
|
initialFilterValues: props.initialFilterValues || {},
|
|
714
772
|
onSearch: props.onSearch,
|
|
715
|
-
onFetch: props.onFetch
|
|
773
|
+
onFetch: props.onFetch,
|
|
774
|
+
onColumnSort: props.onColumnSort,
|
|
775
|
+
onColumnToggle: props.onColumnToggle
|
|
716
776
|
};
|
|
717
777
|
return /*#__PURE__*/_react["default"].createElement(Table, setProps, props.children);
|
|
718
778
|
};
|