config-editor-base 3.0.8 → 3.0.9
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/dist/index.js +36 -47
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +36 -47
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -2
package/dist/index.modern.js
CHANGED
|
@@ -1317,7 +1317,6 @@ var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, conte
|
|
|
1317
1317
|
var setUpdatedFormData = function setUpdatedFormData(formData) {
|
|
1318
1318
|
return function (dispatch) {
|
|
1319
1319
|
dispatch(setUpdatedFormDataValue(formData));
|
|
1320
|
-
dispatch(setConfigContent(formData));
|
|
1321
1320
|
dispatch(calcCrc32EditorLive());
|
|
1322
1321
|
};
|
|
1323
1322
|
};
|
|
@@ -19161,10 +19160,8 @@ var selectOptions$1 = function selectOptions(Files) {
|
|
|
19161
19160
|
});
|
|
19162
19161
|
};
|
|
19163
19162
|
var pastCrc32 = "N/A";
|
|
19164
|
-
var _require$1 = require("
|
|
19165
|
-
|
|
19166
|
-
var _require2 = require("detect-browser"),
|
|
19167
|
-
detect$1 = _require2.detect;
|
|
19163
|
+
var _require$1 = require("detect-browser"),
|
|
19164
|
+
detect$1 = _require$1.detect;
|
|
19168
19165
|
var browser$1 = detect$1();
|
|
19169
19166
|
var crcBrowserSupport$1 = ["chrome", "firefox", "opera", "safari", "edge"].includes(browser$1.name);
|
|
19170
19167
|
var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
|
|
@@ -19188,15 +19185,6 @@ var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
|
|
|
19188
19185
|
}
|
|
19189
19186
|
_inheritsLoose(EditorChangesComparison, _React$Component);
|
|
19190
19187
|
var _proto = EditorChangesComparison.prototype;
|
|
19191
|
-
_proto.buildDiffString = function buildDiffString(past, current) {
|
|
19192
|
-
var hunks = unifiedDiff(past.split(/\r\n|\r|\n/), current.split(/\r\n|\r|\n/), {
|
|
19193
|
-
fromfile: "original_config",
|
|
19194
|
-
tofile: "new_config"
|
|
19195
|
-
});
|
|
19196
|
-
return "diff --git original_config new_config\n" + hunks.map(function (line) {
|
|
19197
|
-
return line.replace(/\n$/, "");
|
|
19198
|
-
}).join("\n");
|
|
19199
|
-
};
|
|
19200
19188
|
_proto.render = function render() {
|
|
19201
19189
|
var _this$props = this.props,
|
|
19202
19190
|
options = _this$props.options,
|
|
@@ -19211,8 +19199,8 @@ var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
|
|
|
19211
19199
|
externalSubmit = _this$props.externalSubmit;
|
|
19212
19200
|
var pastCleaned = past && Object.keys(past).length ? JSON.stringify(JSON.parse(past), null, 2) : "";
|
|
19213
19201
|
if (crcBrowserSupport$1 == 1 && past && Object.keys(past).length) {
|
|
19214
|
-
var
|
|
19215
|
-
crc32 =
|
|
19202
|
+
var _require2 = require("crc"),
|
|
19203
|
+
crc32 = _require2.crc32;
|
|
19216
19204
|
pastCrc32 = crc32(past).toString(16).toUpperCase().padStart(8, "0");
|
|
19217
19205
|
} else {
|
|
19218
19206
|
pastCrc32 = "N/A";
|
|
@@ -19274,15 +19262,16 @@ var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
|
|
|
19274
19262
|
className: "field-description"
|
|
19275
19263
|
}, "This will be the name of the new Configuration File"))))), /*#__PURE__*/React.createElement("div", {
|
|
19276
19264
|
className: "modal-custom-content"
|
|
19277
|
-
}, /*#__PURE__*/React.createElement("div", null,
|
|
19265
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ReactGhLikeDiff, {
|
|
19278
19266
|
options: {
|
|
19279
19267
|
originalFileName: "original_config",
|
|
19280
19268
|
updatedFileName: "new_config",
|
|
19281
19269
|
matchWordsThreshold: 0.25,
|
|
19282
19270
|
matchingMaxComparisons: 5000
|
|
19283
19271
|
},
|
|
19284
|
-
|
|
19285
|
-
|
|
19272
|
+
past: this.state.hideWhiteSpace ? pastCleaned : past,
|
|
19273
|
+
current: JSON.stringify(current, null, 2)
|
|
19274
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
19286
19275
|
className: "modal-custom-footer"
|
|
19287
19276
|
}, /*#__PURE__*/React.createElement("button", {
|
|
19288
19277
|
type: "submit",
|
|
@@ -19360,37 +19349,37 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19360
19349
|
}
|
|
19361
19350
|
};
|
|
19362
19351
|
_proto.subMenuBtnClick = function subMenuBtnClick(name) {
|
|
19363
|
-
var _this2 = this;
|
|
19364
19352
|
var sideBar = this.state.activeSideBar == name ? 'none' : name;
|
|
19353
|
+
this.props.setConfigContentPreSubmit();
|
|
19365
19354
|
this.setState({
|
|
19366
19355
|
activeSideBar: sideBar,
|
|
19367
19356
|
isSideBarExpanded: sideBar === 'none' ? false : this.state.isSideBarExpanded
|
|
19368
|
-
}, function () {
|
|
19369
|
-
_this2.props.setConfigContentPreSubmit();
|
|
19370
19357
|
});
|
|
19371
19358
|
};
|
|
19372
19359
|
_proto.toggleSideBarExpand = function toggleSideBarExpand() {
|
|
19360
|
+
this.props.setConfigContentPreSubmit();
|
|
19373
19361
|
this.setState({
|
|
19374
19362
|
isSideBarExpanded: !this.state.isSideBarExpanded
|
|
19375
19363
|
});
|
|
19376
19364
|
};
|
|
19377
19365
|
_proto.hideUischemaModal = function hideUischemaModal() {
|
|
19366
|
+
this.props.setConfigContentPreSubmit();
|
|
19378
19367
|
this.setState({
|
|
19379
19368
|
showUischemaModal: false
|
|
19380
19369
|
});
|
|
19381
19370
|
};
|
|
19382
19371
|
_proto.handleDropdownChange = function handleDropdownChange(selection, dropdown) {
|
|
19383
19372
|
var _this$setState,
|
|
19384
|
-
|
|
19373
|
+
_this2 = this;
|
|
19385
19374
|
var fileType = getFileType(dropdown);
|
|
19386
19375
|
this.setState((_this$setState = {}, _this$setState[fileType] = selection, _this$setState['selected' + fileType] = selection, _this$setState[fileType.replace('-', '')] = {
|
|
19387
19376
|
value: selection,
|
|
19388
19377
|
label: selection
|
|
19389
19378
|
}, _this$setState), function () {
|
|
19390
|
-
if (
|
|
19391
|
-
|
|
19379
|
+
if (_this2.s3 && !selection.includes('Simple') && !selection.includes('Advanced') && !selection.includes('(local)')) {
|
|
19380
|
+
_this2.props.fetchFileContentExt(selection, fileType);
|
|
19392
19381
|
} else {
|
|
19393
|
-
|
|
19382
|
+
_this2.props.fetchFileContent(selection, fileType);
|
|
19394
19383
|
}
|
|
19395
19384
|
});
|
|
19396
19385
|
};
|
|
@@ -19418,7 +19407,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19418
19407
|
document.removeEventListener('keydown', this.escFunction, false);
|
|
19419
19408
|
};
|
|
19420
19409
|
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
19421
|
-
var
|
|
19410
|
+
var _this3 = this;
|
|
19422
19411
|
var uiLocal = nextProps.editorUISchemaFiles.filter(function (file) {
|
|
19423
19412
|
return file.name.includes('(local)');
|
|
19424
19413
|
});
|
|
@@ -19460,15 +19449,15 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19460
19449
|
}
|
|
19461
19450
|
}, function () {
|
|
19462
19451
|
if (configName.includes('(local)')) {
|
|
19463
|
-
|
|
19464
|
-
} else if (
|
|
19465
|
-
|
|
19452
|
+
_this3.props.fetchFileContent(configName, 'config-review');
|
|
19453
|
+
} else if (_this3.s3) {
|
|
19454
|
+
_this3.props.fetchFileContentExt(configName, 'config-review');
|
|
19466
19455
|
}
|
|
19467
19456
|
});
|
|
19468
19457
|
}
|
|
19469
19458
|
};
|
|
19470
19459
|
_proto.onSubmit = function onSubmit(_ref2) {
|
|
19471
|
-
var
|
|
19460
|
+
var _this4 = this;
|
|
19472
19461
|
var formData = _ref2.formData;
|
|
19473
19462
|
if (this.props.schemaContent == undefined || this.props.schemaContent == null) {
|
|
19474
19463
|
this.props.showAlert('info', 'No Rule Schema has been loaded');
|
|
@@ -19488,12 +19477,12 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19488
19477
|
isSubmitting: true
|
|
19489
19478
|
}, function () {
|
|
19490
19479
|
var tempJson = JSON.stringify(formData, null, 2);
|
|
19491
|
-
|
|
19492
|
-
var revisedConfigFileSchema =
|
|
19480
|
+
_this4.props.setConfigContent(JSON.parse(tempJson));
|
|
19481
|
+
var revisedConfigFileSchema = _this4.state.schema;
|
|
19493
19482
|
var revisedConfigFile = "config-" + revisedConfigFileSchema.match(regexRevision);
|
|
19494
|
-
if (
|
|
19495
|
-
|
|
19496
|
-
|
|
19483
|
+
if (_this4.state.isCompareChanges === false) {
|
|
19484
|
+
_this4.props.runConfigurationWarningChecks(formData);
|
|
19485
|
+
_this4.setState({
|
|
19497
19486
|
isCompareChanges: true,
|
|
19498
19487
|
revisedConfigFile: {
|
|
19499
19488
|
value: revisedConfigFile,
|
|
@@ -19503,16 +19492,16 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19503
19492
|
document.body.style.overflow = 'hidden';
|
|
19504
19493
|
} else {
|
|
19505
19494
|
if (isDownloadConfig) {
|
|
19506
|
-
|
|
19495
|
+
_this4.props.saveUpdatedConfiguration(revisedConfigFile, formData);
|
|
19507
19496
|
isDownloadConfig = false;
|
|
19508
19497
|
document.body.style.overflow = 'auto';
|
|
19509
|
-
|
|
19498
|
+
_this4.setState({
|
|
19510
19499
|
isCompareChanges: false
|
|
19511
19500
|
});
|
|
19512
19501
|
} else {
|
|
19513
|
-
|
|
19502
|
+
_this4.props.updateConfigFileExt(JSON.stringify(formData, null, 2), "" + revisedConfigFile);
|
|
19514
19503
|
document.body.style.overflow = 'auto';
|
|
19515
|
-
|
|
19504
|
+
_this4.setState({
|
|
19516
19505
|
isCompareChanges: false
|
|
19517
19506
|
});
|
|
19518
19507
|
}
|
|
@@ -19524,7 +19513,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19524
19513
|
this.props.showAlert('danger', 'The config contains validation errors (see top of editor) - please review and try again');
|
|
19525
19514
|
};
|
|
19526
19515
|
_proto.render = function render() {
|
|
19527
|
-
var
|
|
19516
|
+
var _this5 = this;
|
|
19528
19517
|
var _this$props = this.props,
|
|
19529
19518
|
editorSchemaFiles = _this$props.editorSchemaFiles,
|
|
19530
19519
|
editorConfigFiles = _this$props.editorConfigFiles,
|
|
@@ -19536,7 +19525,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19536
19525
|
sideBarPadding = _this$props.sideBarPadding;
|
|
19537
19526
|
var editorUISchemaFile = editorUISchemaFiles[0] ? editorUISchemaFiles[0].name : "";
|
|
19538
19527
|
var editorUIAdvancedSimpleTest = editorUISchemaFile.includes("Simple") || editorUISchemaFile.includes("Advanced");
|
|
19539
|
-
var FormWithNav = schemaContent ?
|
|
19528
|
+
var FormWithNav = schemaContent ? applyNav(Form, EditorNavs) : Form;
|
|
19540
19529
|
var editorToolsFull = editorTools.concat({
|
|
19541
19530
|
name: 'partialconfig-modal',
|
|
19542
19531
|
comment: 'Partial config loader',
|
|
@@ -19572,16 +19561,16 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19572
19561
|
return /*#__PURE__*/React.createElement("div", {
|
|
19573
19562
|
key: idx,
|
|
19574
19563
|
style: {
|
|
19575
|
-
display: modal.name ==
|
|
19564
|
+
display: modal.name == _this5.state.activeSideBar ? '' : 'none'
|
|
19576
19565
|
}
|
|
19577
19566
|
}, /*#__PURE__*/React.createElement(EditorToolModalWrapper, {
|
|
19578
19567
|
modal: modal.modal,
|
|
19579
19568
|
name: modal.name,
|
|
19580
19569
|
onClick: function onClick() {
|
|
19581
|
-
return
|
|
19570
|
+
return _this5.subMenuBtnClick('none');
|
|
19582
19571
|
},
|
|
19583
|
-
isExpanded:
|
|
19584
|
-
onToggleExpand:
|
|
19572
|
+
isExpanded: _this5.state.isSideBarExpanded,
|
|
19573
|
+
onToggleExpand: _this5.toggleSideBarExpand
|
|
19585
19574
|
}));
|
|
19586
19575
|
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("div", null, editorConfigFiles.length == 0 && this.props.demoMode == false ? /*#__PURE__*/React.createElement("div", {
|
|
19587
19576
|
className: "schema-loader-callout config-loader"
|
|
@@ -19657,7 +19646,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19657
19646
|
return /*#__PURE__*/React.createElement(EditorToolButton, {
|
|
19658
19647
|
key: idx,
|
|
19659
19648
|
onClick: function onClick() {
|
|
19660
|
-
return
|
|
19649
|
+
return _this5.subMenuBtnClick(modal.name);
|
|
19661
19650
|
},
|
|
19662
19651
|
comment: modal.comment,
|
|
19663
19652
|
className: modal["class"]
|