Skip to content

Commit

Permalink
Add and option to flush settings cache
Browse files Browse the repository at this point in the history
  • Loading branch information
DzikuVx committed May 12, 2024
1 parent e1c3024 commit 6d25fbb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions js/configurator_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const update = require('./globalUpdates');
const appUpdater = require('./appUpdater');
const CliAutoComplete = require('./CliAutoComplete');
const { SITLProcess } = require('./sitl');
const settingsCache = require('./settingsCache');

process.on('uncaughtException', function (error) {
if (process.env.NODE_ENV !== 'development') {
Expand Down Expand Up @@ -385,6 +386,9 @@ $(function() {
$('#demoModeReset').on('click', function () {
SITLProcess.deleteEepromFile('demo.bin');
});
$('#maintenanceFlushSettingsCache').on('click', function () {
settingsCache.flush();
});
function close_and_cleanup(e) {
if (e.type == 'click' && !$.contains($('div#options-window')[0], e.target) || e.type == 'keyup' && e.keyCode == 27) {
$(document).unbind('click keyup', close_and_cleanup);
Expand Down
1 change: 1 addition & 0 deletions js/settingsCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var settingsCache = (function() {

publicScope.flush = function() {
store.delete(SETTINGS_KEY);
console.log('Settings cache flushed');
};

publicScope.get = function(settingName) {
Expand Down
6 changes: 6 additions & 0 deletions locale/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -5812,5 +5812,11 @@
},
"gsTelemetrySpeed": {
"message": "Speed"
},
"maintenance": {
"message": "Maintenance"
},
"maintenanceFlushSettingsCache": {
"message": "Flush settings cache"
}
}
10 changes: 10 additions & 0 deletions tabs/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,15 @@
</div>
</div>
</div>
<div class="options-section gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="maintenance"></div>
</div>
<div class="spacer_box settings">
<div class="default_btn" style="float: none; width: 200px;">
<a id="maintenanceFlushSettingsCache" href="#" i18n="maintenanceFlushSettingsCache"></a>
</div>
</div>
</div>
</div>
</div>

0 comments on commit 6d25fbb

Please sign in to comment.