@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
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { fromJS, List, Range } from 'immutable';
|
|
2
|
+
import { TIMELINES, MAX_PART_LENGTH } from '../../../helpers';
|
|
3
|
+
export var getUsedFields = function getUsedFields(values, partIndex) {
|
|
4
|
+
var partType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'eq';
|
|
5
|
+
var equalities = List();
|
|
6
|
+
|
|
7
|
+
if (partType === 'eq' && partIndex === 0) {
|
|
8
|
+
equalities = List();
|
|
9
|
+
} else if (partType === 'eq' && partIndex === 1) {
|
|
10
|
+
equalities = List([values.get('op0-part')]);
|
|
11
|
+
} else if (partType === 'eq') {
|
|
12
|
+
equalities = Range(0, partIndex).map(function (i) {
|
|
13
|
+
return values.get("op".concat(i, "-part"));
|
|
14
|
+
}).toList().filter(function (f) {
|
|
15
|
+
return f !== '';
|
|
16
|
+
});
|
|
17
|
+
} else if (partType === 'range') {
|
|
18
|
+
var orders = Range(0, MAX_PART_LENGTH).map(function (i) {
|
|
19
|
+
return values.get("orderby".concat(i, "-part"));
|
|
20
|
+
}).toList().filter(function (f) {
|
|
21
|
+
return f !== '' && f !== values.get('range-part');
|
|
22
|
+
});
|
|
23
|
+
equalities = Range(0, MAX_PART_LENGTH).map(function (i) {
|
|
24
|
+
return values.get("op".concat(i, "-part"));
|
|
25
|
+
}).toList().concat(orders).filter(function (f) {
|
|
26
|
+
return f !== '';
|
|
27
|
+
});
|
|
28
|
+
} else if (partType === 'orderBy') {
|
|
29
|
+
var _orders;
|
|
30
|
+
|
|
31
|
+
if (partIndex === 0) {
|
|
32
|
+
_orders = List();
|
|
33
|
+
} else if (partIndex === 1) {
|
|
34
|
+
_orders = List([values.get('orderby0-part')]);
|
|
35
|
+
} else {
|
|
36
|
+
_orders = Range(0, partIndex).map(function (i) {
|
|
37
|
+
return values.get("orderby".concat(i, "-part"));
|
|
38
|
+
}).toList().filter(function (f) {
|
|
39
|
+
return f !== '';
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
equalities = Range(0, MAX_PART_LENGTH).map(function (i) {
|
|
44
|
+
return values.get("op".concat(i, "-part"));
|
|
45
|
+
}).toList().concat(_orders).filter(function (f) {
|
|
46
|
+
return f !== '';
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return equalities;
|
|
51
|
+
};
|
|
52
|
+
export var availableParts = function availableParts(values, indexes, equalityFields) {
|
|
53
|
+
var partType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'eq';
|
|
54
|
+
var remainingParts = indexes.map(function (index) {
|
|
55
|
+
return getRemainingParts(index.get('parts', List()), equalityFields);
|
|
56
|
+
});
|
|
57
|
+
var containsTimeline = equalityFields.some(function (index) {
|
|
58
|
+
return TIMELINES.includes(index);
|
|
59
|
+
});
|
|
60
|
+
var anyAtLast = remainingParts.some(function (index) {
|
|
61
|
+
return index && index.size === 0;
|
|
62
|
+
});
|
|
63
|
+
var rangePart = values.get('range-part');
|
|
64
|
+
var timelinesAvailable = anyAtLast && !containsTimeline ? TIMELINES : containsTimeline ? getRemainingParts(List([equalityFields.last()]), fromJS(TIMELINES)) : List();
|
|
65
|
+
|
|
66
|
+
if (partType === 'range') {
|
|
67
|
+
var rangeRemaining = remainingParts.filter(function (index) {
|
|
68
|
+
return index && index.size === 1;
|
|
69
|
+
});
|
|
70
|
+
return rangeRemaining.concat(rangePart && rangeRemaining.size === 0 && values.get('orderby0-part') && values.get('orderby0-part') !== rangePart ? List([]) : timelinesAvailable || List([]));
|
|
71
|
+
} else if (partType === 'orderBy') {
|
|
72
|
+
return (rangePart ? List([rangePart]) : remainingParts.filter(function (index) {
|
|
73
|
+
return index && index.size > 0;
|
|
74
|
+
}).map(function (index) {
|
|
75
|
+
return index.first();
|
|
76
|
+
})).concat(TIMELINES.includes(rangePart) ? List([rangePart]) : anyAtLast ? fromJS(TIMELINES) : equalityFields.size === 0 ? fromJS(TIMELINES) : List()).toSet().toList();
|
|
77
|
+
} else {
|
|
78
|
+
return remainingParts.filterNot(function (index) {
|
|
79
|
+
return !index || index.size === 0;
|
|
80
|
+
}).map(function (index) {
|
|
81
|
+
return index.first();
|
|
82
|
+
}).toSet().toList().filterNot(function (p) {
|
|
83
|
+
return TIMELINES.includes(p);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
export var getRemainingParts = function getRemainingParts(src, dst) {
|
|
88
|
+
if (src.size === 0 && dst.size === 0) return List(); // If we're matching so far, and the are no more to compare it's a match.
|
|
89
|
+
|
|
90
|
+
if (src.size > 0 && dst.size === 0) return src; // If we're out of elements but there's more to match, it's not a match.
|
|
91
|
+
|
|
92
|
+
if (src.size === 0 && dst.size > 0) return List();
|
|
93
|
+
if (src.first() === dst.first()) return getRemainingParts(src.shift(), dst.shift());
|
|
94
|
+
return null;
|
|
95
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { List, Map, fromJS } from 'immutable';
|
|
2
|
+
import { availableParts, getRemainingParts } from './helpers';
|
|
3
|
+
var INDEX_A_B = fromJS({
|
|
4
|
+
name: 'values[A],values[B]',
|
|
5
|
+
parts: ['values[A]', 'values[B]']
|
|
6
|
+
});
|
|
7
|
+
var INDEX_A_C = fromJS({
|
|
8
|
+
name: 'values[A],values[C]',
|
|
9
|
+
parts: ['values[A]', 'values[C]']
|
|
10
|
+
});
|
|
11
|
+
var INDEX_A_B_C = fromJS({
|
|
12
|
+
name: 'values[A],values[B],values[C]',
|
|
13
|
+
parts: ['values[A]', 'values[B]', 'values[C]']
|
|
14
|
+
});
|
|
15
|
+
describe('submission filter helpers', function () {
|
|
16
|
+
var indexes;
|
|
17
|
+
var values;
|
|
18
|
+
beforeEach(function () {
|
|
19
|
+
values = Map({});
|
|
20
|
+
indexes = List([]);
|
|
21
|
+
});
|
|
22
|
+
describe('#getRemainingParts', function () {
|
|
23
|
+
test('empty sets match', function () {
|
|
24
|
+
var result = getRemainingParts(List(), List());
|
|
25
|
+
expect(result).toBeImmutableList();
|
|
26
|
+
expect(result.size).toBe(0);
|
|
27
|
+
});
|
|
28
|
+
test('when left is the same as right', function () {
|
|
29
|
+
var result = getRemainingParts(List([1]), List([1]));
|
|
30
|
+
expect(result).toBeImmutableList();
|
|
31
|
+
expect(result.size).toBe(0);
|
|
32
|
+
});
|
|
33
|
+
test('when left is larger than right', function () {
|
|
34
|
+
var result = getRemainingParts(List([1, 2]), List([1]));
|
|
35
|
+
expect(result).toBeImmutableList();
|
|
36
|
+
expect(result.size).toBe(1);
|
|
37
|
+
expect(result.first()).toBe(2);
|
|
38
|
+
});
|
|
39
|
+
test('when left is larger than right with multiple values', function () {
|
|
40
|
+
var result = getRemainingParts(List([1, 2, 3, 4]), List([1]));
|
|
41
|
+
expect(result).toBeImmutableList();
|
|
42
|
+
expect(result.size).toBe(3);
|
|
43
|
+
expect(result.first()).toBe(2);
|
|
44
|
+
});
|
|
45
|
+
test('when left does not start with right', function () {
|
|
46
|
+
var result = getRemainingParts(List([2, 1]), List([1]));
|
|
47
|
+
expect(result).toBeNull();
|
|
48
|
+
});
|
|
49
|
+
test('when left does fully not start with right', function () {
|
|
50
|
+
var result = getRemainingParts(List([1, 1, 1]), List([1, 2]));
|
|
51
|
+
expect(result).toBeNull();
|
|
52
|
+
});
|
|
53
|
+
test('when left contains but does not start with right', function () {
|
|
54
|
+
var result = getRemainingParts(List([1, 1, 2]), List([1, 2]));
|
|
55
|
+
expect(result).toBeNull();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
describe('#avaialbleParts', function () {
|
|
59
|
+
test('when there are no indexes', function () {
|
|
60
|
+
var result = availableParts(values, indexes, List(['values[A]', 'values[B]']));
|
|
61
|
+
expect(result).toBeImmutableList();
|
|
62
|
+
expect(result.size).toBe(0);
|
|
63
|
+
});
|
|
64
|
+
test('when there are no indexes with parts remaining', function () {
|
|
65
|
+
var result = availableParts(values, indexes.push(INDEX_A_B), List(['values[A]', 'values[B]']));
|
|
66
|
+
expect(result).toBeImmutableList();
|
|
67
|
+
expect(result.size).toBe(0);
|
|
68
|
+
});
|
|
69
|
+
test('when there are fewer parts', function () {
|
|
70
|
+
// We're expecting parts from `values[A],values[B]`
|
|
71
|
+
var result = availableParts(values, indexes.push(INDEX_A_B), List(['values[A]']));
|
|
72
|
+
expect(result).toBeImmutableList();
|
|
73
|
+
expect(result.size).toBe(1);
|
|
74
|
+
expect(result.first()).toBe('values[B]');
|
|
75
|
+
});
|
|
76
|
+
test('when there are fewer parts in multiple indexes', function () {
|
|
77
|
+
var result = availableParts(values, indexes.push(INDEX_A_B).push(INDEX_A_C), List(['values[A]']));
|
|
78
|
+
expect(result).toBeImmutableList();
|
|
79
|
+
expect(result.size).toBe(2);
|
|
80
|
+
expect(result.first()).toBe('values[B]');
|
|
81
|
+
expect(result.last()).toBe('values[C]');
|
|
82
|
+
});
|
|
83
|
+
test('when there are more parts in the index', function () {
|
|
84
|
+
var result = availableParts(values, indexes.push(INDEX_A_B_C), List(['values[A]']));
|
|
85
|
+
expect(result).toBeImmutableList();
|
|
86
|
+
expect(result.size).toBe(1);
|
|
87
|
+
expect(result.first()).toBe('values[B]');
|
|
88
|
+
});
|
|
89
|
+
test('when multiple indexes start the same', function () {
|
|
90
|
+
var result = availableParts(values, indexes.push(INDEX_A_B).push(INDEX_A_B_C), List(['values[A]']));
|
|
91
|
+
expect(result).toBeImmutableList();
|
|
92
|
+
expect(result.size).toBe(1);
|
|
93
|
+
expect(result.first()).toBe('values[B]');
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
});
|
|
@@ -50,7 +50,7 @@ var filters = function filters() {
|
|
|
50
50
|
name: 'context',
|
|
51
51
|
label: 'Context Type',
|
|
52
52
|
type: 'select',
|
|
53
|
-
options: ['Kapp', '
|
|
53
|
+
options: ['Kapp', 'Custom'].map(function (el) {
|
|
54
54
|
return {
|
|
55
55
|
value: el,
|
|
56
56
|
label: el === 'Kapp' ? 'Form' : el
|
|
@@ -2,8 +2,8 @@ import { get, List, Map } from 'immutable';
|
|
|
2
2
|
import { generateForm } from '../../form/Form';
|
|
3
3
|
import { createUser, fetchAttributeDefinitions, fetchUser, updateUser, fetchLocales, fetchTimezones } from '../../../apis';
|
|
4
4
|
import { handleFormErrors } from '../../form/Form.helpers';
|
|
5
|
-
var USER_INCLUDES = 'attributesMap,authorization,memberships,profileAttributesMap';
|
|
6
|
-
var EMAIL_REGEX = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])
|
|
5
|
+
var USER_INCLUDES = 'details,attributesMap,authorization,memberships,profileAttributesMap';
|
|
6
|
+
var EMAIL_REGEX = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i;
|
|
7
7
|
|
|
8
8
|
var dataSources = function dataSources(_ref) {
|
|
9
9
|
var username = _ref.username,
|
|
@@ -4,7 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
5
5
|
import { generateForm } from '../../form/Form';
|
|
6
6
|
import { get, Map } from 'immutable';
|
|
7
|
-
import {
|
|
7
|
+
import { createWebApi, updateWebApi, fetchSecurityPolicyDefinitions, createTree, updateTree, fetchSpace } from '../../../apis';
|
|
8
8
|
export var WEB_API_METHODS = ['GET', 'POST', 'PUT', 'DELETE'];
|
|
9
9
|
var securityEndpoints = {
|
|
10
10
|
webApiExecution: {
|
|
@@ -15,136 +15,116 @@ var securityEndpoints = {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
var dataSources = function dataSources(_ref) {
|
|
18
|
-
var
|
|
19
|
-
|
|
18
|
+
var kappSlug = _ref.kappSlug,
|
|
19
|
+
webApi = _ref.webApi;
|
|
20
20
|
return {
|
|
21
|
-
webApi: {
|
|
22
|
-
fn: fetchWebApi,
|
|
23
|
-
params: slug && [{
|
|
24
|
-
slug: slug,
|
|
25
|
-
kappSlug: kappSlug,
|
|
26
|
-
include: 'details,securityPolicies'
|
|
27
|
-
}],
|
|
28
|
-
transform: function transform(result) {
|
|
29
|
-
return result.webApi;
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
21
|
securityPolicyDefinitions: {
|
|
33
22
|
fn: fetchSecurityPolicyDefinitions,
|
|
34
|
-
params: kappSlug ? [{
|
|
35
|
-
kappSlug: kappSlug
|
|
23
|
+
params: kappSlug || webApi && webApi.get('kappSlug') ? [{
|
|
24
|
+
kappSlug: kappSlug || webApi && webApi.get('kappSlug')
|
|
36
25
|
}] : [],
|
|
37
26
|
transform: function transform(result) {
|
|
38
27
|
return result.securityPolicyDefinitions;
|
|
39
28
|
}
|
|
40
|
-
},
|
|
41
|
-
sourceName: {
|
|
42
|
-
fn: fetchSpace,
|
|
43
|
-
params: [{
|
|
44
|
-
include: 'platformComponents'
|
|
45
|
-
}],
|
|
46
|
-
transform: function transform(result) {
|
|
47
|
-
return result.space.platformComponents.task.config.platformSourceName;
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
sourceGroup: {
|
|
51
|
-
fn: function fn() {
|
|
52
|
-
return kappSlug ? "WebApis > ".concat(kappSlug) : 'WebApis';
|
|
53
|
-
},
|
|
54
|
-
params: []
|
|
55
|
-
},
|
|
56
|
-
tree: {
|
|
57
|
-
fn: fetchTree,
|
|
58
|
-
params: function params(_ref2) {
|
|
59
|
-
var sourceName = _ref2.sourceName,
|
|
60
|
-
sourceGroup = _ref2.sourceGroup,
|
|
61
|
-
webApi = _ref2.webApi;
|
|
62
|
-
return webApi && sourceName && [{
|
|
63
|
-
sourceName: sourceName,
|
|
64
|
-
sourceGroup: sourceGroup,
|
|
65
|
-
name: webApi.get('slug')
|
|
66
|
-
}];
|
|
67
|
-
},
|
|
68
|
-
transform: function transform(result) {
|
|
69
|
-
return result.error && result.error.notFound ? {} : result.tree;
|
|
70
|
-
}
|
|
71
29
|
}
|
|
72
30
|
};
|
|
73
31
|
};
|
|
74
32
|
|
|
75
|
-
var handleSubmit = function handleSubmit(
|
|
76
|
-
var slug =
|
|
77
|
-
kappSlug =
|
|
33
|
+
var handleSubmit = function handleSubmit(_ref2) {
|
|
34
|
+
var slug = _ref2.slug,
|
|
35
|
+
kappSlug = _ref2.kappSlug,
|
|
36
|
+
webApi = _ref2.webApi;
|
|
78
37
|
return /*#__PURE__*/function () {
|
|
79
|
-
var
|
|
80
|
-
var
|
|
38
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values) {
|
|
39
|
+
var _yield$fetchSpace, space, sourceName, sourceGroup, _ref4, _webApi, error1, _ref5, tree, error2;
|
|
81
40
|
|
|
82
41
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
83
42
|
while (1) {
|
|
84
43
|
switch (_context.prev = _context.next) {
|
|
85
44
|
case 0:
|
|
86
|
-
|
|
45
|
+
if (webApi) {
|
|
46
|
+
_context.next = 38;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
|
|
87
50
|
_context.next = 3;
|
|
88
|
-
return (
|
|
89
|
-
|
|
90
|
-
slug: slug,
|
|
91
|
-
webApi: values.toJS(),
|
|
92
|
-
include: 'securityPolicies'
|
|
51
|
+
return fetchSpace({
|
|
52
|
+
include: 'platformComponents'
|
|
93
53
|
});
|
|
94
54
|
|
|
95
55
|
case 3:
|
|
96
|
-
_yield = _context.sent;
|
|
97
|
-
|
|
98
|
-
|
|
56
|
+
_yield$fetchSpace = _context.sent;
|
|
57
|
+
space = _yield$fetchSpace.space;
|
|
58
|
+
sourceName = space.platformComponents.task.config.platformSourceName;
|
|
59
|
+
sourceGroup = kappSlug ? "WebApis > ".concat(kappSlug) : 'WebApis';
|
|
99
60
|
|
|
100
|
-
if (!
|
|
101
|
-
_context.next =
|
|
61
|
+
if (!slug) {
|
|
62
|
+
_context.next = 13;
|
|
102
63
|
break;
|
|
103
64
|
}
|
|
104
65
|
|
|
105
|
-
|
|
66
|
+
_context.next = 10;
|
|
67
|
+
return updateWebApi({
|
|
68
|
+
kappSlug: kappSlug,
|
|
69
|
+
slug: slug,
|
|
70
|
+
webApi: values.toJS(),
|
|
71
|
+
include: 'securityPolicies'
|
|
72
|
+
});
|
|
106
73
|
|
|
107
|
-
case
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
74
|
+
case 10:
|
|
75
|
+
_context.t0 = _context.sent;
|
|
76
|
+
_context.next = 16;
|
|
77
|
+
break;
|
|
112
78
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
79
|
+
case 13:
|
|
80
|
+
_context.next = 15;
|
|
81
|
+
return createWebApi({
|
|
82
|
+
kappSlug: kappSlug,
|
|
83
|
+
webApi: values.toJS(),
|
|
84
|
+
include: 'securityPolicies'
|
|
120
85
|
});
|
|
121
86
|
|
|
122
|
-
case
|
|
123
|
-
|
|
124
|
-
|
|
87
|
+
case 15:
|
|
88
|
+
_context.t0 = _context.sent;
|
|
89
|
+
|
|
90
|
+
case 16:
|
|
91
|
+
_ref4 = _context.t0;
|
|
92
|
+
_webApi = _ref4.webApi;
|
|
93
|
+
error1 = _ref4.error;
|
|
125
94
|
|
|
126
|
-
if (!
|
|
127
|
-
_context.next =
|
|
95
|
+
if (!error1) {
|
|
96
|
+
_context.next = 21;
|
|
128
97
|
break;
|
|
129
98
|
}
|
|
130
99
|
|
|
131
|
-
throw
|
|
132
|
-
|
|
133
|
-
case 15:
|
|
134
|
-
_context.next = 24;
|
|
135
|
-
break;
|
|
100
|
+
throw error1.statusCode === 400 && error1.message || 'There was an error saving the WebAPI';
|
|
136
101
|
|
|
137
|
-
case
|
|
138
|
-
if (!
|
|
139
|
-
_context.next =
|
|
102
|
+
case 21:
|
|
103
|
+
if (!slug) {
|
|
104
|
+
_context.next = 27;
|
|
140
105
|
break;
|
|
141
106
|
}
|
|
142
107
|
|
|
143
|
-
_context.next =
|
|
108
|
+
_context.next = 24;
|
|
144
109
|
return updateTree({
|
|
145
110
|
sourceName: sourceName,
|
|
146
111
|
sourceGroup: sourceGroup,
|
|
147
112
|
name: slug,
|
|
113
|
+
tree: {
|
|
114
|
+
sourceName: sourceName,
|
|
115
|
+
sourceGroup: sourceGroup,
|
|
116
|
+
name: values.get('slug')
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
case 24:
|
|
121
|
+
_context.t1 = _context.sent;
|
|
122
|
+
_context.next = 30;
|
|
123
|
+
break;
|
|
124
|
+
|
|
125
|
+
case 27:
|
|
126
|
+
_context.next = 29;
|
|
127
|
+
return createTree({
|
|
148
128
|
tree: {
|
|
149
129
|
sourceGroup: sourceGroup,
|
|
150
130
|
sourceName: sourceName,
|
|
@@ -152,21 +132,31 @@ var handleSubmit = function handleSubmit(_ref3) {
|
|
|
152
132
|
}
|
|
153
133
|
});
|
|
154
134
|
|
|
155
|
-
case
|
|
156
|
-
|
|
157
|
-
|
|
135
|
+
case 29:
|
|
136
|
+
_context.t1 = _context.sent;
|
|
137
|
+
|
|
138
|
+
case 30:
|
|
139
|
+
_ref5 = _context.t1;
|
|
140
|
+
tree = _ref5.tree;
|
|
141
|
+
error2 = _ref5.error;
|
|
158
142
|
|
|
159
|
-
if (!
|
|
160
|
-
_context.next =
|
|
143
|
+
if (!error2) {
|
|
144
|
+
_context.next = 35;
|
|
161
145
|
break;
|
|
162
146
|
}
|
|
163
147
|
|
|
164
|
-
throw
|
|
148
|
+
throw error2.statusCode === 400 && error2.message || 'There was an error saving the WebAPI tree';
|
|
165
149
|
|
|
166
|
-
case
|
|
167
|
-
return _context.abrupt("return",
|
|
150
|
+
case 35:
|
|
151
|
+
return _context.abrupt("return", {
|
|
152
|
+
tree: tree,
|
|
153
|
+
webApi: _webApi
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
case 38:
|
|
157
|
+
return _context.abrupt("return", values.toObject());
|
|
168
158
|
|
|
169
|
-
case
|
|
159
|
+
case 39:
|
|
170
160
|
case "end":
|
|
171
161
|
return _context.stop();
|
|
172
162
|
}
|
|
@@ -174,18 +164,17 @@ var handleSubmit = function handleSubmit(_ref3) {
|
|
|
174
164
|
}, _callee);
|
|
175
165
|
}));
|
|
176
166
|
|
|
177
|
-
return function (_x
|
|
178
|
-
return
|
|
167
|
+
return function (_x) {
|
|
168
|
+
return _ref3.apply(this, arguments);
|
|
179
169
|
};
|
|
180
170
|
}();
|
|
181
171
|
};
|
|
182
172
|
|
|
183
|
-
var fields = function fields(
|
|
184
|
-
var
|
|
185
|
-
return function (
|
|
186
|
-
var
|
|
187
|
-
|
|
188
|
-
return (!slug || webApi && tree) && [{
|
|
173
|
+
var fields = function fields(_ref6) {
|
|
174
|
+
var webApi = _ref6.webApi;
|
|
175
|
+
return function (_ref7) {
|
|
176
|
+
var securityPolicyDefinitions = _ref7.securityPolicyDefinitions;
|
|
177
|
+
return securityPolicyDefinitions && [{
|
|
189
178
|
name: 'slug',
|
|
190
179
|
label: 'Slug',
|
|
191
180
|
type: 'text',
|
|
@@ -203,17 +192,17 @@ var fields = function fields(_ref5) {
|
|
|
203
192
|
};
|
|
204
193
|
}),
|
|
205
194
|
initialValue: get(webApi, 'method') || ''
|
|
206
|
-
}].concat(_toConsumableArray(Object.entries(securityEndpoints).map(function (
|
|
207
|
-
var
|
|
208
|
-
endpointFieldName =
|
|
209
|
-
endpoint =
|
|
195
|
+
}].concat(_toConsumableArray(Object.entries(securityEndpoints).map(function (_ref8) {
|
|
196
|
+
var _ref9 = _slicedToArray(_ref8, 2),
|
|
197
|
+
endpointFieldName = _ref9[0],
|
|
198
|
+
endpoint = _ref9[1];
|
|
210
199
|
|
|
211
200
|
return {
|
|
212
201
|
name: endpointFieldName,
|
|
213
202
|
label: endpoint.label,
|
|
214
203
|
type: 'select',
|
|
215
|
-
options: function options(
|
|
216
|
-
var securityPolicyDefinitions =
|
|
204
|
+
options: function options(_ref10) {
|
|
205
|
+
var securityPolicyDefinitions = _ref10.securityPolicyDefinitions;
|
|
217
206
|
return securityPolicyDefinitions ? securityPolicyDefinitions.filter(function (definition) {
|
|
218
207
|
return endpoint.types.includes(definition.get('type'));
|
|
219
208
|
}).map(function (definition) {
|
|
@@ -233,20 +222,16 @@ var fields = function fields(_ref5) {
|
|
|
233
222
|
label: 'Security Policies',
|
|
234
223
|
type: null,
|
|
235
224
|
visible: false,
|
|
236
|
-
serialize: function serialize(
|
|
237
|
-
var values =
|
|
238
|
-
return
|
|
239
|
-
|
|
240
|
-
endpointFieldName = _ref12[0],
|
|
241
|
-
policy = _ref12[1];
|
|
242
|
-
|
|
243
|
-
return {
|
|
225
|
+
serialize: function serialize(_ref11) {
|
|
226
|
+
var values = _ref11.values;
|
|
227
|
+
return Map(securityEndpoints).map(function (policy, endpointFieldName) {
|
|
228
|
+
return Map({
|
|
244
229
|
endpoint: policy.endpoint,
|
|
245
230
|
name: values.get(endpointFieldName)
|
|
246
|
-
};
|
|
247
|
-
}).filter(function (
|
|
248
|
-
return
|
|
249
|
-
});
|
|
231
|
+
});
|
|
232
|
+
}).valueSeq().filter(function (policy) {
|
|
233
|
+
return policy.get('name') !== '';
|
|
234
|
+
}).toList();
|
|
250
235
|
},
|
|
251
236
|
initialValue: get(webApi, 'securityPolicies')
|
|
252
237
|
}]);
|
|
@@ -254,7 +239,7 @@ var fields = function fields(_ref5) {
|
|
|
254
239
|
};
|
|
255
240
|
|
|
256
241
|
export var WebApiForm = generateForm({
|
|
257
|
-
formOptions: ['slug', '
|
|
242
|
+
formOptions: ['kappSlug', 'slug', 'webApi'],
|
|
258
243
|
dataSources: dataSources,
|
|
259
244
|
fields: fields,
|
|
260
245
|
handleSubmit: handleSubmit
|
|
@@ -2,7 +2,7 @@ import { List, Map } from 'immutable';
|
|
|
2
2
|
import { createWebhook, fetchWebhook, fetchKapp, fetchKappWebhookEvents, fetchSpace, fetchSpaceWebhookEvents, updateWebhook } from '../../../apis';
|
|
3
3
|
import { generateForm } from '../../form/Form';
|
|
4
4
|
import { buildBindings } from '../../../helpers';
|
|
5
|
-
var SPACE_INCLUDES = '
|
|
5
|
+
var SPACE_INCLUDES = 'formAttributeDefinitions,spaceAttributeDefinitions,teamAttributeDefinitions,userAttributeDefinitions,userProfileAttributeDefinitions';
|
|
6
6
|
var KAPP_INCLUDES = 'formAttributeDefinitions,kappAttributeDefinitions,fields';
|
|
7
7
|
|
|
8
8
|
var dataSources = function dataSources(_ref) {
|
|
@@ -257,7 +257,7 @@ export var getFieldComponentProps = function getFieldComponentProps(field, readO
|
|
|
257
257
|
onBlur: field.eventHandlers.get('onBlur'),
|
|
258
258
|
onChange: field.eventHandlers.get('onChange'),
|
|
259
259
|
onFocus: field.eventHandlers.get('onFocus'),
|
|
260
|
-
options: ['attributes', 'code', 'form', 'form-multi', 'map', 'radio', 'select', 'select-multi', 'table', 'text', 'text-multi'].includes(field.type) ? field.options : undefined,
|
|
260
|
+
options: ['attributes', 'checkbox-multi', 'code', 'form', 'form-multi', 'map', 'radio', 'select', 'select-multi', 'table', 'text', 'text-multi'].includes(field.type) ? field.options : undefined,
|
|
261
261
|
placeholder: field.placeholder,
|
|
262
262
|
renderAttributes: field.renderAttributes,
|
|
263
263
|
required: field.required,
|