config-editor-base 3.0.7 → 3.0.8

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.
@@ -1113,6 +1113,17 @@ var checkRTCAdjustment = function checkRTCAdjustment(content) {
1113
1113
  }
1114
1114
  };
1115
1115
  };
1116
+ var checkRTCSyncManual = function checkRTCSyncManual(content) {
1117
+ return function (dispatch) {
1118
+ if (content.rtc != undefined && content.rtc.sync === 1) {
1119
+ dispatch(set({
1120
+ type: "warning",
1121
+ message: "You have set the RTC synchronization method to 'Manual update'. This is only intended for one-off RTC resets. Once you have properly reset the RTC, change the method to one of the other methods",
1122
+ autoClear: false
1123
+ }));
1124
+ }
1125
+ };
1126
+ };
1116
1127
  var checkConfigTlsPort = function checkConfigTlsPort(content) {
1117
1128
  return function (dispatch) {
1118
1129
  if (content.connect != undefined && content.connect.s3 != undefined && content.connect.s3.server != undefined) {
@@ -1264,6 +1275,7 @@ var runConfigurationWarningChecks = function runConfigurationWarningChecks(conte
1264
1275
  dispatch(checkWiFiEncryptedPasswordsNoKpub(content));
1265
1276
  dispatch(checkFileSplitOffsetPeriod(content));
1266
1277
  dispatch(checkRTCAdjustment(content));
1278
+ dispatch(checkRTCSyncManual(content));
1267
1279
  dispatch(checkConfigTlsPort(content));
1268
1280
  dispatch(checkFileSplitValue(content));
1269
1281
  dispatch(checkMissingAPN(content));
@@ -1305,6 +1317,7 @@ var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, conte
1305
1317
  var setUpdatedFormData = function setUpdatedFormData(formData) {
1306
1318
  return function (dispatch) {
1307
1319
  dispatch(setUpdatedFormDataValue(formData));
1320
+ dispatch(setConfigContent(formData));
1308
1321
  dispatch(calcCrc32EditorLive());
1309
1322
  };
1310
1323
  };
@@ -1406,6 +1419,7 @@ var actions = {
1406
1419
  checkWiFiEncryptedPasswordsNoKpub: checkWiFiEncryptedPasswordsNoKpub,
1407
1420
  checkFileSplitOffsetPeriod: checkFileSplitOffsetPeriod,
1408
1421
  checkRTCAdjustment: checkRTCAdjustment,
1422
+ checkRTCSyncManual: checkRTCSyncManual,
1409
1423
  checkConfigTlsPort: checkConfigTlsPort,
1410
1424
  checkMissingAPN: checkMissingAPN,
1411
1425
  checkMissingWiFi: checkMissingWiFi,
@@ -19147,8 +19161,10 @@ var selectOptions$1 = function selectOptions(Files) {
19147
19161
  });
19148
19162
  };
19149
19163
  var pastCrc32 = "N/A";
19150
- var _require$1 = require("detect-browser"),
19151
- detect$1 = _require$1.detect;
19164
+ var _require$1 = require("difflib"),
19165
+ unifiedDiff = _require$1.unifiedDiff;
19166
+ var _require2 = require("detect-browser"),
19167
+ detect$1 = _require2.detect;
19152
19168
  var browser$1 = detect$1();
19153
19169
  var crcBrowserSupport$1 = ["chrome", "firefox", "opera", "safari", "edge"].includes(browser$1.name);
19154
19170
  var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
@@ -19172,6 +19188,15 @@ var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
19172
19188
  }
19173
19189
  _inheritsLoose(EditorChangesComparison, _React$Component);
19174
19190
  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
+ };
19175
19200
  _proto.render = function render() {
19176
19201
  var _this$props = this.props,
19177
19202
  options = _this$props.options,
@@ -19186,8 +19211,8 @@ var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
19186
19211
  externalSubmit = _this$props.externalSubmit;
19187
19212
  var pastCleaned = past && Object.keys(past).length ? JSON.stringify(JSON.parse(past), null, 2) : "";
19188
19213
  if (crcBrowserSupport$1 == 1 && past && Object.keys(past).length) {
19189
- var _require2 = require("crc"),
19190
- crc32 = _require2.crc32;
19214
+ var _require3 = require("crc"),
19215
+ crc32 = _require3.crc32;
19191
19216
  pastCrc32 = crc32(past).toString(16).toUpperCase().padStart(8, "0");
19192
19217
  } else {
19193
19218
  pastCrc32 = "N/A";
@@ -19249,16 +19274,15 @@ var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
19249
19274
  className: "field-description"
19250
19275
  }, "This will be the name of the new Configuration File"))))), /*#__PURE__*/React.createElement("div", {
19251
19276
  className: "modal-custom-content"
19252
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ReactGhLikeDiff, {
19277
+ }, /*#__PURE__*/React.createElement("div", null, isCompareChanges ? /*#__PURE__*/React.createElement(ReactGhLikeDiff, {
19253
19278
  options: {
19254
19279
  originalFileName: "original_config",
19255
19280
  updatedFileName: "new_config",
19256
19281
  matchWordsThreshold: 0.25,
19257
19282
  matchingMaxComparisons: 5000
19258
19283
  },
19259
- past: this.state.hideWhiteSpace ? pastCleaned : past,
19260
- current: JSON.stringify(current, null, 2)
19261
- })))), /*#__PURE__*/React.createElement("div", {
19284
+ diffString: this.buildDiffString(this.state.hideWhiteSpace ? pastCleaned : past || "", current ? JSON.stringify(current, null, 2) : "")
19285
+ }) : null))), /*#__PURE__*/React.createElement("div", {
19262
19286
  className: "modal-custom-footer"
19263
19287
  }, /*#__PURE__*/React.createElement("button", {
19264
19288
  type: "submit",
@@ -19284,6 +19308,7 @@ var EditorChangesComparison$1 = connect(mapStateToProps$1)(EditorChangesComparis
19284
19308
  var regexRevision = new RegExp('\\d{2}\\.\\d{2}\\.json', 'g');
19285
19309
  var isDownloadConfig = false;
19286
19310
  var activatedTab;
19311
+ var FormWithNavStable = applyNav(Form, EditorNavs);
19287
19312
  var EditorSection = /*#__PURE__*/function (_React$Component) {
19288
19313
  function EditorSection(props) {
19289
19314
  var _this;
@@ -19320,14 +19345,8 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
19320
19345
  isDownloadConfig: false,
19321
19346
  isCompareChanges: false,
19322
19347
  activeSideBar: 'schema-modal',
19323
- isSideBarExpanded: false,
19324
- showNewToolsHighlight: true
19348
+ isSideBarExpanded: false
19325
19349
  };
19326
- setTimeout(function () {
19327
- _this.setState({
19328
- showNewToolsHighlight: false
19329
- });
19330
- }, 10000);
19331
19350
  _this.toggleSideBarExpand = _this.toggleSideBarExpand.bind(_this);
19332
19351
  _this.input = '';
19333
19352
  _this.s3 = _this.props.fetchFileContentExt ? true : false;
@@ -19395,7 +19414,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
19395
19414
  _proto.componentDidMount = function componentDidMount() {
19396
19415
  document.addEventListener('keydown', this.escFunction, false);
19397
19416
  };
19398
- _proto.componentWillUnMount = function componentWillUnMount() {
19417
+ _proto.componentWillUnmount = function componentWillUnmount() {
19399
19418
  document.removeEventListener('keydown', this.escFunction, false);
19400
19419
  };
19401
19420
  _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
@@ -19517,7 +19536,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
19517
19536
  sideBarPadding = _this$props.sideBarPadding;
19518
19537
  var editorUISchemaFile = editorUISchemaFiles[0] ? editorUISchemaFiles[0].name : "";
19519
19538
  var editorUIAdvancedSimpleTest = editorUISchemaFile.includes("Simple") || editorUISchemaFile.includes("Advanced");
19520
- var FormWithNav = schemaContent ? applyNav(Form, EditorNavs) : Form;
19539
+ var FormWithNav = schemaContent ? FormWithNavStable : Form;
19521
19540
  var editorToolsFull = editorTools.concat({
19522
19541
  name: 'partialconfig-modal',
19523
19542
  comment: 'Partial config loader',
@@ -19643,15 +19662,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
19643
19662
  comment: modal.comment,
19644
19663
  className: modal["class"]
19645
19664
  });
19646
- }), this.state.showNewToolsHighlight && /*#__PURE__*/React.createElement("span", {
19647
- style: {
19648
- fontSize: '12px',
19649
- color: '#337ab7',
19650
- marginLeft: '10px',
19651
- transition: 'opacity 1s ease-out',
19652
- opacity: this.state.showNewToolsHighlight ? 1 : 0
19653
- }
19654
- }, "Tip: New editor tools added"))))))), /*#__PURE__*/React.createElement("div", {
19665
+ }))))))), /*#__PURE__*/React.createElement("div", {
19655
19666
  className: "config-bar-background"
19656
19667
  }));
19657
19668
  };