map: fix subtype filter dropping every measuring tool
MapView carried its own copy of the per-type subtype-id lookup and it never gained a Measuring Tool branch, so selecting any measuring-tool subtype filtered out all assets. Marker coloring and the PDF export were unaffected because both already used the shared getSubtypeId helper. Point the filter at that shared helper and delete the duplicate copy in ShopFloorMap too, so one definition serves filter, coloring and export. Adds a table-driven spec covering every subtype-carrying asset type.
This commit is contained in:
@@ -97,6 +97,7 @@ import L from 'leaflet'
|
||||
import 'leaflet/dist/leaflet.css'
|
||||
import { loadMapConfig, blueprintUrlFor, state as mapConfig } from '../composables/mapConfig'
|
||||
import { assetTypeLabel, assetDetailRoute } from '../utils/assetTypes'
|
||||
import { getSubtypeId } from '../utils/mapColors'
|
||||
import api from '../api'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -239,19 +240,6 @@ const visibleAssetTypes = computed(() => {
|
||||
return result
|
||||
})
|
||||
|
||||
// Get subtype ID from asset based on asset type
|
||||
function getSubtypeId(asset) {
|
||||
if (!asset.typedata) return null
|
||||
// Normalize network_device -> network device so the subtype id resolves.
|
||||
const typeLower = (asset.assettype || '').toLowerCase().replace(/_/g, ' ')
|
||||
if (typeLower === 'machine') return asset.typedata.machinetypeid
|
||||
if (typeLower === 'computer') return asset.typedata.computertypeid
|
||||
if (typeLower === 'network device') return asset.typedata.networkdevicetypeid
|
||||
if (typeLower === 'printer') return asset.typedata.printertypeid
|
||||
if (typeLower === 'measuring tool') return asset.typedata.measuringtooltypeid
|
||||
return null
|
||||
}
|
||||
|
||||
// Get visible subtypes when a type is selected
|
||||
const visibleSubtypes = computed(() => {
|
||||
if (!props.selectedAssetType) return {}
|
||||
|
||||
Reference in New Issue
Block a user