@kineticdata/react 5.1.0-rc.2 → 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.
Files changed (37) hide show
  1. package/lib/apis/core/authentication.js +2 -2
  2. package/lib/apis/core/securityPolicyDefinitions.test.js +4 -4
  3. package/lib/apis/http.js +9 -2
  4. package/lib/apis/system/index.js +86 -1
  5. package/lib/apis/task/index.js +10 -8
  6. package/lib/components/common/BridgeSelect.js +2 -1
  7. package/lib/components/common/FormSelect.js +2 -1
  8. package/lib/components/common/TableInput.js +74 -29
  9. package/lib/components/common/TeamSelect.js +2 -1
  10. package/lib/components/common/UserSelect.js +2 -1
  11. package/lib/components/common/authentication/AuthenticationContainer.js +50 -27
  12. package/lib/components/core/file_resource/FileResourceForm.js +2 -2
  13. package/lib/components/core/space/SpaceForm.js +37 -8
  14. package/lib/components/core/submission/SubmissionForm.js +124 -0
  15. package/lib/components/core/webapi/WebApiForm.js +111 -126
  16. package/lib/components/form/Form.helpers.js +1 -1
  17. package/lib/components/form/Form.js +198 -142
  18. package/lib/components/index.js +5 -1
  19. package/lib/components/system/SystemBackgroundTasksTable.js +83 -0
  20. package/lib/components/system/SystemSecurityForm.js +69 -0
  21. package/lib/components/system/spaces/SystemSpaceForm.js +44 -16
  22. package/lib/components/task/builder/Connector.js +19 -8
  23. package/lib/components/task/builder/ConnectorForm.js +1 -1
  24. package/lib/components/task/builder/Node.js +10 -3
  25. package/lib/components/task/builder/NodeForm.js +51 -22
  26. package/lib/components/task/builder/NodeParametersForm.js +5 -2
  27. package/lib/components/task/builder/SvgCanvas.js +13 -4
  28. package/lib/components/task/builder/TaskDefinitionConfigForm.js +113 -0
  29. package/lib/components/task/builder/TreeBuilder.js +25 -7
  30. package/lib/components/task/builder/builder.redux.js +159 -52
  31. package/lib/components/task/builder/helpers.js +5 -3
  32. package/lib/components/task/builder/models.js +84 -12
  33. package/lib/components/task/errors/RunErrorTable.js +1 -1
  34. package/lib/components/task/runs/CreateManualTriggerForm.js +15 -24
  35. package/lib/components/task/workflows/WorkflowForm.js +67 -85
  36. package/lib/index.js +1 -0
  37. package/package.json +2 -2
@@ -0,0 +1,83 @@
1
+ import { generateTable } from '../table/Table';
2
+ import { fetchSystemBackgroundTasks } from '../../apis';
3
+ import { defineFilter } from '../../helpers';
4
+ import { List } from 'immutable';
5
+ var clientSide = defineFilter(true).startsWith('id', 'id').startsWith('status', 'status').end();
6
+
7
+ var dataSource = function dataSource(_ref) {
8
+ var spaceSlug = _ref.spaceSlug;
9
+ return {
10
+ fn: fetchSystemBackgroundTasks,
11
+ clientSide: clientSide,
12
+ params: function params() {
13
+ return [{
14
+ spaceSlug: spaceSlug
15
+ }];
16
+ },
17
+ transform: function transform(result) {
18
+ return {
19
+ data: result.backgroundTasks
20
+ };
21
+ }
22
+ };
23
+ };
24
+
25
+ var filters = function filters() {
26
+ return function () {
27
+ return [{
28
+ name: 'id',
29
+ label: 'ID',
30
+ type: 'text'
31
+ }, {
32
+ name: 'status',
33
+ label: 'Status',
34
+ type: 'text'
35
+ }];
36
+ };
37
+ };
38
+
39
+ var columns = [{
40
+ value: 'id',
41
+ title: 'ID',
42
+ sortable: false
43
+ }, {
44
+ value: 'createdAt',
45
+ title: 'Created At',
46
+ valueTransform: function valueTransform(_value, row) {
47
+ var createdTransition = row.get('transitions', List()).find(function (t) {
48
+ return t.has('Created');
49
+ });
50
+ return createdTransition ? createdTransition.get('Created') : 'N/A';
51
+ },
52
+ sortable: true
53
+ }, {
54
+ value: 'description',
55
+ title: 'Description',
56
+ sortable: false
57
+ }, {
58
+ value: 'exception',
59
+ title: 'Exception',
60
+ sortable: false
61
+ }, {
62
+ value: 'messages',
63
+ title: 'Messages',
64
+ sortable: false
65
+ }, {
66
+ value: 'Result',
67
+ title: 'Result',
68
+ sortable: false
69
+ }, {
70
+ value: 'status',
71
+ title: 'Status'
72
+ }, {
73
+ value: 'transitions',
74
+ title: 'Transitions',
75
+ sortable: false
76
+ }];
77
+ export var SystemBackgroundTasksTable = generateTable({
78
+ tableOptions: ['spaceSlug'],
79
+ columns: columns,
80
+ filters: filters,
81
+ dataSource: dataSource
82
+ });
83
+ SystemBackgroundTasksTable.displayName = 'SystemBackgroundTasksTable';
@@ -0,0 +1,69 @@
1
+ import { List, fromJS, get } from 'immutable';
2
+ import { generateForm } from '../form/Form';
3
+ import { fetchSystemSecurity, updateSystemSecurity } from '../../apis';
4
+ import { handleFormErrors } from '../form/Form.helpers';
5
+
6
+ var handleSubmit = function handleSubmit() {
7
+ return function (values) {
8
+ return updateSystemSecurity({
9
+ systemSecurity: values.toJS()
10
+ }).then(handleFormErrors());
11
+ };
12
+ };
13
+
14
+ var dataSources = function dataSources() {
15
+ return {
16
+ systemSecurity: {
17
+ fn: fetchSystemSecurity,
18
+ params: [],
19
+ transform: function transform(result) {
20
+ return result.systemSecurity;
21
+ }
22
+ }
23
+ };
24
+ };
25
+
26
+ var fields = function fields() {
27
+ return function (_ref) {
28
+ var systemSecurity = _ref.systemSecurity;
29
+ return systemSecurity && [{
30
+ name: 'allowedSystemIps',
31
+ label: 'Allowed IPs',
32
+ type: 'select',
33
+ options: function options() {
34
+ return fromJS([{
35
+ name: 'description',
36
+ label: 'Description',
37
+ type: 'text'
38
+ }, {
39
+ name: 'value',
40
+ label: 'IP Range',
41
+ type: 'text'
42
+ }]);
43
+ },
44
+ visible: function visible(_ref2) {
45
+ var values = _ref2.values;
46
+ return values.get('allowedSystemIpsEnabled', false);
47
+ },
48
+ initialValue: get(systemSecurity, 'allowedSystemIps', List()),
49
+ serialize: function serialize(_ref3) {
50
+ var values = _ref3.values;
51
+ return values.get('allowedSystemIpsEnabled', false) ? values.get('allowedSystemIps') : [];
52
+ }
53
+ }, {
54
+ name: 'allowedSystemIpsEnabled',
55
+ label: 'Enabled Allowed IP Restrictions?',
56
+ type: 'checkbox',
57
+ initialValue: get(systemSecurity, 'allowedSystemIps', List()).size > 0,
58
+ "transient": true
59
+ }];
60
+ };
61
+ };
62
+
63
+ export var SystemSecurityForm = generateForm({
64
+ formOptions: [],
65
+ dataSources: dataSources,
66
+ fields: fields,
67
+ handleSubmit: handleSubmit
68
+ });
69
+ SystemSecurityForm.displayName = 'SystemSecurityForm';
@@ -1,5 +1,5 @@
1
1
  import { fetchSpace, updateSpace } from '../../../apis';
2
- import { get } from 'immutable';
2
+ import { fromJS, get } from 'immutable';
3
3
  import { generateForm } from '../../form/Form';
4
4
  import { handleFormErrors } from '../../form/Form.helpers';
5
5
 
@@ -10,7 +10,7 @@ var dataSources = function dataSources(_ref) {
10
10
  fn: fetchSpace,
11
11
  params: slug && [{
12
12
  slug: slug,
13
- include: 'details'
13
+ include: 'details,allowedIps'
14
14
  }],
15
15
  transform: function transform(result) {
16
16
  return result.space;
@@ -29,10 +29,9 @@ var handleSubmit = function handleSubmit(_ref2) {
29
29
  };
30
30
  };
31
31
 
32
- var fields = function fields(_ref3) {
33
- var slug = _ref3.slug;
34
- return function (_ref4) {
35
- var space = _ref4.space;
32
+ var fields = function fields() {
33
+ return function (_ref3) {
34
+ var space = _ref3.space;
36
35
  return space && [{
37
36
  name: 'name',
38
37
  label: 'Name',
@@ -52,9 +51,9 @@ var fields = function fields(_ref3) {
52
51
  type: 'checkbox',
53
52
  "transient": true,
54
53
  initialValue: (get(space, 'sharedBundleBase') || '') !== '',
55
- onChange: function onChange(_ref5, _ref6) {
56
- var values = _ref5.values;
57
- var setValue = _ref6.setValue;
54
+ onChange: function onChange(_ref4, _ref5) {
55
+ var values = _ref4.values;
56
+ var setValue = _ref5.setValue;
58
57
 
59
58
  if (values.get('sharedBundleBase') !== '') {
60
59
  setValue('sharedBundleBase', '');
@@ -70,12 +69,12 @@ var fields = function fields(_ref3) {
70
69
  type: 'text',
71
70
  initialValue: get(space, 'sharedBundleBase') || '',
72
71
  helpText: 'Directory used as path prefix for bundles.',
73
- visible: function visible(_ref7) {
74
- var values = _ref7.values;
72
+ visible: function visible(_ref6) {
73
+ var values = _ref6.values;
75
74
  return values.get('sharedBundle');
76
75
  },
77
- required: function required(_ref8) {
78
- var values = _ref8.values;
76
+ required: function required(_ref7) {
77
+ var values = _ref7.values;
79
78
  return values.get('sharedBundle');
80
79
  }
81
80
  }, {
@@ -83,14 +82,43 @@ var fields = function fields(_ref3) {
83
82
  label: 'Bundle Path',
84
83
  type: 'text',
85
84
  initialValue: get(space, 'bundlePath') || '',
86
- visible: function visible(_ref9) {
85
+ visible: function visible(_ref8) {
86
+ var values = _ref8.values;
87
+ return get(values, 'sharedBundle');
88
+ },
89
+ required: function required(_ref9) {
87
90
  var values = _ref9.values;
88
91
  return get(values, 'sharedBundle');
92
+ }
93
+ }, {
94
+ name: 'allowedIps',
95
+ label: 'Allowed IPs',
96
+ type: 'select',
97
+ options: function options() {
98
+ return fromJS([{
99
+ name: 'description',
100
+ label: 'Description',
101
+ type: 'text'
102
+ }, {
103
+ name: 'value',
104
+ label: 'IP Range',
105
+ type: 'text'
106
+ }]);
89
107
  },
90
- required: function required(_ref10) {
108
+ visible: function visible(_ref10) {
91
109
  var values = _ref10.values;
92
- return get(values, 'sharedBundle');
110
+ return values.get('allowedIpsEnabled', false);
111
+ },
112
+ initialValue: get(space, 'allowedIps', []),
113
+ serialize: function serialize(_ref11) {
114
+ var values = _ref11.values;
115
+ return values.get('allowedIpsEnabled', false) ? values.get('allowedIps') : [];
93
116
  }
117
+ }, {
118
+ name: 'allowedIpsEnabled',
119
+ label: 'Enabled Allowed IP Restrictions?',
120
+ type: 'checkbox',
121
+ initialValue: get(space, 'allowedIpsEnabled', false) || false
94
122
  }];
95
123
  };
96
124
  };
@@ -126,21 +126,32 @@ export var Connector = /*#__PURE__*/function (_Component) {
126
126
  var dy = y2 - y1;
127
127
  var length = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
128
128
  var angle = Math.atan2(dy, dx) * 180 / Math.PI + 180;
129
- var attribute = isIE11 ? 'transform' : 'style';
130
- var connectorValue = isIE11 ? "translate(".concat(x2, " ").concat(y2, ") rotate(").concat(angle, ")") : "transform: translate(".concat(x2, "px, ").concat(y2, "px) rotate(").concat(angle, "deg)");
131
- var connectorLabelValue = isIE11 ? "translate(".concat(x1 + dx / 2, " ").concat(y1 + dy / 2, ")") : "transform: translate(".concat(x1 + dx / 2, "px, ").concat(y1 + dy / 2, "px)");
129
+ var connectorValue = isIE11 ? "translate(".concat(x2, " ").concat(y2, ") rotate(").concat(angle, ")") : "translate(".concat(x2, "px, ").concat(y2, "px) rotate(").concat(angle, "deg)");
130
+ var connectorLabelValue = isIE11 ? "translate(".concat(x1 + dx / 2, " ").concat(y1 + dy / 2, ")") : "translate(".concat(x1 + dx / 2, "px, ").concat(y1 + dy / 2, "px)");
131
+
132
+ if (isIE11) {
133
+ _this.connector.current.transform = connectorValue;
134
+
135
+ if (_this.connectorLabel.current) {
136
+ _this.connectorLabel.current.transform = connectorLabelValue;
137
+ }
138
+ } else {
139
+ _this.connector.current.style.transform = connectorValue;
140
+
141
+ if (_this.connectorLabel.current) {
142
+ _this.connectorLabel.current.style.transform = connectorLabelValue;
143
+ }
144
+ } // this.connector.current.setAttribute(attribute, connectorValue);
132
145
 
133
- _this.connector.current.setAttribute(attribute, connectorValue);
134
146
 
135
147
  if (_this.connectorTail.current) {
136
148
  _this.connectorTail.current.setAttribute('cx', length);
137
149
  }
138
150
 
139
- _this.connectorBody.current.setAttribute('x2', length);
151
+ _this.connectorBody.current.setAttribute('x2', length); // if (this.connectorLabel.current) {
152
+ // this.connectorLabel.current.setAttribute(attribute, connectorLabelValue);
153
+ // }
140
154
 
141
- if (_this.connectorLabel.current) {
142
- _this.connectorLabel.current.setAttribute(attribute, connectorLabelValue);
143
- }
144
155
  };
145
156
 
146
157
  _this.connector = createRef();
@@ -72,7 +72,7 @@ var fields = function fields(_ref2) {
72
72
  var handleSubmit = function handleSubmit(_ref4) {
73
73
  var connector = _ref4.connector;
74
74
  return function (values) {
75
- return values.toObject();
75
+ return connector.merge(values);
76
76
  };
77
77
  };
78
78
 
@@ -130,9 +130,16 @@ export var Node = /*#__PURE__*/function (_Component) {
130
130
  }, {
131
131
  key: "draw",
132
132
  value: function draw() {
133
- var attribute = isIE11 ? 'transform' : 'style';
134
- var value = isIE11 ? "translate(".concat(this.position.x, " ").concat(this.position.y, ")") : "transform: translate(".concat(this.position.x, "px, ").concat(this.position.y, "px)");
135
- this.el.current.setAttribute(attribute, value);
133
+ // const attribute = isIE11 ? 'transform' : 'style';
134
+ // const value = isIE11
135
+ // ? `translate(${this.position.x} ${this.position.y})`
136
+ // : `transform: translate(${this.position.x}px, ${this.position.y}px)`;
137
+ // this.el.current.setAttribute(attribute, value);
138
+ if (isIE11) {
139
+ this.el.current.transform = "translate(".concat(this.position.x, " ").concat(this.position.y, ")");
140
+ } else {
141
+ this.el.current.style.transform = "translate(".concat(this.position.x, "px, ").concat(this.position.y, "px)");
142
+ }
136
143
  }
137
144
  }, {
138
145
  key: "render",
@@ -3,6 +3,8 @@ import { List } from 'immutable';
3
3
  import { generateForm } from '../../form/Form';
4
4
  import { NodeMessage } from './models';
5
5
  import { buildBindings } from './helpers';
6
+ import { fetchForm } from '../../../apis';
7
+ import { checkOmittedParameters, generateTaskDefinition } from './TaskDefinitionConfigForm';
6
8
 
7
9
  var dataSources = function dataSources(_ref) {
8
10
  var tasks = _ref.tasks,
@@ -18,6 +20,33 @@ var dataSources = function dataSources(_ref) {
18
20
  return node.parameters;
19
21
  },
20
22
  params: [node]
23
+ },
24
+ form: {
25
+ fn: function fn(node) {
26
+ return fetchForm({
27
+ kappSlug: node.parameters.find(function (parameter) {
28
+ return parameter.id === 'kappSlug';
29
+ }).value,
30
+ formSlug: node.parameters.find(function (parameter) {
31
+ return parameter.id === 'formSlug';
32
+ }).value,
33
+ include: 'fields,kapp'
34
+ }).then(function (data) {
35
+ return data.form;
36
+ });
37
+ },
38
+ params: generateTaskDefinition(tasks.get(node.definitionId)) ? [node] : null
39
+ },
40
+ task: {
41
+ fn: function fn(node, form) {
42
+ return form ? generateTaskDefinition(tasks.get(node.definitionId))({
43
+ form: form.toJS()
44
+ }) : tasks.get(node.definitionId);
45
+ },
46
+ params: function params(_ref2) {
47
+ var form = _ref2.form;
48
+ return generateTaskDefinition(tasks.get(node.definitionId)) ? form ? [node, form] : null : [node, null];
49
+ }
21
50
  }
22
51
  };
23
52
  };
@@ -34,26 +63,26 @@ var getOptions = function getOptions(menu) {
34
63
  };
35
64
 
36
65
  var checkDependsOn = function checkDependsOn(parameter) {
37
- return !parameter.dependsOnId || function (_ref2) {
38
- var values = _ref2.values;
66
+ return !parameter.dependsOnId || function (_ref3) {
67
+ var values = _ref3.values;
39
68
  return values.get("parameter_".concat(parameter.dependsOnId)) === parameter.dependsOnValue;
40
69
  };
41
70
  };
42
71
 
43
- var fields = function fields(_ref3) {
44
- var tasks = _ref3.tasks,
45
- tree = _ref3.tree,
46
- node = _ref3.node;
47
- return function (_ref4) {
48
- var bindings = _ref4.bindings;
72
+ var fields = function fields(_ref4) {
73
+ var tasks = _ref4.tasks,
74
+ tree = _ref4.tree,
75
+ node = _ref4.node;
76
+ return function (_ref5) {
77
+ var bindings = _ref5.bindings;
49
78
  return bindings && [{
50
79
  name: 'name',
51
80
  label: 'Name',
52
81
  type: 'text',
53
82
  initialValue: node.name,
54
83
  required: true,
55
- constraint: function constraint(_ref5) {
56
- var values = _ref5.values;
84
+ constraint: function constraint(_ref6) {
85
+ var values = _ref6.values;
57
86
  return tree.nodes.some(function (other) {
58
87
  return other.name === values.get('name') && other.id !== node.id;
59
88
  }) ? 'This name is already used by another node' : values.get('name').length > 128 ? 'Name cannot exceed 128 characters' : true;
@@ -98,14 +127,14 @@ var fields = function fields(_ref3) {
98
127
  initialValue: parameter.value,
99
128
  options: parameter.menu ? getOptions(parameter.menu) : bindings,
100
129
  "transient": true,
101
- visible: checkDependsOn(parameter)
130
+ visible: checkDependsOn(parameter) && checkOmittedParameters(node, parameter)
102
131
  };
103
132
  })), [{
104
133
  name: 'parameters',
105
134
  type: null,
106
135
  visible: false,
107
- serialize: function serialize(_ref6) {
108
- var values = _ref6.values;
136
+ serialize: function serialize(_ref7) {
137
+ var values = _ref7.values;
109
138
  return node.parameters.map(function (parameter) {
110
139
  return parameter.set('value', values.get("parameter_".concat(parameter.id)));
111
140
  });
@@ -122,8 +151,8 @@ var fields = function fields(_ref3) {
122
151
  language: 'erb',
123
152
  options: bindings,
124
153
  "transient": true,
125
- visible: function visible(_ref7) {
126
- var values = _ref7.values;
154
+ visible: function visible(_ref8) {
155
+ var values = _ref8.values;
127
156
  return values.get('defers', false);
128
157
  }
129
158
  }, {
@@ -138,8 +167,8 @@ var fields = function fields(_ref3) {
138
167
  language: 'erb',
139
168
  options: bindings,
140
169
  "transient": true,
141
- visible: function visible(_ref8) {
142
- var values = _ref8.values;
170
+ visible: function visible(_ref9) {
171
+ var values = _ref9.values;
143
172
  return values.get('defers', false);
144
173
  }
145
174
  }, {
@@ -158,8 +187,8 @@ var fields = function fields(_ref3) {
158
187
  name: 'messages',
159
188
  type: null,
160
189
  visible: false,
161
- serialize: function serialize(_ref9) {
162
- var values = _ref9.values;
190
+ serialize: function serialize(_ref10) {
191
+ var values = _ref10.values;
163
192
  return List(values.get('defers') ? ['Create', 'Update', 'Complete'] : ['Complete']).map(function (type) {
164
193
  return NodeMessage({
165
194
  type: type,
@@ -174,10 +203,10 @@ var fields = function fields(_ref3) {
174
203
  };
175
204
  };
176
205
 
177
- var handleSubmit = function handleSubmit(_ref10) {
178
- var node = _ref10.node;
206
+ var handleSubmit = function handleSubmit(_ref11) {
207
+ var node = _ref11.node;
179
208
  return function (values) {
180
- return values.toObject();
209
+ return node.merge(values);
181
210
  };
182
211
  };
183
212
 
@@ -2,6 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import { generateForm } from '../../form/Form';
3
3
  import { buildBindings, normalizeParameter } from './helpers';
4
4
  import { NodeParameter } from './models';
5
+ import { checkOmittedParameters } from './TaskDefinitionConfigForm';
5
6
 
6
7
  var getOptions = function getOptions(menu) {
7
8
  return menu.split(',').filter(function (value) {
@@ -54,7 +55,8 @@ var fields = function fields(_ref2) {
54
55
  initialValue: parameter.value,
55
56
  options: parameter.menu ? getOptions(parameter.menu) : bindings,
56
57
  "transient": true,
57
- enabled: false
58
+ enabled: false,
59
+ visible: checkOmittedParameters(node, parameter)
58
60
  };
59
61
  })), _toConsumableArray(parameters.map(function (parameter) {
60
62
  var matchingParameter = node.parameters.find(function (oldParameter) {
@@ -68,7 +70,8 @@ var fields = function fields(_ref2) {
68
70
  helpText: parameter.description,
69
71
  initialValue: matchingParameter ? matchingParameter.value : parameter.defaultValue,
70
72
  options: parameter.menu ? getOptions(parameter.menu) : bindings,
71
- "transient": true
73
+ "transient": true,
74
+ visible: checkOmittedParameters(node, parameter)
72
75
  };
73
76
  })), [{
74
77
  name: 'parameters',
@@ -245,11 +245,20 @@ export var SvgCanvas = /*#__PURE__*/function (_Component) {
245
245
  x = _this$viewport.x,
246
246
  y = _this$viewport.y;
247
247
 
248
- if (!isIE11) {
249
- var transition = duration ? "transition: transform ".concat(duration, "ms ").concat(ease) : '';
250
- this.transformer.current.setAttribute('style', "transform: translate(".concat(x, "px, ").concat(y, "px) scale(").concat(scale, ");").concat(transition));
248
+ if (isIE11) {
249
+ // this.transformer.current.setAttribute(
250
+ // 'transform',
251
+ // `translate(${x} ${y}) scale(${scale})`,
252
+ // );
253
+ this.transformer.current.transform = "translate(".concat(x, " ").concat(y, ") scale(").concat(scale, ")");
251
254
  } else {
252
- this.transformer.current.setAttribute('transform', "translate(".concat(x, " ").concat(y, ") scale(").concat(scale, ")"));
255
+ var transition = duration ? "transform ".concat(duration, "ms ").concat(ease) : ''; // this.transformer.current.setAttribute(
256
+ // 'style',
257
+ // `transform: translate(${x}px, ${y}px) scale(${scale});${transition}`,
258
+ // );
259
+
260
+ this.transformer.current.style.transform = "translate(".concat(x, "px, ").concat(y, "px) scale(").concat(scale, ")");
261
+ this.transformer.current.style.transition = transition;
253
262
  }
254
263
 
255
264
  if (this.viewport.scale < 0.26 && this.transformer.current.className.baseVal !== 'min-detail') {
@@ -0,0 +1,113 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import { List, Map } from 'immutable';
4
+ import { generateForm } from '../../form/Form';
5
+ import { fetchForm, fetchKapps } from '../../../apis';
6
+ export var checkOmittedParameters = function checkOmittedParameters(node, parameter) {
7
+ if (node.definitionId === 'system_submission_create_v1') {
8
+ return !['kappSlug', 'formSlug'].includes(parameter.id);
9
+ } else {
10
+ return true;
11
+ }
12
+ };
13
+ export var generateTaskDefinition = function generateTaskDefinition(taskDefinition) {
14
+ if (taskDefinition.definitionName === 'system_submission_create') {
15
+ return function (_ref) {
16
+ var form = _ref.form;
17
+ return _objectSpread(_objectSpread({}, taskDefinition), {}, {
18
+ parameters: [].concat(_toConsumableArray(taskDefinition.parameters.map(function (parameter) {
19
+ return parameter.id === 'kappSlug' ? _objectSpread(_objectSpread({}, parameter), {}, {
20
+ defaultValue: form.kapp.slug
21
+ }) : parameter.id === 'formSlug' ? _objectSpread(_objectSpread({}, parameter), {}, {
22
+ defaultValue: form.slug
23
+ }) : parameter;
24
+ })), _toConsumableArray(form.fields.map(function (field) {
25
+ return {
26
+ name: field.name,
27
+ defaultValue: '',
28
+ dependsOnId: null,
29
+ dependsOnValue: null,
30
+ description: '',
31
+ id: "values.".concat(field.name),
32
+ required: false
33
+ };
34
+ })))
35
+ });
36
+ };
37
+ } else {
38
+ return null;
39
+ }
40
+ };
41
+
42
+ var dataSources = function dataSources() {
43
+ return {
44
+ kapps: {
45
+ fn: fetchKapps,
46
+ params: [],
47
+ transform: function transform(data) {
48
+ return data.kapps;
49
+ }
50
+ }
51
+ };
52
+ };
53
+
54
+ var fields = function fields() {
55
+ return function () {
56
+ return [{
57
+ name: 'kappSlug',
58
+ label: 'Kapp',
59
+ type: 'select',
60
+ required: true,
61
+ options: function options(_ref2) {
62
+ var kapps = _ref2.kapps;
63
+ return kapps ? kapps.map(function (kapp) {
64
+ return Map({
65
+ value: kapp.get('slug'),
66
+ label: kapp.get('name')
67
+ });
68
+ }) : List();
69
+ },
70
+ onChange: function onChange(_ref3, actions) {
71
+ var values = _ref3.values;
72
+
73
+ if (!!values.get('form')) {
74
+ actions.setValue('form', null);
75
+ }
76
+ }
77
+ }, {
78
+ name: 'form',
79
+ label: 'Form',
80
+ type: 'form',
81
+ required: true,
82
+ enabled: function enabled(_ref4) {
83
+ var values = _ref4.values;
84
+ return values.get('kappSlug') !== '';
85
+ },
86
+ search: function search(_ref5) {
87
+ var values = _ref5.values;
88
+ return values.get('kappSlug') !== '' ? {
89
+ kappSlug: values.get('kappSlug')
90
+ } : {};
91
+ }
92
+ }];
93
+ };
94
+ };
95
+
96
+ var handleSubmit = function handleSubmit(_ref6) {
97
+ var taskDefinition = _ref6.taskDefinition;
98
+ return function (values) {
99
+ return fetchForm({
100
+ kappSlug: values.get('kappSlug'),
101
+ formSlug: values.getIn(['form', 'slug'], ''),
102
+ include: 'fields,kapp'
103
+ }).then(generateTaskDefinition(taskDefinition));
104
+ };
105
+ };
106
+
107
+ export var TaskDefinitionConfigForm = generateForm({
108
+ formOptions: ['taskDefinition'],
109
+ dataSources: dataSources,
110
+ fields: fields,
111
+ handleSubmit: handleSubmit
112
+ });
113
+ TaskDefinitionConfigForm.displayName = 'TaskDefinitionConfigForm';