forked from MapComplete/MapComplete
		
	Debug: add localstorage debug overview
This commit is contained in:
		
							parent
							
								
									833b827523
								
							
						
					
					
						commit
						b5b79601f9
					
				
					 2 changed files with 46 additions and 2 deletions
				
			
		|  | @ -1520,6 +1520,34 @@ | ||||||
|       ], |       ], | ||||||
|       "condition": "mapcomplete-show_debug=yes", |       "condition": "mapcomplete-show_debug=yes", | ||||||
|       "render": "{all_tags()}" |       "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 |   "allowMove": false | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ import LoginButton from "../Base/LoginButton.svelte" | ||||||
| import ThemeViewState from "../../Models/ThemeViewState" | import ThemeViewState from "../../Models/ThemeViewState" | ||||||
| import OrientationDebugPanel from "../Debug/OrientationDebugPanel.svelte" | import OrientationDebugPanel from "../Debug/OrientationDebugPanel.svelte" | ||||||
| import AllTagsPanel from "../Popup/AllTagsPanel.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 ClearCaches from "../Popup/ClearCaches.svelte" | ||||||
| import Locale from "../i18n/Locale" | import Locale from "../i18n/Locale" | ||||||
| import LanguageUtils from "../../Utils/LanguageUtils" | 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", |                 funcName: "clear_caches", | ||||||
|                 docs: "A button which clears the locally downloaded data and the service worker. Login status etc will be kept", |                 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( |                 constr( | ||||||
|                     _: SpecialVisualizationState, |                     _: SpecialVisualizationState, | ||||||
|                     __: UIEventSource<Record<string, string>>, |                     __: UIEventSource<Record<string, string>>, | ||||||
|                     argument: string[], |                     argument: string[] | ||||||
|                 ): SvelteUIElement { |                 ): SvelteUIElement { | ||||||
|                     return new SvelteUIElement(ClearCaches, { |                     return new SvelteUIElement(ClearCaches, { | ||||||
|                         msg: argument[0] ?? "Clear local caches" |                         msg: argument[0] ?? "Clear local caches" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue