Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to

### Added
- cli: Add auto-paging to `dump`, `schema` and all view commands (#138).
- web: Adjust datacenters map zoom level to fit their markers locations (#78).
- docs:
- Mention support of Fedora 42.
- Mention support of Debian 14 _« forky »_
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/views/DatacentersView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ function datacentersMapConfig() {
// Configuration of the map
const map = L.map(mapContainer.value).setView([averageLatitude, averageLongitude], 5)
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map)

// Prepare bounds to fit all markers
const bounds = L.latLngBounds([])

// Add a marker on a map if the datacenter has coordinates
datacenters.value.forEach((datacenter) => {
// Skip datacenter if location is not defined
Expand All @@ -80,6 +82,7 @@ function datacentersMapConfig() {
let marker = L.marker([datacenter.location.latitude, datacenter.location.longitude], {
icon: purpleIcon
}).addTo(map)
bounds.extend([datacenter.location.latitude, datacenter.location.longitude])
marker.bindPopup(
`<div class="text-center max-h-30">
<a class="appearance-none" href="${datacenterRoute.fullPath}">
Expand All @@ -90,6 +93,9 @@ function datacentersMapConfig() {
</div>`
)
})

// Adjust the map view to include all markers
map.fitBounds(bounds, { padding: [10, 10] })
}

onMounted(async () => {
Expand Down