Merge ticket branch t090
This commit is contained in:
@@ -11,6 +11,16 @@ const EMPTY_KIND: ParamDeclaration['kind'] = 'string'
|
||||
// sharing the same label set (ticket 038).
|
||||
type ExtractionSource = 'regex' | 'json_field' | 'elapsed_since_last'
|
||||
|
||||
// The parenthesized suffix shown after a declared-param badge's kind, e.g. "(string, group path)" —
|
||||
// one of five possible forms depending on how the param's value is produced.
|
||||
function paramBadgeSuffix(p: ParamDeclaration): string {
|
||||
if (p.elapsed_since_last) return ', elapsed since previous'
|
||||
if (p.kind === 'boolean') return ''
|
||||
if (p.json_field_path) return `, json field ${p.json_field_path}`
|
||||
if (p.capture_group !== p.name) return `, group ${p.capture_group}`
|
||||
return ''
|
||||
}
|
||||
|
||||
/// A JSON *object* (not an array/scalar) parses cleanly and pretty-prints with braces — the same
|
||||
/// shape a JSON field path can be read from, so this is the "line looks like JSON" gate that
|
||||
/// unlocks the "JSON field" extraction option.
|
||||
@@ -301,15 +311,7 @@ export function Params({ params, onDeclared }: { params: ParamDeclaration[]; onD
|
||||
title={p.elapsed_since_last ? undefined : p.message_match_regex}
|
||||
>
|
||||
{p.name} ({p.kind}
|
||||
{p.elapsed_since_last
|
||||
? ', elapsed since previous'
|
||||
: p.kind === 'boolean'
|
||||
? ''
|
||||
: p.json_field_path
|
||||
? `, json field ${p.json_field_path}`
|
||||
: p.capture_group !== p.name
|
||||
? `, group ${p.capture_group}`
|
||||
: ''}
|
||||
{paramBadgeSuffix(p)}
|
||||
)
|
||||
</button>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user