Co-authored-by: Madison Grubb <madison@elastiflow.com> Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
@@ -214,10 +214,6 @@
|
||||
import 'leaflet/dist/leaflet.css'
|
||||
|
||||
const props = defineProps({
|
||||
feeds: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
devices: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
@@ -382,8 +378,7 @@ function updateMarkers() {
|
||||
if (m) m.remove()
|
||||
})
|
||||
|
||||
const feedSources = [...(props.feeds || []), ...(props.devices || [])]
|
||||
const validSources = feedSources.filter(f => typeof f?.lat === 'number' && typeof f?.lng === 'number')
|
||||
const validSources = (props.devices || []).filter(f => typeof f?.lat === 'number' && typeof f?.lng === 'number')
|
||||
markersRef.value = validSources.map(item =>
|
||||
L.marker([item.lat, item.lng]).addTo(ctx.map).on('click', () => emit('select', item)),
|
||||
)
|
||||
@@ -622,7 +617,7 @@ onBeforeUnmount(() => {
|
||||
destroyMap()
|
||||
})
|
||||
|
||||
watch(() => [props.feeds, props.devices], () => updateMarkers(), { deep: true })
|
||||
watch(() => props.devices, () => updateMarkers(), { deep: true })
|
||||
watch([() => props.pois, () => props.canEditPois], () => updatePoiMarkers(), { deep: true })
|
||||
watch(() => props.liveSessions, () => updateLiveMarkers(), { deep: true })
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export function useUser() {
|
||||
// eslint-disable-next-line no-undef
|
||||
const requestFetch = useRequestFetch()
|
||||
const { data: user, refresh } = useAsyncData(
|
||||
'user',
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<div class="relative h-2/3 w-full md:h-full md:flex-1">
|
||||
<ClientOnly>
|
||||
<KestrelMap
|
||||
:feeds="[]"
|
||||
:devices="devices ?? []"
|
||||
:pois="pois ?? []"
|
||||
:live-sessions="liveSessions ?? []"
|
||||
|
||||
@@ -421,8 +421,11 @@ const deleteConfirmUser = ref(null)
|
||||
|
||||
function setDropdownWrapRef(userId, el) {
|
||||
if (el) dropdownWrapRefs.value[userId] = el
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
else delete dropdownWrapRefs.value[userId]
|
||||
else {
|
||||
dropdownWrapRefs.value = Object.fromEntries(
|
||||
Object.entries(dropdownWrapRefs.value).filter(([k]) => k !== userId),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
watch(user, (u) => {
|
||||
@@ -484,8 +487,9 @@ async function saveRole(id) {
|
||||
try {
|
||||
await $fetch(`/api/users/${id}`, { method: 'PATCH', body: { role } })
|
||||
await refreshUsers()
|
||||
const { [id]: _, ...rest } = pendingRoleUpdates.value
|
||||
pendingRoleUpdates.value = rest
|
||||
pendingRoleUpdates.value = Object.fromEntries(
|
||||
Object.entries(pendingRoleUpdates.value).filter(([k]) => k !== id),
|
||||
)
|
||||
}
|
||||
catch {
|
||||
// could set error state
|
||||
|
||||
Reference in New Issue
Block a user