@commercetools-frontend-extensions/export-resources-modal 1.3.1 → 1.3.3
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.
|
@@ -26,22 +26,21 @@ var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibl
|
|
|
26
26
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
27
27
|
var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
|
|
28
28
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
29
|
-
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
30
|
-
var PropTypes = require('prop-types');
|
|
31
|
-
var formik = require('formik');
|
|
32
|
-
var moment = require('moment');
|
|
33
|
-
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
34
|
-
var react = require('react');
|
|
35
29
|
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
36
30
|
var omitEmpty = require('omit-empty-es');
|
|
37
31
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
38
|
-
var _valuesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/values');
|
|
39
32
|
var designSystem = require('@commercetools-uikit/design-system');
|
|
40
|
-
var
|
|
33
|
+
var PropTypes = require('prop-types');
|
|
34
|
+
var react$1 = require('react');
|
|
35
|
+
var react = require('@emotion/react');
|
|
41
36
|
var _styled = require('@emotion/styled/base');
|
|
37
|
+
var _valuesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/values');
|
|
38
|
+
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
42
39
|
var sdk = require('@commercetools-frontend/sdk');
|
|
43
|
-
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
44
40
|
var constants = require('@commercetools-frontend/constants');
|
|
41
|
+
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
42
|
+
var formik = require('formik');
|
|
43
|
+
var moment = require('moment');
|
|
45
44
|
|
|
46
45
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
47
46
|
|
|
@@ -58,31 +57,34 @@ var _flatInstanceProperty__default = /*#__PURE__*/_interopDefault(_flatInstanceP
|
|
|
58
57
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
59
58
|
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
60
59
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
61
|
-
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
62
|
-
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
63
60
|
var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
|
|
64
|
-
var
|
|
61
|
+
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
65
62
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
63
|
+
var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefault(_valuesInstanceProperty);
|
|
64
|
+
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
66
65
|
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
const EXPORT_OPERATION_STATES = {
|
|
67
|
+
PROCESSING: 'processing',
|
|
68
|
+
COMPLETED: 'completed',
|
|
69
|
+
FAILED: 'failed'
|
|
71
70
|
};
|
|
71
|
+
|
|
72
72
|
const EXPORT_SELECTION_TYPES = {
|
|
73
73
|
ALL_RESOURCES: 'allResources',
|
|
74
74
|
ONLY_MATCHING: 'onlyMatching',
|
|
75
75
|
ONLY_SELECTED: 'onlySelected'
|
|
76
76
|
};
|
|
77
|
+
|
|
78
|
+
const EXPORTABLE_RESOURCES = {
|
|
79
|
+
CATEGORY: 'category',
|
|
80
|
+
PRODUCT: 'product',
|
|
81
|
+
DISCOUNT_CODE: 'discountCode'
|
|
82
|
+
};
|
|
83
|
+
|
|
77
84
|
const OUTPUT_FORMATS = {
|
|
78
85
|
JSON: 'json',
|
|
79
86
|
CSV: 'csv'
|
|
80
87
|
};
|
|
81
|
-
const EXPORT_OPERATION_STATES = {
|
|
82
|
-
PROCESSING: 'processing',
|
|
83
|
-
COMPLETED: 'completed',
|
|
84
|
-
FAILED: 'failed'
|
|
85
|
-
};
|
|
86
88
|
|
|
87
89
|
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); }; }
|
|
88
90
|
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; } }
|
|
@@ -178,6 +180,14 @@ function isFilledArray(maybeArray) {
|
|
|
178
180
|
return _Array$isArray__default["default"](maybeArray) && maybeArray.length;
|
|
179
181
|
}
|
|
180
182
|
|
|
183
|
+
/*
|
|
184
|
+
* This function is responsible for constructing the GraphQL query based on the export settings
|
|
185
|
+
*
|
|
186
|
+
* Depending on the type of export selection (all resources, only selected, or only matching/filtered) it constructs different types of queries:
|
|
187
|
+
* - For 'all resources', it generates a query that fetches all fields and languages specified in the export settings.
|
|
188
|
+
* - For 'only selected', it creates a query that fetches only the fields and languages of the selected resources. The ids of the selected resources are included in the query.
|
|
189
|
+
* - The 'only matching' case is a placeholder for future development where a query will be constructed based on certain filtering criteria using the `where` parameter.
|
|
190
|
+
*/
|
|
181
191
|
function buildGraphQuery(exportSettings) {
|
|
182
192
|
var _context;
|
|
183
193
|
const operation = resourceTypeToOperationName(exportSettings.resourceType);
|
|
@@ -213,6 +223,21 @@ function buildGraphQuery(exportSettings) {
|
|
|
213
223
|
throw new UnexpectedSelectionTypeError(exportSettings.exportSelectionType);
|
|
214
224
|
}
|
|
215
225
|
}
|
|
226
|
+
|
|
227
|
+
/*
|
|
228
|
+
* This function builds the necessary field structure for our GraphQL queries, tt is specifically designed to handle different types of fields
|
|
229
|
+
*
|
|
230
|
+
* For fields whose values change depending on the language aka localised fields, a unique request format is used
|
|
231
|
+
* This format combines the field and the language, separated by '_____'. This approach is adopted as our system disallows the use of hyphens `-` in these situations
|
|
232
|
+
*
|
|
233
|
+
* Fields that don't vary by language but contain additional subfields (known as 'nested fields') are also addressed
|
|
234
|
+
* In these cases the function is used recursively on these subfields to generate the appropriate request.
|
|
235
|
+
*
|
|
236
|
+
* Overall, this function enables us to accurately request different types of data, including those varying by language or containing subfields.
|
|
237
|
+
*
|
|
238
|
+
* More details can be found in the related PR: https://github.com/commercetools/commercetools-exporter/pull/103
|
|
239
|
+
*/
|
|
240
|
+
|
|
216
241
|
function buildFields(_ref) {
|
|
217
242
|
var _context2;
|
|
218
243
|
let fields = _ref.fields,
|
|
@@ -220,7 +245,7 @@ function buildFields(_ref) {
|
|
|
220
245
|
return _flatInstanceProperty__default["default"](_context2 = _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
221
246
|
if (field.isLocalized) return _mapInstanceProperty__default["default"](languages).call(languages, language => {
|
|
222
247
|
var _context3, _context4, _context5;
|
|
223
|
-
const alias = replaceSpecialCharsWithUnderscore(_concatInstanceProperty__default["default"](_context3 = "".concat(field.key, "
|
|
248
|
+
const alias = replaceSpecialCharsWithUnderscore(_concatInstanceProperty__default["default"](_context3 = "".concat(field.key, "_____")).call(_context3, language));
|
|
224
249
|
return _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = "".concat(alias, ": ")).call(_context5, field.key, "(locale: \"")).call(_context4, language, "\")");
|
|
225
250
|
});else {
|
|
226
251
|
if (isFilledArray(field.fields)) {
|
|
@@ -236,6 +261,22 @@ function buildFields(_ref) {
|
|
|
236
261
|
})).call(_context2);
|
|
237
262
|
}
|
|
238
263
|
|
|
264
|
+
function validate(values) {
|
|
265
|
+
const errors = {
|
|
266
|
+
fileName: {},
|
|
267
|
+
languages: {}
|
|
268
|
+
};
|
|
269
|
+
if (uiKit.TextInput.isEmpty(values.fileName)) {
|
|
270
|
+
errors.fileName.missing = true;
|
|
271
|
+
} else if (!/^[a-zA-Z0-9-_]+$/.test(values.fileName)) {
|
|
272
|
+
errors.fileName.invalidInput = true;
|
|
273
|
+
}
|
|
274
|
+
if (values.languages.length < 1) {
|
|
275
|
+
errors.languages.missing = true;
|
|
276
|
+
}
|
|
277
|
+
return omitEmpty__default["default"](errors);
|
|
278
|
+
}
|
|
279
|
+
|
|
239
280
|
var messages = reactIntl.defineMessages({
|
|
240
281
|
modalTitle: {
|
|
241
282
|
id: 'ExportResourcesModal.modalTitle',
|
|
@@ -350,7 +391,7 @@ var messages = reactIntl.defineMessages({
|
|
|
350
391
|
exportOperationSuccessMessage: {
|
|
351
392
|
id: 'ExportResourcesModal.exportOperationSuccessMessage',
|
|
352
393
|
description: 'Success message',
|
|
353
|
-
defaultMessage: 'Your export has started
|
|
394
|
+
defaultMessage: '<b>Your export has started.</b> <newline></newline><logsLink>Go to Export logs</logsLink> to view the progress and download the file.'
|
|
354
395
|
},
|
|
355
396
|
exportConfirmationLabel: {
|
|
356
397
|
id: 'ExportResourcesModal.exportConfirmationLabel',
|
|
@@ -389,112 +430,30 @@ var messages = reactIntl.defineMessages({
|
|
|
389
430
|
}
|
|
390
431
|
});
|
|
391
432
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
isOpen: PropTypes__default["default"].bool.isRequired,
|
|
398
|
-
closeModal: PropTypes__default["default"].func.isRequired,
|
|
399
|
-
allResourcesCount: PropTypes__default["default"].number.isRequired,
|
|
400
|
-
matchingResourcesCount: PropTypes__default["default"].number,
|
|
401
|
-
selectedResourceIds: PropTypes__default["default"].array,
|
|
402
|
-
// TODO: Circular reference
|
|
403
|
-
fields: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
404
|
-
key: PropTypes__default["default"].string.isRequired,
|
|
405
|
-
label: PropTypes__default["default"].string,
|
|
406
|
-
isLocalized: PropTypes__default["default"].bool,
|
|
407
|
-
fields: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
408
|
-
key: PropTypes__default["default"].string.isRequired,
|
|
409
|
-
label: PropTypes__default["default"].string,
|
|
410
|
-
isLocalized: PropTypes__default["default"].bool
|
|
411
|
-
}))
|
|
412
|
-
})).isRequired,
|
|
413
|
-
exportSelectionType: PropTypes__default["default"].string,
|
|
414
|
-
appliedSearchTerms: PropTypes__default["default"].array,
|
|
415
|
-
appliedFilters: PropTypes__default["default"].array,
|
|
416
|
-
renderProperties: PropTypes__default["default"].func
|
|
417
|
-
}).isRequired;
|
|
418
|
-
|
|
419
|
-
function validate(values) {
|
|
420
|
-
const errors = {
|
|
421
|
-
fileName: {},
|
|
422
|
-
languages: {}
|
|
423
|
-
};
|
|
424
|
-
if (uiKit.TextInput.isEmpty(values.fileName)) {
|
|
425
|
-
errors.fileName.missing = true;
|
|
426
|
-
} else if (!/^[a-zA-Z0-9-_]+$/.test(values.fileName)) {
|
|
427
|
-
errors.fileName.invalidInput = true;
|
|
428
|
-
}
|
|
429
|
-
if (values.languages.length < 1) {
|
|
430
|
-
errors.languages.missing = true;
|
|
431
|
-
}
|
|
432
|
-
return omitEmpty__default["default"](errors);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
const ExportResourcesContextProvider = props => {
|
|
436
|
-
var _context;
|
|
437
|
-
const todayFormatted = moment__default["default"]().format('DD-MM-YY_HH-mm');
|
|
438
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
439
|
-
language: applicationContext.dataLocale
|
|
440
|
-
})),
|
|
441
|
-
language = _useApplicationContex.language;
|
|
442
|
-
const formik$1 = formik.useFormik({
|
|
443
|
-
initialValues: {
|
|
444
|
-
outputFormat: props.outputFormat,
|
|
445
|
-
fileName: _concatInstanceProperty__default["default"](_context = "".concat(resourceTypeToPlural({
|
|
446
|
-
resourceType: props.resourceType,
|
|
447
|
-
isUpperCase: true
|
|
448
|
-
}), "_Export_")).call(_context, todayFormatted),
|
|
449
|
-
languages: [language],
|
|
450
|
-
fields: props.fields,
|
|
451
|
-
appliedSearchTerms: props.appliedSearchTerms,
|
|
452
|
-
appliedFilters: props.appliedFilters,
|
|
453
|
-
exportSelectionType: props.exportSelectionType,
|
|
454
|
-
isAllLanguagesChecked: false
|
|
455
|
-
},
|
|
456
|
-
validate
|
|
457
|
-
});
|
|
458
|
-
const _useState = react.useState(false),
|
|
459
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
460
|
-
exportOperationStarted = _useState2[0],
|
|
461
|
-
setExportOperationStarted = _useState2[1];
|
|
462
|
-
return jsxRuntime.jsx(ExportResourcesContext.Provider, {
|
|
463
|
-
value: {
|
|
464
|
-
formik: formik$1,
|
|
465
|
-
resourceType: props.resourceType,
|
|
466
|
-
allResourcesCount: props.allResourcesCount,
|
|
467
|
-
matchingResourcesCount: props.matchingResourcesCount,
|
|
468
|
-
selectedResourceIds: props.selectedResourceIds,
|
|
469
|
-
exportOperationStarted,
|
|
470
|
-
setExportOperationStarted
|
|
471
|
-
},
|
|
472
|
-
children: props.children
|
|
433
|
+
function getBold(msg) {
|
|
434
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
435
|
+
as: "span",
|
|
436
|
+
isBold: true,
|
|
437
|
+
children: msg
|
|
473
438
|
});
|
|
474
|
-
}
|
|
475
|
-
ExportResourcesContextProvider.displayName = 'ExportResourcesContextProvider';
|
|
476
|
-
ExportResourcesContextProvider.propTypes = {};
|
|
439
|
+
}
|
|
477
440
|
|
|
478
|
-
function
|
|
479
|
-
|
|
480
|
-
if (!context) {
|
|
481
|
-
throw new MissingExportResourceProviderError();
|
|
482
|
-
}
|
|
483
|
-
return context;
|
|
441
|
+
function getNewLine() {
|
|
442
|
+
return jsxRuntime.jsx("br", {});
|
|
484
443
|
}
|
|
485
444
|
|
|
486
|
-
const smallTopPadding = /*#__PURE__*/react
|
|
445
|
+
const smallTopPadding = /*#__PURE__*/react.css("padding-top:", designSystem.customProperties.spacingXs, ";" + ("" ), "" );
|
|
487
446
|
const tagListContainer = _ref => {
|
|
488
447
|
let isNewTheme = _ref.isNewTheme;
|
|
489
|
-
return /*#__PURE__*/react
|
|
448
|
+
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;}" + ("" ), "" );
|
|
490
449
|
};
|
|
491
|
-
const tagListItem = /*#__PURE__*/react
|
|
492
|
-
const divider = /*#__PURE__*/react
|
|
450
|
+
const tagListItem = /*#__PURE__*/react.css("margin:0 ", designSystem.customProperties.spacingXs, " ", designSystem.customProperties.spacingXs, " 0;display:flex;min-width:0;" + ("" ), "" );
|
|
451
|
+
const divider = /*#__PURE__*/react.css("box-sizing:border-box;width:100%;margin:0;border:0;border-top:1px solid ", designSystem.customProperties.colorNeutral60, ";" + ("" ), "" );
|
|
493
452
|
const notBold = {
|
|
494
453
|
name: "lugakg",
|
|
495
454
|
styles: "font-weight:normal"
|
|
496
455
|
} ;
|
|
497
|
-
const successMessage = /*#__PURE__*/react
|
|
456
|
+
const successMessage = /*#__PURE__*/react.css("margin-bottom:", designSystem.customProperties.spacingL, ";" + ("" ), "" );
|
|
498
457
|
const styles = {
|
|
499
458
|
tagListItem,
|
|
500
459
|
tagListContainer,
|
|
@@ -504,174 +463,51 @@ const styles = {
|
|
|
504
463
|
successMessage
|
|
505
464
|
};
|
|
506
465
|
|
|
507
|
-
function
|
|
508
|
-
function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$a(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$a(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
509
|
-
function ExportSelectionRadioButtons() {
|
|
466
|
+
function TagList(props) {
|
|
510
467
|
const _useTheme = designSystem.useTheme(),
|
|
511
468
|
isNewTheme = _useTheme.isNewTheme;
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
});
|
|
522
|
-
return jsxRuntime.jsx(uiKit.Spacings.Inline, {
|
|
523
|
-
scale: "xl",
|
|
524
|
-
children: jsxRuntime.jsxs(uiKit.RadioInput.Group, {
|
|
525
|
-
name: "exportSelectionType",
|
|
526
|
-
value: _valuesInstanceProperty__default["default"](formik).exportSelectionType,
|
|
527
|
-
direction: "inline",
|
|
528
|
-
directionProps: {
|
|
529
|
-
scale: 'xl'
|
|
530
|
-
},
|
|
531
|
-
onChange: formik.handleChange,
|
|
532
|
-
children: [jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
533
|
-
value: EXPORT_SELECTION_TYPES.ALL_RESOURCES,
|
|
534
|
-
"data-testid": 'test-all-resources',
|
|
535
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
536
|
-
isBold: !isNewTheme,
|
|
537
|
-
intlMessage: _objectSpread$a(_objectSpread$a({}, messages.exportAllResources), {}, {
|
|
538
|
-
values: {
|
|
539
|
-
resourceType: resourceTypePlural,
|
|
540
|
-
count: allResourcesCount
|
|
541
|
-
}
|
|
542
|
-
})
|
|
543
|
-
})
|
|
544
|
-
}), jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
545
|
-
value: EXPORT_SELECTION_TYPES.ONLY_MATCHING,
|
|
546
|
-
"data-testid": 'test-only-matching',
|
|
547
|
-
isDisabled: !Boolean(matchingResourcesCount),
|
|
548
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
549
|
-
isBold: !isNewTheme,
|
|
550
|
-
intlMessage: _objectSpread$a(_objectSpread$a({}, messages.exportOnlyMatchingResources), {}, {
|
|
551
|
-
values: {
|
|
552
|
-
count: matchingResourcesCount || intl.formatMessage(messages.nothingApplied)
|
|
553
|
-
}
|
|
554
|
-
})
|
|
555
|
-
})
|
|
556
|
-
}), jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
557
|
-
value: EXPORT_SELECTION_TYPES.ONLY_SELECTED,
|
|
558
|
-
"data-testid": 'test-only-selected',
|
|
559
|
-
isDisabled: !Boolean(selectedResourceIds.length),
|
|
560
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
561
|
-
isBold: !isNewTheme,
|
|
562
|
-
intlMessage: _objectSpread$a(_objectSpread$a({}, messages.exportOnlySelectedResources), {}, {
|
|
563
|
-
values: {
|
|
564
|
-
resourceType: resourceTypePlural,
|
|
565
|
-
count: selectedResourceIds.length
|
|
566
|
-
}
|
|
567
|
-
})
|
|
568
|
-
})
|
|
569
|
-
})]
|
|
570
|
-
})
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
function getBold(msg) {
|
|
575
|
-
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
576
|
-
as: "span",
|
|
577
|
-
isBold: true,
|
|
578
|
-
children: msg
|
|
469
|
+
return jsxRuntime.jsx("div", {
|
|
470
|
+
css: styles.tagListContainer({
|
|
471
|
+
isNewTheme
|
|
472
|
+
}),
|
|
473
|
+
"data-testid": props['data-testid'],
|
|
474
|
+
children: _mapInstanceProperty__default["default"](react$1.Children).call(react$1.Children, props.children, tag => jsxRuntime.jsx("div", {
|
|
475
|
+
css: styles.tagListItem,
|
|
476
|
+
children: tag
|
|
477
|
+
}))
|
|
579
478
|
});
|
|
580
479
|
}
|
|
480
|
+
TagList.displayName = 'TagList';
|
|
481
|
+
TagList.propTypes = {};
|
|
581
482
|
|
|
582
483
|
function ownKeys$9(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
583
484
|
function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$9(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$9(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
584
|
-
function
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
resourceType: resourceTypePlural,
|
|
611
|
-
b: getBold
|
|
612
|
-
}
|
|
613
|
-
})
|
|
614
|
-
});
|
|
615
|
-
case EXPORT_SELECTION_TYPES.ONLY_SELECTED:
|
|
616
|
-
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
617
|
-
intlMessage: _objectSpread$9(_objectSpread$9({}, messages.exportSelectedMessage), {}, {
|
|
618
|
-
values: {
|
|
619
|
-
count: selectedResourceIds.length,
|
|
620
|
-
resourceType: resourceTypePlural,
|
|
621
|
-
b: getBold
|
|
622
|
-
}
|
|
623
|
-
})
|
|
624
|
-
});
|
|
625
|
-
default:
|
|
626
|
-
throw new UnexpectedSelectionTypeError(_valuesInstanceProperty__default["default"](formik).exportSelectionType);
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
function TagList(props) {
|
|
631
|
-
const _useTheme = designSystem.useTheme(),
|
|
632
|
-
isNewTheme = _useTheme.isNewTheme;
|
|
633
|
-
return jsxRuntime.jsx("div", {
|
|
634
|
-
css: styles.tagListContainer({
|
|
635
|
-
isNewTheme
|
|
636
|
-
}),
|
|
637
|
-
"data-testid": props['data-testid'],
|
|
638
|
-
children: _mapInstanceProperty__default["default"](react.Children).call(react.Children, props.children, tag => jsxRuntime.jsx("div", {
|
|
639
|
-
css: styles.tagListItem,
|
|
640
|
-
children: tag
|
|
641
|
-
}))
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
TagList.displayName = 'TagList';
|
|
645
|
-
TagList.propTypes = {};
|
|
646
|
-
|
|
647
|
-
function ownKeys$8(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
648
|
-
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$8(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$8(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
649
|
-
function AppliedFilters(_ref) {
|
|
650
|
-
let filters = _ref.filters,
|
|
651
|
-
onFilterRemove = _ref.onFilterRemove;
|
|
652
|
-
const _useTheme = designSystem.useTheme(),
|
|
653
|
-
isNewTheme = _useTheme.isNewTheme;
|
|
654
|
-
if (isNewTheme) return jsxRuntime.jsx(uiKit.CollapsiblePanel, {
|
|
655
|
-
condensed: true,
|
|
656
|
-
isDefaultClosed: !Boolean(filters.length),
|
|
657
|
-
header: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
658
|
-
intlMessage: _objectSpread$8(_objectSpread$8({}, messages.appliedFiltersMessage), {}, {
|
|
659
|
-
values: {
|
|
660
|
-
filtersCount: filters.length
|
|
661
|
-
}
|
|
662
|
-
})
|
|
663
|
-
}),
|
|
664
|
-
children: jsxRuntime.jsx(TagList, {
|
|
665
|
-
children: _mapInstanceProperty__default["default"](filters).call(filters, filter => jsxRuntime.jsx("div", {
|
|
666
|
-
"data-testid": "test-filter-".concat(filter),
|
|
667
|
-
children: jsxRuntime.jsx(uiKit.Tag, {
|
|
668
|
-
onRemove: () => {
|
|
669
|
-
onFilterRemove(filter);
|
|
670
|
-
},
|
|
671
|
-
children: filter
|
|
672
|
-
})
|
|
673
|
-
}, filter))
|
|
674
|
-
})
|
|
485
|
+
function AppliedFilters(_ref) {
|
|
486
|
+
let filters = _ref.filters,
|
|
487
|
+
onFilterRemove = _ref.onFilterRemove;
|
|
488
|
+
const _useTheme = designSystem.useTheme(),
|
|
489
|
+
isNewTheme = _useTheme.isNewTheme;
|
|
490
|
+
if (isNewTheme) return jsxRuntime.jsx(uiKit.CollapsiblePanel, {
|
|
491
|
+
condensed: true,
|
|
492
|
+
isDefaultClosed: !Boolean(filters.length),
|
|
493
|
+
header: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
494
|
+
intlMessage: _objectSpread$9(_objectSpread$9({}, messages.appliedFiltersMessage), {}, {
|
|
495
|
+
values: {
|
|
496
|
+
filtersCount: filters.length
|
|
497
|
+
}
|
|
498
|
+
})
|
|
499
|
+
}),
|
|
500
|
+
children: jsxRuntime.jsx(TagList, {
|
|
501
|
+
children: _mapInstanceProperty__default["default"](filters).call(filters, filter => jsxRuntime.jsx("div", {
|
|
502
|
+
"data-testid": "test-filter-".concat(filter),
|
|
503
|
+
children: jsxRuntime.jsx(uiKit.Tag, {
|
|
504
|
+
onRemove: () => {
|
|
505
|
+
onFilterRemove(filter);
|
|
506
|
+
},
|
|
507
|
+
children: filter
|
|
508
|
+
})
|
|
509
|
+
}, filter))
|
|
510
|
+
})
|
|
675
511
|
});
|
|
676
512
|
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
677
513
|
scale: "s",
|
|
@@ -684,7 +520,7 @@ function AppliedFilters(_ref) {
|
|
|
684
520
|
color: "neutral60"
|
|
685
521
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
686
522
|
isBold: true,
|
|
687
|
-
intlMessage: _objectSpread$
|
|
523
|
+
intlMessage: _objectSpread$9(_objectSpread$9({}, messages.appliedFiltersMessage), {}, {
|
|
688
524
|
values: {
|
|
689
525
|
filtersCount: filters.length
|
|
690
526
|
}
|
|
@@ -705,31 +541,10 @@ function AppliedFilters(_ref) {
|
|
|
705
541
|
}
|
|
706
542
|
AppliedFilters.propTypes = {};
|
|
707
543
|
|
|
708
|
-
|
|
709
|
-
function
|
|
710
|
-
const _useTheme = designSystem.useTheme(),
|
|
711
|
-
themedValue = _useTheme.themedValue;
|
|
712
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
713
|
-
scale: "m",
|
|
714
|
-
alignItems: "center",
|
|
715
|
-
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
716
|
-
intlMessage: messages.exportBasedOnMyViewsMessage
|
|
717
|
-
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
718
|
-
intlMessage: messages.myViews
|
|
719
|
-
}), jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
720
|
-
max: themedValue(4, 7),
|
|
721
|
-
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
722
|
-
isDisabled: true,
|
|
723
|
-
placeholder: "Default"
|
|
724
|
-
})
|
|
725
|
-
})]
|
|
726
|
-
});
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
function ownKeys$7(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
730
|
-
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$7(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$7(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
544
|
+
function ownKeys$8(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
545
|
+
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$8(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$8(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
731
546
|
const IconPlaceholder = /*#__PURE__*/_styled__default["default"]("div", {
|
|
732
|
-
target: "
|
|
547
|
+
target: "e1oion860"
|
|
733
548
|
} )("width:", uiKit.customProperties.spacingM, ";" + ("" ));
|
|
734
549
|
function AppliedSearchTerms(_ref) {
|
|
735
550
|
let appliedSearchTerms = _ref.appliedSearchTerms;
|
|
@@ -739,7 +554,7 @@ function AppliedSearchTerms(_ref) {
|
|
|
739
554
|
condensed: true,
|
|
740
555
|
isDefaultClosed: !Boolean(appliedSearchTerms.length),
|
|
741
556
|
header: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
742
|
-
intlMessage: _objectSpread$
|
|
557
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages.appliedSearchTermsMessage), {}, {
|
|
743
558
|
values: {
|
|
744
559
|
searchTermsCount: appliedSearchTerms.length
|
|
745
560
|
}
|
|
@@ -760,7 +575,7 @@ function AppliedSearchTerms(_ref) {
|
|
|
760
575
|
color: "neutral60"
|
|
761
576
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
762
577
|
isBold: true,
|
|
763
|
-
intlMessage: _objectSpread$
|
|
578
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages.appliedSearchTermsMessage), {}, {
|
|
764
579
|
values: {
|
|
765
580
|
searchTermsCount: appliedSearchTerms.length
|
|
766
581
|
}
|
|
@@ -777,15 +592,193 @@ function AppliedSearchTerms(_ref) {
|
|
|
777
592
|
}
|
|
778
593
|
AppliedSearchTerms.propTypes = {};
|
|
779
594
|
|
|
595
|
+
// TODO: @redesign cleanup
|
|
596
|
+
function ExportBasedOnMyViewsSelectField() {
|
|
597
|
+
const _useTheme = designSystem.useTheme(),
|
|
598
|
+
themedValue = _useTheme.themedValue;
|
|
599
|
+
return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
600
|
+
scale: "m",
|
|
601
|
+
alignItems: "center",
|
|
602
|
+
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
603
|
+
intlMessage: messages.exportBasedOnMyViewsMessage
|
|
604
|
+
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
605
|
+
intlMessage: messages.myViews
|
|
606
|
+
}), jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
607
|
+
max: themedValue(4, 7),
|
|
608
|
+
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
609
|
+
isDisabled: true,
|
|
610
|
+
placeholder: "Default"
|
|
611
|
+
})
|
|
612
|
+
})]
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
function ownKeys$7(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
617
|
+
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$7(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$7(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
618
|
+
function renderFileNameError(key) {
|
|
619
|
+
switch (key) {
|
|
620
|
+
case 'missing':
|
|
621
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$7({}, messages.missingFileNameError));
|
|
622
|
+
case 'invalidInput':
|
|
623
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$7({}, messages.invalidFileNameError));
|
|
624
|
+
default:
|
|
625
|
+
return null;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
function renderLanguageError(key) {
|
|
629
|
+
switch (key) {
|
|
630
|
+
case 'missing':
|
|
631
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$7({}, messages.missingLanguageError));
|
|
632
|
+
default:
|
|
633
|
+
return null;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
function useExportResourcesContext() {
|
|
638
|
+
const context = react$1.useContext(ExportResourcesContext);
|
|
639
|
+
if (!context) {
|
|
640
|
+
throw new MissingExportResourceProviderError();
|
|
641
|
+
}
|
|
642
|
+
return context;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
async function createExportOperation(_ref) {
|
|
646
|
+
let projectKey = _ref.projectKey,
|
|
647
|
+
graphQuery = _ref.graphQuery,
|
|
648
|
+
asyncDispatchFn = _ref.asyncDispatchFn;
|
|
649
|
+
const uri = "/proxy/export/".concat(projectKey, "/export-operations");
|
|
650
|
+
const response = await asyncDispatchFn(sdk.actions.post({
|
|
651
|
+
// FIXME: EXPORT is undefined
|
|
652
|
+
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.EXPORT,
|
|
653
|
+
uri: uri,
|
|
654
|
+
headers: {
|
|
655
|
+
accept: 'application/json'
|
|
656
|
+
},
|
|
657
|
+
payload: {
|
|
658
|
+
query: graphQuery
|
|
659
|
+
}
|
|
660
|
+
}));
|
|
661
|
+
return response;
|
|
662
|
+
}
|
|
663
|
+
|
|
780
664
|
function ownKeys$6(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
781
|
-
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
665
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$6(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$6(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
666
|
+
const getExportLogsLink = (projectKey, msg) => jsxRuntime.jsx(uiKit.Link, {
|
|
667
|
+
to: "/".concat(projectKey, "/operations/export/logs"),
|
|
668
|
+
children: msg
|
|
669
|
+
});
|
|
670
|
+
function ExportConfirmationModal(props) {
|
|
671
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => {
|
|
672
|
+
var _applicationContext$p, _applicationContext$p2;
|
|
673
|
+
return {
|
|
674
|
+
projectName: (_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.name,
|
|
675
|
+
projectKey: (_applicationContext$p2 = applicationContext.project) === null || _applicationContext$p2 === void 0 ? void 0 : _applicationContext$p2.key
|
|
676
|
+
};
|
|
677
|
+
}),
|
|
678
|
+
projectName = _useApplicationContex.projectName,
|
|
679
|
+
projectKey = _useApplicationContex.projectKey;
|
|
680
|
+
const _useExportResourcesCo = useExportResourcesContext(),
|
|
681
|
+
formik = _useExportResourcesCo.formik,
|
|
682
|
+
allResourcesCount = _useExportResourcesCo.allResourcesCount,
|
|
683
|
+
matchingResourcesCount = _useExportResourcesCo.matchingResourcesCount,
|
|
684
|
+
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
685
|
+
resourceType = _useExportResourcesCo.resourceType;
|
|
686
|
+
const showNotification = actionsGlobal.useShowNotification();
|
|
687
|
+
const intl = reactIntl.useIntl();
|
|
688
|
+
const asyncDispatch = sdk.useAsyncDispatch();
|
|
689
|
+
const resourceTypePlural = resourceTypeToPlural({
|
|
690
|
+
resourceType: props.resourceType
|
|
691
|
+
});
|
|
692
|
+
const countInConfirmationMessage = () => {
|
|
693
|
+
switch (_valuesInstanceProperty__default["default"](formik).exportSelectionType) {
|
|
694
|
+
case EXPORT_SELECTION_TYPES.ALL_RESOURCES:
|
|
695
|
+
return allResourcesCount;
|
|
696
|
+
case EXPORT_SELECTION_TYPES.ONLY_MATCHING:
|
|
697
|
+
return matchingResourcesCount;
|
|
698
|
+
case EXPORT_SELECTION_TYPES.ONLY_SELECTED:
|
|
699
|
+
return selectedResourceIds.length;
|
|
700
|
+
default:
|
|
701
|
+
throw new UnexpectedSelectionTypeError(_valuesInstanceProperty__default["default"](formik).exportSelectionType);
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
return jsxRuntime.jsx(applicationComponents.ConfirmationDialog, {
|
|
705
|
+
dataAttributesPrimaryButton: {
|
|
706
|
+
'data-testid': 'confirm-export-button'
|
|
707
|
+
},
|
|
708
|
+
title: intl.formatMessage(messages.confirmationTitle, {
|
|
709
|
+
resourceType: resourceTypePlural
|
|
710
|
+
}),
|
|
711
|
+
labelPrimary: intl.formatMessage(messages.exportConfirmationLabel, {
|
|
712
|
+
resourceType: resourceTypePlural
|
|
713
|
+
}),
|
|
714
|
+
isOpen: props.isOpen,
|
|
715
|
+
onClose: props.closeModal,
|
|
716
|
+
onCancel: props.closeModal,
|
|
717
|
+
onConfirm: async () => {
|
|
718
|
+
const graphQuery = buildGraphQuery({
|
|
719
|
+
resourceType: resourceType,
|
|
720
|
+
selectedResourceIds: selectedResourceIds,
|
|
721
|
+
fields: _valuesInstanceProperty__default["default"](formik).fields,
|
|
722
|
+
exportSelectionType: _valuesInstanceProperty__default["default"](formik).exportSelectionType,
|
|
723
|
+
languages: _valuesInstanceProperty__default["default"](formik).languages
|
|
724
|
+
});
|
|
725
|
+
props.closeModal();
|
|
726
|
+
try {
|
|
727
|
+
const response = await createExportOperation({
|
|
728
|
+
projectKey,
|
|
729
|
+
graphQuery,
|
|
730
|
+
asyncDispatchFn: asyncDispatch
|
|
731
|
+
});
|
|
732
|
+
switch (response.state) {
|
|
733
|
+
case EXPORT_OPERATION_STATES.PROCESSING:
|
|
734
|
+
case EXPORT_OPERATION_STATES.COMPLETED:
|
|
735
|
+
showNotification({
|
|
736
|
+
kind: 'success',
|
|
737
|
+
domain: constants.DOMAINS.SIDE,
|
|
738
|
+
text: intl.formatMessage(messages.exportOperationSuccessMessage, {
|
|
739
|
+
newline: getNewLine,
|
|
740
|
+
logsLink: msg => getExportLogsLink(projectKey, msg),
|
|
741
|
+
b: getBold
|
|
742
|
+
})
|
|
743
|
+
});
|
|
744
|
+
props.onCloseParentModal();
|
|
745
|
+
break;
|
|
746
|
+
default:
|
|
747
|
+
throw new UnexpectedExportOperationStateError(response.state);
|
|
748
|
+
}
|
|
749
|
+
} catch (errors) {
|
|
750
|
+
actionsGlobal.showApiErrorNotification({
|
|
751
|
+
errors
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
children: jsxRuntime.jsxs("div", {
|
|
756
|
+
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
757
|
+
intlMessage: _objectSpread$6(_objectSpread$6({}, messages.confirmationBodyPlan), {}, {
|
|
758
|
+
values: {
|
|
759
|
+
resourceType: resourceTypePlural,
|
|
760
|
+
projectName: projectName,
|
|
761
|
+
count: countInConfirmationMessage(),
|
|
762
|
+
bold: getBold
|
|
763
|
+
}
|
|
764
|
+
})
|
|
765
|
+
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
766
|
+
intlMessage: messages.confirmationBodyQuestion
|
|
767
|
+
})]
|
|
768
|
+
})
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
ExportConfirmationModal.propTypes = {};
|
|
772
|
+
|
|
773
|
+
function ownKeys$5(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
774
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$5(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$5(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
782
775
|
function normalizeFields(fields) {
|
|
783
776
|
const result = _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
784
777
|
if (isFilledArray(field.fields)) {
|
|
785
778
|
var _context;
|
|
786
779
|
return _mapInstanceProperty__default["default"](_context = normalizeFields(field.fields)).call(_context, nestedField => {
|
|
787
780
|
var _context2;
|
|
788
|
-
return _objectSpread$
|
|
781
|
+
return _objectSpread$5(_objectSpread$5({}, nestedField), {}, {
|
|
789
782
|
key: _concatInstanceProperty__default["default"](_context2 = "".concat(field.key, ".")).call(_context2, nestedField.key)
|
|
790
783
|
});
|
|
791
784
|
});
|
|
@@ -815,7 +808,7 @@ function ExportFields(_ref2) {
|
|
|
815
808
|
condensed: true,
|
|
816
809
|
isDefaultClosed: !Boolean(fields.length),
|
|
817
810
|
header: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
818
|
-
intlMessage: _objectSpread$
|
|
811
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages.columnsMessage), {}, {
|
|
819
812
|
values: {
|
|
820
813
|
columnsCount: fields.length
|
|
821
814
|
}
|
|
@@ -825,29 +818,144 @@ function ExportFields(_ref2) {
|
|
|
825
818
|
fields: fields
|
|
826
819
|
})
|
|
827
820
|
});
|
|
828
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
829
|
-
scale: "s",
|
|
830
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
831
|
-
scale: "s",
|
|
832
|
-
alignItems: "flex-start",
|
|
833
|
-
children: [jsxRuntime.jsx(uiKit.AngleRightIcon, {
|
|
834
|
-
"data-testid": "test-arrowRight",
|
|
835
|
-
size: "medium",
|
|
836
|
-
color: "neutral60"
|
|
837
|
-
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
838
|
-
isBold: true,
|
|
839
|
-
intlMessage: _objectSpread$
|
|
821
|
+
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
822
|
+
scale: "s",
|
|
823
|
+
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
824
|
+
scale: "s",
|
|
825
|
+
alignItems: "flex-start",
|
|
826
|
+
children: [jsxRuntime.jsx(uiKit.AngleRightIcon, {
|
|
827
|
+
"data-testid": "test-arrowRight",
|
|
828
|
+
size: "medium",
|
|
829
|
+
color: "neutral60"
|
|
830
|
+
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
831
|
+
isBold: true,
|
|
832
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages.columnsMessage), {}, {
|
|
833
|
+
values: {
|
|
834
|
+
columnsCount: fields.length
|
|
835
|
+
}
|
|
836
|
+
})
|
|
837
|
+
})]
|
|
838
|
+
}), jsxRuntime.jsx(FieldsRenderer, {
|
|
839
|
+
fields: fields
|
|
840
|
+
})]
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
ExportFields.propTypes = {};
|
|
844
|
+
|
|
845
|
+
function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
846
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
847
|
+
function ExportSelectionRadioButtons() {
|
|
848
|
+
const _useTheme = designSystem.useTheme(),
|
|
849
|
+
isNewTheme = _useTheme.isNewTheme;
|
|
850
|
+
const intl = reactIntl.useIntl();
|
|
851
|
+
const _useExportResourcesCo = useExportResourcesContext(),
|
|
852
|
+
formik = _useExportResourcesCo.formik,
|
|
853
|
+
resourceType = _useExportResourcesCo.resourceType,
|
|
854
|
+
allResourcesCount = _useExportResourcesCo.allResourcesCount,
|
|
855
|
+
matchingResourcesCount = _useExportResourcesCo.matchingResourcesCount,
|
|
856
|
+
selectedResourceIds = _useExportResourcesCo.selectedResourceIds;
|
|
857
|
+
const resourceTypePlural = resourceTypeToPlural({
|
|
858
|
+
resourceType: resourceType
|
|
859
|
+
});
|
|
860
|
+
return jsxRuntime.jsx(uiKit.Spacings.Inline, {
|
|
861
|
+
scale: "xl",
|
|
862
|
+
children: jsxRuntime.jsxs(uiKit.RadioInput.Group, {
|
|
863
|
+
name: "exportSelectionType",
|
|
864
|
+
value: _valuesInstanceProperty__default["default"](formik).exportSelectionType,
|
|
865
|
+
direction: "inline",
|
|
866
|
+
directionProps: {
|
|
867
|
+
scale: 'xl'
|
|
868
|
+
},
|
|
869
|
+
onChange: formik.handleChange,
|
|
870
|
+
children: [jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
871
|
+
value: EXPORT_SELECTION_TYPES.ALL_RESOURCES,
|
|
872
|
+
"data-testid": 'test-all-resources',
|
|
873
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
874
|
+
isBold: !isNewTheme,
|
|
875
|
+
intlMessage: _objectSpread$4(_objectSpread$4({}, messages.exportAllResources), {}, {
|
|
876
|
+
values: {
|
|
877
|
+
resourceType: resourceTypePlural,
|
|
878
|
+
count: allResourcesCount
|
|
879
|
+
}
|
|
880
|
+
})
|
|
881
|
+
})
|
|
882
|
+
}), jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
883
|
+
value: EXPORT_SELECTION_TYPES.ONLY_MATCHING,
|
|
884
|
+
"data-testid": 'test-only-matching',
|
|
885
|
+
isDisabled: !Boolean(matchingResourcesCount),
|
|
886
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
887
|
+
isBold: !isNewTheme,
|
|
888
|
+
intlMessage: _objectSpread$4(_objectSpread$4({}, messages.exportOnlyMatchingResources), {}, {
|
|
889
|
+
values: {
|
|
890
|
+
count: matchingResourcesCount || intl.formatMessage(messages.nothingApplied)
|
|
891
|
+
}
|
|
892
|
+
})
|
|
893
|
+
})
|
|
894
|
+
}), jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
895
|
+
value: EXPORT_SELECTION_TYPES.ONLY_SELECTED,
|
|
896
|
+
"data-testid": 'test-only-selected',
|
|
897
|
+
isDisabled: !Boolean(selectedResourceIds.length),
|
|
898
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
899
|
+
isBold: !isNewTheme,
|
|
900
|
+
intlMessage: _objectSpread$4(_objectSpread$4({}, messages.exportOnlySelectedResources), {}, {
|
|
901
|
+
values: {
|
|
902
|
+
resourceType: resourceTypePlural,
|
|
903
|
+
count: selectedResourceIds.length
|
|
904
|
+
}
|
|
905
|
+
})
|
|
906
|
+
})
|
|
907
|
+
})]
|
|
908
|
+
})
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
913
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$3(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$3(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
914
|
+
function ExportTextMessage() {
|
|
915
|
+
const _useExportResourcesCo = useExportResourcesContext(),
|
|
916
|
+
resourceType = _useExportResourcesCo.resourceType,
|
|
917
|
+
allResourcesCount = _useExportResourcesCo.allResourcesCount,
|
|
918
|
+
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
919
|
+
matchingResourcesCount = _useExportResourcesCo.matchingResourcesCount,
|
|
920
|
+
formik = _useExportResourcesCo.formik;
|
|
921
|
+
const resourceTypePlural = resourceTypeToPlural({
|
|
922
|
+
resourceType: resourceType
|
|
923
|
+
});
|
|
924
|
+
switch (_valuesInstanceProperty__default["default"](formik).exportSelectionType) {
|
|
925
|
+
case EXPORT_SELECTION_TYPES.ALL_RESOURCES:
|
|
926
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
927
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages.exportAllMessage), {}, {
|
|
840
928
|
values: {
|
|
841
|
-
|
|
929
|
+
count: allResourcesCount,
|
|
930
|
+
resourceType: resourceTypePlural,
|
|
931
|
+
b: getBold
|
|
842
932
|
}
|
|
843
933
|
})
|
|
844
|
-
})
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
934
|
+
});
|
|
935
|
+
case EXPORT_SELECTION_TYPES.ONLY_MATCHING:
|
|
936
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
937
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages.exportMatchingMessage), {}, {
|
|
938
|
+
values: {
|
|
939
|
+
count: matchingResourcesCount,
|
|
940
|
+
resourceType: resourceTypePlural,
|
|
941
|
+
b: getBold
|
|
942
|
+
}
|
|
943
|
+
})
|
|
944
|
+
});
|
|
945
|
+
case EXPORT_SELECTION_TYPES.ONLY_SELECTED:
|
|
946
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
947
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages.exportSelectedMessage), {}, {
|
|
948
|
+
values: {
|
|
949
|
+
count: selectedResourceIds.length,
|
|
950
|
+
resourceType: resourceTypePlural,
|
|
951
|
+
b: getBold
|
|
952
|
+
}
|
|
953
|
+
})
|
|
954
|
+
});
|
|
955
|
+
default:
|
|
956
|
+
throw new UnexpectedSelectionTypeError(_valuesInstanceProperty__default["default"](formik).exportSelectionType);
|
|
957
|
+
}
|
|
849
958
|
}
|
|
850
|
-
ExportFields.propTypes = {};
|
|
851
959
|
|
|
852
960
|
const ExportSelection = () => {
|
|
853
961
|
const _useTheme = designSystem.useTheme(),
|
|
@@ -911,8 +1019,8 @@ const ExportSelection = () => {
|
|
|
911
1019
|
});
|
|
912
1020
|
};
|
|
913
1021
|
|
|
914
|
-
function ownKeys$
|
|
915
|
-
function _objectSpread$
|
|
1022
|
+
function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1023
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
916
1024
|
const ExportProperties = props => {
|
|
917
1025
|
const _useTheme = designSystem.useTheme(),
|
|
918
1026
|
isNewTheme = _useTheme.isNewTheme;
|
|
@@ -929,36 +1037,15 @@ const ExportProperties = props => {
|
|
|
929
1037
|
return jsxRuntime.jsx(uiKit.CollapsiblePanel, {
|
|
930
1038
|
header: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
931
1039
|
isBold: true,
|
|
932
|
-
intlMessage: _objectSpread$
|
|
1040
|
+
intlMessage: _objectSpread$2({}, messages.propertiesPanelLabel)
|
|
933
1041
|
}),
|
|
934
1042
|
children: props.renderProperties()
|
|
935
1043
|
});
|
|
936
1044
|
};
|
|
937
1045
|
ExportProperties.propTypes = {};
|
|
938
1046
|
|
|
939
|
-
function ownKeys$
|
|
940
|
-
function _objectSpread$
|
|
941
|
-
function renderFileNameError(key) {
|
|
942
|
-
switch (key) {
|
|
943
|
-
case 'missing':
|
|
944
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages.missingFileNameError));
|
|
945
|
-
case 'invalidInput':
|
|
946
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages.invalidFileNameError));
|
|
947
|
-
default:
|
|
948
|
-
return null;
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
function renderLanguageError(key) {
|
|
952
|
-
switch (key) {
|
|
953
|
-
case 'missing':
|
|
954
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages.missingLanguageError));
|
|
955
|
-
default:
|
|
956
|
-
return null;
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
961
|
-
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$3(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$3(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
1047
|
+
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1048
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
962
1049
|
const outputFormatOptions = [{
|
|
963
1050
|
value: OUTPUT_FORMATS.JSON,
|
|
964
1051
|
label: 'JSON'
|
|
@@ -992,12 +1079,12 @@ function ExportFileSettings(props) {
|
|
|
992
1079
|
children: [jsxRuntime.jsx(applicationComponents.PageContentNarrow, {
|
|
993
1080
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
994
1081
|
scale: "xl",
|
|
995
|
-
children: [jsxRuntime.jsx(uiKit.SelectField, _objectSpread$
|
|
1082
|
+
children: [jsxRuntime.jsx(uiKit.SelectField, _objectSpread$1(_objectSpread$1({
|
|
996
1083
|
isDisabled: true
|
|
997
1084
|
}, formik.getFieldProps('outputFormat')), {}, {
|
|
998
1085
|
title: intl.formatMessage(messages.outputFormat),
|
|
999
1086
|
options: outputFormatOptions
|
|
1000
|
-
})), jsxRuntime.jsx(uiKit.TextField, _objectSpread$
|
|
1087
|
+
})), jsxRuntime.jsx(uiKit.TextField, _objectSpread$1(_objectSpread$1({
|
|
1001
1088
|
title: intl.formatMessage(messages.fileName)
|
|
1002
1089
|
}, formik.getFieldProps('fileName')), {}, {
|
|
1003
1090
|
touched: formik.touched.fileName,
|
|
@@ -1005,7 +1092,7 @@ function ExportFileSettings(props) {
|
|
|
1005
1092
|
renderError: renderFileNameError
|
|
1006
1093
|
})), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1007
1094
|
scale: "xs",
|
|
1008
|
-
children: [jsxRuntime.jsx(uiKit.SelectField, _objectSpread$
|
|
1095
|
+
children: [jsxRuntime.jsx(uiKit.SelectField, _objectSpread$1(_objectSpread$1({
|
|
1009
1096
|
id: "languages",
|
|
1010
1097
|
title: intl.formatMessage(messages.localLanguage),
|
|
1011
1098
|
options: mapLanguagesToOptions(languages),
|
|
@@ -1042,13 +1129,13 @@ function ExportFileSettings(props) {
|
|
|
1042
1129
|
scale: "l",
|
|
1043
1130
|
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1044
1131
|
scale: "l",
|
|
1045
|
-
children: [jsxRuntime.jsx(uiKit.SelectField, _objectSpread$
|
|
1132
|
+
children: [jsxRuntime.jsx(uiKit.SelectField, _objectSpread$1(_objectSpread$1({
|
|
1046
1133
|
isDisabled: true
|
|
1047
1134
|
}, formik.getFieldProps('outputFormat')), {}, {
|
|
1048
1135
|
title: intl.formatMessage(messages.outputFormat),
|
|
1049
1136
|
options: outputFormatOptions,
|
|
1050
1137
|
horizontalConstraint: 7
|
|
1051
|
-
})), jsxRuntime.jsx(uiKit.TextField, _objectSpread$
|
|
1138
|
+
})), jsxRuntime.jsx(uiKit.TextField, _objectSpread$1(_objectSpread$1({
|
|
1052
1139
|
title: intl.formatMessage(messages.fileName)
|
|
1053
1140
|
}, formik.getFieldProps('fileName')), {}, {
|
|
1054
1141
|
touched: formik.touched.fileName,
|
|
@@ -1057,7 +1144,7 @@ function ExportFileSettings(props) {
|
|
|
1057
1144
|
horizontalConstraint: 7
|
|
1058
1145
|
}))]
|
|
1059
1146
|
}), jsxRuntime.jsx(uiKit.Spacings.Inline, {
|
|
1060
|
-
children: jsxRuntime.jsx(uiKit.SelectField, _objectSpread$
|
|
1147
|
+
children: jsxRuntime.jsx(uiKit.SelectField, _objectSpread$1(_objectSpread$1({
|
|
1061
1148
|
id: "languages",
|
|
1062
1149
|
title: jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1063
1150
|
scale: "s",
|
|
@@ -1097,155 +1184,69 @@ function ExportFileSettings(props) {
|
|
|
1097
1184
|
ExportFileSettings.displayName = 'ExportFileSettings';
|
|
1098
1185
|
ExportFileSettings.propTypes = {};
|
|
1099
1186
|
|
|
1100
|
-
|
|
1101
|
-
let projectKey = _ref.projectKey,
|
|
1102
|
-
graphQuery = _ref.graphQuery,
|
|
1103
|
-
asyncDispatchFn = _ref.asyncDispatchFn;
|
|
1104
|
-
const uri = "/proxy/export/".concat(projectKey, "/export-operations");
|
|
1105
|
-
const response = await asyncDispatchFn(sdk.actions.post({
|
|
1106
|
-
// FIXME: EXPORT is undefined
|
|
1107
|
-
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.EXPORT,
|
|
1108
|
-
uri: uri,
|
|
1109
|
-
headers: {
|
|
1110
|
-
accept: 'application/json'
|
|
1111
|
-
},
|
|
1112
|
-
payload: {
|
|
1113
|
-
query: graphQuery
|
|
1114
|
-
}
|
|
1115
|
-
}));
|
|
1116
|
-
return response;
|
|
1117
|
-
}
|
|
1187
|
+
const ExportResourcesContext = /*#__PURE__*/react$1.createContext();
|
|
1118
1188
|
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
}),
|
|
1165
|
-
isOpen: props.isOpen,
|
|
1166
|
-
onClose: props.closeModal,
|
|
1167
|
-
onCancel: props.closeModal,
|
|
1168
|
-
onConfirm: async () => {
|
|
1169
|
-
setExportOperationStarted(false);
|
|
1170
|
-
const graphQuery = buildGraphQuery({
|
|
1171
|
-
resourceType: resourceType,
|
|
1172
|
-
selectedResourceIds: selectedResourceIds,
|
|
1173
|
-
fields: _valuesInstanceProperty__default["default"](formik).fields,
|
|
1174
|
-
exportSelectionType: _valuesInstanceProperty__default["default"](formik).exportSelectionType,
|
|
1175
|
-
languages: _valuesInstanceProperty__default["default"](formik).languages
|
|
1176
|
-
});
|
|
1177
|
-
props.closeModal();
|
|
1178
|
-
try {
|
|
1179
|
-
const response = await createExportOperation({
|
|
1180
|
-
projectKey,
|
|
1181
|
-
graphQuery,
|
|
1182
|
-
asyncDispatchFn: asyncDispatch
|
|
1183
|
-
});
|
|
1184
|
-
switch (response.state) {
|
|
1185
|
-
case EXPORT_OPERATION_STATES.PROCESSING:
|
|
1186
|
-
case EXPORT_OPERATION_STATES.COMPLETED:
|
|
1187
|
-
setExportOperationStarted(true);
|
|
1188
|
-
break;
|
|
1189
|
-
default:
|
|
1190
|
-
throw new UnexpectedExportOperationStateError(response.state);
|
|
1191
|
-
}
|
|
1192
|
-
} catch (errors) {
|
|
1193
|
-
actionsGlobal.showApiErrorNotification({
|
|
1194
|
-
errors
|
|
1195
|
-
});
|
|
1196
|
-
}
|
|
1189
|
+
PropTypes__default["default"].shape({
|
|
1190
|
+
resourceType: PropTypes__default["default"].string.isRequired,
|
|
1191
|
+
outputFormat: PropTypes__default["default"].string,
|
|
1192
|
+
isOpen: PropTypes__default["default"].bool.isRequired,
|
|
1193
|
+
closeModal: PropTypes__default["default"].func.isRequired,
|
|
1194
|
+
allResourcesCount: PropTypes__default["default"].number.isRequired,
|
|
1195
|
+
matchingResourcesCount: PropTypes__default["default"].number,
|
|
1196
|
+
selectedResourceIds: PropTypes__default["default"].array,
|
|
1197
|
+
// TODO: Circular reference
|
|
1198
|
+
fields: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
1199
|
+
key: PropTypes__default["default"].string.isRequired,
|
|
1200
|
+
label: PropTypes__default["default"].string,
|
|
1201
|
+
isLocalized: PropTypes__default["default"].bool,
|
|
1202
|
+
fields: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
1203
|
+
key: PropTypes__default["default"].string.isRequired,
|
|
1204
|
+
label: PropTypes__default["default"].string,
|
|
1205
|
+
isLocalized: PropTypes__default["default"].bool
|
|
1206
|
+
}))
|
|
1207
|
+
})).isRequired,
|
|
1208
|
+
exportSelectionType: PropTypes__default["default"].string,
|
|
1209
|
+
appliedSearchTerms: PropTypes__default["default"].array,
|
|
1210
|
+
appliedFilters: PropTypes__default["default"].array,
|
|
1211
|
+
renderProperties: PropTypes__default["default"].func
|
|
1212
|
+
}).isRequired;
|
|
1213
|
+
|
|
1214
|
+
const ExportResourcesContextProvider = props => {
|
|
1215
|
+
var _context;
|
|
1216
|
+
const todayFormatted = moment__default["default"]().format('DD-MM-YY_HH-mm');
|
|
1217
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
1218
|
+
language: applicationContext.dataLocale
|
|
1219
|
+
})),
|
|
1220
|
+
language = _useApplicationContex.language;
|
|
1221
|
+
const formik$1 = formik.useFormik({
|
|
1222
|
+
initialValues: {
|
|
1223
|
+
outputFormat: props.outputFormat,
|
|
1224
|
+
fileName: _concatInstanceProperty__default["default"](_context = "".concat(resourceTypeToPlural({
|
|
1225
|
+
resourceType: props.resourceType,
|
|
1226
|
+
isUpperCase: true
|
|
1227
|
+
}), "_Export_")).call(_context, todayFormatted),
|
|
1228
|
+
languages: [language],
|
|
1229
|
+
fields: props.fields,
|
|
1230
|
+
appliedSearchTerms: props.appliedSearchTerms,
|
|
1231
|
+
appliedFilters: props.appliedFilters,
|
|
1232
|
+
exportSelectionType: props.exportSelectionType,
|
|
1233
|
+
isAllLanguagesChecked: false
|
|
1197
1234
|
},
|
|
1198
|
-
|
|
1199
|
-
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1200
|
-
intlMessage: _objectSpread$2(_objectSpread$2({}, messages.confirmationBodyPlan), {}, {
|
|
1201
|
-
values: {
|
|
1202
|
-
resourceType: resourceTypePlural,
|
|
1203
|
-
projectName: projectName,
|
|
1204
|
-
count: countInConfirmationMessage(),
|
|
1205
|
-
bold: getBold
|
|
1206
|
-
}
|
|
1207
|
-
})
|
|
1208
|
-
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1209
|
-
intlMessage: messages.confirmationBodyQuestion
|
|
1210
|
-
})]
|
|
1211
|
-
})
|
|
1235
|
+
validate
|
|
1212
1236
|
});
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
function ExportOperationSuccessMessage(_ref) {
|
|
1223
|
-
let isShown = _ref.isShown;
|
|
1224
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => {
|
|
1225
|
-
var _applicationContext$p;
|
|
1226
|
-
return {
|
|
1227
|
-
projectKey: (_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.key
|
|
1228
|
-
};
|
|
1229
|
-
}),
|
|
1230
|
-
projectKey = _useApplicationContex.projectKey;
|
|
1231
|
-
if (!isShown) return null;
|
|
1232
|
-
return jsxRuntime.jsx("div", {
|
|
1233
|
-
css: styles.successMessage,
|
|
1234
|
-
"data-testid": "export-started-message",
|
|
1235
|
-
children: jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
1236
|
-
max: 16,
|
|
1237
|
-
children: jsxRuntime.jsx(uiKit.ContentNotification, {
|
|
1238
|
-
type: "success",
|
|
1239
|
-
intlMessage: _objectSpread$1(_objectSpread$1({}, messages.exportOperationSuccessMessage), {}, {
|
|
1240
|
-
values: {
|
|
1241
|
-
logsLink: msg => getExportLogsLink(projectKey, msg)
|
|
1242
|
-
}
|
|
1243
|
-
})
|
|
1244
|
-
})
|
|
1245
|
-
})
|
|
1237
|
+
return jsxRuntime.jsx(ExportResourcesContext.Provider, {
|
|
1238
|
+
value: {
|
|
1239
|
+
formik: formik$1,
|
|
1240
|
+
resourceType: props.resourceType,
|
|
1241
|
+
allResourcesCount: props.allResourcesCount,
|
|
1242
|
+
matchingResourcesCount: props.matchingResourcesCount,
|
|
1243
|
+
selectedResourceIds: props.selectedResourceIds
|
|
1244
|
+
},
|
|
1245
|
+
children: props.children
|
|
1246
1246
|
});
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1247
|
+
};
|
|
1248
|
+
ExportResourcesContextProvider.displayName = 'ExportResourcesContextProvider';
|
|
1249
|
+
ExportResourcesContextProvider.propTypes = {};
|
|
1249
1250
|
|
|
1250
1251
|
const _excluded = ["renderProperties"];
|
|
1251
1252
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -1261,8 +1262,7 @@ const ExportResourcesModal = _ref => {
|
|
|
1261
1262
|
return jsxRuntime.jsx(ExportResourcesContextProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
1262
1263
|
children: jsxRuntime.jsx(ExportResourcesContext.Consumer, {
|
|
1263
1264
|
children: _ref2 => {
|
|
1264
|
-
let formik = _ref2.formik
|
|
1265
|
-
exportOperationStarted = _ref2.exportOperationStarted;
|
|
1265
|
+
let formik = _ref2.formik;
|
|
1266
1266
|
return jsxRuntime.jsxs(applicationComponents.FormModalPage, {
|
|
1267
1267
|
title: intl.formatMessage(messages.modalTitle, {
|
|
1268
1268
|
resourceType: resourceTypePlural
|
|
@@ -1279,14 +1279,13 @@ const ExportResourcesModal = _ref => {
|
|
|
1279
1279
|
resourceType: props.resourceType
|
|
1280
1280
|
}),
|
|
1281
1281
|
onPrimaryButtonClick: confirmationModal.openModal,
|
|
1282
|
-
children: [jsxRuntime.jsx(
|
|
1283
|
-
isShown: exportOperationStarted
|
|
1284
|
-
}), jsxRuntime.jsx(ExportFileSettings, {
|
|
1282
|
+
children: [jsxRuntime.jsx(ExportFileSettings, {
|
|
1285
1283
|
renderProperties: renderProperties
|
|
1286
1284
|
}), jsxRuntime.jsx(ExportConfirmationModal, {
|
|
1287
1285
|
resourceType: props.resourceType,
|
|
1288
1286
|
isOpen: confirmationModal.isModalOpen,
|
|
1289
|
-
closeModal: confirmationModal.closeModal
|
|
1287
|
+
closeModal: confirmationModal.closeModal,
|
|
1288
|
+
onCloseParentModal: props.closeModal
|
|
1290
1289
|
})]
|
|
1291
1290
|
});
|
|
1292
1291
|
}
|