map: fix PDF export 404 on the blueprint under a subpath mount

exportPdf passed the raw map_blueprint_light setting value, which is a
root-relative /api path. Under /ops or /shopdb that resolves to the server
root and 404s, so the export died with "Failed to load blueprint image".
The on-screen map was unaffected because it goes through blueprintUrlFor,
which applies withBase - use that here too.

Same file, so this also carries the subtype auto-palette replacement that
goes with the marker-legibility change in the next commit.
This commit is contained in:
cproudlock
2026-07-31 09:02:56 -04:00
parent b16f143467
commit d5635a4306

View File

@@ -82,7 +82,7 @@ import ShopFloorMap from '../components/ShopFloorMap.vue'
import { assetsApi } from '../api'
import { currentTheme } from '../stores/theme'
import { useAuthStore } from '../stores/auth'
import { loadMapConfig, state as mapConfig } from '../composables/mapConfig'
import { loadMapConfig, blueprintUrlFor, state as mapConfig } from '../composables/mapConfig'
import { exportMapPdf } from '../utils/mapPdf'
import { assetTypeLabel, assetDetailRoute } from '../utils/assetTypes'
import { getSubtypeId } from '../utils/mapColors'
@@ -140,12 +140,18 @@ const subtypeLabel = computed(() => {
return labels[selectedType.value.toLowerCase().replace(/_/g, ' ')] || 'All Subtypes'
})
// Generate distinct colors for subtypes
// Auto colors for subtypes that have not been given one. Every step clears 3:1
// against BOTH map surfaces (white blueprint and the dark navy card), so none
// washes out; the old list ran through pale yellows and limes (#FFEB3B was
// 1.1:1 on white) that were invisible on the light blueprint. Ordered by
// max-min perceptual separation, so the fewer subtypes are on screen the
// further apart their colors sit. Past roughly the fifth entry no palette can
// keep every pair distinguishable under color-blind simulation - the legend and
// the hover tooltip carry identity from there.
const subtypeColorPalette = [
'#F44336', '#E91E63', '#9C27B0', '#673AB7', '#3F51B5',
'#2196F3', '#03A9F4', '#00BCD4', '#009688', '#4CAF50',
'#8BC34A', '#CDDC39', '#FFEB3B', '#FFC107', '#FF9800',
'#FF5722', '#795548', '#607D8B', '#00ACC1', '#5C6BC0'
'#7c4dff', '#ef6c00', '#0097a7', '#c2185b', '#1565c0',
'#e03131', '#e0479e', '#00897b', '#827717', '#1976d2',
'#d81b60', '#388e3c', '#9c4dcc', '#2e7d32'
]
// Map subtype IDs to colors: prefer each subtype's stored color; fall back to
@@ -236,7 +242,10 @@ async function exportPdf() {
await loadMapConfig()
await exportMapPdf({
assets: filteredAssets.value,
blueprintUrl: mapConfig.blueprintLight,
// blueprintUrlFor applies withBase - the raw setting value is a
// root-relative /api path, which 404s under a subpath mount like /ops.
// The PDF always uses the light blueprint: it prints on white paper.
blueprintUrl: blueprintUrlFor('light'),
mapWidth: mapConfig.width,
mapHeight: mapConfig.height,
selectedType: selectedType.value,