Enable the ‘view on map’ log action item.

This commit is contained in:
D. Berge
2021-05-17 17:14:58 +02:00
parent 4d87506720
commit 0c352512b0

View File

@@ -267,15 +267,15 @@
<!-- Actions column (FIXME currently not used) -->
<template v-slot:item.actions="{ item }">
<div style="white-space:nowrap;">
<v-icon v-if="$root.user || true"
small
class="mr-2"
title="View on map"
@click="viewOnMap(item)"
disabled
>
mdi-map
</v-icon>
<a :href="viewOnMap(item)" v-if="viewOnMap(item)">
<v-icon v-if="$root.user || true"
small
class="mr-2"
title="View on map"
>
mdi-map
</v-icon>
</a>
</div>
</template>
@@ -746,6 +746,15 @@ export default {
item.items.some( i => i.labels.some( l => l.toLowerCase().includes(s) ));
}
},
viewOnMap(row) {
if (row && row.items && row.items.length) {
if (row.items[0].geometry && row.items[0].geometry.type == "Point") {
const [ lon, lat ] = row.items[0].geometry.coordinates;
return `map#15/${lon.toFixed(6)}/${lat.toFixed(6)}`;
}
}
},
...mapActions(["api", "showSnack"])
},