@commercetools-frontend-extensions/export-resources-modal 1.5.3 → 3.0.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/README.md +85 -82
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +516 -719
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +485 -683
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +507 -715
- package/package.json +11 -11
|
@@ -11,10 +11,9 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
|
|
|
11
11
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
12
12
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
13
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
|
-
var
|
|
14
|
+
var React = require('react');
|
|
15
15
|
var reactIntl = require('react-intl');
|
|
16
16
|
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
17
|
-
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
18
17
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
19
18
|
var _flatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flat');
|
|
20
19
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
@@ -26,23 +25,28 @@ var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
|
26
25
|
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
27
26
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
28
27
|
var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
|
|
28
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
29
29
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
30
|
+
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
31
|
+
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
32
|
+
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
33
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
34
|
+
var _valuesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/values');
|
|
30
35
|
var omitEmpty = require('omit-empty-es');
|
|
31
36
|
var _findIndexInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find-index');
|
|
32
37
|
var _spliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/splice');
|
|
33
|
-
|
|
34
|
-
var designSystem = require('@commercetools-uikit/design-system');
|
|
35
|
-
var PropTypes = require('prop-types');
|
|
36
|
-
var react$1 = require('react');
|
|
37
|
-
var react = require('@emotion/react');
|
|
38
|
-
var _styled = require('@emotion/styled/base');
|
|
39
|
-
var _valuesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/values');
|
|
38
|
+
require('@commercetools-uikit/design-system');
|
|
40
39
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
41
|
-
var formik = require('formik');
|
|
42
40
|
var moment = require('moment');
|
|
43
|
-
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
44
41
|
var sdk = require('@commercetools-frontend/sdk');
|
|
42
|
+
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
45
43
|
var constants = require('@commercetools-frontend/constants');
|
|
44
|
+
var _styled = require('@emotion/styled/base');
|
|
45
|
+
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
46
|
+
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
47
|
+
var PropTypes = require('prop-types');
|
|
48
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
49
|
+
var formik = require('formik');
|
|
46
50
|
|
|
47
51
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
48
52
|
|
|
@@ -54,18 +58,23 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
|
|
|
54
58
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
55
59
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
56
60
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
61
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
57
62
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
58
63
|
var _flatInstanceProperty__default = /*#__PURE__*/_interopDefault(_flatInstanceProperty);
|
|
59
64
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
60
65
|
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
61
66
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
67
|
+
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
68
|
+
var _Object$assign__default = /*#__PURE__*/_interopDefault(_Object$assign);
|
|
69
|
+
var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefault(_valuesInstanceProperty);
|
|
62
70
|
var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
|
|
63
71
|
var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefault(_findIndexInstanceProperty);
|
|
64
72
|
var _spliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_spliceInstanceProperty);
|
|
65
|
-
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
66
|
-
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
67
|
-
var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefault(_valuesInstanceProperty);
|
|
68
73
|
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
74
|
+
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
75
|
+
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
76
|
+
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
77
|
+
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
69
78
|
|
|
70
79
|
const EXPORT_OPERATION_STATES = {
|
|
71
80
|
PROCESSING: 'processing',
|
|
@@ -73,10 +82,10 @@ const EXPORT_OPERATION_STATES = {
|
|
|
73
82
|
FAILED: 'failed'
|
|
74
83
|
};
|
|
75
84
|
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
85
|
+
const EXPORT_TYPES = {
|
|
86
|
+
ALL: 'all',
|
|
87
|
+
FILTERED: 'filtered',
|
|
88
|
+
SELECTED: 'selected'
|
|
80
89
|
};
|
|
81
90
|
|
|
82
91
|
const EXPORTABLE_RESOURCES = {
|
|
@@ -89,20 +98,31 @@ const OUTPUT_FORMATS = {
|
|
|
89
98
|
JSON: 'json',
|
|
90
99
|
CSV: 'csv'
|
|
91
100
|
};
|
|
101
|
+
const OUTPUT_FORMAT_OPTIONS = [{
|
|
102
|
+
value: OUTPUT_FORMATS.CSV,
|
|
103
|
+
label: 'CSV'
|
|
104
|
+
}, {
|
|
105
|
+
value: OUTPUT_FORMATS.JSON,
|
|
106
|
+
label: 'JSON'
|
|
107
|
+
}];
|
|
108
|
+
|
|
109
|
+
const COLUMN_DEFINITIONS_URLS = {
|
|
110
|
+
category: 'https://docs-proxy-sarm-product-import-csv.commercetools.vercel.app/merchant-center/import-categories#supported-headers-and-values'
|
|
111
|
+
};
|
|
92
112
|
|
|
93
113
|
function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
94
114
|
function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !_Reflect$construct__default["default"]) return false; if (_Reflect$construct__default["default"].sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
95
|
-
let
|
|
96
|
-
_inherits(
|
|
97
|
-
var _super = _createSuper$3(
|
|
98
|
-
function
|
|
115
|
+
let UnexpectedExportTypeError = /*#__PURE__*/function (_Error) {
|
|
116
|
+
_inherits(UnexpectedExportTypeError, _Error);
|
|
117
|
+
var _super = _createSuper$3(UnexpectedExportTypeError);
|
|
118
|
+
function UnexpectedExportTypeError(exportType) {
|
|
99
119
|
var _this;
|
|
100
|
-
_classCallCheck(this,
|
|
101
|
-
_this = _super.call(this, "Unexpected
|
|
102
|
-
_this.name = '
|
|
120
|
+
_classCallCheck(this, UnexpectedExportTypeError);
|
|
121
|
+
_this = _super.call(this, "Unexpected export type: ".concat(exportType));
|
|
122
|
+
_this.name = 'UnexpectedExportTypeError';
|
|
103
123
|
return _this;
|
|
104
124
|
}
|
|
105
|
-
return _createClass(
|
|
125
|
+
return _createClass(UnexpectedExportTypeError);
|
|
106
126
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
107
127
|
|
|
108
128
|
function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -113,7 +133,7 @@ let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
|
113
133
|
function MissingExportResourceProviderError() {
|
|
114
134
|
var _this;
|
|
115
135
|
_classCallCheck(this, MissingExportResourceProviderError);
|
|
116
|
-
_this = _super.call(this, 'useExportResourcesContext must be used within
|
|
136
|
+
_this = _super.call(this, 'useExportResourcesContext must be used within ExportResourcesProvider');
|
|
117
137
|
_this.name = 'MissingExportResourceProviderError';
|
|
118
138
|
return _this;
|
|
119
139
|
}
|
|
@@ -150,8 +170,9 @@ let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
|
150
170
|
return _createClass(UnexpectedResourceTypeError);
|
|
151
171
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
152
172
|
|
|
153
|
-
|
|
154
|
-
function
|
|
173
|
+
const _excluded$1 = ["name"];
|
|
174
|
+
function ownKeys$5(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
175
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys$5(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys$5(Object(t))).call(_context5, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
155
176
|
function resourceTypeToPlural(_ref) {
|
|
156
177
|
let resourceType = _ref.resourceType,
|
|
157
178
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
@@ -179,6 +200,12 @@ function resourceTypeToOperationName(resourceType) {
|
|
|
179
200
|
throw UnexpectedResourceTypeError(resourceType);
|
|
180
201
|
}
|
|
181
202
|
}
|
|
203
|
+
function mapLocalesToOptions(locales) {
|
|
204
|
+
return _mapInstanceProperty__default["default"](locales).call(locales, locale => ({
|
|
205
|
+
value: locale,
|
|
206
|
+
label: locale
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
182
209
|
function replaceSpecialCharsWithUnderscore(string) {
|
|
183
210
|
return string.replace(/[^a-zA-Z0-9]/g, '_');
|
|
184
211
|
}
|
|
@@ -197,8 +224,8 @@ function flattenNestedFields(fields) {
|
|
|
197
224
|
var _context2;
|
|
198
225
|
return _mapInstanceProperty__default["default"](_context2 = flattenNestedFields(field.fields)).call(_context2, nestedField => {
|
|
199
226
|
var _context3;
|
|
200
|
-
return _objectSpread$
|
|
201
|
-
|
|
227
|
+
return _objectSpread$5(_objectSpread$5({}, nestedField), {}, {
|
|
228
|
+
name: _concatInstanceProperty__default["default"](_context3 = "".concat(field.name, ".")).call(_context3, nestedField.name)
|
|
202
229
|
});
|
|
203
230
|
});
|
|
204
231
|
}
|
|
@@ -206,20 +233,60 @@ function flattenNestedFields(fields) {
|
|
|
206
233
|
})) || [];
|
|
207
234
|
return _flatInstanceProperty__default["default"](result).call(result);
|
|
208
235
|
}
|
|
236
|
+
function unflattenNestedFields(flattenedFields) {
|
|
237
|
+
const reconstructed = [];
|
|
238
|
+
_forEachInstanceProperty__default["default"](flattenedFields).call(flattenedFields, field => {
|
|
239
|
+
const fieldNames = field.name.split('.');
|
|
240
|
+
let currentLevel = reconstructed;
|
|
241
|
+
_forEachInstanceProperty__default["default"](fieldNames).call(fieldNames, (name, index) => {
|
|
242
|
+
let existingField = _findInstanceProperty__default["default"](currentLevel).call(currentLevel, f => f.name === name);
|
|
243
|
+
if (!existingField) {
|
|
244
|
+
existingField = {
|
|
245
|
+
name,
|
|
246
|
+
fields: []
|
|
247
|
+
};
|
|
248
|
+
currentLevel.push(existingField);
|
|
249
|
+
}
|
|
250
|
+
if (index === fieldNames.length - 1) {
|
|
251
|
+
field.name;
|
|
252
|
+
const otherProps = _objectWithoutProperties(field, _excluded$1);
|
|
253
|
+
_Object$assign__default["default"](existingField, otherProps);
|
|
254
|
+
} else {
|
|
255
|
+
currentLevel = existingField.fields;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
return reconstructed;
|
|
260
|
+
}
|
|
261
|
+
function getSelectedFields(fields) {
|
|
262
|
+
return _filterInstanceProperty__default["default"](fields).call(fields, field => field.isChecked);
|
|
263
|
+
}
|
|
264
|
+
function getFieldNames(fields) {
|
|
265
|
+
return _mapInstanceProperty__default["default"](fields).call(fields, field => field.name);
|
|
266
|
+
}
|
|
267
|
+
function checkRequiredFields(fields) {
|
|
268
|
+
return _mapInstanceProperty__default["default"](fields).call(fields, field => field.isRequired ? _objectSpread$5(_objectSpread$5({}, field), {}, {
|
|
269
|
+
isChecked: true
|
|
270
|
+
}) : field);
|
|
271
|
+
}
|
|
272
|
+
const getExportLogsLink = (projectKey, msg) => jsxRuntime.jsx(uiKit.Link, {
|
|
273
|
+
to: "/".concat(projectKey, "/operations/export/logs"),
|
|
274
|
+
children: msg
|
|
275
|
+
});
|
|
209
276
|
|
|
210
277
|
/*
|
|
211
278
|
* This function is responsible for constructing the GraphQL query based on the export settings
|
|
212
279
|
*
|
|
213
|
-
* Depending on the type of export selection (all
|
|
214
|
-
* - For 'all
|
|
215
|
-
* - For '
|
|
216
|
-
* - The '
|
|
280
|
+
* Depending on the type of export selection (all, selected, or filtered) it constructs different types of queries:
|
|
281
|
+
* - For 'all', it generates a query that fetches all fields and locales specified in the export settings.
|
|
282
|
+
* - For 'selected', it creates a query that fetches only the fields and locales of the selected resources. The ids of the selected resources are included in the query.
|
|
283
|
+
* - The 'filtered' case is a placeholder for future development where a query will be constructed based on certain filtering criteria using the `where` parameter.
|
|
217
284
|
*/
|
|
218
285
|
function buildGraphQuery(exportSettings) {
|
|
219
286
|
var _context;
|
|
220
287
|
const operation = resourceTypeToOperationName(exportSettings.resourceType);
|
|
221
|
-
switch (exportSettings.
|
|
222
|
-
case
|
|
288
|
+
switch (exportSettings.exportType) {
|
|
289
|
+
case EXPORT_TYPES.ALL:
|
|
223
290
|
return gqlQueryBuilder.query({
|
|
224
291
|
operation,
|
|
225
292
|
fields: [{
|
|
@@ -230,7 +297,7 @@ function buildGraphQuery(exportSettings) {
|
|
|
230
297
|
}],
|
|
231
298
|
variables: {}
|
|
232
299
|
});
|
|
233
|
-
case
|
|
300
|
+
case EXPORT_TYPES.SELECTED:
|
|
234
301
|
return gqlQueryBuilder.query({
|
|
235
302
|
operation,
|
|
236
303
|
fields: [{
|
|
@@ -243,11 +310,11 @@ function buildGraphQuery(exportSettings) {
|
|
|
243
310
|
where: "id in (".concat(_mapInstanceProperty__default["default"](_context = exportSettings.selectedResourceIds).call(_context, id => "\"".concat(id, "\"")).join(', '), ")")
|
|
244
311
|
}
|
|
245
312
|
});
|
|
246
|
-
case
|
|
313
|
+
case EXPORT_TYPES.FILTERED:
|
|
247
314
|
// TODO: gql query for exporting filtered resources.
|
|
248
|
-
throw new
|
|
315
|
+
throw new UnexpectedExportTypeError(exportSettings.exportType);
|
|
249
316
|
default:
|
|
250
|
-
throw new
|
|
317
|
+
throw new UnexpectedExportTypeError(exportSettings.exportType);
|
|
251
318
|
}
|
|
252
319
|
}
|
|
253
320
|
|
|
@@ -272,27 +339,31 @@ function buildFields(_ref) {
|
|
|
272
339
|
return _flatInstanceProperty__default["default"](_context2 = _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
273
340
|
if (field.isLocalized) return _mapInstanceProperty__default["default"](locales).call(locales, locale => {
|
|
274
341
|
var _context3, _context4, _context5;
|
|
275
|
-
const alias = replaceSpecialCharsWithUnderscore(_concatInstanceProperty__default["default"](_context3 = "".concat(field.
|
|
276
|
-
return _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = "".concat(alias, ": ")).call(_context5, field.
|
|
342
|
+
const alias = replaceSpecialCharsWithUnderscore(_concatInstanceProperty__default["default"](_context3 = "".concat(field.name, "______")).call(_context3, locale));
|
|
343
|
+
return _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = "".concat(alias, ": ")).call(_context5, field.name, "(locale: \"")).call(_context4, locale, "\")");
|
|
277
344
|
});else {
|
|
278
345
|
if (isFilledArray(field.fields)) {
|
|
279
346
|
return {
|
|
280
|
-
[field.
|
|
347
|
+
[field.name]: buildFields({
|
|
281
348
|
fields: field.fields,
|
|
282
349
|
locales
|
|
283
350
|
})
|
|
284
351
|
};
|
|
285
352
|
}
|
|
286
|
-
return field.
|
|
353
|
+
return field.name;
|
|
287
354
|
}
|
|
288
355
|
})).call(_context2);
|
|
289
356
|
}
|
|
290
357
|
|
|
291
|
-
function validate(
|
|
358
|
+
function validate(_ref) {
|
|
359
|
+
let values = _valuesInstanceProperty__default["default"](_ref),
|
|
360
|
+
step = _ref.step;
|
|
292
361
|
const errors = {
|
|
293
362
|
fileName: {},
|
|
294
|
-
locales: {}
|
|
363
|
+
locales: {},
|
|
364
|
+
fields: {}
|
|
295
365
|
};
|
|
366
|
+
// Always validate these fields (first and second steps)
|
|
296
367
|
if (uiKit.TextInput.isEmpty(values.fileName)) {
|
|
297
368
|
errors.fileName.missing = true;
|
|
298
369
|
} else if (!/^[a-zA-Z0-9-_.]+$/.test(values.fileName)) {
|
|
@@ -301,6 +372,16 @@ function validate(values) {
|
|
|
301
372
|
if (values.locales.length < 1) {
|
|
302
373
|
errors.locales.missing = true;
|
|
303
374
|
}
|
|
375
|
+
//
|
|
376
|
+
|
|
377
|
+
// Only validate these fields on the 2nd step
|
|
378
|
+
if (step === 2) {
|
|
379
|
+
var _context;
|
|
380
|
+
const checkedFields = _filterInstanceProperty__default["default"](_context = values.fields).call(_context, field => field.isChecked);
|
|
381
|
+
if (checkedFields.length < 2) {
|
|
382
|
+
errors.fields.missing = true;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
304
385
|
return omitEmpty__default["default"](errors);
|
|
305
386
|
}
|
|
306
387
|
|
|
@@ -354,11 +435,6 @@ var messages = reactIntl.defineMessages({
|
|
|
354
435
|
description: 'Export All selection',
|
|
355
436
|
defaultMessage: 'Export all {resourceType} ({count})'
|
|
356
437
|
},
|
|
357
|
-
exportOnlyMatchingResources: {
|
|
358
|
-
id: 'ExportResourcesModal.exportOnlyMatchingResources',
|
|
359
|
-
description: 'Export resources only matching search/filter',
|
|
360
|
-
defaultMessage: 'Export list matching search/filter ({count})'
|
|
361
|
-
},
|
|
362
438
|
exportOnlySelectedResources: {
|
|
363
439
|
id: 'ExportResourcesModal.exportOnlySelectedResources',
|
|
364
440
|
description: 'Export only selected resources',
|
|
@@ -384,16 +460,6 @@ var messages = reactIntl.defineMessages({
|
|
|
384
460
|
description: 'Exported columns and attributes based on table settings',
|
|
385
461
|
defaultMessage: 'Exported columns/attributes based on table settings: {columnsCount}'
|
|
386
462
|
},
|
|
387
|
-
appliedSearchTermsMessage: {
|
|
388
|
-
id: 'ExportResourcesModal.appliedSearchTermsMessage',
|
|
389
|
-
description: 'Applied Search Term(s)',
|
|
390
|
-
defaultMessage: 'Applied search term(s): {searchTermsCount}'
|
|
391
|
-
},
|
|
392
|
-
appliedFiltersMessage: {
|
|
393
|
-
id: 'ExportResourcesModal.appliedFiltersMessage',
|
|
394
|
-
description: 'Applied Filter(s)',
|
|
395
|
-
defaultMessage: 'Applied Filter(s): {filtersCount}'
|
|
396
|
-
},
|
|
397
463
|
exportBasedOnMyViewsMessage: {
|
|
398
464
|
id: 'ExportResourcesModal.exportBasedOnMyViewsMessage',
|
|
399
465
|
description: 'Select Export setttings based on my views',
|
|
@@ -439,15 +505,34 @@ var messages = reactIntl.defineMessages({
|
|
|
439
505
|
description: 'Label for "My Views" Select Field',
|
|
440
506
|
defaultMessage: 'My Views'
|
|
441
507
|
},
|
|
442
|
-
|
|
443
|
-
id: 'ExportResourcesModal.
|
|
444
|
-
|
|
445
|
-
|
|
508
|
+
selectColumnsToExport: {
|
|
509
|
+
id: 'ExportResourcesModal.selectColumnsToExport',
|
|
510
|
+
defaultMessage: 'Select columns to export'
|
|
511
|
+
},
|
|
512
|
+
back: {
|
|
513
|
+
id: 'ExportResourcesModal.back',
|
|
514
|
+
description: 'Label for "Back" button',
|
|
515
|
+
defaultMessage: 'Back'
|
|
446
516
|
},
|
|
447
517
|
startExport: {
|
|
448
518
|
id: 'ExportResourcesModal.startExport',
|
|
449
|
-
description: 'Label for "Start
|
|
450
|
-
defaultMessage: 'Start
|
|
519
|
+
description: 'Label for "Start export" button',
|
|
520
|
+
defaultMessage: 'Start export'
|
|
521
|
+
},
|
|
522
|
+
continue: {
|
|
523
|
+
id: 'ExportResourcesModal.continue',
|
|
524
|
+
description: 'Label for "Continue" button',
|
|
525
|
+
defaultMessage: 'Continue'
|
|
526
|
+
},
|
|
527
|
+
columnDefinitions: {
|
|
528
|
+
id: 'ExportResourcesModal.columnDefinitions',
|
|
529
|
+
description: 'Label for "Column Definitions" link',
|
|
530
|
+
defaultMessage: 'Column definitions'
|
|
531
|
+
},
|
|
532
|
+
allGeneralFields: {
|
|
533
|
+
id: 'ExportResourcesModal.allGeneralFields',
|
|
534
|
+
description: 'Label for "All general fields" checkbox',
|
|
535
|
+
defaultMessage: 'All general fields'
|
|
451
536
|
}
|
|
452
537
|
});
|
|
453
538
|
|
|
@@ -463,185 +548,14 @@ function getNewLine() {
|
|
|
463
548
|
return jsxRuntime.jsx("br", {});
|
|
464
549
|
}
|
|
465
550
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
let isNewTheme = _ref.isNewTheme;
|
|
469
|
-
return /*#__PURE__*/react.css("width:100%;display:flex;flex-wrap:wrap;display:inline-flex;padding:0 ", isNewTheme ? 0 : designSystem.customProperties.spacingL, ";&>div{margin:0 ", designSystem.customProperties.spacingS, " ", designSystem.customProperties.spacingS, " 0;}" + ("" ), "" );
|
|
470
|
-
};
|
|
471
|
-
const tagListItem = /*#__PURE__*/react.css("margin:0 ", designSystem.customProperties.spacingXs, " ", designSystem.customProperties.spacingXs, " 0;display:flex;min-width:0;" + ("" ), "" );
|
|
472
|
-
const divider = /*#__PURE__*/react.css("box-sizing:border-box;width:100%;margin:0;border:0;border-top:1px solid ", designSystem.customProperties.colorNeutral60, ";" + ("" ), "" );
|
|
473
|
-
const notBold = {
|
|
474
|
-
name: "lugakg",
|
|
475
|
-
styles: "font-weight:normal"
|
|
476
|
-
} ;
|
|
477
|
-
const successMessage = /*#__PURE__*/react.css("margin-bottom:", designSystem.customProperties.spacingL, ";" + ("" ), "" );
|
|
478
|
-
const styles = {
|
|
479
|
-
tagListItem,
|
|
480
|
-
tagListContainer,
|
|
481
|
-
smallTopPadding,
|
|
482
|
-
divider,
|
|
483
|
-
notBold,
|
|
484
|
-
successMessage
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
function TagList(props) {
|
|
488
|
-
const _useTheme = designSystem.useTheme(),
|
|
489
|
-
isNewTheme = _useTheme.isNewTheme;
|
|
490
|
-
return jsxRuntime.jsx("div", {
|
|
491
|
-
css: styles.tagListContainer({
|
|
492
|
-
isNewTheme
|
|
493
|
-
}),
|
|
494
|
-
"data-testid": props['data-testid'],
|
|
495
|
-
children: _mapInstanceProperty__default["default"](react$1.Children).call(react$1.Children, props.children, tag => jsxRuntime.jsx("div", {
|
|
496
|
-
css: styles.tagListItem,
|
|
497
|
-
children: tag
|
|
498
|
-
}))
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
TagList.displayName = 'TagList';
|
|
502
|
-
TagList.propTypes = {};
|
|
503
|
-
|
|
504
|
-
function ownKeys$8(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
505
|
-
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$8(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$8(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
506
|
-
function AppliedFilters(_ref) {
|
|
507
|
-
let filters = _ref.filters,
|
|
508
|
-
onFilterRemove = _ref.onFilterRemove;
|
|
509
|
-
const _useTheme = designSystem.useTheme(),
|
|
510
|
-
isNewTheme = _useTheme.isNewTheme;
|
|
511
|
-
if (isNewTheme) return jsxRuntime.jsx(uiKit.CollapsiblePanel, {
|
|
512
|
-
condensed: true,
|
|
513
|
-
isDefaultClosed: !Boolean(filters.length),
|
|
514
|
-
header: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
515
|
-
intlMessage: _objectSpread$8(_objectSpread$8({}, messages.appliedFiltersMessage), {}, {
|
|
516
|
-
values: {
|
|
517
|
-
filtersCount: filters.length
|
|
518
|
-
}
|
|
519
|
-
})
|
|
520
|
-
}),
|
|
521
|
-
children: jsxRuntime.jsx(TagList, {
|
|
522
|
-
children: _mapInstanceProperty__default["default"](filters).call(filters, filter => jsxRuntime.jsx("div", {
|
|
523
|
-
"data-testid": "test-filter-".concat(filter),
|
|
524
|
-
children: jsxRuntime.jsx(uiKit.Tag, {
|
|
525
|
-
onRemove: () => {
|
|
526
|
-
onFilterRemove(filter);
|
|
527
|
-
},
|
|
528
|
-
children: filter
|
|
529
|
-
})
|
|
530
|
-
}, filter))
|
|
531
|
-
})
|
|
532
|
-
});
|
|
533
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
534
|
-
scale: "s",
|
|
535
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
536
|
-
scale: "s",
|
|
537
|
-
alignItems: "flex-start",
|
|
538
|
-
children: [jsxRuntime.jsx(uiKit.AngleRightIcon, {
|
|
539
|
-
"data-testid": "test-arrowRight",
|
|
540
|
-
size: "medium",
|
|
541
|
-
color: "neutral60"
|
|
542
|
-
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
543
|
-
isBold: true,
|
|
544
|
-
intlMessage: _objectSpread$8(_objectSpread$8({}, messages.appliedFiltersMessage), {}, {
|
|
545
|
-
values: {
|
|
546
|
-
filtersCount: filters.length
|
|
547
|
-
}
|
|
548
|
-
})
|
|
549
|
-
})]
|
|
550
|
-
}), jsxRuntime.jsx(TagList, {
|
|
551
|
-
children: _mapInstanceProperty__default["default"](filters).call(filters, filter => jsxRuntime.jsx("div", {
|
|
552
|
-
"data-testid": "test-filter-".concat(filter),
|
|
553
|
-
children: jsxRuntime.jsx(uiKit.Tag, {
|
|
554
|
-
onRemove: () => {
|
|
555
|
-
onFilterRemove(filter);
|
|
556
|
-
},
|
|
557
|
-
children: filter
|
|
558
|
-
})
|
|
559
|
-
}, filter))
|
|
560
|
-
})]
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
AppliedFilters.propTypes = {};
|
|
564
|
-
|
|
565
|
-
function ownKeys$7(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
566
|
-
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$7(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$7(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
567
|
-
const IconPlaceholder = /*#__PURE__*/_styled__default["default"]("div", {
|
|
568
|
-
target: "e1oion860"
|
|
569
|
-
} )("width:", uiKit.customProperties.spacingM, ";" + ("" ));
|
|
570
|
-
function AppliedSearchTerms(_ref) {
|
|
571
|
-
let appliedSearchTerms = _ref.appliedSearchTerms;
|
|
572
|
-
const _useTheme = designSystem.useTheme(),
|
|
573
|
-
isNewTheme = _useTheme.isNewTheme;
|
|
574
|
-
if (isNewTheme) return jsxRuntime.jsx(uiKit.CollapsiblePanel, {
|
|
575
|
-
condensed: true,
|
|
576
|
-
isDefaultClosed: !Boolean(appliedSearchTerms.length),
|
|
577
|
-
header: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
578
|
-
intlMessage: _objectSpread$7(_objectSpread$7({}, messages.appliedSearchTermsMessage), {}, {
|
|
579
|
-
values: {
|
|
580
|
-
searchTermsCount: appliedSearchTerms.length
|
|
581
|
-
}
|
|
582
|
-
})
|
|
583
|
-
}),
|
|
584
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
585
|
-
children: appliedSearchTerms.join(', ')
|
|
586
|
-
})
|
|
587
|
-
});
|
|
588
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
589
|
-
scale: "s",
|
|
590
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
591
|
-
scale: "s",
|
|
592
|
-
alignItems: "flex-start",
|
|
593
|
-
children: [jsxRuntime.jsx(uiKit.AngleRightIcon, {
|
|
594
|
-
"data-testid": "test-arrowRight",
|
|
595
|
-
size: "medium",
|
|
596
|
-
color: "neutral60"
|
|
597
|
-
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
598
|
-
isBold: true,
|
|
599
|
-
intlMessage: _objectSpread$7(_objectSpread$7({}, messages.appliedSearchTermsMessage), {}, {
|
|
600
|
-
values: {
|
|
601
|
-
searchTermsCount: appliedSearchTerms.length
|
|
602
|
-
}
|
|
603
|
-
})
|
|
604
|
-
})]
|
|
605
|
-
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
606
|
-
scale: "s",
|
|
607
|
-
alignItems: "flex-start",
|
|
608
|
-
children: [jsxRuntime.jsx(IconPlaceholder, {}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
609
|
-
children: appliedSearchTerms.join(', ')
|
|
610
|
-
})]
|
|
611
|
-
})]
|
|
612
|
-
});
|
|
613
|
-
}
|
|
614
|
-
AppliedSearchTerms.propTypes = {};
|
|
615
|
-
|
|
616
|
-
// TODO: @redesign cleanup
|
|
617
|
-
function ExportBasedOnMyViewsSelectField() {
|
|
618
|
-
const _useTheme = designSystem.useTheme(),
|
|
619
|
-
themedValue = _useTheme.themedValue;
|
|
620
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
621
|
-
scale: "m",
|
|
622
|
-
alignItems: "center",
|
|
623
|
-
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
624
|
-
intlMessage: messages.exportBasedOnMyViewsMessage
|
|
625
|
-
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
626
|
-
intlMessage: messages.myViews
|
|
627
|
-
}), jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
628
|
-
max: themedValue(4, 7),
|
|
629
|
-
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
630
|
-
isDisabled: true,
|
|
631
|
-
placeholder: "Default"
|
|
632
|
-
})
|
|
633
|
-
})]
|
|
634
|
-
});
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
function ownKeys$6(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
638
|
-
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$6(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$6(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
551
|
+
function ownKeys$4(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
552
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
639
553
|
function renderFileNameError(key) {
|
|
640
554
|
switch (key) {
|
|
641
555
|
case 'missing':
|
|
642
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
556
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages.missingFileNameError));
|
|
643
557
|
case 'invalidInput':
|
|
644
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
558
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages.invalidFileNameError));
|
|
645
559
|
default:
|
|
646
560
|
return null;
|
|
647
561
|
}
|
|
@@ -649,353 +563,50 @@ function renderFileNameError(key) {
|
|
|
649
563
|
function renderLocaleError(key) {
|
|
650
564
|
switch (key) {
|
|
651
565
|
case 'missing':
|
|
652
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
566
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages.missingLocaleError));
|
|
653
567
|
default:
|
|
654
568
|
return null;
|
|
655
569
|
}
|
|
656
570
|
}
|
|
657
571
|
|
|
658
|
-
function ownKeys$5(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
659
|
-
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$5(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$5(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
660
|
-
function FieldsRenderer(_ref) {
|
|
661
|
-
let fields = _ref.fields;
|
|
662
|
-
const allFields = flattenNestedFields(fields);
|
|
663
|
-
return jsxRuntime.jsx(TagList, {
|
|
664
|
-
children: _mapInstanceProperty__default["default"](allFields).call(allFields, field => jsxRuntime.jsx("div", {
|
|
665
|
-
"data-testid": "test-field-".concat(field.key),
|
|
666
|
-
children: jsxRuntime.jsx(uiKit.Tag, {
|
|
667
|
-
children: field.label || field.key
|
|
668
|
-
})
|
|
669
|
-
}, field.key))
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
FieldsRenderer.propTypes = {};
|
|
673
|
-
function ExportFields(_ref2) {
|
|
674
|
-
let fields = _ref2.fields;
|
|
675
|
-
const _useTheme = designSystem.useTheme(),
|
|
676
|
-
isNewTheme = _useTheme.isNewTheme;
|
|
677
|
-
if (isNewTheme) return jsxRuntime.jsx(uiKit.CollapsiblePanel, {
|
|
678
|
-
condensed: true,
|
|
679
|
-
isDefaultClosed: !Boolean(fields.length),
|
|
680
|
-
header: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
681
|
-
intlMessage: _objectSpread$5(_objectSpread$5({}, messages.columnsMessage), {}, {
|
|
682
|
-
values: {
|
|
683
|
-
columnsCount: fields.length
|
|
684
|
-
}
|
|
685
|
-
})
|
|
686
|
-
}),
|
|
687
|
-
children: jsxRuntime.jsx(FieldsRenderer, {
|
|
688
|
-
fields: fields
|
|
689
|
-
})
|
|
690
|
-
});
|
|
691
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
692
|
-
scale: "s",
|
|
693
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
694
|
-
scale: "s",
|
|
695
|
-
alignItems: "flex-start",
|
|
696
|
-
children: [jsxRuntime.jsx(uiKit.AngleRightIcon, {
|
|
697
|
-
"data-testid": "test-arrowRight",
|
|
698
|
-
size: "medium",
|
|
699
|
-
color: "neutral60"
|
|
700
|
-
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
701
|
-
isBold: true,
|
|
702
|
-
intlMessage: _objectSpread$5(_objectSpread$5({}, messages.columnsMessage), {}, {
|
|
703
|
-
values: {
|
|
704
|
-
columnsCount: fields.length
|
|
705
|
-
}
|
|
706
|
-
})
|
|
707
|
-
})]
|
|
708
|
-
}), jsxRuntime.jsx(FieldsRenderer, {
|
|
709
|
-
fields: fields
|
|
710
|
-
})]
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
ExportFields.propTypes = {};
|
|
714
|
-
|
|
715
572
|
function useExportResourcesContext() {
|
|
716
|
-
const context =
|
|
573
|
+
const context = React.useContext(ExportResourcesContext);
|
|
717
574
|
if (!context) {
|
|
718
575
|
throw new MissingExportResourceProviderError();
|
|
719
576
|
}
|
|
720
577
|
return context;
|
|
721
578
|
}
|
|
722
579
|
|
|
723
|
-
|
|
724
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
725
|
-
function ExportSelectionRadioButtons() {
|
|
726
|
-
const _useTheme = designSystem.useTheme(),
|
|
727
|
-
isNewTheme = _useTheme.isNewTheme;
|
|
728
|
-
const intl = reactIntl.useIntl();
|
|
729
|
-
const _useExportResourcesCo = useExportResourcesContext(),
|
|
730
|
-
formik = _useExportResourcesCo.formik,
|
|
731
|
-
resourceType = _useExportResourcesCo.resourceType,
|
|
732
|
-
allResourcesCount = _useExportResourcesCo.allResourcesCount,
|
|
733
|
-
matchingResourcesCount = _useExportResourcesCo.matchingResourcesCount,
|
|
734
|
-
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
735
|
-
exportSelectionType = _useExportResourcesCo.exportSelectionType;
|
|
736
|
-
const resourceTypePlural = resourceTypeToPlural({
|
|
737
|
-
resourceType: resourceType
|
|
738
|
-
});
|
|
739
|
-
return jsxRuntime.jsx(uiKit.Spacings.Inline, {
|
|
740
|
-
scale: "xl",
|
|
741
|
-
children: jsxRuntime.jsxs(uiKit.RadioInput.Group, {
|
|
742
|
-
name: "exportSelectionType",
|
|
743
|
-
value: exportSelectionType,
|
|
744
|
-
direction: "inline",
|
|
745
|
-
directionProps: {
|
|
746
|
-
scale: 'xl'
|
|
747
|
-
},
|
|
748
|
-
onChange: formik.handleChange,
|
|
749
|
-
children: [jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
750
|
-
value: EXPORT_SELECTION_TYPES.ALL_RESOURCES,
|
|
751
|
-
"data-testid": 'test-all-resources',
|
|
752
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
753
|
-
isBold: !isNewTheme,
|
|
754
|
-
intlMessage: _objectSpread$4(_objectSpread$4({}, messages.exportAllResources), {}, {
|
|
755
|
-
values: {
|
|
756
|
-
resourceType: resourceTypePlural,
|
|
757
|
-
count: allResourcesCount
|
|
758
|
-
}
|
|
759
|
-
})
|
|
760
|
-
})
|
|
761
|
-
}), jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
762
|
-
value: EXPORT_SELECTION_TYPES.ONLY_MATCHING,
|
|
763
|
-
"data-testid": 'test-only-matching',
|
|
764
|
-
isDisabled: !Boolean(matchingResourcesCount),
|
|
765
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
766
|
-
isBold: !isNewTheme,
|
|
767
|
-
intlMessage: _objectSpread$4(_objectSpread$4({}, messages.exportOnlyMatchingResources), {}, {
|
|
768
|
-
values: {
|
|
769
|
-
count: matchingResourcesCount || intl.formatMessage(messages.nothingApplied)
|
|
770
|
-
}
|
|
771
|
-
})
|
|
772
|
-
})
|
|
773
|
-
}), jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
774
|
-
value: EXPORT_SELECTION_TYPES.ONLY_SELECTED,
|
|
775
|
-
"data-testid": 'test-only-selected',
|
|
776
|
-
isDisabled: !Boolean(selectedResourceIds.length),
|
|
777
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
778
|
-
isBold: !isNewTheme,
|
|
779
|
-
intlMessage: _objectSpread$4(_objectSpread$4({}, messages.exportOnlySelectedResources), {}, {
|
|
780
|
-
values: {
|
|
781
|
-
resourceType: resourceTypePlural,
|
|
782
|
-
count: selectedResourceIds.length
|
|
783
|
-
}
|
|
784
|
-
})
|
|
785
|
-
})
|
|
786
|
-
})]
|
|
787
|
-
})
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
|
|
580
|
+
const _excluded = ["isSelectedByDefault"];
|
|
791
581
|
function ownKeys$3(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
792
|
-
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
exportSelectionType = _useExportResourcesCo.exportSelectionType;
|
|
800
|
-
const resourceTypePlural = resourceTypeToPlural({
|
|
801
|
-
resourceType: resourceType
|
|
802
|
-
});
|
|
803
|
-
switch (exportSelectionType) {
|
|
804
|
-
case EXPORT_SELECTION_TYPES.ALL_RESOURCES:
|
|
805
|
-
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
806
|
-
intlMessage: _objectSpread$3(_objectSpread$3({}, messages.exportAllMessage), {}, {
|
|
807
|
-
values: {
|
|
808
|
-
count: allResourcesCount,
|
|
809
|
-
resourceType: resourceTypePlural,
|
|
810
|
-
b: getBold
|
|
811
|
-
}
|
|
812
|
-
})
|
|
813
|
-
});
|
|
814
|
-
case EXPORT_SELECTION_TYPES.ONLY_MATCHING:
|
|
815
|
-
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
816
|
-
intlMessage: _objectSpread$3(_objectSpread$3({}, messages.exportMatchingMessage), {}, {
|
|
817
|
-
values: {
|
|
818
|
-
count: matchingResourcesCount,
|
|
819
|
-
resourceType: resourceTypePlural,
|
|
820
|
-
b: getBold
|
|
821
|
-
}
|
|
822
|
-
})
|
|
823
|
-
});
|
|
824
|
-
case EXPORT_SELECTION_TYPES.ONLY_SELECTED:
|
|
825
|
-
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
826
|
-
intlMessage: _objectSpread$3(_objectSpread$3({}, messages.exportSelectedMessage), {}, {
|
|
827
|
-
values: {
|
|
828
|
-
count: selectedResourceIds.length,
|
|
829
|
-
resourceType: resourceTypePlural,
|
|
830
|
-
b: getBold
|
|
831
|
-
}
|
|
832
|
-
})
|
|
833
|
-
});
|
|
834
|
-
default:
|
|
835
|
-
throw new UnexpectedSelectionTypeError(exportSelectionType);
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
const ExportSelection = () => {
|
|
840
|
-
const _useTheme = designSystem.useTheme(),
|
|
841
|
-
isNewTheme = _useTheme.isNewTheme;
|
|
842
|
-
const _useExportResourcesCo = useExportResourcesContext(),
|
|
843
|
-
formik = _useExportResourcesCo.formik,
|
|
844
|
-
exportSelectionType = _useExportResourcesCo.exportSelectionType;
|
|
845
|
-
const onAppliedFilterRemove = filter => {
|
|
846
|
-
var _context;
|
|
847
|
-
formik.setFieldValue('appliedFilters', _filterInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](formik).appliedFilters).call(_context, appliedFilter => appliedFilter !== filter));
|
|
848
|
-
};
|
|
849
|
-
if (isNewTheme) return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
850
|
-
scale: "xl",
|
|
851
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
852
|
-
scale: "l",
|
|
853
|
-
children: [jsxRuntime.jsx(uiKit.Text.Headline, {
|
|
854
|
-
as: "h2",
|
|
855
|
-
intlMessage: messages.exportSelection
|
|
856
|
-
}), jsxRuntime.jsx(ExportSelectionRadioButtons, {}), jsxRuntime.jsx(ExportTextMessage, {})]
|
|
857
|
-
}), exportSelectionType === EXPORT_SELECTION_TYPES.ONLY_MATCHING && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
858
|
-
children: [jsxRuntime.jsx(ExportBasedOnMyViewsSelectField, {}), jsxRuntime.jsx(AppliedSearchTerms, {
|
|
859
|
-
appliedSearchTerms: _valuesInstanceProperty__default["default"](formik).appliedSearchTerms
|
|
860
|
-
}), jsxRuntime.jsx(AppliedFilters, {
|
|
861
|
-
filters: _valuesInstanceProperty__default["default"](formik).appliedFilters,
|
|
862
|
-
onFilterRemove: onAppliedFilterRemove
|
|
863
|
-
})]
|
|
864
|
-
}), _valuesInstanceProperty__default["default"](formik).fields.length > 0 && jsxRuntime.jsx(ExportFields, {
|
|
865
|
-
fields: _valuesInstanceProperty__default["default"](formik).fields
|
|
866
|
-
})]
|
|
867
|
-
});
|
|
868
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
869
|
-
scale: "s",
|
|
870
|
-
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
871
|
-
isBold: true,
|
|
872
|
-
intlMessage: messages.exportSelection
|
|
873
|
-
}), jsxRuntime.jsxs(uiKit.Card, {
|
|
874
|
-
theme: "dark",
|
|
875
|
-
type: "raised",
|
|
876
|
-
insetScale: "none",
|
|
877
|
-
children: [jsxRuntime.jsx(uiKit.Spacings.Inset, {
|
|
878
|
-
scale: "m",
|
|
879
|
-
children: jsxRuntime.jsx(ExportSelectionRadioButtons, {})
|
|
880
|
-
}), jsxRuntime.jsx("div", {
|
|
881
|
-
css: styles.divider
|
|
882
|
-
}), jsxRuntime.jsx(uiKit.Spacings.Inset, {
|
|
883
|
-
scale: "m",
|
|
884
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
885
|
-
scale: "l",
|
|
886
|
-
children: [jsxRuntime.jsx(ExportTextMessage, {}), exportSelectionType === EXPORT_SELECTION_TYPES.ONLY_MATCHING && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
887
|
-
children: [jsxRuntime.jsx(ExportBasedOnMyViewsSelectField, {}), jsxRuntime.jsx(AppliedSearchTerms, {
|
|
888
|
-
appliedSearchTerms: _valuesInstanceProperty__default["default"](formik).appliedSearchTerms
|
|
889
|
-
}), jsxRuntime.jsx(AppliedFilters, {
|
|
890
|
-
filters: _valuesInstanceProperty__default["default"](formik).appliedFilters,
|
|
891
|
-
onFilterRemove: onAppliedFilterRemove
|
|
892
|
-
})]
|
|
893
|
-
}), _valuesInstanceProperty__default["default"](formik).fields.length > 0 && jsxRuntime.jsx(ExportFields, {
|
|
894
|
-
fields: _valuesInstanceProperty__default["default"](formik).fields
|
|
895
|
-
})]
|
|
896
|
-
})
|
|
897
|
-
})]
|
|
898
|
-
})]
|
|
899
|
-
});
|
|
900
|
-
};
|
|
901
|
-
|
|
902
|
-
function ownKeys$2(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
903
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
904
|
-
const ExportProperties = props => {
|
|
905
|
-
const _useTheme = designSystem.useTheme(),
|
|
906
|
-
isNewTheme = _useTheme.isNewTheme;
|
|
907
|
-
if (typeof props.renderProperties !== 'function') return null;
|
|
908
|
-
if (isNewTheme) return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
909
|
-
scale: "m",
|
|
910
|
-
children: [jsxRuntime.jsx(uiKit.Text.Headline, {
|
|
911
|
-
as: "h2",
|
|
912
|
-
intlMessage: messages.propertiesPanelLabel
|
|
913
|
-
}), jsxRuntime.jsx("div", {
|
|
914
|
-
children: props.renderProperties()
|
|
915
|
-
})]
|
|
916
|
-
});
|
|
917
|
-
return jsxRuntime.jsx(uiKit.CollapsiblePanel, {
|
|
918
|
-
header: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
919
|
-
isBold: true,
|
|
920
|
-
intlMessage: _objectSpread$2({}, messages.propertiesPanelLabel)
|
|
921
|
-
}),
|
|
922
|
-
children: props.renderProperties()
|
|
923
|
-
});
|
|
924
|
-
};
|
|
925
|
-
ExportProperties.propTypes = {};
|
|
926
|
-
|
|
927
|
-
function ownKeys$1(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
928
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
929
|
-
const outputFormatOptions = [{
|
|
930
|
-
value: OUTPUT_FORMATS.CSV,
|
|
931
|
-
label: 'CSV'
|
|
932
|
-
}, {
|
|
933
|
-
value: OUTPUT_FORMATS.JSON,
|
|
934
|
-
label: 'JSON'
|
|
935
|
-
}];
|
|
936
|
-
function mapLocalesToOptions(locales) {
|
|
937
|
-
return _mapInstanceProperty__default["default"](locales).call(locales, locale => ({
|
|
938
|
-
value: locale,
|
|
939
|
-
label: locale
|
|
940
|
-
}));
|
|
941
|
-
}
|
|
942
|
-
function ExportFileSettings(props) {
|
|
943
|
-
const intl = reactIntl.useIntl();
|
|
944
|
-
const _useExportResourcesCo = useExportResourcesContext(),
|
|
945
|
-
formik = _useExportResourcesCo.formik;
|
|
946
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => {
|
|
947
|
-
var _applicationContext$p;
|
|
948
|
-
return {
|
|
949
|
-
locale: applicationContext.dataLocale,
|
|
950
|
-
locales: ((_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.languages) || []
|
|
951
|
-
};
|
|
952
|
-
}),
|
|
953
|
-
locales = _useApplicationContex.locales,
|
|
582
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$3(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$3(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
583
|
+
const useInitialValues = props => {
|
|
584
|
+
var _context;
|
|
585
|
+
const todayFormatted = moment__default["default"]().format('DD-MM-YY_HH-mm');
|
|
586
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
587
|
+
locale: applicationContext.dataLocale
|
|
588
|
+
})),
|
|
954
589
|
locale = _useApplicationContex.locale;
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
})
|
|
961
|
-
title: intl.formatMessage(messages.fileName)
|
|
962
|
-
}, formik.getFieldProps('fileName')), {}, {
|
|
963
|
-
touched: formik.touched.fileName,
|
|
964
|
-
errors: formik.errors.fileName,
|
|
965
|
-
renderError: renderFileNameError
|
|
966
|
-
})), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
967
|
-
scale: "xs",
|
|
968
|
-
children: [jsxRuntime.jsx(uiKit.SelectField, _objectSpread$1(_objectSpread$1({
|
|
969
|
-
id: "locales",
|
|
970
|
-
title: intl.formatMessage(messages.locale),
|
|
971
|
-
options: mapLocalesToOptions(locales),
|
|
972
|
-
isMulti: true
|
|
973
|
-
}, formik.getFieldProps('locales')), {}, {
|
|
974
|
-
onChange: e => {
|
|
975
|
-
formik.handleChange(e);
|
|
976
|
-
formik.setFieldValue('isAllLocalesChecked', false);
|
|
977
|
-
},
|
|
978
|
-
touched: formik.touched.locales,
|
|
979
|
-
errors: formik.errors.locales,
|
|
980
|
-
renderError: renderLocaleError
|
|
981
|
-
})), jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
982
|
-
name: "isAllLocalesChecked",
|
|
983
|
-
isChecked: _valuesInstanceProperty__default["default"](formik).isAllLocalesChecked,
|
|
984
|
-
onChange: e => {
|
|
985
|
-
if (e.target.checked) formik.setFieldValue('locales', locales);else formik.setFieldValue('locales', [locale]);
|
|
986
|
-
formik.handleChange(e);
|
|
987
|
-
},
|
|
988
|
-
children: intl.formatMessage(messages.selectAllLocales)
|
|
989
|
-
})]
|
|
990
|
-
}), props.showExportSelection && jsxRuntime.jsx(ExportSelection, {}), jsxRuntime.jsx(ExportProperties, {
|
|
991
|
-
renderProperties: props.renderProperties
|
|
992
|
-
})]
|
|
590
|
+
const fields = _mapInstanceProperty__default["default"](_context = flattenNestedFields(props.fields)).call(_context, _ref => {
|
|
591
|
+
let isSelectedByDefault = _ref.isSelectedByDefault,
|
|
592
|
+
field = _objectWithoutProperties(_ref, _excluded);
|
|
593
|
+
return _objectSpread$3(_objectSpread$3({}, field), {}, {
|
|
594
|
+
isChecked: isSelectedByDefault !== null && isSelectedByDefault !== void 0 ? isSelectedByDefault : true
|
|
595
|
+
});
|
|
993
596
|
});
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
597
|
+
return React__default["default"].useMemo(() => {
|
|
598
|
+
var _context2;
|
|
599
|
+
return {
|
|
600
|
+
outputFormat: props.outputFormat,
|
|
601
|
+
fileName: _concatInstanceProperty__default["default"](_context2 = "".concat(resourceTypeToPlural({
|
|
602
|
+
resourceType: props.resourceType,
|
|
603
|
+
isUpperCase: true
|
|
604
|
+
}), "_Export_")).call(_context2, todayFormatted),
|
|
605
|
+
locales: [locale],
|
|
606
|
+
fields: checkRequiredFields(fields)
|
|
607
|
+
};
|
|
608
|
+
}, [props, locale, todayFormatted, fields]);
|
|
609
|
+
};
|
|
999
610
|
|
|
1000
611
|
async function createExportOperation(_ref) {
|
|
1001
612
|
let fileName = _ref.fileName,
|
|
@@ -1024,35 +635,8 @@ async function createExportOperation(_ref) {
|
|
|
1024
635
|
return response;
|
|
1025
636
|
}
|
|
1026
637
|
|
|
1027
|
-
|
|
1028
|
-
resourceType: PropTypes__default["default"].string.isRequired,
|
|
1029
|
-
outputFormat: PropTypes__default["default"].string,
|
|
1030
|
-
closeModal: PropTypes__default["default"].func.isRequired,
|
|
1031
|
-
allResourcesCount: PropTypes__default["default"].number.isRequired,
|
|
1032
|
-
matchingResourcesCount: PropTypes__default["default"].number,
|
|
1033
|
-
selectedResourceIds: PropTypes__default["default"].array,
|
|
1034
|
-
showExportSelection: PropTypes__default["default"].bool,
|
|
1035
|
-
// TODO: Circular reference
|
|
1036
|
-
fields: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
1037
|
-
key: PropTypes__default["default"].string.isRequired,
|
|
1038
|
-
label: PropTypes__default["default"].string,
|
|
1039
|
-
isLocalized: PropTypes__default["default"].bool,
|
|
1040
|
-
fields: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
1041
|
-
key: PropTypes__default["default"].string.isRequired,
|
|
1042
|
-
label: PropTypes__default["default"].string,
|
|
1043
|
-
isLocalized: PropTypes__default["default"].bool
|
|
1044
|
-
}))
|
|
1045
|
-
})).isRequired,
|
|
1046
|
-
exportSelectionType: PropTypes__default["default"].string,
|
|
1047
|
-
appliedSearchTerms: PropTypes__default["default"].array,
|
|
1048
|
-
appliedFilters: PropTypes__default["default"].array,
|
|
1049
|
-
renderProperties: PropTypes__default["default"].func
|
|
1050
|
-
}).isRequired;
|
|
1051
|
-
|
|
1052
|
-
const ExportResourcesContextProvider = props => {
|
|
1053
|
-
var _context2;
|
|
638
|
+
const useStartExportOperation = props => {
|
|
1054
639
|
const intl = reactIntl.useIntl();
|
|
1055
|
-
const todayFormatted = moment__default["default"]().format('DD-MM-YY_HH-mm');
|
|
1056
640
|
const asyncDispatch = sdk.useAsyncDispatch();
|
|
1057
641
|
const showNotification = actionsGlobal.useShowNotification();
|
|
1058
642
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => {
|
|
@@ -1062,23 +646,21 @@ const ExportResourcesContextProvider = props => {
|
|
|
1062
646
|
projectKey: (_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.key
|
|
1063
647
|
};
|
|
1064
648
|
}),
|
|
1065
|
-
projectKey = _useApplicationContex.projectKey
|
|
1066
|
-
|
|
1067
|
-
const onSubmit = async values => {
|
|
649
|
+
projectKey = _useApplicationContex.projectKey;
|
|
650
|
+
const startExportOperation = async values => {
|
|
1068
651
|
const graphQuery = buildGraphQuery({
|
|
1069
652
|
resourceType: props.resourceType,
|
|
1070
|
-
|
|
653
|
+
exportType: props.exportType,
|
|
1071
654
|
selectedResourceIds: props.selectedResourceIds,
|
|
1072
|
-
fields: values.fields,
|
|
655
|
+
fields: unflattenNestedFields(getSelectedFields(values.fields)),
|
|
1073
656
|
locales: values.locales
|
|
1074
657
|
});
|
|
1075
658
|
try {
|
|
1076
|
-
var _context;
|
|
1077
659
|
const response = await createExportOperation({
|
|
1078
660
|
fileName: appendCsvOrJsonExtensionIfAbsent(values.fileName, values.outputFormat),
|
|
1079
661
|
fileFormat: values.outputFormat,
|
|
1080
662
|
locales: values.locales,
|
|
1081
|
-
columns: extendColumns(
|
|
663
|
+
columns: extendColumns(getFieldNames(getSelectedFields(values.fields)), props.resourceType),
|
|
1082
664
|
projectKey,
|
|
1083
665
|
graphQuery,
|
|
1084
666
|
asyncDispatchFn: asyncDispatch
|
|
@@ -1107,93 +689,317 @@ const ExportResourcesContextProvider = props => {
|
|
|
1107
689
|
errors
|
|
1108
690
|
});
|
|
1109
691
|
} finally {
|
|
1110
|
-
props.
|
|
692
|
+
if (typeof props.onClose === 'function') props.onClose();
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
return {
|
|
696
|
+
startExportOperation
|
|
697
|
+
};
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
function ownKeys$2(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
701
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
702
|
+
function ExportTextMessage() {
|
|
703
|
+
const _useExportResourcesCo = useExportResourcesContext(),
|
|
704
|
+
resourceType = _useExportResourcesCo.resourceType,
|
|
705
|
+
totalResourcesCount = _useExportResourcesCo.totalResourcesCount,
|
|
706
|
+
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
707
|
+
exportType = _useExportResourcesCo.exportType;
|
|
708
|
+
const resourceTypePlural = resourceTypeToPlural({
|
|
709
|
+
resourceType: resourceType
|
|
710
|
+
});
|
|
711
|
+
let message;
|
|
712
|
+
let count;
|
|
713
|
+
switch (exportType) {
|
|
714
|
+
case EXPORT_TYPES.ALL:
|
|
715
|
+
message = messages.exportAllMessage;
|
|
716
|
+
count = totalResourcesCount;
|
|
717
|
+
break;
|
|
718
|
+
case EXPORT_TYPES.SELECTED:
|
|
719
|
+
message = messages.exportSelectedMessage;
|
|
720
|
+
count = selectedResourceIds.length;
|
|
721
|
+
break;
|
|
722
|
+
default:
|
|
723
|
+
throw new UnexpectedExportTypeError(exportType);
|
|
724
|
+
}
|
|
725
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
726
|
+
"data-testid": "export-description",
|
|
727
|
+
intlMessage: _objectSpread$2(_objectSpread$2({}, message), {}, {
|
|
728
|
+
values: {
|
|
729
|
+
count: count,
|
|
730
|
+
resourceType: resourceTypePlural,
|
|
731
|
+
b: getBold
|
|
732
|
+
}
|
|
733
|
+
})
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
const ExportFileSettingsStep = () => {
|
|
738
|
+
const intl = reactIntl.useIntl();
|
|
739
|
+
const _useExportResourcesCo = useExportResourcesContext(),
|
|
740
|
+
formik = _useExportResourcesCo.formik;
|
|
741
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => {
|
|
742
|
+
var _applicationContext$p;
|
|
743
|
+
return {
|
|
744
|
+
locale: applicationContext.dataLocale,
|
|
745
|
+
locales: ((_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.languages) || []
|
|
746
|
+
};
|
|
747
|
+
}),
|
|
748
|
+
locales = _useApplicationContex.locales,
|
|
749
|
+
locale = _useApplicationContex.locale;
|
|
750
|
+
const areAllLocalesChecked = _valuesInstanceProperty__default["default"](formik).locales.length === locales.length;
|
|
751
|
+
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
752
|
+
scale: "xxxl",
|
|
753
|
+
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
754
|
+
scale: "l",
|
|
755
|
+
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
756
|
+
alignItems: "center",
|
|
757
|
+
children: [jsxRuntime.jsx(uiKit.ExportIcon, {
|
|
758
|
+
size: "medium",
|
|
759
|
+
color: "neutral60"
|
|
760
|
+
}), jsxRuntime.jsx(ExportTextMessage, {})]
|
|
761
|
+
}), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
762
|
+
scale: "m",
|
|
763
|
+
children: [jsxRuntime.jsx(uiKit.SelectField, {
|
|
764
|
+
name: "outputFormat",
|
|
765
|
+
onChange: formik.handleChange,
|
|
766
|
+
onBlur: formik.handleBlur,
|
|
767
|
+
value: _valuesInstanceProperty__default["default"](formik).outputFormat,
|
|
768
|
+
title: intl.formatMessage(messages.outputFormat),
|
|
769
|
+
options: OUTPUT_FORMAT_OPTIONS
|
|
770
|
+
}), jsxRuntime.jsx(uiKit.TextField, {
|
|
771
|
+
name: "fileName",
|
|
772
|
+
onChange: formik.handleChange,
|
|
773
|
+
onBlur: formik.handleBlur,
|
|
774
|
+
value: _valuesInstanceProperty__default["default"](formik).fileName,
|
|
775
|
+
title: intl.formatMessage(messages.fileName),
|
|
776
|
+
touched: formik.touched.fileName,
|
|
777
|
+
errors: formik.errors.fileName,
|
|
778
|
+
renderError: renderFileNameError
|
|
779
|
+
}), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
780
|
+
scale: "xs",
|
|
781
|
+
children: [jsxRuntime.jsx(uiKit.SelectField, {
|
|
782
|
+
id: "locales",
|
|
783
|
+
name: "locales",
|
|
784
|
+
value: _valuesInstanceProperty__default["default"](formik).locales,
|
|
785
|
+
title: intl.formatMessage(messages.locale),
|
|
786
|
+
options: mapLocalesToOptions(locales),
|
|
787
|
+
isMulti: true,
|
|
788
|
+
onChange: formik.handleChange,
|
|
789
|
+
onBlur: formik.handleBlur,
|
|
790
|
+
touched: formik.touched.locales,
|
|
791
|
+
errors: formik.errors.locales,
|
|
792
|
+
renderError: renderLocaleError
|
|
793
|
+
}), jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
794
|
+
isChecked: areAllLocalesChecked,
|
|
795
|
+
onChange: e => {
|
|
796
|
+
if (e.target.checked) formik.setFieldValue('locales', locales);else formik.setFieldValue('locales', [locale]);
|
|
797
|
+
},
|
|
798
|
+
children: intl.formatMessage(messages.selectAllLocales)
|
|
799
|
+
})]
|
|
800
|
+
})]
|
|
801
|
+
})]
|
|
802
|
+
}), jsxRuntime.jsx(uiKit.Spacings.Inline, {
|
|
803
|
+
justifyContent: "flex-end",
|
|
804
|
+
children: jsxRuntime.jsx(uiKit.PrimaryButton, {
|
|
805
|
+
label: intl.formatMessage(messages.continue),
|
|
806
|
+
onClick: formik.submitForm,
|
|
807
|
+
isDisabled: !formik.isValid
|
|
808
|
+
})
|
|
809
|
+
})]
|
|
810
|
+
});
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
function ownKeys$1(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
814
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys$1(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$1(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
815
|
+
const StyledCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
816
|
+
target: "e1ocu3bb2"
|
|
817
|
+
} )({
|
|
818
|
+
name: "1jtoq3b",
|
|
819
|
+
styles: "border-radius:4px 0px 0px 4px;&>div{height:490px;overflow-y:auto;}"
|
|
820
|
+
} );
|
|
821
|
+
const StyledCardLeft = /*#__PURE__*/_styled__default["default"](StyledCard, {
|
|
822
|
+
target: "e1ocu3bb1"
|
|
823
|
+
} )({
|
|
824
|
+
name: "65buvr",
|
|
825
|
+
styles: "background-color:#f9f9fb"
|
|
826
|
+
} );
|
|
827
|
+
const StyledCardRight = /*#__PURE__*/_styled__default["default"](StyledCard, {
|
|
828
|
+
target: "e1ocu3bb0"
|
|
829
|
+
} )({
|
|
830
|
+
name: "1oktwfs",
|
|
831
|
+
styles: "border-radius:0px 4px 4px 0px;border-left:0"
|
|
832
|
+
} );
|
|
833
|
+
const ExportFieldsSelectionStep = () => {
|
|
834
|
+
var _context, _context2, _context4;
|
|
835
|
+
const intl = reactIntl.useIntl();
|
|
836
|
+
const _useExportResourcesCo = useExportResourcesContext(),
|
|
837
|
+
formik = _useExportResourcesCo.formik,
|
|
838
|
+
setCurrentStep = _useExportResourcesCo.setCurrentStep,
|
|
839
|
+
resourceType = _useExportResourcesCo.resourceType;
|
|
840
|
+
const areAllFieldsChecked = _everyInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](formik).fields).call(_context, field => field.isChecked);
|
|
841
|
+
const isAtLeastOneFieldChecked = _someInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](formik).fields).call(_context2, field => field.isChecked);
|
|
842
|
+
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
843
|
+
scale: "xl",
|
|
844
|
+
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
845
|
+
scale: "m",
|
|
846
|
+
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
847
|
+
justifyContent: "space-between",
|
|
848
|
+
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
849
|
+
intlMessage: messages.selectColumnsToExport
|
|
850
|
+
}), jsxRuntime.jsx(uiKit.Link, {
|
|
851
|
+
isExternal: true,
|
|
852
|
+
tone: "secondary",
|
|
853
|
+
intlMessage: messages.columnDefinitions,
|
|
854
|
+
to: COLUMN_DEFINITIONS_URLS[resourceType]
|
|
855
|
+
})]
|
|
856
|
+
}), jsxRuntime.jsxs(uiKit.Grid, {
|
|
857
|
+
gridAutoFlow: "column",
|
|
858
|
+
gridTemplateColumns: "".concat(uiKit.customProperties.constraint5, " auto"),
|
|
859
|
+
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
860
|
+
children: jsxRuntime.jsx(StyledCardLeft, {
|
|
861
|
+
insetScale: "l",
|
|
862
|
+
children: jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
863
|
+
isIndeterminate: !areAllFieldsChecked && isAtLeastOneFieldChecked,
|
|
864
|
+
isChecked: areAllFieldsChecked,
|
|
865
|
+
onChange: e => {
|
|
866
|
+
var _context3;
|
|
867
|
+
formik.setFieldValue('fields', _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](formik).fields).call(_context3, field => _objectSpread$1(_objectSpread$1({}, field), {}, {
|
|
868
|
+
isChecked: field.isRequired ? true : e.target.checked
|
|
869
|
+
})));
|
|
870
|
+
},
|
|
871
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
872
|
+
intlMessage: messages.allGeneralFields
|
|
873
|
+
})
|
|
874
|
+
})
|
|
875
|
+
})
|
|
876
|
+
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
877
|
+
children: jsxRuntime.jsx(StyledCardRight, {
|
|
878
|
+
insetScale: "l",
|
|
879
|
+
children: _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](formik).fields).call(_context4, field => jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
880
|
+
isReadOnly: field.isRequired,
|
|
881
|
+
isChecked: field.isChecked,
|
|
882
|
+
onChange: e => {
|
|
883
|
+
var _context5;
|
|
884
|
+
formik.setFieldValue('fields', _mapInstanceProperty__default["default"](_context5 = _valuesInstanceProperty__default["default"](formik).fields).call(_context5, _field => field.name === _field.name ? _objectSpread$1(_objectSpread$1({}, _field), {}, {
|
|
885
|
+
isChecked: e.target.checked
|
|
886
|
+
}) : _field));
|
|
887
|
+
},
|
|
888
|
+
children: jsxRuntime.jsxs(uiKit.Text.Body, {
|
|
889
|
+
children: [field.label, " ", field.isRequired && '*']
|
|
890
|
+
})
|
|
891
|
+
}, field.name))
|
|
892
|
+
})
|
|
893
|
+
})]
|
|
894
|
+
})]
|
|
895
|
+
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
896
|
+
scale: "m",
|
|
897
|
+
justifyContent: "flex-end",
|
|
898
|
+
children: [jsxRuntime.jsx(uiKit.SecondaryButton, {
|
|
899
|
+
label: intl.formatMessage(messages.back),
|
|
900
|
+
onClick: () => setCurrentStep(1)
|
|
901
|
+
}), jsxRuntime.jsx(uiKit.PrimaryButton, {
|
|
902
|
+
label: intl.formatMessage(messages.startExport),
|
|
903
|
+
onClick: formik.submitForm,
|
|
904
|
+
isDisabled: !formik.isValid
|
|
905
|
+
})]
|
|
906
|
+
})]
|
|
907
|
+
});
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
const ExportResourcesContext = /*#__PURE__*/React.createContext();
|
|
911
|
+
|
|
912
|
+
PropTypes__default["default"].shape({
|
|
913
|
+
resourceType: PropTypes__default["default"].string.isRequired,
|
|
914
|
+
outputFormat: PropTypes__default["default"].string,
|
|
915
|
+
onClose: PropTypes__default["default"].func,
|
|
916
|
+
totalResourcesCount: PropTypes__default["default"].number.isRequired,
|
|
917
|
+
selectedResourceIds: PropTypes__default["default"].array,
|
|
918
|
+
// TODO: Circular reference
|
|
919
|
+
fields: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
920
|
+
name: PropTypes__default["default"].string.isRequired,
|
|
921
|
+
label: PropTypes__default["default"].string,
|
|
922
|
+
isLocalized: PropTypes__default["default"].bool,
|
|
923
|
+
fields: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
924
|
+
name: PropTypes__default["default"].string.isRequired,
|
|
925
|
+
label: PropTypes__default["default"].string,
|
|
926
|
+
isLocalized: PropTypes__default["default"].bool,
|
|
927
|
+
isSelectedByDefault: PropTypes__default["default"].bool,
|
|
928
|
+
isRequired: PropTypes__default["default"].bool
|
|
929
|
+
}))
|
|
930
|
+
})).isRequired,
|
|
931
|
+
exportType: PropTypes__default["default"].string,
|
|
932
|
+
renderProperties: PropTypes__default["default"].func
|
|
933
|
+
}).isRequired;
|
|
934
|
+
|
|
935
|
+
const ExportResourcesProvider = props => {
|
|
936
|
+
const _useStartExportOperat = useStartExportOperation(props),
|
|
937
|
+
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
938
|
+
const initialValues = useInitialValues(props);
|
|
939
|
+
const _React$useState = React__default["default"].useState(1),
|
|
940
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
941
|
+
currentStep = _React$useState2[0],
|
|
942
|
+
setCurrentStep = _React$useState2[1];
|
|
943
|
+
const onSubmit = async values => {
|
|
944
|
+
if (currentStep === 1) {
|
|
945
|
+
setCurrentStep(2);
|
|
946
|
+
} else {
|
|
947
|
+
startExportOperation(values);
|
|
1111
948
|
}
|
|
1112
949
|
};
|
|
1113
950
|
const formik$1 = formik.useFormik({
|
|
1114
|
-
initialValues
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
}), "_Export_")).call(_context2, todayFormatted),
|
|
1120
|
-
locales: [locale],
|
|
1121
|
-
fields: props.fields,
|
|
1122
|
-
appliedSearchTerms: props.appliedSearchTerms,
|
|
1123
|
-
appliedFilters: props.appliedFilters,
|
|
1124
|
-
isAllLocalesChecked: false
|
|
1125
|
-
},
|
|
1126
|
-
validate,
|
|
951
|
+
initialValues,
|
|
952
|
+
validate: values => validate({
|
|
953
|
+
values,
|
|
954
|
+
step: currentStep
|
|
955
|
+
}),
|
|
1127
956
|
onSubmit
|
|
1128
957
|
});
|
|
958
|
+
React__default["default"].useEffect(() => {
|
|
959
|
+
formik$1.validateForm();
|
|
960
|
+
}, [currentStep]);
|
|
1129
961
|
return jsxRuntime.jsx(ExportResourcesContext.Provider, {
|
|
1130
962
|
value: {
|
|
963
|
+
currentStep,
|
|
964
|
+
setCurrentStep,
|
|
1131
965
|
formik: formik$1,
|
|
1132
966
|
resourceType: props.resourceType,
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
matchingResourcesCount: props.matchingResourcesCount,
|
|
967
|
+
exportType: props.exportType,
|
|
968
|
+
totalResourcesCount: props.totalResourcesCount,
|
|
1136
969
|
selectedResourceIds: props.selectedResourceIds
|
|
1137
970
|
},
|
|
1138
971
|
children: props.children
|
|
1139
972
|
});
|
|
1140
973
|
};
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
974
|
+
ExportResourcesProvider.displayName = 'ExportResourcesProvider';
|
|
975
|
+
ExportResourcesProvider.propTypes = {};
|
|
976
|
+
|
|
977
|
+
const CurrentStep = () => {
|
|
978
|
+
const _useExportResourcesCo = useExportResourcesContext(),
|
|
979
|
+
currentStep = _useExportResourcesCo.currentStep;
|
|
980
|
+
const steps = {
|
|
981
|
+
1: jsxRuntime.jsx(ExportFileSettingsStep, {}),
|
|
982
|
+
2: jsxRuntime.jsx(ExportFieldsSelectionStep, {})
|
|
983
|
+
};
|
|
984
|
+
return steps[currentStep] || null;
|
|
985
|
+
};
|
|
1147
986
|
|
|
1148
|
-
const _excluded = ["renderProperties", "showExportSelection"];
|
|
1149
987
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1150
988
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1151
|
-
const ExportResourcesModal =
|
|
1152
|
-
let renderProperties = _ref.renderProperties,
|
|
1153
|
-
showExportSelection = _ref.showExportSelection,
|
|
1154
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
989
|
+
const ExportResourcesModal = props => {
|
|
1155
990
|
const intl = reactIntl.useIntl();
|
|
1156
991
|
const resourceTypePlural = resourceTypeToPlural({
|
|
1157
992
|
resourceType: props.resourceType
|
|
1158
993
|
});
|
|
1159
|
-
return jsxRuntime.jsx(
|
|
1160
|
-
children: jsxRuntime.jsx(
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
onClose: props.closeModal,
|
|
1169
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1170
|
-
scale: "xxxl",
|
|
1171
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1172
|
-
scale: "l",
|
|
1173
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1174
|
-
alignItems: "center",
|
|
1175
|
-
children: [jsxRuntime.jsx(uiKit.ExportIcon, {
|
|
1176
|
-
size: "medium",
|
|
1177
|
-
color: "neutral60"
|
|
1178
|
-
}), jsxRuntime.jsx(ExportTextMessage, {})]
|
|
1179
|
-
}), jsxRuntime.jsx(ExportFileSettings, {
|
|
1180
|
-
renderProperties: renderProperties,
|
|
1181
|
-
showExportSelection: showExportSelection
|
|
1182
|
-
})]
|
|
1183
|
-
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1184
|
-
justifyContent: "flex-end",
|
|
1185
|
-
scale: "m",
|
|
1186
|
-
children: [jsxRuntime.jsx(uiKit.SecondaryButton, {
|
|
1187
|
-
label: intl.formatMessage(messages.cancel),
|
|
1188
|
-
onClick: props.closeModal
|
|
1189
|
-
}), jsxRuntime.jsx(uiKit.PrimaryButton, {
|
|
1190
|
-
label: intl.formatMessage(messages.startExport),
|
|
1191
|
-
onClick: formik.submitForm
|
|
1192
|
-
})]
|
|
1193
|
-
})]
|
|
1194
|
-
})
|
|
1195
|
-
});
|
|
1196
|
-
}
|
|
994
|
+
return jsxRuntime.jsx(ExportResourcesProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
995
|
+
children: jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
996
|
+
isOpen: true,
|
|
997
|
+
title: intl.formatMessage(messages.modalTitle, {
|
|
998
|
+
resourceType: resourceTypePlural
|
|
999
|
+
}),
|
|
1000
|
+
onClose: props.onClose,
|
|
1001
|
+
size: 16,
|
|
1002
|
+
children: jsxRuntime.jsx(CurrentStep, {})
|
|
1197
1003
|
})
|
|
1198
1004
|
}));
|
|
1199
1005
|
};
|
|
@@ -1201,14 +1007,10 @@ ExportResourcesModal.displayName = 'ExportResourcesModal';
|
|
|
1201
1007
|
ExportResourcesModal.propTypes = {};
|
|
1202
1008
|
ExportResourcesModal.defaultProps = {
|
|
1203
1009
|
selectedResourceIds: [],
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
matchingResourcesCount: 0,
|
|
1207
|
-
exportSelectionType: EXPORT_SELECTION_TYPES.ALL_RESOURCES,
|
|
1208
|
-
outputFormat: OUTPUT_FORMATS.CSV,
|
|
1209
|
-
showExportSelection: false
|
|
1010
|
+
exportType: EXPORT_TYPES.ALL,
|
|
1011
|
+
outputFormat: OUTPUT_FORMATS.CSV
|
|
1210
1012
|
};
|
|
1211
1013
|
|
|
1212
1014
|
exports.EXPORTABLE_RESOURCES = EXPORTABLE_RESOURCES;
|
|
1213
|
-
exports.
|
|
1015
|
+
exports.EXPORT_TYPES = EXPORT_TYPES;
|
|
1214
1016
|
exports["default"] = ExportResourcesModal;
|