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.
package/dist/index.js CHANGED
@@ -1116,6 +1116,17 @@ var checkRTCAdjustment = function checkRTCAdjustment(content) {
1116
1116
  }
1117
1117
  };
1118
1118
  };
1119
+ var checkRTCSyncManual = function checkRTCSyncManual(content) {
1120
+ return function (dispatch) {
1121
+ if (content.rtc != undefined && content.rtc.sync === 1) {
1122
+ dispatch(set({
1123
+ type: "warning",
1124
+ 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",
1125
+ autoClear: false
1126
+ }));
1127
+ }
1128
+ };
1129
+ };
1119
1130
  var checkConfigTlsPort = function checkConfigTlsPort(content) {
1120
1131
  return function (dispatch) {
1121
1132
  if (content.connect != undefined && content.connect.s3 != undefined && content.connect.s3.server != undefined) {
@@ -1267,6 +1278,7 @@ var runConfigurationWarningChecks = function runConfigurationWarningChecks(conte
1267
1278
  dispatch(checkWiFiEncryptedPasswordsNoKpub(content));
1268
1279
  dispatch(checkFileSplitOffsetPeriod(content));
1269
1280
  dispatch(checkRTCAdjustment(content));
1281
+ dispatch(checkRTCSyncManual(content));
1270
1282
  dispatch(checkConfigTlsPort(content));
1271
1283
  dispatch(checkFileSplitValue(content));
1272
1284
  dispatch(checkMissingAPN(content));
@@ -1308,6 +1320,7 @@ var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, conte
1308
1320
  var setUpdatedFormData = function setUpdatedFormData(formData) {
1309
1321
  return function (dispatch) {
1310
1322
  dispatch(setUpdatedFormDataValue(formData));
1323
+ dispatch(setConfigContent(formData));
1311
1324
  dispatch(calcCrc32EditorLive());
1312
1325
  };
1313
1326
  };
@@ -1409,6 +1422,7 @@ var actions = {
1409
1422
  checkWiFiEncryptedPasswordsNoKpub: checkWiFiEncryptedPasswordsNoKpub,
1410
1423
  checkFileSplitOffsetPeriod: checkFileSplitOffsetPeriod,
1411
1424
  checkRTCAdjustment: checkRTCAdjustment,
1425
+ checkRTCSyncManual: checkRTCSyncManual,
1412
1426
  checkConfigTlsPort: checkConfigTlsPort,
1413
1427
  checkMissingAPN: checkMissingAPN,
1414
1428
  checkMissingWiFi: checkMissingWiFi,
@@ -19150,8 +19164,10 @@ var selectOptions$1 = function selectOptions(Files) {
19150
19164
  });
19151
19165
  };
19152
19166
  var pastCrc32 = "N/A";
19153
- var _require$1 = require("detect-browser"),
19154
- detect$1 = _require$1.detect;
19167
+ var _require$1 = require("difflib"),
19168
+ unifiedDiff = _require$1.unifiedDiff;
19169
+ var _require2 = require("detect-browser"),
19170
+ detect$1 = _require2.detect;
19155
19171
  var browser$1 = detect$1();
19156
19172
  var crcBrowserSupport$1 = ["chrome", "firefox", "opera", "safari", "edge"].includes(browser$1.name);
19157
19173
  var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
@@ -19175,6 +19191,15 @@ var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
19175
19191
  }
19176
19192
  _inheritsLoose(EditorChangesComparison, _React$Component);
19177
19193
  var _proto = EditorChangesComparison.prototype;
19194
+ _proto.buildDiffString = function buildDiffString(past, current) {
19195
+ var hunks = unifiedDiff(past.split(/\r\n|\r|\n/), current.split(/\r\n|\r|\n/), {
19196
+ fromfile: "original_config",
19197
+ tofile: "new_config"
19198
+ });
19199
+ return "diff --git original_config new_config\n" + hunks.map(function (line) {
19200
+ return line.replace(/\n$/, "");
19201
+ }).join("\n");
19202
+ };
19178
19203
  _proto.render = function render() {
19179
19204
  var _this$props = this.props,
19180
19205
  options = _this$props.options,
@@ -19189,8 +19214,8 @@ var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
19189
19214
  externalSubmit = _this$props.externalSubmit;
19190
19215
  var pastCleaned = past && Object.keys(past).length ? JSON.stringify(JSON.parse(past), null, 2) : "";
19191
19216
  if (crcBrowserSupport$1 == 1 && past && Object.keys(past).length) {
19192
- var _require2 = require("crc"),
19193
- crc32 = _require2.crc32;
19217
+ var _require3 = require("crc"),
19218
+ crc32 = _require3.crc32;
19194
19219
  pastCrc32 = crc32(past).toString(16).toUpperCase().padStart(8, "0");
19195
19220
  } else {
19196
19221
  pastCrc32 = "N/A";
@@ -19252,16 +19277,15 @@ var EditorChangesComparison = /*#__PURE__*/function (_React$Component) {
19252
19277
  className: "field-description"
19253
19278
  }, "This will be the name of the new Configuration File"))))), /*#__PURE__*/React.createElement("div", {
19254
19279
  className: "modal-custom-content"
19255
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(reactGhLikeDiff.ReactGhLikeDiff, {
19280
+ }, /*#__PURE__*/React.createElement("div", null, isCompareChanges ? /*#__PURE__*/React.createElement(reactGhLikeDiff.ReactGhLikeDiff, {
19256
19281
  options: {
19257
19282
  originalFileName: "original_config",
19258
19283
  updatedFileName: "new_config",
19259
19284
  matchWordsThreshold: 0.25,
19260
19285
  matchingMaxComparisons: 5000
19261
19286
  },
19262
- past: this.state.hideWhiteSpace ? pastCleaned : past,
19263
- current: JSON.stringify(current, null, 2)
19264
- })))), /*#__PURE__*/React.createElement("div", {
19287
+ diffString: this.buildDiffString(this.state.hideWhiteSpace ? pastCleaned : past || "", current ? JSON.stringify(current, null, 2) : "")
19288
+ }) : null))), /*#__PURE__*/React.createElement("div", {
19265
19289
  className: "modal-custom-footer"
19266
19290
  }, /*#__PURE__*/React.createElement("button", {
19267
19291
  type: "submit",
@@ -19287,6 +19311,7 @@ var EditorChangesComparison$1 = reactRedux.connect(mapStateToProps$1)(EditorChan
19287
19311
  var regexRevision = new RegExp('\\d{2}\\.\\d{2}\\.json', 'g');
19288
19312
  var isDownloadConfig = false;
19289
19313
  var activatedTab;
19314
+ var FormWithNavStable = applyNav__default(Form, EditorNavs);
19290
19315
  var EditorSection = /*#__PURE__*/function (_React$Component) {
19291
19316
  function EditorSection(props) {
19292
19317
  var _this;
@@ -19323,14 +19348,8 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
19323
19348
  isDownloadConfig: false,
19324
19349
  isCompareChanges: false,
19325
19350
  activeSideBar: 'schema-modal',
19326
- isSideBarExpanded: false,
19327
- showNewToolsHighlight: true
19351
+ isSideBarExpanded: false
19328
19352
  };
19329
- setTimeout(function () {
19330
- _this.setState({
19331
- showNewToolsHighlight: false
19332
- });
19333
- }, 10000);
19334
19353
  _this.toggleSideBarExpand = _this.toggleSideBarExpand.bind(_this);
19335
19354
  _this.input = '';
19336
19355
  _this.s3 = _this.props.fetchFileContentExt ? true : false;
@@ -19398,7 +19417,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
19398
19417
  _proto.componentDidMount = function componentDidMount() {
19399
19418
  document.addEventListener('keydown', this.escFunction, false);
19400
19419
  };
19401
- _proto.componentWillUnMount = function componentWillUnMount() {
19420
+ _proto.componentWillUnmount = function componentWillUnmount() {
19402
19421
  document.removeEventListener('keydown', this.escFunction, false);
19403
19422
  };
19404
19423
  _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
@@ -19520,7 +19539,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
19520
19539
  sideBarPadding = _this$props.sideBarPadding;
19521
19540
  var editorUISchemaFile = editorUISchemaFiles[0] ? editorUISchemaFiles[0].name : "";
19522
19541
  var editorUIAdvancedSimpleTest = editorUISchemaFile.includes("Simple") || editorUISchemaFile.includes("Advanced");
19523
- var FormWithNav = schemaContent ? applyNav__default(Form, EditorNavs) : Form;
19542
+ var FormWithNav = schemaContent ? FormWithNavStable : Form;
19524
19543
  var editorToolsFull = editorTools.concat({
19525
19544
  name: 'partialconfig-modal',
19526
19545
  comment: 'Partial config loader',
@@ -19646,15 +19665,7 @@ var EditorSection = /*#__PURE__*/function (_React$Component) {
19646
19665
  comment: modal.comment,
19647
19666
  className: modal["class"]
19648
19667
  });
19649
- }), this.state.showNewToolsHighlight && /*#__PURE__*/React.createElement("span", {
19650
- style: {
19651
- fontSize: '12px',
19652
- color: '#337ab7',
19653
- marginLeft: '10px',
19654
- transition: 'opacity 1s ease-out',
19655
- opacity: this.state.showNewToolsHighlight ? 1 : 0
19656
- }
19657
- }, "Tip: New editor tools added"))))))), /*#__PURE__*/React.createElement("div", {
19668
+ }))))))), /*#__PURE__*/React.createElement("div", {
19658
19669
  className: "config-bar-background"
19659
19670
  }));
19660
19671
  };