diff --git a/assets/layers/usersettings/usersettings.json b/assets/layers/usersettings/usersettings.json index f05d8aff68..382092523b 100644 --- a/assets/layers/usersettings/usersettings.json +++ b/assets/layers/usersettings/usersettings.json @@ -1520,6 +1520,34 @@ ], "condition": "mapcomplete-show_debug=yes", "render": "{all_tags()}" + }, + { + "id": "debug_storage_accordeon", + "render": { + "special": { + "type": "group", + "header": "debug_storage_accordeon_title", + "labels": "debug_storage" + } + } + }, + { + "id": "debug_storage_accordeon_title", + "labels": [ + "hidden" + ], + "render": { + "en": "Debug information about local storage" + } + }, + { + "id": "debug_storage", + "labels": [ + "hidden" + ], + "render": { + "*": "{storage_all_tags()}" + } } ], "allowMove": false diff --git a/src/UI/SpecialVisualisations/SettingsVisualisations.ts b/src/UI/SpecialVisualisations/SettingsVisualisations.ts index b47aac4f7e..ee1655b486 100644 --- a/src/UI/SpecialVisualisations/SettingsVisualisations.ts +++ b/src/UI/SpecialVisualisations/SettingsVisualisations.ts @@ -7,7 +7,7 @@ import LoginButton from "../Base/LoginButton.svelte" import ThemeViewState from "../../Models/ThemeViewState" import OrientationDebugPanel from "../Debug/OrientationDebugPanel.svelte" import AllTagsPanel from "../Popup/AllTagsPanel.svelte" -import { UIEventSource } from "../../Logic/UIEventSource" +import { ImmutableStore, UIEventSource } from "../../Logic/UIEventSource" import ClearCaches from "../Popup/ClearCaches.svelte" import Locale from "../i18n/Locale" import LanguageUtils from "../../Utils/LanguageUtils" @@ -75,6 +75,22 @@ export class SettingsVisualisations { }) } }, + { + funcName: "storage_all_tags", + group: "settings", + docs: "Shows the current state of storage", + args: [], + constr( + state: SpecialVisualizationState + ): SvelteUIElement { + const data = {} + for (const key in localStorage) { + data[key] = localStorage[key] + } + const tags = new ImmutableStore(data) + return new SvelteUIElement(AllTagsPanel, { state, tags }) + } + }, { funcName: "clear_caches", docs: "A button which clears the locally downloaded data and the service worker. Login status etc will be kept", @@ -89,7 +105,7 @@ export class SettingsVisualisations { constr( _: SpecialVisualizationState, __: UIEventSource>, - argument: string[], + argument: string[] ): SvelteUIElement { return new SvelteUIElement(ClearCaches, { msg: argument[0] ?? "Clear local caches"