From e12233c0e91e40aef5da4b5d8298fd01ca29ff8d Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 10 Apr 2024 14:10:28 +0200 Subject: [PATCH] UX: comparision-action and comparison-table got debug information and indicator for no data loaded --- langs/en.json | 1 + src/UI/Comparison/ComparisonAction.svelte | 30 +++++++++++------------ src/UI/Comparison/ComparisonTable.svelte | 25 +++++++++++++++---- 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/langs/en.json b/langs/en.json index bfa69f2e6..4831fbfb2 100644 --- a/langs/en.json +++ b/langs/en.json @@ -60,6 +60,7 @@ "done": "Done", "error": "Error", "loadedFrom": "The following data is loaded from {source} using the embedded JSON-LD", + "noDataLoaded": "The external website has no linked data that could be loaded", "overwrite": "Overwrite" }, "favourite": { diff --git a/src/UI/Comparison/ComparisonAction.svelte b/src/UI/Comparison/ComparisonAction.svelte index 6d0b39091..810d75d37 100644 --- a/src/UI/Comparison/ComparisonAction.svelte +++ b/src/UI/Comparison/ComparisonAction.svelte @@ -63,31 +63,31 @@
-
+
- {#if renderingExternal} - - {:else} -
- {key}{externalProperties[key]} -
+ {#if renderingExternal} + + {:else} +
+ {key}{externalProperties[key]} +
- {/if} -
+ {/if} +
{#if $isTesting || $isDebug || $showTags === "yes" || $showTags === "always" || $showTags === "full"}
- + {#if $tags[key] !== undefined} OSM: {key}={$tags[key]} - + + {/if} - Ext: {key}= {externalProperties[key]} - +
{/if}
diff --git a/src/UI/Comparison/ComparisonTable.svelte b/src/UI/Comparison/ComparisonTable.svelte index ebf9b8d3e..325e946a0 100644 --- a/src/UI/Comparison/ComparisonTable.svelte +++ b/src/UI/Comparison/ComparisonTable.svelte @@ -42,10 +42,18 @@ .filter((i) => !knownImages.has(i)) let propertyKeysExternal = externalKeys.filter((k) => k.match(imageKeyRegex) === null) - let missing = propertyKeysExternal.filter((k) => osmProperties[k] === undefined && typeof externalProperties[k] === "string") + let missing = propertyKeysExternal.filter((k) => { + if (k.startsWith("_")) { + return false + } + return osmProperties[k] === undefined && typeof externalProperties[k] === "string" + }) // let same = propertyKeysExternal.filter((key) => osmProperties[key] === externalProperties[key]) let different = propertyKeysExternal.filter( (key) => { + if (key.startsWith("_")) { + return false + } if (osmProperties[key] === undefined) { return false } @@ -56,11 +64,10 @@ return false } - if (key === "website") - { + if (key === "website") { const osmCanon = new URL(osmProperties[key]).toString() const externalCanon = new URL(externalProperties[key]).toString() - if(osmCanon === externalCanon){ + if (osmCanon === externalCanon) { return false } } @@ -83,7 +90,9 @@ currentStep = "all_applied" } -{#if unknownImages.length === 0 && missing.length === 0 && different.length === 0} +{#if propertyKeysExternal.length === 0 && knownImages.size + unknownImages.length === 0} + +{:else if unknownImages.length === 0 && missing.length === 0 && different.length === 0}
@@ -170,6 +179,12 @@ {/each} {/if} {/if} + {#if externalProperties["_last_edit_timestamp"] !== undefined} + + + External data has been last modified on {externalProperties["_last_edit_timestamp"]} + + {/if}
{/if}