Skip to content

Feat/vehicle tag registry - #210

Merged
tzebrowski merged 2 commits into
mainfrom
feat/vehicle-tag-registry
Aug 25, 2026
Merged

Feat/vehicle tag registry#210
tzebrowski merged 2 commits into
mainfrom
feat/vehicle-tag-registry

Conversation

@tzebrowski

Copy link
Copy Markdown
Owner

No description provided.

The '175tbi' and '2.0gme' tags gate real behavior (the WOT quick-filter's
per-ECU channel set, the acceleration Registry's extra run curves) but were
hard-coded independently in math-definitions.ts and acceleration.service.ts,
so a typo in either failed silently.

Add src/app/core/vehicle-tags.ts as the single registry of tags the app
branches on, distinct from the free-form labels users attach for filtering.
autoEnableSignalsByTag is now keyed by VehicleTag, so a bad key fails the
build, and both call sites match through fileHasVehicleTag(). That also
normalizes the comparison (trim/lowercase/collapse whitespace, matching the
signal-name lookups), so a log tagged externally as '2.0GME' -- tags seeded
from Drive appProperties are never normalized on the way in -- now matches
where it previously did not.

Also fix the one-directional tag sync: DriveService.addTag wrote the Drive
entry and appProperties only, never AppStateService.files or IndexedDB, so
tagging an already-loaded log from the Drive panel left the loaded copy
untagged until a reload -- silently keeping the default channel sets. addTag
now emits DRIVE_TAG_ADDED once the write lands and AppStateService applies it
to any loaded file of that name. The handler deliberately does not re-emit
FILE_TAG_ADDED, which is what keeps the chart->Drive->state round trip from
echoing.
Both tag entry points were a bare window.prompt, so a near-miss like
'2.0 gme' was accepted, stored, synced to Drive and permanent -- while
silently changing which channel sets the log gets. Nothing anywhere could
remove a tag, which was survivable while tags were decoration and is not now
that they gate behavior.

Replace both prompts with an inline TagInput component: a native datalist of
the tags already in use (DriveService.knownTags -- the listing's tags, the
loaded files' tags, and the registered vehicle tags), Enter/Escape handling,
and a preview of the spelling that will actually be stored.

Normalization moves into the services so no caller has to remember it:
canonicalTag() normalizes and snaps a variant of a registered vehicle tag
onto its registered spelling, and AppStateService.addFileTag/DriveService
.addTag both run through it. normalizeTag() also drops commas, which used to
split one tag into two on the next Drive load since appProperties stores them
comma-joined.

Add the removal path as the mirror of the add path: removeFileTag/removeTag,
FILE_TAG_REMOVED/DRIVE_TAG_REMOVED to sync the two sides, and an x on every
pill in both views. Removal matches the stored spelling exactly rather than
canonicalizing, since a tag seeded from Drive was never normalized on the way
in. Clearing the last tag sends appProperties.tags = null so the key is
deleted rather than left as an empty string.

knownTags is deliberately separate from availableTags: the filter dropdown
stays listing-derived, since offering a tag no listed file carries would just
empty the list.

Also dedupes the two byte-identical copies of legacy's _getTagStyle into
tags.util.ts.
@tzebrowski
tzebrowski merged commit 1a39540 into main Aug 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant