]> git.openstreetmap.org Git - nominatim-ui.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 8 Mar 2021 09:10:10 +0000 (10:10 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 8 Mar 2021 09:10:10 +0000 (10:10 +0100)
CHANGES.md
package.json
src/components/DetailsInfoRowList.svelte
src/components/DetailsOneRow.svelte
src/components/Header.svelte
src/components/ReverseLink.svelte
src/lib/api_utils.js
src/lib/stores.js
src/pages/DetailsPage.svelte

index 716e3697b934dbcc6f5d3ee16a3d4d1a6336cb02..b561799abe71fd7d324e5e2fa0d720b569e546af 100644 (file)
@@ -1,5 +1,18 @@
 # CHANGES
 
+* version 3.0.2 - 2021-03-05
+
+    * Details page: don't print 'null' when postcode is missing
+    * Details page: make sure links to children,hierarcy update after pageload, thx LiteratimBi for the report
+    * Details page: in hierachy list all addresslines were marked unused (grayed out)
+    * Details page: API doesn't always return address keywords
+    * PageLinks/ReverseLink: fix warnings when properties not set
+
+* version 3.0.1 - 2021-03-05
+
+    * Details page: table is now responsive, no longer overflows
+    * Documentation: fix link to theme configuration file
+
 * version 3.0.0 - 2021-02-25
 
     Version 3 add a new directory dist/theme/. It changes the default welcome, about and
index 426cd30f89f44095e936690fc562fca98aeb8db9..1e601c27eee6c40b5aa25cefb50b335e3ca2c5d6 100644 (file)
@@ -1,7 +1,7 @@
 {
   "name": "nominatim-ui",
   "description": "Debug web interface for Nominatim geocoder",
-  "version": "3.0.0",
+  "version": "3.0.2",
   "license": "GPL-2.0",
   "scripts": {
     "build": "rollup -c",
index 7fcba67faf22972cad2b1b7e88fec42aca9287df..637159befb611b7e42b8cb5ca3b35a846b0d4cff 100644 (file)
@@ -3,8 +3,9 @@
 </script>
 
 <style>
-  .name{
+  .name {
     font-weight: bold;
+    overflow-wrap: anywhere;
   }
 </style>
 
index 9b3b27e22ba8e8b0763a020358c79837095dc525..7455245a2e1ce88407ae10f2b00debbd0897048a 100644 (file)
@@ -7,12 +7,13 @@
 
   export let addressLine;
   export let bDistanceInMeters;
+  export let bMarkUnusedLines = false;
 
   $: bAddressLineUsed = addressLine.isaddress;
 
 </script>
 
-<tr class:notused={!bAddressLineUsed}>
+<tr class:notused={bMarkUnusedLines && !bAddressLineUsed}>
   <td class="name font-weight-bold">
     {#if addressLine.localname}
       {addressLine.localname}
@@ -29,9 +30,9 @@
     {#if addressLine.osm_id}
       <DetailsLink feature={addressLine}>details</DetailsLink>
     {:else if addressLine.type.match(/^country/)}
-      <PageLink page='search', params_hash={{ country: addressLine.localname }}>search by name</PageLink>
+      <PageLink page='search' params_hash={{ country: addressLine.localname }}>search by name</PageLink>
     {:else if addressLine.type === 'postcode'}
-      <PageLink page='search', params_hash={{ postalcode: addressLine.localname }}>search by name</PageLink>
+      <PageLink page='search' params_hash={{ postalcode: addressLine.localname }}>search by name</PageLink>
     {/if}
   </td>
 </tr>
index 4e6359a2a7e11fcde699752ce7690c86c20fd9cb..9fef1f9615690ddd996eac4e7f9a562d2d573581 100644 (file)
       <!-- Left-aligned links -->
       <ul class="navbar-nav mr-auto">
         <li class="nav-item {view === 'search' ? 'active' : ''}">
-          <PageLink page="search" extra_classes="nav-link ">Search</PageLink>
+          <PageLink page="search" extra_classes="nav-link">Search</PageLink>
         </li>
         <li class="nav-item {view === 'reverse' ? 'active' : ''}">
           <ReverseLink extra_classes="nav-link ">Reverse</ReverseLink>
         </li>
         <li class="nav-item {view === 'details' ? 'active' : ''}">
-          <PageLink page="details" extra_classes="nav-link ">Search By ID</PageLink>
+          <PageLink page="details" extra_classes="nav-link">Search By ID</PageLink>
         </li>
       </ul>
     </div>
     <!-- Right aligned links -->
     <ul class="navbar-nav">
       <li class="nav-item {view === 'about' ? 'active' : ''}">
-        <PageLink page="about" extra_classes="nav-link ">About & Help</PageLink>
+        <PageLink page="about" extra_classes="nav-link">About & Help</PageLink>
       </li>
     </ul>
   </nav>
index 2fd2c4ceebe15435286ab6b47087ee9c6ae7e9c0..bbd54d77cc0b0f4214be3975d2e7c26a92d9814d 100644 (file)
@@ -1,8 +1,8 @@
 <script>
 import { refresh_page } from '../lib/stores.js';
 
-export let lat;
-export let lon;
+export let lat = null;
+export let lon = null;
 export let zoom = null;
 export let extra_classes = '';
 
index a44a30e19e690b504cc368e3f203e7cbf4785d5e..9dff8771818f23955d240a952cd0326c5f7b4f02 100644 (file)
@@ -33,17 +33,27 @@ export async function fetch_from_api(endpoint_name, params, callback) {
 
 var fetch_content_cache = {};
 export async function fetch_content_into_element(url, dom_element) {
+  if (!window.location.protocol.match(/^http/)) {
+    dom_element.innerHTML = `Cannot display data from ${url} here. `
+      + 'Browser security prevents loading content from file:// URLs.';
+    return;
+  }
+
   if (fetch_content_cache[url]) {
     dom_element.innerHTML = fetch_content_cache[url];
     return;
   }
-  await fetch(url)
-    .then(response => response.text())
-    .then(html => {
-      html = html.replace('Nominatim_API_Endpoint', Nominatim_Config.Nominatim_API_Endpoint);
-      dom_element.innerHTML = html;
-      fetch_content_cache[url] = html;
-    });
+  try {
+    await fetch(url)
+      .then(response => response.text())
+      .then(html => {
+        html = html.replace('Nominatim_API_Endpoint', Nominatim_Config.Nominatim_API_Endpoint);
+        dom_element.innerHTML = html;
+        fetch_content_cache[url] = html;
+      });
+  } catch (error) {
+    dom_element.innerHTML = `Error fetching content from ${url} (${error})`;
+  }
 }
 
 function generate_nominatim_api_url(endpoint_name, params) {
index 7ada7761489c0ddba2547c29f753f688cdc95f37..00b41959379e6b606c4b0a40040fb8bfb74f9d0d 100644 (file)
@@ -34,7 +34,13 @@ export function refresh_page(pagename, params) {
     if (param_str) {
       param_str = '?' + param_str;
     }
-    window.history.pushState([], '', pagename + '.html' + param_str);
+    let new_url = pagename + '.html' + param_str;
+
+    if (window.location.protocol.match(/^http/)) {
+      window.history.pushState([], '', new_url);
+    } else {
+      window.location.href = new_url;
+    }
   }
 
   page.set({ tab: pagename, params: params });
index bbf2bf59a75af7e0da786d8c96a8cb9e30bdead5..500c5c30248062c1964789ffb9a63988acecfeb8 100644 (file)
@@ -16,7 +16,7 @@
   import Map from '../components/Map.svelte';
 
   let aPlace;
-  let base_url = window.location.search;
+  let base_url;
   let api_request_params;
   let api_request_finished = false;
 
@@ -57,6 +57,7 @@
     let pageinfo = $page;
     if (pageinfo.tab === 'details') {
       loaddata(pageinfo.params);
+      base_url = window.location.search;
     }
   }
 </script>
@@ -80,7 +81,7 @@
     </div>
     <div class="row">
       <div class="col-md-6">
-        <table id="locationdetails" class="table table-striped">
+        <table id="locationdetails" class="table table-striped table-responsive">
           <tbody>
             <InfoRow title="Name"><InfoRowList items={aPlace.names} /></InfoRow>
             <InfoRow title="Type">{aPlace.category}:{aPlace.type}</InfoRow>
           <tbody>
             {#if aPlace.address}
               {#each aPlace.address as addressLine}
-                <DetailsOneRow addressLine={addressLine} bDistanceInMeters=false />
+                <DetailsOneRow addressLine={addressLine} bMarkUnusedLines=true bDistanceInMeters=false />
               {/each}
             {/if}
 
             {#if aPlace.linked_places}
               <tr class="all-columns"><td colspan="6"><h2>Linked Places</h2></td></tr>
               {#each aPlace.linked_places as addressLine}
-                <DetailsOneRow addressLine={addressLine} bDistanceInMeters=true />
+                <DetailsOneRow addressLine={addressLine} bMarkUnusedLines=true bDistanceInMeters=true />
               {/each}
             {/if}
 
                 </tr>
               {/each}
 
-              <tr class="all-columns"><td colspan="6"><h3>Address Keywords</h3></td></tr>
-              {#each aPlace.keywords.address as keyword}
-                <tr>
-                  <td>{formatKeywordToken(keyword.token)}</td>
-                  {#if keyword.id}
-                    <td>word id: {keyword.id}</td>
-                  {/if}
-              </tr>
-              {/each}
+              {#if aPlace.keywords.address}
+                <tr class="all-columns"><td colspan="6"><h3>Address Keywords</h3></td></tr>
+                {#each aPlace.keywords.address as keyword}
+                  <tr>
+                    <td>{formatKeywordToken(keyword.token)}</td>
+                    {#if keyword.id}
+                      <td>word id: {keyword.id}</td>
+                    {/if}
+                  </tr>
+                {/each}
+              {/if}
             {:else}
               <tr>
                 <td>
     padding-left: 0 !important;
   }
 
-  .table {
-    width: 100%;
-  }
   #map-wrapper {
     width:100%;
     min-height: auto;