@kineticdata/react 6.0.5 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +64 -6
- 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/integrations.js +61 -0
- 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 +114 -15
- 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 +30 -5
- package/lib/apis/index.js +48 -0
- package/lib/apis/integrator/index.js +337 -0
- package/lib/apis/system/index.js +64 -12
- package/lib/apis/task/index.js +9 -2
- package/lib/components/agent/filestore/FilestoreForm.js +1 -1
- package/lib/components/common/AttributeSelect.js +11 -2
- package/lib/components/common/BridgeSelect.js +3 -1
- package/lib/components/common/ConnectionSelect.js +73 -0
- package/lib/components/common/FormSelect.js +3 -1
- package/lib/components/common/NodeSelect.js +1 -0
- package/lib/components/common/StaticSelect.js +16 -6
- package/lib/components/common/TableInput.js +4 -1
- package/lib/components/common/TeamSelect.js +3 -1
- package/lib/components/common/ToastContainer.js +34 -10
- package/lib/components/common/Typeahead.js +62 -23
- package/lib/components/common/UserSelect.js +3 -1
- package/lib/components/common/authentication/AuthenticationContainer.js +121 -55
- package/lib/components/common/authentication/RequestInterceptor.js +1 -1
- package/lib/components/common/preferences/PreferencesProvider.js +461 -0
- package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +10 -7
- package/lib/components/core/bridge_model/BridgeModelTable.js +19 -0
- package/lib/components/core/bridge_model_attribute/BridgeModelAttributeForm.js +6 -9
- package/lib/components/core/bridge_model_attribute/BridgeModelAttributeTable.js +0 -4
- package/lib/components/core/bridge_model_qualification/BridgeModelQualificationForm.js +7 -10
- package/lib/components/core/bridge_model_qualification/BridgeModelQualificationTable.js +2 -15
- package/lib/components/core/category/CategoryForm.js +4 -1
- package/lib/components/core/category/CategoryTable.js +2 -2
- package/lib/components/core/core_form/CoreForm.js +18 -10
- package/lib/components/core/field_definition/FieldDefinitionForm.js +3 -3
- package/lib/components/core/file_resource/FileResourceForm.js +2 -1
- package/lib/components/core/file_resource/FileResourceTable.js +14 -7
- package/lib/components/core/form/FormForm.js +42 -19
- package/lib/components/core/form/FormTable.js +13 -14
- package/lib/components/core/form_type/FormTypeForm.js +3 -0
- package/lib/components/core/i18n/Moment.js +1 -0
- package/lib/components/core/integration/IntegrationForm.js +232 -0
- package/lib/components/core/integration/IntegrationTable.js +142 -0
- package/lib/components/core/kapp/KappForm.js +18 -5
- package/lib/components/core/kapp/KappTable.js +3 -3
- package/lib/components/core/log/LogTable.js +1 -1
- package/lib/components/core/security_definition/SecurityDefinitionForm.js +48 -10
- package/lib/components/core/space/SpaceForm.js +17 -36
- package/lib/components/core/submission/DatastoreSubmissionTable.js +4 -4
- package/lib/components/core/submission/FormSubmissionTable.js +12 -7
- package/lib/components/core/submission/KappSubmissionTable.js +4 -4
- package/lib/components/core/submission/SubmissionActivityForm.js +79 -0
- package/lib/components/core/submission/SubmissionForm.js +15 -3
- package/lib/components/core/team/TeamTable.js +17 -7
- 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 +22 -22
- package/lib/components/core/webapi/WebApiForm.js +5 -2
- package/lib/components/core/webapi/WebApiTable.js +2 -2
- package/lib/components/core/webhook/WebhookForm.js +43 -33
- package/lib/components/core/webhook/WebhookTable.js +16 -16
- package/lib/components/core/webhook_job/WebhookJobTable.js +17 -6
- package/lib/components/form/Form.helpers.js +10 -4
- package/lib/components/form/Form.js +264 -171
- package/lib/components/form/Form.models.js +6 -1
- package/lib/components/form/FormState.js +9 -5
- package/lib/components/form/SimpleForm.js +2 -2
- package/lib/components/form/defaults/CodeField.js +44 -1
- package/lib/components/index.js +152 -3
- package/lib/components/integrator/connection/ConnectionForm.js +156 -0
- package/lib/components/integrator/connection/ConnectionTable.js +82 -0
- package/lib/components/integrator/connection/config_fields/http.js +570 -0
- package/lib/components/integrator/connection/config_fields/sql.js +123 -0
- package/lib/components/integrator/integrationTypes.js +120 -0
- package/lib/components/integrator/operation/OperationForm.js +148 -0
- package/lib/components/integrator/operation/OperationTable.js +62 -0
- package/lib/components/integrator/operation/config_fields/http.js +185 -0
- package/lib/components/integrator/operation/config_fields/sql.js +81 -0
- package/lib/components/system/SystemSecurityForm.js +1 -1
- package/lib/components/system/SystemTaskAdapterForm.js +9 -9
- package/lib/components/system/SystemUserForm.js +2 -0
- package/lib/components/system/helpers.js +123 -100
- package/lib/components/system/spaces/SystemSpaceForm.js +9 -37
- package/lib/components/system/spaces/SystemTenantForm.js +276 -104
- package/lib/components/system/spaces/SystemTenantMigrateForm.js +449 -0
- package/lib/components/system/spaces/SystemTenantTable.js +20 -16
- package/lib/components/table/Table.js +75 -15
- package/lib/components/table/Table.redux.js +297 -73
- 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/ConnectorForm.js +11 -7
- package/lib/components/task/builder/Node.js +31 -35
- package/lib/components/task/builder/NodeForm.js +93 -22
- package/lib/components/task/builder/NodeParametersForm.js +29 -17
- package/lib/components/task/builder/SvgCanvas.js +3 -17
- package/lib/components/task/builder/TaskDefinitionConfigForm.js +18 -50
- package/lib/components/task/builder/TreeBuilder.js +23 -3
- package/lib/components/task/builder/builder.redux.js +342 -197
- package/lib/components/task/builder/constants.js +10 -2
- package/lib/components/task/builder/helpers.js +231 -81
- package/lib/components/task/builder/models.js +7 -6
- package/lib/components/task/category/TaskCategoryTable.js +3 -3
- package/lib/components/task/common/UsageTable.js +9 -2
- package/lib/components/task/handlers/HandlerTable.js +44 -37
- package/lib/components/task/policy_rule/PolicyRuleTable.js +3 -3
- package/lib/components/task/runs/CreateManualTriggerForm.js +2 -0
- package/lib/components/task/runs/RunTable.js +10 -14
- package/lib/components/task/runs/RunTaskTable.js +1 -1
- package/lib/components/task/sources/SourceTable.js +2 -2
- package/lib/components/task/triggers/TriggerTable.js +2 -2
- package/lib/components/task/workflows/LinkedWorkflowTable.js +16 -11
- package/lib/components/task/workflows/WorkflowForm.js +27 -8
- package/lib/components/task/workflows/WorkflowTable.js +27 -26
- package/lib/helpers/index.js +307 -74
- package/lib/index.js +2 -1
- package/lib/saga.js +4 -4
- package/lib/store.js +2 -1
- package/package.json +7 -6
- package/proxyhelper.js +201 -176
- package/CHANGELOG.md +0 -94
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.usePreferences = exports.setPreferenceJSON = exports.setPreferenceBool = exports.setPreference = exports.PreferencesProvider = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
|
12
|
+
var _classPrivateFieldLooseBase2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classPrivateFieldLooseBase"));
|
|
13
|
+
var _classPrivateFieldLooseKey2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classPrivateFieldLooseKey"));
|
|
14
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
|
|
15
|
+
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
16
|
+
var _reducer = require("../../../reducer");
|
|
17
|
+
var _saga = require("../../../saga");
|
|
18
|
+
var _effects = require("redux-saga/effects");
|
|
19
|
+
var _store = require("../../../store");
|
|
20
|
+
var _react = require("react");
|
|
21
|
+
var _immutable = require("immutable");
|
|
22
|
+
var _reactRedux = require("react-redux");
|
|
23
|
+
var _apis = require("../../../apis");
|
|
24
|
+
/**
|
|
25
|
+
* Preferences are stored as key-value pairs, where both the key and value are
|
|
26
|
+
* strings. These can be stored either in a browser session, or persisted in
|
|
27
|
+
* the database. We can also set temporary preferences which are only stored in
|
|
28
|
+
* redux, and thus will reset when the app is reloaded.
|
|
29
|
+
*
|
|
30
|
+
* This implementation expects that the key persisted in session or the db will
|
|
31
|
+
* consist of a prefix and key(suffix) value, where both contain lowercase
|
|
32
|
+
* alphanumeric characters and dashes. This implementation then combines the
|
|
33
|
+
* two parts with 4 consecutive dashes (----) to create the full key. The
|
|
34
|
+
* reason for having the two parts is to allow us to group preferences together
|
|
35
|
+
* by using the same prefix, which will make it easier to retrieve groups of
|
|
36
|
+
* preferences.
|
|
37
|
+
*
|
|
38
|
+
* The value must be saved as a string. In order to use other datatypes, you
|
|
39
|
+
* will need to convert the data when retrieving and updating preferences.
|
|
40
|
+
*
|
|
41
|
+
* Persisted preference examples:
|
|
42
|
+
* 'kapp-forms-table----filter-toggle': 'true'
|
|
43
|
+
* 'kapp-forms-table----initial-filters': '{"name": "A", "type": "Service"}'
|
|
44
|
+
* 'workflow-table----columns': '["name", "event", "updatedAt"]'
|
|
45
|
+
*
|
|
46
|
+
* Retrieved preference structure (as stored in redux):
|
|
47
|
+
* {
|
|
48
|
+
* kapp-forms-table: {
|
|
49
|
+
* 'filter-toggle': 'true',
|
|
50
|
+
* 'initial-filters': '{"name": "A", "type": "Service"}'
|
|
51
|
+
* },
|
|
52
|
+
* workflow-table: {
|
|
53
|
+
* 'columns': '["name", "event", "updatedAt"]'
|
|
54
|
+
* }
|
|
55
|
+
* }
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
(0, _reducer.regHandlers)({
|
|
59
|
+
INIT_PREFERENCES: function INIT_PREFERENCES(state) {
|
|
60
|
+
return state.set('preferences', (0, _immutable.Map)());
|
|
61
|
+
},
|
|
62
|
+
LOAD_PREFERENCES: function LOAD_PREFERENCES(state, _ref) {
|
|
63
|
+
var payload = _ref.payload;
|
|
64
|
+
return state.set('preferences', payload);
|
|
65
|
+
},
|
|
66
|
+
SET_PREFERENCE_PERSISTENT: function SET_PREFERENCE_PERSISTENT(state, _ref2) {
|
|
67
|
+
var _ref2$payload = _ref2.payload,
|
|
68
|
+
prefix = _ref2$payload.prefix,
|
|
69
|
+
key = _ref2$payload.key,
|
|
70
|
+
value = _ref2$payload.value;
|
|
71
|
+
return typeof value === 'function' ? state.updateIn(['preferences', prefix, key], value) : state.setIn(['preferences', prefix, key], value);
|
|
72
|
+
},
|
|
73
|
+
SET_PREFERENCE_SESSION: function SET_PREFERENCE_SESSION(state, _ref3) {
|
|
74
|
+
var _ref3$payload = _ref3.payload,
|
|
75
|
+
prefix = _ref3$payload.prefix,
|
|
76
|
+
key = _ref3$payload.key,
|
|
77
|
+
value = _ref3$payload.value;
|
|
78
|
+
return typeof value === 'function' ? state.updateIn(['preferences', prefix, key], value) : state.setIn(['preferences', prefix, key], value);
|
|
79
|
+
},
|
|
80
|
+
SET_PREFERENCE_TEMP: function SET_PREFERENCE_TEMP(state, _ref4) {
|
|
81
|
+
var _ref4$payload = _ref4.payload,
|
|
82
|
+
prefix = _ref4$payload.prefix,
|
|
83
|
+
key = _ref4$payload.key,
|
|
84
|
+
value = _ref4$payload.value;
|
|
85
|
+
return typeof value === 'function' ? state.updateIn(['preferences', prefix, key], value) : state.setIn(['preferences', prefix, key], value);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
(0, _saga.regSaga)((0, _effects.takeLatest)('INIT_PREFERENCES', function (_ref5) {
|
|
89
|
+
var loggedIn = _ref5.payload;
|
|
90
|
+
return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
91
|
+
var preferences, persisted;
|
|
92
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
93
|
+
while (1) switch (_context.prev = _context.next) {
|
|
94
|
+
case 0:
|
|
95
|
+
// Create preferences map
|
|
96
|
+
preferences = (0, _immutable.Map)();
|
|
97
|
+
if (!loggedIn) {
|
|
98
|
+
_context.next = 6;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
_context.next = 4;
|
|
102
|
+
return (0, _effects.call)(_apis.fetchUserPreferences);
|
|
103
|
+
case 4:
|
|
104
|
+
persisted = _context.sent;
|
|
105
|
+
if (persisted.userPreferences) {
|
|
106
|
+
// Combine both preference lists
|
|
107
|
+
preferences = preferences.merge(Object.fromEntries(persisted.userPreferences.map(function (_ref6) {
|
|
108
|
+
var key = _ref6.key,
|
|
109
|
+
value = _ref6.value;
|
|
110
|
+
return [key, value];
|
|
111
|
+
})));
|
|
112
|
+
}
|
|
113
|
+
case 6:
|
|
114
|
+
// Get preferences from session storage
|
|
115
|
+
preferences = preferences.merge((0, _objectSpread3["default"])({}, sessionStorage));
|
|
116
|
+
_context.next = 9;
|
|
117
|
+
return (0, _effects.put)((0, _store.action)('LOAD_PREFERENCES', preferences
|
|
118
|
+
// Split each key into a prefix and key(suffix), using an empty
|
|
119
|
+
// string if a prefix is missing
|
|
120
|
+
.mapKeys(function (key) {
|
|
121
|
+
var keyArray = key.split(/(.*)----/);
|
|
122
|
+
if (keyArray.length > 1) return keyArray.slice(1, 3);else if (keyArray.length === 1) return ['', keyArray[0]];else return ['', ''];
|
|
123
|
+
})
|
|
124
|
+
// Group the preferences by the prefix
|
|
125
|
+
.groupBy(function (val, key) {
|
|
126
|
+
return key[0];
|
|
127
|
+
})
|
|
128
|
+
// Update each group to change theirs keys to remove the prefix
|
|
129
|
+
.map(function (val) {
|
|
130
|
+
return val.mapKeys(function (key) {
|
|
131
|
+
return key[1];
|
|
132
|
+
});
|
|
133
|
+
})));
|
|
134
|
+
case 9:
|
|
135
|
+
case "end":
|
|
136
|
+
return _context.stop();
|
|
137
|
+
}
|
|
138
|
+
}, _callee);
|
|
139
|
+
})();
|
|
140
|
+
}));
|
|
141
|
+
(0, _saga.regSaga)((0, _effects.takeEvery)('SET_PREFERENCE_PERSISTENT', function (_ref7) {
|
|
142
|
+
var _ref7$payload = _ref7.payload,
|
|
143
|
+
prefix = _ref7$payload.prefix,
|
|
144
|
+
key = _ref7$payload.key;
|
|
145
|
+
return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2() {
|
|
146
|
+
var updatedValue;
|
|
147
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
|
|
148
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
149
|
+
case 0:
|
|
150
|
+
_context2.next = 2;
|
|
151
|
+
return (0, _effects.select)(function (state) {
|
|
152
|
+
return state.getIn(['preferences', prefix, key]);
|
|
153
|
+
});
|
|
154
|
+
case 2:
|
|
155
|
+
updatedValue = _context2.sent;
|
|
156
|
+
if (!(typeof updatedValue === 'string')) {
|
|
157
|
+
_context2.next = 8;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
_context2.next = 6;
|
|
161
|
+
return (0, _effects.call)(_apis.upsertUserPreference, {
|
|
162
|
+
userPreference: {
|
|
163
|
+
key: "".concat(prefix, "----").concat(key),
|
|
164
|
+
value: updatedValue
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
case 6:
|
|
168
|
+
_context2.next = 9;
|
|
169
|
+
break;
|
|
170
|
+
case 8:
|
|
171
|
+
console.error("User preference values must be strings. The value for key '".concat(key, "' was of type '").concat(typeof updatedValue, "'."));
|
|
172
|
+
case 9:
|
|
173
|
+
case "end":
|
|
174
|
+
return _context2.stop();
|
|
175
|
+
}
|
|
176
|
+
}, _callee2);
|
|
177
|
+
})();
|
|
178
|
+
}));
|
|
179
|
+
(0, _saga.regSaga)((0, _effects.takeEvery)('SET_PREFERENCE_SESSION', function (_ref8) {
|
|
180
|
+
var _ref8$payload = _ref8.payload,
|
|
181
|
+
prefix = _ref8$payload.prefix,
|
|
182
|
+
key = _ref8$payload.key;
|
|
183
|
+
return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee3() {
|
|
184
|
+
var updatedValue;
|
|
185
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
|
|
186
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
187
|
+
case 0:
|
|
188
|
+
_context3.next = 2;
|
|
189
|
+
return (0, _effects.select)(function (state) {
|
|
190
|
+
return state.getIn(['preferences', prefix, key]);
|
|
191
|
+
});
|
|
192
|
+
case 2:
|
|
193
|
+
updatedValue = _context3.sent;
|
|
194
|
+
if (!(typeof updatedValue === 'string')) {
|
|
195
|
+
_context3.next = 8;
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
_context3.next = 6;
|
|
199
|
+
return (0, _effects.call)([sessionStorage, sessionStorage.setItem], "".concat(prefix, "----").concat(key), updatedValue);
|
|
200
|
+
case 6:
|
|
201
|
+
_context3.next = 9;
|
|
202
|
+
break;
|
|
203
|
+
case 8:
|
|
204
|
+
console.error("User preference values must be strings. The value for key '".concat(key, "' was of type '").concat(typeof updatedValue, "'."));
|
|
205
|
+
case 9:
|
|
206
|
+
case "end":
|
|
207
|
+
return _context3.stop();
|
|
208
|
+
}
|
|
209
|
+
}, _callee3);
|
|
210
|
+
})();
|
|
211
|
+
}));
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Sets a preference value for a given prefix and key
|
|
215
|
+
* @param {String} prefix The prefix part of the preference key.
|
|
216
|
+
* @param {String} key The key(suffix) part of the preference key.
|
|
217
|
+
* @param {String|Function} value The value to store for the preference key, or
|
|
218
|
+
* an updater function that receives the previous value as a parameter.
|
|
219
|
+
* @param {('persist'|'session'|'temp')} duration How long to store the
|
|
220
|
+
* preference for. Defaults to `session`.
|
|
221
|
+
* - `persist` will store it forever.
|
|
222
|
+
* - `session` will store it for the current browser session.
|
|
223
|
+
* - `temp` will store it for the current instance of the webpage.
|
|
224
|
+
*/
|
|
225
|
+
var setPreference = exports.setPreference = function setPreference(prefix, key, value, duration) {
|
|
226
|
+
return (0, _store.dispatch)(duration === 'persist' ? 'SET_PREFERENCE_PERSISTENT' : duration === 'temp' ? 'SET_PREFERENCE_TEMP' : 'SET_PREFERENCE_SESSION', {
|
|
227
|
+
prefix: prefix,
|
|
228
|
+
key: key,
|
|
229
|
+
value: value
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
var setPreferenceBool = exports.setPreferenceBool = function setPreferenceBool(prefix, key, value, duration) {
|
|
233
|
+
return setPreference(prefix, key, typeof value === 'function' ? function (stateValue) {
|
|
234
|
+
return toBooleanString(value(fromBooleanString(stateValue)));
|
|
235
|
+
} : toBooleanString(value), duration);
|
|
236
|
+
};
|
|
237
|
+
var setPreferenceJSON = exports.setPreferenceJSON = function setPreferenceJSON(prefix, key, value, duration) {
|
|
238
|
+
return setPreference(prefix, key, typeof value === 'function' ? function (stateValue) {
|
|
239
|
+
return toJSONString(value(fromJSONString(stateValue)));
|
|
240
|
+
} : toJSONString(value), duration);
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* A class for defining a Preference record with getters and setters for
|
|
245
|
+
* different data types.
|
|
246
|
+
* @class
|
|
247
|
+
* @property {string} prefix The prefix of the preference
|
|
248
|
+
* @property {string} key The key of the preference
|
|
249
|
+
* @property {string} value The value of the preference
|
|
250
|
+
*/
|
|
251
|
+
var _prefix = /*#__PURE__*/(0, _classPrivateFieldLooseKey2["default"])("prefix");
|
|
252
|
+
var _key = /*#__PURE__*/(0, _classPrivateFieldLooseKey2["default"])("key");
|
|
253
|
+
var _value = /*#__PURE__*/(0, _classPrivateFieldLooseKey2["default"])("value");
|
|
254
|
+
var Preference = /*#__PURE__*/function () {
|
|
255
|
+
function Preference(prefix, key, value) {
|
|
256
|
+
(0, _classCallCheck2["default"])(this, Preference);
|
|
257
|
+
Object.defineProperty(this, _prefix, {
|
|
258
|
+
writable: true,
|
|
259
|
+
value: void 0
|
|
260
|
+
});
|
|
261
|
+
Object.defineProperty(this, _key, {
|
|
262
|
+
writable: true,
|
|
263
|
+
value: void 0
|
|
264
|
+
});
|
|
265
|
+
Object.defineProperty(this, _value, {
|
|
266
|
+
writable: true,
|
|
267
|
+
value: void 0
|
|
268
|
+
});
|
|
269
|
+
(0, _classPrivateFieldLooseBase2["default"])(this, _prefix)[_prefix] = prefix;
|
|
270
|
+
(0, _classPrivateFieldLooseBase2["default"])(this, _key)[_key] = key;
|
|
271
|
+
(0, _classPrivateFieldLooseBase2["default"])(this, _value)[_value] = value;
|
|
272
|
+
this.asBool = this.asBool.bind(this);
|
|
273
|
+
this.asJSON = this.asJSON.bind(this);
|
|
274
|
+
this.set = this.set.bind(this);
|
|
275
|
+
this.setBool = this.setBool.bind(this);
|
|
276
|
+
this.setJSON = this.setJSON.bind(this);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Get the preference prefix
|
|
281
|
+
* @returns {String}
|
|
282
|
+
*/
|
|
283
|
+
(0, _createClass2["default"])(Preference, [{
|
|
284
|
+
key: "prefix",
|
|
285
|
+
get: function get() {
|
|
286
|
+
return (0, _classPrivateFieldLooseBase2["default"])(this, _prefix)[_prefix];
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Get the preference key
|
|
290
|
+
* @returns {String}
|
|
291
|
+
*/
|
|
292
|
+
}, {
|
|
293
|
+
key: "key",
|
|
294
|
+
get: function get() {
|
|
295
|
+
return (0, _classPrivateFieldLooseBase2["default"])(this, _key)[_key];
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Get the preference value as a string
|
|
299
|
+
* @returns {String}
|
|
300
|
+
*/
|
|
301
|
+
}, {
|
|
302
|
+
key: "value",
|
|
303
|
+
get: function get() {
|
|
304
|
+
return (0, _classPrivateFieldLooseBase2["default"])(this, _value)[_value];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Get the preference value as a boolean, defaulting to the provided
|
|
309
|
+
* `defaultValue` if there is no preference set.
|
|
310
|
+
* @param {boolean} [defaultValue]
|
|
311
|
+
* @returns {boolean}
|
|
312
|
+
*/
|
|
313
|
+
}, {
|
|
314
|
+
key: "asBool",
|
|
315
|
+
value: function asBool(defaultValue) {
|
|
316
|
+
return fromBooleanString((0, _classPrivateFieldLooseBase2["default"])(this, _value)[_value], defaultValue);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Get the preference values as a JSON object, defaulting to the provided
|
|
321
|
+
* `defaultValue` if there is no preference set, or the set preference is
|
|
322
|
+
* not a valid JSON string
|
|
323
|
+
* @param {Object} [defaultValue]
|
|
324
|
+
* @returns {Object}
|
|
325
|
+
*/
|
|
326
|
+
}, {
|
|
327
|
+
key: "asJSON",
|
|
328
|
+
value: function asJSON(defaultValue) {
|
|
329
|
+
return fromJSONString((0, _classPrivateFieldLooseBase2["default"])(this, _value)[_value], defaultValue);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Saves the provided value for this preference for the given duration
|
|
334
|
+
* @param {string} value The value to save
|
|
335
|
+
* @param {('persist'|'session'|'temp')} [duration] How long to save the
|
|
336
|
+
* preference for. Defaults to `session`.
|
|
337
|
+
* - `persist` will store it forever.
|
|
338
|
+
* - `session` will store it for the current browser session.
|
|
339
|
+
* - `temp` will store it for the current instance of the webpage.
|
|
340
|
+
*/
|
|
341
|
+
}, {
|
|
342
|
+
key: "set",
|
|
343
|
+
value: function set(value, duration) {
|
|
344
|
+
setPreference((0, _classPrivateFieldLooseBase2["default"])(this, _prefix)[_prefix], (0, _classPrivateFieldLooseBase2["default"])(this, _key)[_key], value, duration);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Saves the provided boolean value for this preference for the given duration
|
|
349
|
+
* @param {boolean} value The boolean value to save
|
|
350
|
+
* @param {('persist'|'session'|'temp')} [duration] How long to save the
|
|
351
|
+
* preference for. Defaults to `session`.
|
|
352
|
+
* - `persist` will store it forever.
|
|
353
|
+
* - `session` will store it for the current browser session.
|
|
354
|
+
* - `temp` will store it for the current instance of the webpage.
|
|
355
|
+
*/
|
|
356
|
+
}, {
|
|
357
|
+
key: "setBool",
|
|
358
|
+
value: function setBool(value, duration) {
|
|
359
|
+
setPreference((0, _classPrivateFieldLooseBase2["default"])(this, _prefix)[_prefix], (0, _classPrivateFieldLooseBase2["default"])(this, _key)[_key], toBooleanString(value), duration);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Saves the provided JSON value for this preference for the given duration
|
|
364
|
+
* @param {Object} value The JSON value to save
|
|
365
|
+
* @param {('persist'|'session'|'temp')} [duration] How long to save the
|
|
366
|
+
* preference for. Defaults to `session`.
|
|
367
|
+
* - `persist` will store it forever.
|
|
368
|
+
* - `session` will store it for the current browser session.
|
|
369
|
+
* - `temp` will store it for the current instance of the webpage.
|
|
370
|
+
*/
|
|
371
|
+
}, {
|
|
372
|
+
key: "setJSON",
|
|
373
|
+
value: function setJSON(value, duration) {
|
|
374
|
+
setPreference((0, _classPrivateFieldLooseBase2["default"])(this, _prefix)[_prefix], (0, _classPrivateFieldLooseBase2["default"])(this, _key)[_key], toJSONString(value), duration);
|
|
375
|
+
}
|
|
376
|
+
}]);
|
|
377
|
+
return Preference;
|
|
378
|
+
}();
|
|
379
|
+
/**
|
|
380
|
+
* Hook for retrieving user preferences for a given prefix.
|
|
381
|
+
*
|
|
382
|
+
* @param {String} prefix A prefix that defines a group of preferences to allow
|
|
383
|
+
* for fetching multiple related preferences at once. Prefixes should be
|
|
384
|
+
* lowercase, alphanumeric and dashes only, and should not contain multiple
|
|
385
|
+
* consecutive dashes.
|
|
386
|
+
* @param {String[]} [keys] List of preference keys for the given prefix to
|
|
387
|
+
* return. Keys should be lowercase, alphanumeric and dashes only, and should
|
|
388
|
+
* not contain multiple consecutive dashes.
|
|
389
|
+
* @returns {Object.<string,Preference>} Returns a map of preferences for the
|
|
390
|
+
* provided `keys`. Each preference is a class with getters and setters for
|
|
391
|
+
* various data types.
|
|
392
|
+
*/
|
|
393
|
+
var usePreferences = exports.usePreferences = function usePreferences() {
|
|
394
|
+
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
395
|
+
var keys = arguments.length > 1 ? arguments[1] : undefined;
|
|
396
|
+
var preferences = (0, _store.useSelector)(function (state) {
|
|
397
|
+
var prefixPrefs = state.getIn(['preferences', prefix], (0, _immutable.Map)());
|
|
398
|
+
return Array.isArray(keys) ? keys.reduce(function (prefs, key) {
|
|
399
|
+
return (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, prefs), {}, (0, _defineProperty2["default"])({}, key, prefixPrefs.get(key, '')));
|
|
400
|
+
}, {}) : prefixPrefs.toJS();
|
|
401
|
+
}, _reactRedux.shallowEqual);
|
|
402
|
+
return (0, _react.useMemo)(function () {
|
|
403
|
+
return Object.fromEntries(Object.entries(preferences).map(function (_ref9) {
|
|
404
|
+
var _ref10 = (0, _slicedToArray2["default"])(_ref9, 2),
|
|
405
|
+
key = _ref10[0],
|
|
406
|
+
value = _ref10[1];
|
|
407
|
+
return [key, new Preference(prefix, key, value)];
|
|
408
|
+
}));
|
|
409
|
+
}, [preferences, prefix]);
|
|
410
|
+
};
|
|
411
|
+
var PreferencesProvider = exports.PreferencesProvider = function PreferencesProvider(_ref11) {
|
|
412
|
+
var loggedIn = _ref11.loggedIn,
|
|
413
|
+
children = _ref11.children;
|
|
414
|
+
(0, _react.useEffect)(function () {
|
|
415
|
+
(0, _store.dispatch)('INIT_PREFERENCES', loggedIn);
|
|
416
|
+
}, [loggedIn]);
|
|
417
|
+
return children;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* @param {String} value JSON string to parse into a JS object.
|
|
422
|
+
* @param {Object} [defaultValue] Value to return if the `value` param isn't
|
|
423
|
+
* valid JSON.
|
|
424
|
+
* @returns {Object}
|
|
425
|
+
*/
|
|
426
|
+
function fromJSONString(value, defaultValue) {
|
|
427
|
+
try {
|
|
428
|
+
return value && typeof value === 'string' ? JSON.parse(value) : defaultValue || null;
|
|
429
|
+
} catch (e) {
|
|
430
|
+
return defaultValue || null;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* @param {Object} value JS object to convert into a JSON string.
|
|
436
|
+
* @returns {String}
|
|
437
|
+
*/
|
|
438
|
+
function toJSONString(value) {
|
|
439
|
+
try {
|
|
440
|
+
return value && typeof value === 'object' ? JSON.stringify(value) : '';
|
|
441
|
+
} catch (e) {
|
|
442
|
+
return '';
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* @param {String} value Boolean string to parse into a boolean variable.
|
|
448
|
+
* @param {boolean} [defaultValue] Value to return if the `value` param is empty.
|
|
449
|
+
* @returns {boolean}
|
|
450
|
+
*/
|
|
451
|
+
function fromBooleanString(value, defaultValue) {
|
|
452
|
+
return value && typeof value === 'string' ? (value === null || value === void 0 ? void 0 : value.toLowerCase()) === 'true' : typeof defaultValue === 'boolean' ? defaultValue : null;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* @param {boolean} value Boolean variable to convert to a string.
|
|
457
|
+
* @returns {string}
|
|
458
|
+
*/
|
|
459
|
+
function toBooleanString(value) {
|
|
460
|
+
return typeof value === 'boolean' ? value ? 'true' : 'false' : '';
|
|
461
|
+
}
|
|
@@ -23,6 +23,9 @@ var dataSources = function dataSources(_ref) {
|
|
|
23
23
|
}],
|
|
24
24
|
transform: function transform(result) {
|
|
25
25
|
return result.attributeDefinition;
|
|
26
|
+
},
|
|
27
|
+
errorTransform: function errorTransform(result) {
|
|
28
|
+
return result.error;
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
};
|
|
@@ -75,9 +78,9 @@ var fields = function fields(_ref4) {
|
|
|
75
78
|
};
|
|
76
79
|
};
|
|
77
80
|
|
|
78
|
-
/**
|
|
79
|
-
* @component
|
|
80
|
-
* A form for creating and updating Attribute Definitions within the Kinetic Platform
|
|
81
|
+
/**
|
|
82
|
+
* @component
|
|
83
|
+
* A form for creating and updating Attribute Definitions within the Kinetic Platform
|
|
81
84
|
*/
|
|
82
85
|
var AttributeDefinitionForm = exports.AttributeDefinitionForm = (0, _Form.generateForm)({
|
|
83
86
|
formOptions: ['kappSlug', 'attributeType', 'attributeName'],
|
|
@@ -97,10 +100,10 @@ AttributeDefinitionForm.propTypes = {
|
|
|
97
100
|
attributeType: _propTypes["default"].oneOf(['spaceAttributeDefinitions', 'teamAttributeDefinitions', 'userAttributeDefinitions', 'userProfileAttributeDefinitions', 'categoryAttributeDefinitions', 'kappAttributeDefinitions', 'formAttributeDefinitions']).isRequired,
|
|
98
101
|
/** The name of the attribute (assumes new if not null). */
|
|
99
102
|
attributeName: _propTypes["default"].string,
|
|
100
|
-
/**
|
|
101
|
-
* If the attribute definition is for a Kapp
|
|
102
|
-
* (Kapp Attributes, Form Attributes, Category Attributes, ...etc)
|
|
103
|
-
* a Kapp Slug is required.
|
|
103
|
+
/**
|
|
104
|
+
* If the attribute definition is for a Kapp
|
|
105
|
+
* (Kapp Attributes, Form Attributes, Category Attributes, ...etc)
|
|
106
|
+
* a Kapp Slug is required.
|
|
104
107
|
*/
|
|
105
108
|
kappSlug: _propTypes["default"].string
|
|
106
109
|
};
|
|
@@ -56,6 +56,25 @@ var columns = [{
|
|
|
56
56
|
title: 'Status',
|
|
57
57
|
sortable: true,
|
|
58
58
|
toggleable: true
|
|
59
|
+
}, {
|
|
60
|
+
value: 'createdAt',
|
|
61
|
+
title: 'Created At',
|
|
62
|
+
sortable: true,
|
|
63
|
+
toggleable: true
|
|
64
|
+
}, {
|
|
65
|
+
value: 'createdBy',
|
|
66
|
+
title: 'Created By',
|
|
67
|
+
toggleable: true
|
|
68
|
+
}, {
|
|
69
|
+
value: 'updatedAt',
|
|
70
|
+
title: 'Updated At',
|
|
71
|
+
toggleable: true,
|
|
72
|
+
sortable: true
|
|
73
|
+
}, {
|
|
74
|
+
value: 'updatedBy',
|
|
75
|
+
title: 'Updated By',
|
|
76
|
+
toggleable: true,
|
|
77
|
+
sortable: true
|
|
59
78
|
}];
|
|
60
79
|
var BridgeModelTable = exports.BridgeModelTable = (0, _Table.generateTable)({
|
|
61
80
|
columns: columns,
|
|
@@ -87,15 +87,12 @@ var fields = function fields(_ref6) {
|
|
|
87
87
|
language: 'js-template',
|
|
88
88
|
required: true,
|
|
89
89
|
initialValue: bridgeModelAttribute && bridgeModelAttribute.get('structureField') || '',
|
|
90
|
-
options: {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
90
|
+
options: [{
|
|
91
|
+
label: 'fields',
|
|
92
|
+
type: 'function',
|
|
93
|
+
quoteType: 'double',
|
|
94
|
+
detail: 'Add Field Mapping'
|
|
95
|
+
}]
|
|
99
96
|
}];
|
|
100
97
|
};
|
|
101
98
|
};
|
|
@@ -71,9 +71,6 @@ var dataSource = function dataSource(_ref5) {
|
|
|
71
71
|
transform: transform
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
-
|
|
75
|
-
// const filters = () => () => [{ name: 'name', label: 'Name', type: 'text' }];
|
|
76
|
-
|
|
77
74
|
var columns = [{
|
|
78
75
|
value: 'name',
|
|
79
76
|
title: 'Name',
|
|
@@ -85,7 +82,6 @@ var columns = [{
|
|
|
85
82
|
}];
|
|
86
83
|
var BridgeModelAttributeTable = exports.BridgeModelAttributeTable = (0, _Table.generateTable)({
|
|
87
84
|
columns: columns,
|
|
88
|
-
// filters,
|
|
89
85
|
dataSource: dataSource,
|
|
90
86
|
tableOptions: ['modelName']
|
|
91
87
|
});
|
|
@@ -122,18 +122,15 @@ var fields = function fields(_ref6) {
|
|
|
122
122
|
name: 'query',
|
|
123
123
|
label: 'Query',
|
|
124
124
|
type: 'code',
|
|
125
|
-
language: '
|
|
125
|
+
language: 'text',
|
|
126
126
|
required: false,
|
|
127
127
|
initialValue: bridgeModelQualificationMapping && bridgeModelQualificationMapping.get('query') || '',
|
|
128
|
-
options: {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
128
|
+
options: [{
|
|
129
|
+
label: 'parameters',
|
|
130
|
+
type: 'function',
|
|
131
|
+
quoteType: 'double',
|
|
132
|
+
detail: 'Add Parameter'
|
|
133
|
+
}]
|
|
137
134
|
}];
|
|
138
135
|
};
|
|
139
136
|
};
|
|
@@ -11,8 +11,6 @@ var _apis = require("../../../apis");
|
|
|
11
11
|
var _helpers = require("../../../helpers");
|
|
12
12
|
var clientSide = (0, _helpers.defineFilter)(true).startsWith('name', 'name').equals('resultType', 'resultType').end();
|
|
13
13
|
|
|
14
|
-
// const resultTypes = ['Single', 'Multiple'];
|
|
15
|
-
|
|
16
14
|
// Handles bridge model api response by checking for error and also returning
|
|
17
15
|
// error if active mapping is not present. If valid returns object with the
|
|
18
16
|
// attributes and their mappings.
|
|
@@ -73,31 +71,20 @@ var dataSource = function dataSource(_ref5) {
|
|
|
73
71
|
transform: transform
|
|
74
72
|
};
|
|
75
73
|
};
|
|
76
|
-
|
|
77
|
-
// const filters = () => () => [
|
|
78
|
-
// { name: 'name', label: 'Name', type: 'text' },
|
|
79
|
-
// {
|
|
80
|
-
// name: 'resultType',
|
|
81
|
-
// label: 'Result Type',
|
|
82
|
-
// type: 'select',
|
|
83
|
-
// options: resultTypes.map(el => ({ label: el, value: el })),
|
|
84
|
-
// },
|
|
85
|
-
// ];
|
|
86
|
-
|
|
87
74
|
var columns = [{
|
|
88
75
|
value: 'name',
|
|
89
76
|
title: 'Name',
|
|
90
77
|
sortable: true
|
|
91
78
|
}, {
|
|
92
79
|
value: 'resultType',
|
|
93
|
-
title: 'Result Type'
|
|
80
|
+
title: 'Result Type',
|
|
81
|
+
sortable: true
|
|
94
82
|
}, {
|
|
95
83
|
value: 'query',
|
|
96
84
|
title: 'Query'
|
|
97
85
|
}];
|
|
98
86
|
var BridgeModelQualificationTable = exports.BridgeModelQualificationTable = (0, _Table.generateTable)({
|
|
99
87
|
columns: columns,
|
|
100
|
-
// filters,
|
|
101
88
|
dataSource: dataSource,
|
|
102
89
|
tableOptions: ['modelName']
|
|
103
90
|
});
|
|
@@ -22,6 +22,9 @@ var dataSources = function dataSources(_ref) {
|
|
|
22
22
|
}],
|
|
23
23
|
transform: function transform(result) {
|
|
24
24
|
return result.category;
|
|
25
|
+
},
|
|
26
|
+
errorTransform: function errorTransform(result) {
|
|
27
|
+
return result.error;
|
|
25
28
|
}
|
|
26
29
|
},
|
|
27
30
|
attributeDefinitions: {
|
|
@@ -77,7 +80,7 @@ var fields = function fields(_ref4) {
|
|
|
77
80
|
name: 'slug',
|
|
78
81
|
label: 'Slug',
|
|
79
82
|
type: 'text',
|
|
80
|
-
required:
|
|
83
|
+
required: true,
|
|
81
84
|
initialValue: category ? category.get('slug') : '',
|
|
82
85
|
onChange: function onChange(_bindings, _ref8) {
|
|
83
86
|
var setValue = _ref8.setValue;
|
|
@@ -54,7 +54,7 @@ var columns = [{
|
|
|
54
54
|
toggleable: true
|
|
55
55
|
}, {
|
|
56
56
|
value: 'createdAt',
|
|
57
|
-
title: 'Created',
|
|
57
|
+
title: 'Created At',
|
|
58
58
|
sortable: true,
|
|
59
59
|
toggleable: true
|
|
60
60
|
}, {
|
|
@@ -64,7 +64,7 @@ var columns = [{
|
|
|
64
64
|
toggleable: true
|
|
65
65
|
}, {
|
|
66
66
|
value: 'updatedAt',
|
|
67
|
-
title: 'Updated',
|
|
67
|
+
title: 'Updated At',
|
|
68
68
|
sortable: true,
|
|
69
69
|
toggleable: true
|
|
70
70
|
}, {
|