Skip to content

Commit

Permalink
Keep all spans expanded when uiFind param is present (#34)
Browse files Browse the repository at this point in the history
* Keep all spans expanded when uiFind param is present

* Add search by exact string
  • Loading branch information
kshmidt-digma authored Dec 6, 2023
1 parent 5e872e3 commit ccf66b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function setTrace(state: TTraceTimeline, { uiFind, trace }: TTraceUiFindValue) {

return Object.assign(
{ ...newInitialState(), spanNameColumnWidth, traceID },
uiFind ? calculateFocusedFindRowStates(uiFind, spans) : null
uiFind ? calculateFocusedFindRowStates(uiFind, spans, false) : null
);
}

Expand Down
23 changes: 12 additions & 11 deletions packages/jaeger-ui/src/utils/filter-spans.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ export default function filterSpans(textFilter: string, spans: Span[] | TNil) {
// values with keys that include text in any one of the excludeKeys will be ignored
const excludeKeys: string[] = [];

// split textFilter by whitespace, remove empty strings, and extract includeFilters and excludeKeys
textFilter
.split(/\s+/)
.filter(Boolean)
.forEach(w => {
if (w[0] === '-') {
excludeKeys.push(w.substr(1).toLowerCase());
} else {
includeFilters.push(w.toLowerCase());
}
});
// split textFilter by whitespace, but not that in double quotes, remove empty strings, and extract includeFilters and excludeKeys
const regex = /"[^"]+"|[^\s]+/g;
const match = textFilter.match(regex);
const results = match ? match.map(e => e.replace(/"(.*)"/, '$1')) : [];

results.filter(Boolean).forEach(w => {
if (w[0] === '-') {
excludeKeys.push(w.substr(1).toLowerCase());
} else {
includeFilters.push(w.toLowerCase());
}
});

const isTextInFilters = (filters: Array<string>, text: string) =>
filters.some(filter => text.toLowerCase().includes(filter));
Expand Down

0 comments on commit ccf66b8

Please sign in to comment.