webui: Render hex strings using IdentifierComponent in json-tree#167
Open
gtom84 wants to merge 1 commit into
Open
webui: Render hex strings using IdentifierComponent in json-tree#167gtom84 wants to merge 1 commit into
gtom84 wants to merge 1 commit into
Conversation
Implements automatic detection of hex strings within the JSON tree viewer and uses the `app-identifier` component to format them (e.g., with ASCII/text decoding). This improves the readability of Kea DHCP hex values, such as options payloads or flex-id, etc. - Added `isHexString()` detection logic to JsonTreeComponent. - Imported and embedded IdentifierComponent into json-tree templates. - Added unit tests for hexadecimal pattern matching.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR improves the usability of the JSON tree viewer by automatically formatting raw hexadecimal values using the existing
IdentifierComponent(app-identifier).When viewing raw DHCP data returned by Kea (such as
00020000000005830100...), it is incredibly helpful to see the parsed ASCII representation inline instead of a continuous block of hex data. This change conditionally triggers the hex formatter if a primitive value matches hexadecimal patterns.Changes
json-tree.component.ts: ImplementedisHexString()logic. It filters out pure decimal strings to reduce false positives, ensures the string length is even, and requires a length0xprefix.json-tree.component.html: Wrapped primitive text rendering in a condition that substitutes the raw string with<app-identifier>when hex formatting is applicable.json-tree.component.spec.ts: Added specific test assertions verifying the hex classification boundaries (including null states, raw numbers, explicit0xprefixes, and long Kea-specific hex outputs).Testing Done
npm run test(or the equivalent Angular CLI test runner for Stork webui) to verify the new test suites pass cleanly.0xprefix.