config-editor-base 3.0.8 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +36 -48
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +36 -48
- 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",
|
|
@@ -19308,7 +19297,6 @@ var EditorChangesComparison$1 = connect(mapStateToProps$1)(EditorChangesComparis
|
|
|
19308
19297
|
var regexRevision = new RegExp('\\d{2}\\.\\d{2}\\.json', 'g');
|
|
19309
19298
|
var isDownloadConfig = false;
|
|
19310
19299
|
var activatedTab;
|
|
19311
|
-
var FormWithNavStable = applyNav(Form, EditorNavs);
|
|
19312
19300
|
var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
19313
19301
|
function EditorSection(props) {
|
|
19314
19302
|
var _this;
|
|
@@ -19360,37 +19348,37 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19360
19348
|
}
|
|
19361
19349
|
};
|
|
19362
19350
|
_proto.subMenuBtnClick = function subMenuBtnClick(name) {
|
|
19363
|
-
var _this2 = this;
|
|
19364
19351
|
var sideBar = this.state.activeSideBar == name ? 'none' : name;
|
|
19352
|
+
this.props.setConfigContentPreSubmit();
|
|
19365
19353
|
this.setState({
|
|
19366
19354
|
activeSideBar: sideBar,
|
|
19367
19355
|
isSideBarExpanded: sideBar === 'none' ? false : this.state.isSideBarExpanded
|
|
19368
|
-
}, function () {
|
|
19369
|
-
_this2.props.setConfigContentPreSubmit();
|
|
19370
19356
|
});
|
|
19371
19357
|
};
|
|
19372
19358
|
_proto.toggleSideBarExpand = function toggleSideBarExpand() {
|
|
19359
|
+
this.props.setConfigContentPreSubmit();
|
|
19373
19360
|
this.setState({
|
|
19374
19361
|
isSideBarExpanded: !this.state.isSideBarExpanded
|
|
19375
19362
|
});
|
|
19376
19363
|
};
|
|
19377
19364
|
_proto.hideUischemaModal = function hideUischemaModal() {
|
|
19365
|
+
this.props.setConfigContentPreSubmit();
|
|
19378
19366
|
this.setState({
|
|
19379
19367
|
showUischemaModal: false
|
|
19380
19368
|
});
|
|
19381
19369
|
};
|
|
19382
19370
|
_proto.handleDropdownChange = function handleDropdownChange(selection, dropdown) {
|
|
19383
19371
|
var _this$setState,
|
|
19384
|
-
|
|
19372
|
+
_this2 = this;
|
|
19385
19373
|
var fileType = getFileType(dropdown);
|
|
19386
19374
|
this.setState((_this$setState = {}, _this$setState[fileType] = selection, _this$setState['selected' + fileType] = selection, _this$setState[fileType.replace('-', '')] = {
|
|
19387
19375
|
value: selection,
|
|
19388
19376
|
label: selection
|
|
19389
19377
|
}, _this$setState), function () {
|
|
19390
|
-
if (
|
|
19391
|
-
|
|
19378
|
+
if (_this2.s3 && !selection.includes('Simple') && !selection.includes('Advanced') && !selection.includes('(local)')) {
|
|
19379
|
+
_this2.props.fetchFileContentExt(selection, fileType);
|
|
19392
19380
|
} else {
|
|
19393
|
-
|
|
19381
|
+
_this2.props.fetchFileContent(selection, fileType);
|
|
19394
19382
|
}
|
|
19395
19383
|
});
|
|
19396
19384
|
};
|
|
@@ -19418,7 +19406,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19418
19406
|
document.removeEventListener('keydown', this.escFunction, false);
|
|
19419
19407
|
};
|
|
19420
19408
|
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
19421
|
-
var
|
|
19409
|
+
var _this3 = this;
|
|
19422
19410
|
var uiLocal = nextProps.editorUISchemaFiles.filter(function (file) {
|
|
19423
19411
|
return file.name.includes('(local)');
|
|
19424
19412
|
});
|
|
@@ -19460,15 +19448,15 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19460
19448
|
}
|
|
19461
19449
|
}, function () {
|
|
19462
19450
|
if (configName.includes('(local)')) {
|
|
19463
|
-
|
|
19464
|
-
} else if (
|
|
19465
|
-
|
|
19451
|
+
_this3.props.fetchFileContent(configName, 'config-review');
|
|
19452
|
+
} else if (_this3.s3) {
|
|
19453
|
+
_this3.props.fetchFileContentExt(configName, 'config-review');
|
|
19466
19454
|
}
|
|
19467
19455
|
});
|
|
19468
19456
|
}
|
|
19469
19457
|
};
|
|
19470
19458
|
_proto.onSubmit = function onSubmit(_ref2) {
|
|
19471
|
-
var
|
|
19459
|
+
var _this4 = this;
|
|
19472
19460
|
var formData = _ref2.formData;
|
|
19473
19461
|
if (this.props.schemaContent == undefined || this.props.schemaContent == null) {
|
|
19474
19462
|
this.props.showAlert('info', 'No Rule Schema has been loaded');
|
|
@@ -19488,12 +19476,12 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19488
19476
|
isSubmitting: true
|
|
19489
19477
|
}, function () {
|
|
19490
19478
|
var tempJson = JSON.stringify(formData, null, 2);
|
|
19491
|
-
|
|
19492
|
-
var revisedConfigFileSchema =
|
|
19479
|
+
_this4.props.setConfigContent(JSON.parse(tempJson));
|
|
19480
|
+
var revisedConfigFileSchema = _this4.state.schema;
|
|
19493
19481
|
var revisedConfigFile = "config-" + revisedConfigFileSchema.match(regexRevision);
|
|
19494
|
-
if (
|
|
19495
|
-
|
|
19496
|
-
|
|
19482
|
+
if (_this4.state.isCompareChanges === false) {
|
|
19483
|
+
_this4.props.runConfigurationWarningChecks(formData);
|
|
19484
|
+
_this4.setState({
|
|
19497
19485
|
isCompareChanges: true,
|
|
19498
19486
|
revisedConfigFile: {
|
|
19499
19487
|
value: revisedConfigFile,
|
|
@@ -19503,16 +19491,16 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19503
19491
|
document.body.style.overflow = 'hidden';
|
|
19504
19492
|
} else {
|
|
19505
19493
|
if (isDownloadConfig) {
|
|
19506
|
-
|
|
19494
|
+
_this4.props.saveUpdatedConfiguration(revisedConfigFile, formData);
|
|
19507
19495
|
isDownloadConfig = false;
|
|
19508
19496
|
document.body.style.overflow = 'auto';
|
|
19509
|
-
|
|
19497
|
+
_this4.setState({
|
|
19510
19498
|
isCompareChanges: false
|
|
19511
19499
|
});
|
|
19512
19500
|
} else {
|
|
19513
|
-
|
|
19501
|
+
_this4.props.updateConfigFileExt(JSON.stringify(formData, null, 2), "" + revisedConfigFile);
|
|
19514
19502
|
document.body.style.overflow = 'auto';
|
|
19515
|
-
|
|
19503
|
+
_this4.setState({
|
|
19516
19504
|
isCompareChanges: false
|
|
19517
19505
|
});
|
|
19518
19506
|
}
|
|
@@ -19524,7 +19512,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19524
19512
|
this.props.showAlert('danger', 'The config contains validation errors (see top of editor) - please review and try again');
|
|
19525
19513
|
};
|
|
19526
19514
|
_proto.render = function render() {
|
|
19527
|
-
var
|
|
19515
|
+
var _this5 = this;
|
|
19528
19516
|
var _this$props = this.props,
|
|
19529
19517
|
editorSchemaFiles = _this$props.editorSchemaFiles,
|
|
19530
19518
|
editorConfigFiles = _this$props.editorConfigFiles,
|
|
@@ -19536,7 +19524,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19536
19524
|
sideBarPadding = _this$props.sideBarPadding;
|
|
19537
19525
|
var editorUISchemaFile = editorUISchemaFiles[0] ? editorUISchemaFiles[0].name : "";
|
|
19538
19526
|
var editorUIAdvancedSimpleTest = editorUISchemaFile.includes("Simple") || editorUISchemaFile.includes("Advanced");
|
|
19539
|
-
var FormWithNav = schemaContent ?
|
|
19527
|
+
var FormWithNav = schemaContent ? applyNav(Form, EditorNavs) : Form;
|
|
19540
19528
|
var editorToolsFull = editorTools.concat({
|
|
19541
19529
|
name: 'partialconfig-modal',
|
|
19542
19530
|
comment: 'Partial config loader',
|
|
@@ -19572,16 +19560,16 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19572
19560
|
return /*#__PURE__*/React.createElement("div", {
|
|
19573
19561
|
key: idx,
|
|
19574
19562
|
style: {
|
|
19575
|
-
display: modal.name ==
|
|
19563
|
+
display: modal.name == _this5.state.activeSideBar ? '' : 'none'
|
|
19576
19564
|
}
|
|
19577
19565
|
}, /*#__PURE__*/React.createElement(EditorToolModalWrapper, {
|
|
19578
19566
|
modal: modal.modal,
|
|
19579
19567
|
name: modal.name,
|
|
19580
19568
|
onClick: function onClick() {
|
|
19581
|
-
return
|
|
19569
|
+
return _this5.subMenuBtnClick('none');
|
|
19582
19570
|
},
|
|
19583
|
-
isExpanded:
|
|
19584
|
-
onToggleExpand:
|
|
19571
|
+
isExpanded: _this5.state.isSideBarExpanded,
|
|
19572
|
+
onToggleExpand: _this5.toggleSideBarExpand
|
|
19585
19573
|
}));
|
|
19586
19574
|
}), /*#__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
19575
|
className: "schema-loader-callout config-loader"
|
|
@@ -19657,7 +19645,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
|
|
|
19657
19645
|
return /*#__PURE__*/React.createElement(EditorToolButton, {
|
|
19658
19646
|
key: idx,
|
|
19659
19647
|
onClick: function onClick() {
|
|
19660
|
-
return
|
|
19648
|
+
return _this5.subMenuBtnClick(modal.name);
|
|
19661
19649
|
},
|
|
19662
19650
|
comment: modal.comment,
|
|
19663
19651
|
className: modal["class"]
|