Frontend naming + CSS-variable cleanups (review low)
Naming convention (LOCKED): rename the ManifestEditor simulate state sim -> simulateInputs / simResult -> simulateResult (+ .sim-result CSS class) - 'sim' was banned standalone shorthand. Rename AssetRelationships props assetId -> assetid and machineNumber -> machinenumber so a prop holding a DB field value mirrors it verbatim; updated the five detail-page call sites (:assetid=). CSS variables: SearchResults per-domain badge palette moved into CSS variables on the container; the duplicated prefers-color-scheme dark block collapses to a single set of variable overrides instead of restating all ten selectors. frontend build green; vitest 49 pass; naming green; search badges + detail relationships verified rendering with no console errors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -196,12 +196,12 @@ import { apiError } from '../utils/apiError'
|
||||
const toast = useToast()
|
||||
|
||||
const props = defineProps({
|
||||
assetId: {
|
||||
assetid: {
|
||||
type: Number,
|
||||
default: null
|
||||
},
|
||||
// Alternative: lookup by machine/asset number
|
||||
machineNumber: {
|
||||
machinenumber: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
@@ -315,14 +315,14 @@ onMounted(async () => {
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => props.assetId, async () => {
|
||||
watch(() => props.assetid, async () => {
|
||||
await resolveAssetId()
|
||||
if (resolvedAssetId.value) {
|
||||
await loadRelationships()
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => props.machineNumber, async () => {
|
||||
watch(() => props.machinenumber, async () => {
|
||||
await resolveAssetId()
|
||||
if (resolvedAssetId.value) {
|
||||
await loadRelationships()
|
||||
@@ -330,17 +330,17 @@ watch(() => props.machineNumber, async () => {
|
||||
})
|
||||
|
||||
async function resolveAssetId() {
|
||||
// If assetId is provided directly, use it
|
||||
if (props.assetId) {
|
||||
resolvedAssetId.value = props.assetId
|
||||
// If assetid is provided directly, use it
|
||||
if (props.assetid) {
|
||||
resolvedAssetId.value = props.assetid
|
||||
lookupFailed.value = false
|
||||
return
|
||||
}
|
||||
|
||||
// Otherwise, try to look up by machine number
|
||||
if (props.machineNumber) {
|
||||
if (props.machinenumber) {
|
||||
try {
|
||||
const response = await assetsApi.lookup(props.machineNumber)
|
||||
const response = await assetsApi.lookup(props.machinenumber)
|
||||
resolvedAssetId.value = response.data.data?.assetid
|
||||
lookupFailed.value = !resolvedAssetId.value
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user