diff --git a/app/assets/javascripts/app/directives/views/sessionHistoryMenu.js b/app/assets/javascripts/app/directives/views/sessionHistoryMenu.js index 771963880..45b4e51e3 100644 --- a/app/assets/javascripts/app/directives/views/sessionHistoryMenu.js +++ b/app/assets/javascripts/app/directives/views/sessionHistoryMenu.js @@ -22,7 +22,7 @@ class SessionHistoryMenu { }) $scope.history = history; } - + $scope.reloadHistory(); $scope.openRevision = function(revision) { @@ -65,6 +65,11 @@ class SessionHistoryMenu { } $scope.toggleDiskSaving = function() { + if(!sessionHistory.diskEnabled) { + if(!confirm("Are you sure you want to save history to disk? This will decrease general performance, especially as you type. You are advised to disable this feature if you experience any lagging.")){ + return; + } + } sessionHistory.toggleDiskSaving().then(() => { $timeout(() => { $scope.diskEnabled = sessionHistory.diskEnabled; diff --git a/app/assets/javascripts/app/services/storageManager.js b/app/assets/javascripts/app/services/storageManager.js index 87b46eb56..ea3dbb9fb 100644 --- a/app/assets/javascripts/app/services/storageManager.js +++ b/app/assets/javascripts/app/services/storageManager.js @@ -107,7 +107,12 @@ class StorageManager extends SFStorageManager { async setItem(key, value, vaultKey) { var storage = this.getVault(vaultKey); - storage.setItem(key, value); + try { + storage.setItem(key, value); + } catch (e) { + console.error("Exception while trying to setItem in StorageManager:", e); + alert("The application's local storage is out of space. If you have Session History save-to-disk enabled, please disable it, and try again."); + } if(vaultKey === StorageManager.FixedEncrypted || (!vaultKey && this.itemsStorageMode === StorageManager.FixedEncrypted)) { this.writeEncryptedStorageToDisk(); diff --git a/app/assets/templates/directives/session-history-menu.html.haml b/app/assets/templates/directives/session-history-menu.html.haml index 72f87e640..da3633a74 100644 --- a/app/assets/templates/directives/session-history-menu.html.haml +++ b/app/assets/templates/directives/session-history-menu.html.haml @@ -14,7 +14,7 @@ Automatically cleans up small revisions to conserve space. %menu-row{"label" => "(diskEnabled ? 'Disable' : 'Enable') + ' saving history to disk'", "action" => "toggleDiskSaving()"} .sk-sublabel - Saving to disk may increase app loading time and memory footprint. + Saving to disk is not recommended. Decreases performance and increases app loading time and memory footprint. %menu-row{"ng-repeat" => "revision in entries", "action" => "openRevision(revision);",