@kineticdata/react 5.0.16 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apis/core/attributeDefinitions.js +3 -2
- package/lib/apis/core/authentication.js +13 -5
- package/lib/apis/core/backgroundJobs.js +22 -39
- package/lib/apis/core/fileResources.js +36 -0
- package/lib/apis/core/filestores.js +40 -0
- package/lib/apis/core/forms.js +21 -36
- package/lib/apis/core/forms.test.js +51 -278
- package/lib/apis/core/securityPolicyDefinitions.test.js +4 -4
- package/lib/apis/core/submissions.js +46 -30
- package/lib/apis/core/webhooks.js +1 -2
- package/lib/apis/discussions/index.js +2 -1
- package/lib/apis/http.js +28 -13
- package/lib/apis/http.test.js +13 -15
- package/lib/apis/index.js +2 -0
- package/lib/apis/system/index.js +86 -1
- package/lib/apis/task/index.js +22 -14
- package/lib/components/agent/filestore/FilestoreForm.js +132 -0
- package/lib/components/agent/filestore/FilestoreTable.js +53 -0
- package/lib/components/common/BridgeSelect.js +2 -1
- package/lib/components/common/FormSelect.js +2 -1
- package/lib/components/common/Scroller.js +6 -6
- package/lib/components/common/TableInput.js +74 -29
- package/lib/components/common/TeamSelect.js +2 -1
- package/lib/components/common/Typeahead.js +7 -4
- package/lib/components/common/UserSelect.js +2 -1
- package/lib/components/common/authentication/AuthenticationContainer.js +50 -27
- package/lib/components/common/code_input/languageHelpers.test.js +1 -1
- package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +1 -1
- package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +1 -1
- package/lib/components/core/core_form/CoreForm.js +10 -10
- package/lib/components/core/field_definition/FieldDefinitionForm.js +130 -0
- package/lib/components/core/field_definition/FieldDefinitionTable.js +86 -0
- package/lib/components/core/file_resource/FileResourceForm.js +180 -0
- package/lib/components/core/file_resource/FileResourceTable.js +71 -0
- package/lib/components/core/form/FormForm.js +12 -17
- package/lib/components/core/form/FormTable.js +3 -8
- package/lib/components/core/i18n/I18n.js +15 -15
- package/lib/components/core/index_definition/IndexDefinitionForm.js +32 -19
- package/lib/components/core/index_definition/IndexDefinitionTable.js +15 -24
- package/lib/components/core/index_job/IndexJobTable.js +12 -9
- package/lib/components/core/security_definition/SecurityDefinitionForm.js +1 -1
- package/lib/components/core/space/SpaceForm.js +59 -10
- package/lib/components/core/submission/DatastoreSubmissionTable.js +31 -1
- package/lib/components/core/submission/FormSubmissionFilters.js +378 -0
- package/lib/components/core/submission/FormSubmissionTable.js +116 -0
- package/lib/components/core/submission/KappSubmissionTable.js +250 -0
- package/lib/components/core/submission/SubmissionForm.js +124 -0
- package/lib/components/core/submission/SubmissionTable.js +35 -249
- package/lib/components/core/submission/helpers.js +95 -0
- package/lib/components/core/submission/helpers.test.js +96 -0
- package/lib/components/core/translation/ContextTable.js +1 -1
- package/lib/components/core/user/UserForm.js +2 -2
- package/lib/components/core/webapi/WebApiForm.js +111 -126
- package/lib/components/core/webhook/WebhookForm.js +1 -1
- package/lib/components/form/Form.helpers.js +1 -1
- package/lib/components/form/Form.js +200 -144
- package/lib/components/index.js +16 -6
- package/lib/components/system/SystemBackgroundTasksTable.js +83 -0
- package/lib/components/system/SystemSecurityForm.js +69 -0
- package/lib/components/system/helpers.js +20 -6
- package/lib/components/system/spaces/SystemSpaceForm.js +44 -16
- package/lib/components/system/spaces/SystemTenantForm.js +15 -9
- package/lib/components/system/spaces/SystemTenantTable.js +21 -16
- package/lib/components/table/Table.js +37 -10
- package/lib/components/table/Table.redux.js +228 -57
- package/lib/components/table/Table.redux.test.js +73 -2
- package/lib/components/task/builder/Connector.js +21 -10
- package/lib/components/task/builder/ConnectorForm.js +1 -1
- package/lib/components/task/builder/Node.js +10 -3
- package/lib/components/task/builder/NodeForm.js +54 -22
- package/lib/components/task/builder/NodeParametersForm.js +5 -2
- package/lib/components/task/builder/SvgCanvas.js +13 -4
- package/lib/components/task/builder/TaskDefinitionConfigForm.js +113 -0
- package/lib/components/task/builder/TreeBuilder.js +27 -9
- package/lib/components/task/builder/builder.redux.js +159 -52
- package/lib/components/task/builder/helpers.js +5 -3
- package/lib/components/task/builder/models.js +84 -12
- package/lib/components/task/errors/RunErrorTable.js +1 -1
- package/lib/components/task/runs/CreateManualTriggerForm.js +15 -24
- package/lib/components/task/runs/RunTable.js +5 -3
- package/lib/components/task/triggers/TriggerTable.js +3 -2
- package/lib/components/task/workflows/WorkflowForm.js +67 -85
- package/lib/helpers/index.js +19 -2
- package/lib/index.js +1 -0
- package/lib/models/discussions.js +18 -2
- package/lib/models/index.js +1 -1
- package/package.json +3 -3
- package/proxyhelper.js +19 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
-
import { get, Map } from 'immutable';
|
|
3
|
+
import { fromJS, get, Map } from 'immutable';
|
|
4
4
|
import t from 'prop-types';
|
|
5
5
|
import { generateForm } from '../../form/Form';
|
|
6
6
|
import { updateSpace, fetchSpace, fetchAttributeDefinitions, fetchLocales, fetchTimezones, fetchSecurityPolicyDefinitions } from '../../../apis';
|
|
@@ -12,7 +12,7 @@ var dataSources = function dataSources() {
|
|
|
12
12
|
space: {
|
|
13
13
|
fn: fetchSpace,
|
|
14
14
|
params: [{
|
|
15
|
-
include: 'attributesMap,securityPolicies,details'
|
|
15
|
+
include: 'allowedIps,attributesMap,securityPolicies,details'
|
|
16
16
|
}],
|
|
17
17
|
transform: function transform(result) {
|
|
18
18
|
return result.space;
|
|
@@ -113,6 +113,26 @@ var securityEndpoints = {
|
|
|
113
113
|
endpoint: 'User Modification',
|
|
114
114
|
label: 'User Modification',
|
|
115
115
|
types: ['Space', 'User']
|
|
116
|
+
},
|
|
117
|
+
defaultFormDisplay: {
|
|
118
|
+
endpoint: 'Default Form Display',
|
|
119
|
+
label: 'Default Form Display',
|
|
120
|
+
types: ['Form']
|
|
121
|
+
},
|
|
122
|
+
defaultFormModification: {
|
|
123
|
+
endpoint: 'Default Form Modification',
|
|
124
|
+
label: 'Default Form Modification',
|
|
125
|
+
types: ['Form']
|
|
126
|
+
},
|
|
127
|
+
defaultSubmissionAccess: {
|
|
128
|
+
endpoint: 'Default Submission Access',
|
|
129
|
+
label: 'Default Submission Access',
|
|
130
|
+
types: ['Form', 'Submission']
|
|
131
|
+
},
|
|
132
|
+
defaultSubmissionModification: {
|
|
133
|
+
endpoint: 'Default Submission Modification',
|
|
134
|
+
label: 'Default Submission Modification',
|
|
135
|
+
types: ['Form', 'Submission']
|
|
116
136
|
}
|
|
117
137
|
};
|
|
118
138
|
|
|
@@ -146,20 +166,20 @@ var fields = function fields() {
|
|
|
146
166
|
return get(values, 'sharedBundleBase') !== '' && get(values, 'displayType') === 'Display Page';
|
|
147
167
|
}
|
|
148
168
|
}, {
|
|
149
|
-
name: '
|
|
150
|
-
label: 'Default
|
|
169
|
+
name: 'defaultFormConfirmationPage',
|
|
170
|
+
label: 'Default Form Confirmation Page',
|
|
151
171
|
type: 'text',
|
|
152
|
-
initialValue: get(space, '
|
|
172
|
+
initialValue: get(space, 'defaultFormConfirmationPage'),
|
|
153
173
|
placeholder: 'confirmation.jsp',
|
|
154
174
|
visible: function visible(_ref6) {
|
|
155
175
|
var values = _ref6.values;
|
|
156
176
|
return get(values, 'displayType') !== 'Single Page App';
|
|
157
177
|
}
|
|
158
178
|
}, {
|
|
159
|
-
name: '
|
|
160
|
-
label: 'Default
|
|
179
|
+
name: 'defaultFormDisplayPage',
|
|
180
|
+
label: 'Default Form Display Page',
|
|
161
181
|
type: 'text',
|
|
162
|
-
initialValue: get(space, '
|
|
182
|
+
initialValue: get(space, 'defaultFormDisplayPage'),
|
|
163
183
|
placeholder: 'form.jsp',
|
|
164
184
|
visible: function visible(_ref7) {
|
|
165
185
|
var values = _ref7.values;
|
|
@@ -426,13 +446,42 @@ var fields = function fields() {
|
|
|
426
446
|
});
|
|
427
447
|
},
|
|
428
448
|
initialValue: get(space, 'securityPolicies')
|
|
449
|
+
}, {
|
|
450
|
+
name: 'allowedIps',
|
|
451
|
+
label: 'Allowed IPs',
|
|
452
|
+
type: 'select',
|
|
453
|
+
options: function options() {
|
|
454
|
+
return fromJS([{
|
|
455
|
+
name: 'description',
|
|
456
|
+
label: 'Description',
|
|
457
|
+
type: 'text'
|
|
458
|
+
}, {
|
|
459
|
+
name: 'value',
|
|
460
|
+
label: 'IP Range',
|
|
461
|
+
type: 'text'
|
|
462
|
+
}]);
|
|
463
|
+
},
|
|
464
|
+
visible: function visible(_ref34) {
|
|
465
|
+
var values = _ref34.values;
|
|
466
|
+
return values.get('allowedIpsEnabled', false);
|
|
467
|
+
},
|
|
468
|
+
initialValue: get(space, 'allowedIps', []),
|
|
469
|
+
serialize: function serialize(_ref35) {
|
|
470
|
+
var values = _ref35.values;
|
|
471
|
+
return values.get('allowedIpsEnabled', false) ? values.get('allowedIps') : [];
|
|
472
|
+
}
|
|
473
|
+
}, {
|
|
474
|
+
name: 'allowedIpsEnabled',
|
|
475
|
+
label: 'Enabled Allowed IP Restrictions?',
|
|
476
|
+
type: 'checkbox',
|
|
477
|
+
initialValue: get(space, 'allowedIpsEnabled', false) || false
|
|
429
478
|
}, {
|
|
430
479
|
name: 'attributesMap',
|
|
431
480
|
label: 'Attributes',
|
|
432
481
|
type: 'attributes',
|
|
433
482
|
required: false,
|
|
434
|
-
options: function options(
|
|
435
|
-
var attributeDefinitions =
|
|
483
|
+
options: function options(_ref36) {
|
|
484
|
+
var attributeDefinitions = _ref36.attributeDefinitions;
|
|
436
485
|
return attributeDefinitions;
|
|
437
486
|
},
|
|
438
487
|
initialValue: get(space, 'attributesMap')
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
1
5
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
|
+
import React, { Component } from 'react';
|
|
3
8
|
import { generateTable } from '../../table/Table';
|
|
4
9
|
import { searchSubmissions } from '../../../apis';
|
|
5
10
|
import { generatePaginationParams } from '../../../apis/http';
|
|
@@ -103,12 +108,37 @@ var columns = [{
|
|
|
103
108
|
title: 'Updated By',
|
|
104
109
|
sortable: false
|
|
105
110
|
}];
|
|
106
|
-
|
|
111
|
+
var DatastoreSubmissionTableComponent = generateTable({
|
|
107
112
|
tableOptions: ['formSlug', 'include'],
|
|
108
113
|
columns: columns,
|
|
109
114
|
dataSource: dataSource,
|
|
110
115
|
filters: filters,
|
|
111
116
|
filterDataSources: filterDataSources
|
|
112
117
|
});
|
|
118
|
+
export var DatastoreSubmissionTable = /*#__PURE__*/function (_Component) {
|
|
119
|
+
_inherits(DatastoreSubmissionTable, _Component);
|
|
120
|
+
|
|
121
|
+
var _super = _createSuper(DatastoreSubmissionTable);
|
|
122
|
+
|
|
123
|
+
function DatastoreSubmissionTable() {
|
|
124
|
+
_classCallCheck(this, DatastoreSubmissionTable);
|
|
125
|
+
|
|
126
|
+
return _super.apply(this, arguments);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
_createClass(DatastoreSubmissionTable, [{
|
|
130
|
+
key: "componentDidMount",
|
|
131
|
+
value: function componentDidMount() {
|
|
132
|
+
console.warn('Datastore Submissions are deprecated in Core 5.1, please upgrade to "form" mode.');
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
key: "render",
|
|
136
|
+
value: function render() {
|
|
137
|
+
return /*#__PURE__*/React.createElement(DatastoreSubmissionTableComponent, this.props, this.props.children);
|
|
138
|
+
}
|
|
139
|
+
}]);
|
|
140
|
+
|
|
141
|
+
return DatastoreSubmissionTable;
|
|
142
|
+
}(Component);
|
|
113
143
|
DatastoreSubmissionTable.displayName = 'DatastoreSubmissionTable';
|
|
114
144
|
export default DatastoreSubmissionTable;
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
import { List, Map, Range } from 'immutable';
|
|
4
|
+
import moment from 'moment';
|
|
5
|
+
import { fetchForm, fetchKapp, fetchSpace } from '../../../apis';
|
|
6
|
+
import { defineKqlQuery, MAX_PART_LENGTH, TIMELINES } from '../../../helpers';
|
|
7
|
+
import { availableParts, getUsedFields } from './helpers';
|
|
8
|
+
export var filterDataSources = function filterDataSources(_ref) {
|
|
9
|
+
var formSlug = _ref.formSlug,
|
|
10
|
+
kappSlug = _ref.kappSlug;
|
|
11
|
+
return {
|
|
12
|
+
form: {
|
|
13
|
+
fn: !formSlug && !kappSlug ? fetchSpace : kappSlug && !formSlug ? fetchKapp : fetchForm,
|
|
14
|
+
params: [{
|
|
15
|
+
kappSlug: kappSlug,
|
|
16
|
+
formSlug: formSlug,
|
|
17
|
+
include: 'indexDefinitions,fields,fields.details'
|
|
18
|
+
}],
|
|
19
|
+
transform: function transform(result) {
|
|
20
|
+
return !formSlug && !kappSlug ? result.space : kappSlug && !formSlug ? result.kapp : result.form;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
fields: {
|
|
24
|
+
fn: function fn(form) {
|
|
25
|
+
return form.get('fields').filter(function (f) {
|
|
26
|
+
return f.get('dataType') !== 'file';
|
|
27
|
+
}).map(function (f) {
|
|
28
|
+
return "values[".concat(f.get('name'), "]");
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
params: function params(_ref2) {
|
|
32
|
+
var form = _ref2.form;
|
|
33
|
+
return form && [form];
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
indexDefinitions: {
|
|
37
|
+
fn: function fn(form) {
|
|
38
|
+
return form.get('indexDefinitions');
|
|
39
|
+
},
|
|
40
|
+
params: function params(_ref3) {
|
|
41
|
+
var form = _ref3.form;
|
|
42
|
+
return form && [form];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var getPartIndex = function getPartIndex(name) {
|
|
49
|
+
var match = name.match(/op(\d+)-part/);
|
|
50
|
+
return match && parseInt(match[1]);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var getOrderPartIndex = function getOrderPartIndex(name) {
|
|
54
|
+
var match = name.match(/orderby(\d+)-part/);
|
|
55
|
+
return match && parseInt(match[1]);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var operatorChangeFn = function operatorChangeFn(i) {
|
|
59
|
+
return function (_ref4, _ref5) {
|
|
60
|
+
var values = _ref4.values;
|
|
61
|
+
var setValue = _ref5.setValue;
|
|
62
|
+
var value = values.get("op".concat(i, "-operator")); // If the operator was set to '' and the first operand is set, clear it.
|
|
63
|
+
|
|
64
|
+
if (!value && values.get("op".concat(i, "-operand1"))) {
|
|
65
|
+
setValue("op".concat(i, "-operand1"), '');
|
|
66
|
+
} // If the operator is not 'bt' and the second operand is set, clear it.
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
if (value !== 'between' && values.get("op".concat(i, "-operand2"))) {
|
|
70
|
+
setValue("op".concat(i, "-operand2"), '');
|
|
71
|
+
} // If the operator is not 'in and the third operand is set, clear it.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
if (value !== 'in' && !values.get("op".concat(i, "-operand3")).isEmpty()) {
|
|
75
|
+
setValue("op".concat(i, "-operand3"), List());
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
var partChangeFn = function partChangeFn(i) {
|
|
81
|
+
return function (_ref6, _ref7) {
|
|
82
|
+
var values = _ref6.values;
|
|
83
|
+
var setValue = _ref7.setValue;
|
|
84
|
+
// If the operator was set to something besides 'eq' or 'in' clear any
|
|
85
|
+
// operators after this. Their change events will then fire and clear the
|
|
86
|
+
// corresponding operands.
|
|
87
|
+
values.filter(function (value, name) {
|
|
88
|
+
return getPartIndex(name) > i;
|
|
89
|
+
}).forEach(function (_value, name) {
|
|
90
|
+
return setValue(name, '', false);
|
|
91
|
+
});
|
|
92
|
+
setValue('range-part', '', false);
|
|
93
|
+
Range(0, MAX_PART_LENGTH).forEach(function (i) {
|
|
94
|
+
return setValue("orderby".concat(i, "-part"), '', false);
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
var orderChangeFn = function orderChangeFn(i) {
|
|
100
|
+
return function (_ref8, _ref9) {
|
|
101
|
+
var values = _ref8.values;
|
|
102
|
+
var setValue = _ref9.setValue;
|
|
103
|
+
var value = values.get("orderby".concat(i, "-part"));
|
|
104
|
+
|
|
105
|
+
if (!value || TIMELINES.includes(value)) {
|
|
106
|
+
values.filter(function (value, name) {
|
|
107
|
+
return getOrderPartIndex(name) > i;
|
|
108
|
+
}).forEach(function (_value, name) {
|
|
109
|
+
return setValue(name, '', false);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
var enabledFn = function enabledFn(i) {
|
|
116
|
+
return function (_ref10) {
|
|
117
|
+
var values = _ref10.values;
|
|
118
|
+
return Range(0, i, -1).map(function (i) {
|
|
119
|
+
return values.get("op".concat(i, "-part"));
|
|
120
|
+
}).every(function (value) {
|
|
121
|
+
return value;
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
var rangeVisibleFn = function rangeVisibleFn(operatorType) {
|
|
127
|
+
var timeline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
128
|
+
return function (_ref11) {
|
|
129
|
+
var values = _ref11.values,
|
|
130
|
+
indexDefinitions = _ref11.indexDefinitions;
|
|
131
|
+
var usedFields = getUsedFields(values, -1, 'range');
|
|
132
|
+
var partsAvailable = availableParts(values, indexDefinitions, usedFields, 'range');
|
|
133
|
+
var isOperandValid = operatorType ? !timeline ? operatorType === 'between' ? !TIMELINES.includes(values.get('range-part')) && values.get('range-operator') === 'between' : !TIMELINES.includes(values.get('range-part')) : operatorType === 'between' ? TIMELINES.includes(values.get('range-part')) && values.get('range-operator') === 'between' : TIMELINES.includes(values.get('range-part')) : true;
|
|
134
|
+
return isOperandValid && partsAvailable.size > 0;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
var visibleFn = function visibleFn(currentPart, i, operatorType) {
|
|
139
|
+
return function (_ref12) {
|
|
140
|
+
var values = _ref12.values,
|
|
141
|
+
indexDefinitions = _ref12.indexDefinitions;
|
|
142
|
+
var hasRange = values.get('range-part') !== '';
|
|
143
|
+
var hasOrderBy = Range(0, MAX_PART_LENGTH).map(function (i) {
|
|
144
|
+
return values.get("orderby".concat(i, "-part"));
|
|
145
|
+
}).filter(function (v) {
|
|
146
|
+
return v !== '';
|
|
147
|
+
}).toList().size > 0;
|
|
148
|
+
var usedFields = getUsedFields(values, i, 'eq');
|
|
149
|
+
var partsAvailable = availableParts(values, indexDefinitions, usedFields, 'eq'); // If this equality has this operator type selected.
|
|
150
|
+
|
|
151
|
+
if (operatorType) return values.get("op".concat(i, "-operator")) === operatorType; // If there's a range value set and this equality is not.
|
|
152
|
+
|
|
153
|
+
if ((hasRange || hasOrderBy) && !values.get("op".concat(i, "-part"))) return false; // If it is the first equality or the previous equality has a value set and
|
|
154
|
+
// this equality has available options.
|
|
155
|
+
|
|
156
|
+
return (i === 0 || values.get("op".concat(i - 1, "-part"))) && partsAvailable.size > 0;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
var orderVisibleFn = function orderVisibleFn(partIndex) {
|
|
161
|
+
return function (bindings) {
|
|
162
|
+
var values = bindings.values;
|
|
163
|
+
var prevPart = values.get("orderby".concat(partIndex - 1, "-part"));
|
|
164
|
+
return partIndex === 0 || !values.get('range-part') && prevPart && !TIMELINES.includes(prevPart);
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export var availableOptions = function availableOptions(partType, partIndex) {
|
|
169
|
+
return function (bindings) {
|
|
170
|
+
var values = bindings.values,
|
|
171
|
+
indexDefinitions = bindings.indexDefinitions;
|
|
172
|
+
var usedFields = getUsedFields(values, partIndex, partType);
|
|
173
|
+
var partsAvailable = availableParts(values, indexDefinitions, usedFields, partType).flatten();
|
|
174
|
+
var valueParts = partsAvailable.filter(function (f) {
|
|
175
|
+
return f.startsWith('values[');
|
|
176
|
+
}).sort();
|
|
177
|
+
var staticParts = partsAvailable.filterNot(function (f) {
|
|
178
|
+
return f.startsWith('values[');
|
|
179
|
+
}).sort();
|
|
180
|
+
return valueParts.concat(staticParts).map(function (f) {
|
|
181
|
+
return Map({
|
|
182
|
+
label: f,
|
|
183
|
+
value: f
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
var getRValues = function getRValues(operator, values, opBase) {
|
|
190
|
+
var isTimeline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
191
|
+
var v1 = isTimeline ? values.get("".concat(opBase, "-operand3")) : values.get("".concat(opBase, "-operand1"));
|
|
192
|
+
var v2 = isTimeline ? values.get("".concat(opBase, "-operand4")) : values.get("".concat(opBase, "-operand2"));
|
|
193
|
+
return operator === 'between' ? [v1, v2] : operator === 'in' ? [values.get("".concat(opBase, "-operand3"))] : [v1];
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
var getSerializedParts = function getSerializedParts(values) {
|
|
197
|
+
return Range(0, MAX_PART_LENGTH).filter(function (i) {
|
|
198
|
+
return values.get("op".concat(i, "-part"));
|
|
199
|
+
}).map(function (i) {
|
|
200
|
+
// Handle the equality parts.
|
|
201
|
+
var part = values.get("op".concat(i, "-part"));
|
|
202
|
+
var operator = values.get("op".concat(i, "-operator"));
|
|
203
|
+
var rValues = getRValues(operator, values, "op".concat(i));
|
|
204
|
+
return List([part, operator, "op".concat(i)].concat(_toConsumableArray(rValues)));
|
|
205
|
+
}).toList().update(function (ps) {
|
|
206
|
+
var rangePart = values.get('range-part');
|
|
207
|
+
var rangeOp = values.get('range-operator');
|
|
208
|
+
var rangeValues = getRValues(rangeOp, values, 'range', TIMELINES.includes(rangePart));
|
|
209
|
+
return rangePart ? ps.push(List([rangePart, rangeOp, 'range'].concat(_toConsumableArray(rangeValues)))) : ps;
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
var serializeQuery = function serializeQuery(_ref13) {
|
|
214
|
+
var values = _ref13.values;
|
|
215
|
+
var parts = getSerializedParts(values);
|
|
216
|
+
return {
|
|
217
|
+
parts: parts,
|
|
218
|
+
q: parts.reduce(function (query, partEntry) {
|
|
219
|
+
var _partEntry = _slicedToArray(partEntry, 3),
|
|
220
|
+
part = _partEntry[0],
|
|
221
|
+
operator = _partEntry[1],
|
|
222
|
+
opBase = _partEntry[2];
|
|
223
|
+
|
|
224
|
+
var op1 = opBase === 'range' && TIMELINES.includes(part) ? "".concat(opBase, "-operand3") : "".concat(opBase, "-operand1");
|
|
225
|
+
var op2 = opBase === 'range' && TIMELINES.includes(part) ? "".concat(opBase, "-operand4") : "".concat(opBase, "-operand2");
|
|
226
|
+
var op3 = "".concat(opBase, "-operand3");
|
|
227
|
+
return operator === 'between' ? query.between(part, op1, op2, true) : operator === 'in' ? query["in"](part, op3, true) : operator ? query[operator](part, op1, true) : query;
|
|
228
|
+
}, defineKqlQuery()).end()(values.map(function (v, k) {
|
|
229
|
+
return ['range-operand3', 'range-operand4'].includes(k) && v ? moment(v).toISOString() : v;
|
|
230
|
+
}).toJS()),
|
|
231
|
+
orderBy: Range(0, MAX_PART_LENGTH).map(function (i) {
|
|
232
|
+
return values.get("orderby".concat(i, "-part"));
|
|
233
|
+
}).filter(function (v) {
|
|
234
|
+
return v;
|
|
235
|
+
}).toArray().join(',')
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export var filters = function filters() {
|
|
240
|
+
return function (_ref14) {
|
|
241
|
+
var form = _ref14.form,
|
|
242
|
+
indexDefinitions = _ref14.indexDefinitions;
|
|
243
|
+
return form && indexDefinitions && [].concat(_toConsumableArray(Range(0, MAX_PART_LENGTH).flatMap(function (i) {
|
|
244
|
+
return [{
|
|
245
|
+
enabled: enabledFn(i),
|
|
246
|
+
name: "op".concat(i, "-part"),
|
|
247
|
+
type: 'select',
|
|
248
|
+
visible: visibleFn("op".concat(i, "-part"), i),
|
|
249
|
+
onChange: partChangeFn(i),
|
|
250
|
+
options: availableOptions('eq', i),
|
|
251
|
+
"transient": true
|
|
252
|
+
}, {
|
|
253
|
+
enabled: enabledFn(i),
|
|
254
|
+
name: "op".concat(i, "-operator"),
|
|
255
|
+
type: 'select',
|
|
256
|
+
visible: visibleFn("op".concat(i, "-part"), i),
|
|
257
|
+
onChange: operatorChangeFn(i),
|
|
258
|
+
options: [{
|
|
259
|
+
label: '=',
|
|
260
|
+
value: 'equals'
|
|
261
|
+
}, {
|
|
262
|
+
label: 'in',
|
|
263
|
+
value: 'in'
|
|
264
|
+
}],
|
|
265
|
+
initialValue: 'equals',
|
|
266
|
+
"transient": true
|
|
267
|
+
}, {
|
|
268
|
+
enabled: enabledFn(i),
|
|
269
|
+
name: "op".concat(i, "-operand1"),
|
|
270
|
+
"transient": true,
|
|
271
|
+
type: 'text',
|
|
272
|
+
visible: visibleFn("op".concat(i, "-part"), i)
|
|
273
|
+
}, {
|
|
274
|
+
enabled: enabledFn(i),
|
|
275
|
+
name: "op".concat(i, "-operand2"),
|
|
276
|
+
"transient": true,
|
|
277
|
+
type: 'text',
|
|
278
|
+
visible: visibleFn("op".concat(i, "-part"), i, 'between')
|
|
279
|
+
}, {
|
|
280
|
+
enabled: enabledFn(i),
|
|
281
|
+
name: "op".concat(i, "-operand3"),
|
|
282
|
+
"transient": true,
|
|
283
|
+
type: 'text-multi',
|
|
284
|
+
visible: visibleFn("op".concat(i, "-part"), i, 'in')
|
|
285
|
+
}];
|
|
286
|
+
}).toArray()), [{
|
|
287
|
+
name: 'range-part',
|
|
288
|
+
type: 'select',
|
|
289
|
+
visible: rangeVisibleFn(),
|
|
290
|
+
options: availableOptions('range'),
|
|
291
|
+
onChange: function onChange(_ref15, _ref16) {
|
|
292
|
+
var values = _ref15.values;
|
|
293
|
+
var setValue = _ref16.setValue;
|
|
294
|
+
// Recalculate order by.
|
|
295
|
+
var value = values.get('range-part'); // Clear out all of the order by values, range supersedes.
|
|
296
|
+
|
|
297
|
+
setValue('orderby0-part', value);
|
|
298
|
+
Range(1, MAX_PART_LENGTH).forEach(function (i) {
|
|
299
|
+
return setValue("orderby".concat(i, "-part"), '');
|
|
300
|
+
});
|
|
301
|
+
},
|
|
302
|
+
"transient": true
|
|
303
|
+
}, {
|
|
304
|
+
name: 'range-operator',
|
|
305
|
+
type: 'select',
|
|
306
|
+
visible: rangeVisibleFn(),
|
|
307
|
+
options: [{
|
|
308
|
+
label: '>',
|
|
309
|
+
value: 'greaterThan'
|
|
310
|
+
}, {
|
|
311
|
+
label: '>=',
|
|
312
|
+
value: 'greaterThanOrEquals'
|
|
313
|
+
}, {
|
|
314
|
+
label: '<',
|
|
315
|
+
value: 'lessThan'
|
|
316
|
+
}, {
|
|
317
|
+
label: '<=',
|
|
318
|
+
value: 'lessThanOrEquals'
|
|
319
|
+
}, {
|
|
320
|
+
label: 'between',
|
|
321
|
+
value: 'between'
|
|
322
|
+
}, {
|
|
323
|
+
label: 'startsWith',
|
|
324
|
+
value: 'startsWith'
|
|
325
|
+
}],
|
|
326
|
+
"transient": true
|
|
327
|
+
}, {
|
|
328
|
+
name: 'range-operand1',
|
|
329
|
+
"transient": true,
|
|
330
|
+
type: 'text',
|
|
331
|
+
visible: rangeVisibleFn('eq', false)
|
|
332
|
+
}, {
|
|
333
|
+
name: 'range-operand2',
|
|
334
|
+
"transient": true,
|
|
335
|
+
type: 'text',
|
|
336
|
+
visible: rangeVisibleFn('between', false)
|
|
337
|
+
}, {
|
|
338
|
+
name: 'range-operand3',
|
|
339
|
+
"transient": true,
|
|
340
|
+
type: 'datetime',
|
|
341
|
+
visible: rangeVisibleFn('eq', true)
|
|
342
|
+
}, {
|
|
343
|
+
name: 'range-operand4',
|
|
344
|
+
"transient": true,
|
|
345
|
+
type: 'datetime',
|
|
346
|
+
visible: rangeVisibleFn('between', true)
|
|
347
|
+
}, {
|
|
348
|
+
name: 'orderDirection',
|
|
349
|
+
type: 'select',
|
|
350
|
+
options: [{
|
|
351
|
+
label: 'ASC',
|
|
352
|
+
value: 'ASC'
|
|
353
|
+
}, {
|
|
354
|
+
label: 'DESC',
|
|
355
|
+
value: 'DESC'
|
|
356
|
+
}],
|
|
357
|
+
initialValue: 'DESC',
|
|
358
|
+
required: true
|
|
359
|
+
}], _toConsumableArray(Range(0, MAX_PART_LENGTH).flatMap(function (i) {
|
|
360
|
+
return [{
|
|
361
|
+
name: "orderby".concat(i, "-part"),
|
|
362
|
+
"transient": true,
|
|
363
|
+
type: 'select',
|
|
364
|
+
onChange: orderChangeFn(i),
|
|
365
|
+
enabled: function enabled(_ref17) {
|
|
366
|
+
var values = _ref17.values;
|
|
367
|
+
return !values.get('range-part');
|
|
368
|
+
},
|
|
369
|
+
options: availableOptions('orderBy', i),
|
|
370
|
+
visible: orderVisibleFn(i)
|
|
371
|
+
}];
|
|
372
|
+
}).toArray()), [{
|
|
373
|
+
name: 'query',
|
|
374
|
+
type: null,
|
|
375
|
+
serialize: serializeQuery
|
|
376
|
+
}]);
|
|
377
|
+
};
|
|
378
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import { generateTable } from '../../table/Table';
|
|
4
|
+
import { searchSubmissions } from '../../../apis';
|
|
5
|
+
import { generatePaginationParams, transformCoreResult } from '../../../apis/http';
|
|
6
|
+
import { filterDataSources, filters } from './FormSubmissionFilters';
|
|
7
|
+
import { Set } from 'immutable';
|
|
8
|
+
|
|
9
|
+
var dataSource = function dataSource(_ref) {
|
|
10
|
+
var kappSlug = _ref.kappSlug,
|
|
11
|
+
formSlug = _ref.formSlug,
|
|
12
|
+
include = _ref.include,
|
|
13
|
+
count = _ref.count;
|
|
14
|
+
return {
|
|
15
|
+
fn: function fn(options) {
|
|
16
|
+
return searchSubmissions(options);
|
|
17
|
+
},
|
|
18
|
+
params: function params(paramData) {
|
|
19
|
+
var q = paramData.filters.getIn(['query', 'q']) || undefined;
|
|
20
|
+
var orderBy = paramData.filters.getIn(['query', 'orderBy']) || 'createdAt';
|
|
21
|
+
return [{
|
|
22
|
+
form: formSlug,
|
|
23
|
+
kapp: kappSlug,
|
|
24
|
+
search: _objectSpread({
|
|
25
|
+
direction: paramData.filters.get('orderDirection', 'DESC'),
|
|
26
|
+
include: Set([].concat(_toConsumableArray(typeof include === 'string' ? include.split(',') : Array.isArray(include) ? include : []), ['details'])).toJS(),
|
|
27
|
+
// need to pass undefined instead of null so the `q` parameter is not
|
|
28
|
+
// added to the query string with empty value
|
|
29
|
+
q: q,
|
|
30
|
+
orderBy: orderBy
|
|
31
|
+
}, generatePaginationParams(paramData)),
|
|
32
|
+
count: count ? true : undefined
|
|
33
|
+
}];
|
|
34
|
+
},
|
|
35
|
+
transform: transformCoreResult('submissions')
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var columns = [{
|
|
40
|
+
value: 'closedAt',
|
|
41
|
+
title: 'Closed At',
|
|
42
|
+
sortable: true
|
|
43
|
+
}, {
|
|
44
|
+
value: 'closedBy',
|
|
45
|
+
title: 'closedBy',
|
|
46
|
+
sortable: false
|
|
47
|
+
}, {
|
|
48
|
+
value: 'coreState',
|
|
49
|
+
title: 'Core State',
|
|
50
|
+
sortable: false
|
|
51
|
+
}, {
|
|
52
|
+
value: 'createdAt',
|
|
53
|
+
title: 'Created',
|
|
54
|
+
sortable: true
|
|
55
|
+
}, {
|
|
56
|
+
value: 'createdBy',
|
|
57
|
+
title: 'Created By',
|
|
58
|
+
sortable: false
|
|
59
|
+
}, {
|
|
60
|
+
value: 'currentPage',
|
|
61
|
+
title: 'Current Page',
|
|
62
|
+
sortable: false
|
|
63
|
+
}, {
|
|
64
|
+
value: 'handle',
|
|
65
|
+
title: 'Handle',
|
|
66
|
+
sortable: false
|
|
67
|
+
}, {
|
|
68
|
+
value: 'id',
|
|
69
|
+
title: 'Id',
|
|
70
|
+
sortable: false
|
|
71
|
+
}, {
|
|
72
|
+
value: 'label',
|
|
73
|
+
title: 'Label',
|
|
74
|
+
sortable: false
|
|
75
|
+
}, {
|
|
76
|
+
value: 'origin',
|
|
77
|
+
title: 'Origin',
|
|
78
|
+
sortable: false
|
|
79
|
+
}, {
|
|
80
|
+
value: 'parent',
|
|
81
|
+
title: 'Parent',
|
|
82
|
+
sortable: false
|
|
83
|
+
}, {
|
|
84
|
+
value: 'sessionToken',
|
|
85
|
+
title: 'Session Token',
|
|
86
|
+
sortable: false
|
|
87
|
+
}, {
|
|
88
|
+
value: 'submittedAt',
|
|
89
|
+
title: 'Submitted At',
|
|
90
|
+
sortable: true
|
|
91
|
+
}, {
|
|
92
|
+
value: 'submittedBy',
|
|
93
|
+
title: 'Submitted By',
|
|
94
|
+
sortable: false
|
|
95
|
+
}, {
|
|
96
|
+
value: 'type',
|
|
97
|
+
title: 'Type',
|
|
98
|
+
sortable: false
|
|
99
|
+
}, {
|
|
100
|
+
value: 'updatedAt',
|
|
101
|
+
title: 'Updated',
|
|
102
|
+
sortable: false
|
|
103
|
+
}, {
|
|
104
|
+
value: 'updatedBy',
|
|
105
|
+
title: 'Updated By',
|
|
106
|
+
sortable: false
|
|
107
|
+
}];
|
|
108
|
+
export var FormSubmissionTable = generateTable({
|
|
109
|
+
tableOptions: ['kappSlug', 'formSlug', 'include', 'count'],
|
|
110
|
+
columns: columns,
|
|
111
|
+
dataSource: dataSource,
|
|
112
|
+
filters: filters,
|
|
113
|
+
filterDataSources: filterDataSources
|
|
114
|
+
});
|
|
115
|
+
FormSubmissionTable.displayName = 'FormSubmissionTable';
|
|
116
|
+
export default FormSubmissionTable;
|