From 95b3c26da724aff5b9aae88daf0783d866e95fda Mon Sep 17 00:00:00 2001 From: tomasz1986 Date: Thu, 31 Aug 2023 17:11:03 +0200 Subject: [PATCH] gui: Prevent modifications when saving changes (fixes #9019) (#9063) --- gui/default/assets/lang/lang-en.json | 2 ++ gui/default/index.html | 1 + gui/default/syncthing/core/savingChangesDialogView.html | 8 ++++++++ gui/default/syncthing/core/syncthingController.js | 6 +++++- 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 gui/default/syncthing/core/savingChangesDialogView.html diff --git a/gui/default/assets/lang/lang-en.json b/gui/default/assets/lang/lang-en.json index 1c0b99fd4..4e3bba0de 100644 --- a/gui/default/assets/lang/lang-en.json +++ b/gui/default/assets/lang/lang-en.json @@ -325,6 +325,7 @@ "Revert": "Revert", "Revert Local Changes": "Revert Local Changes", "Save": "Save", + "Saving changes": "Saving changes", "Scan Time Remaining": "Scan Time Remaining", "Scanning": "Scanning", "See external versioning help for supported templated command line parameters.": "See external versioning help for supported templated command line parameters.", @@ -391,6 +392,7 @@ "Syncthing is listening on the following network addresses for connection attempts from other devices:": "Syncthing is listening on the following network addresses for connection attempts from other devices:", "Syncthing is not listening for connection attempts from other devices on any address. Only outgoing connections from this device may work.": "Syncthing is not listening for connection attempts from other devices on any address. Only outgoing connections from this device may work.", "Syncthing is restarting.": "Syncthing is restarting.", + "Syncthing is saving changes.": "Syncthing is saving changes.", "Syncthing is upgrading.": "Syncthing is upgrading.", "Syncthing now supports automatically reporting crashes to the developers. This feature is enabled by default.": "Syncthing now supports automatically reporting crashes to the developers. This feature is enabled by default.", "Syncthing seems to be down, or there is a problem with your Internet connection. Retrying…": "Syncthing seems to be down, or there is a problem with your Internet connection. Retrying…", diff --git a/gui/default/index.html b/gui/default/index.html index c3bf309e6..dff6ee5e4 100644 --- a/gui/default/index.html +++ b/gui/default/index.html @@ -978,6 +978,7 @@ + diff --git a/gui/default/syncthing/core/savingChangesDialogView.html b/gui/default/syncthing/core/savingChangesDialogView.html new file mode 100644 index 000000000..81b0b49d1 --- /dev/null +++ b/gui/default/syncthing/core/savingChangesDialogView.html @@ -0,0 +1,8 @@ + + + diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 6e93b507c..975cb4638 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -1513,13 +1513,17 @@ angular.module('syncthing.core') }; $scope.saveConfig = function () { + $('#savingChanges').modal(); var cfg = JSON.stringify($scope.config); var opts = { headers: { 'Content-Type': 'application/json' } }; - return $http.put(urlbase + '/config', cfg, opts).finally(refreshConfig).catch($scope.emitHTTPError); + return $http.put(urlbase + '/config', cfg, opts).finally(function () { + refreshConfig(); + $('#savingChanges').modal("hide"); + }).catch($scope.emitHTTPError); }; $scope.urVersions = function () {