]> git.openstreetmap.org Git - nominatim-ui.git/blob - src/pages/PolygonsPage.svelte
Convert page stores into global applicaton state (#292)
[nominatim-ui.git] / src / pages / PolygonsPage.svelte
1 <script>
2   import { onMount } from 'svelte';
3   import { update_html_title } from '../lib/api_utils.js';
4   import { formatOSMType, osmLink } from '../lib/helpers.js';
5   import { appState } from '../state/AppState.svelte.js';
6
7   import Header from '../components/Header.svelte';
8
9   let aPolygons = $state([]);
10
11   function loaddata() {
12     appState.fetchFromApi('polygons', { format: 'json' }, function (data) {
13       aPolygons = data;
14     });
15     update_html_title('Broken polygons');
16   }
17   onMount(loaddata);
18 </script>
19
20 <Header/>
21 <div class="container">
22   <div class="row">
23     <div class="col-sm-12">
24       <h1>Broken polygons</h1>
25
26       <p>
27         Total number of broken polygons: {aPolygons.length}.
28       </p>
29
30       <table class="table table-striped table-hover">
31         <thead>
32           <tr>
33             <th>OSM object</th>
34             <th>Class</th>
35             <th>Type</th>
36             <th>Name</th>
37             <th>Country Code</th>
38             <th>Error message</th>
39             <th>Updated</th>
40             <th></th>
41           </tr>
42         </thead>
43         <tbody>
44           {#each aPolygons as polygon}
45             <tr>
46               <!-- eslint-disable-next-line svelte/no-at-html-tags -->
47               <td>{@html osmLink(polygon)}</td>
48               <td>{polygon.class}</td>
49               <td>{polygon.type}</td>
50               <td>{polygon.name}</td>
51               <td>{polygon.country_code || ''}</td>
52               <td>{polygon.errormessage}</td>
53               <td>{polygon.updated}</td>
54               <td>
55                 <a href="http://localhost:8111/import?url=https://www.openstreetmap.org/api/0.6/{formatOSMType(polygon.osm_type)}/{polygon.osm_id}/full" target="josm">josm</a>
56               </td>
57             </tr>
58           {/each}
59         </tbody>
60       </table>
61     </div>
62   </div>
63 </div>