Skip to content

Commit ccf66b8

Browse files
Keep all spans expanded when uiFind param is present (#34)
* Keep all spans expanded when uiFind param is present * Add search by exact string
1 parent 5e872e3 commit ccf66b8

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/duck.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ function setTrace(state: TTraceTimeline, { uiFind, trace }: TTraceUiFindValue) {
157157

158158
return Object.assign(
159159
{ ...newInitialState(), spanNameColumnWidth, traceID },
160-
uiFind ? calculateFocusedFindRowStates(uiFind, spans) : null
160+
uiFind ? calculateFocusedFindRowStates(uiFind, spans, false) : null
161161
);
162162
}
163163

packages/jaeger-ui/src/utils/filter-spans.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,18 @@ export default function filterSpans(textFilter: string, spans: Span[] | TNil) {
2626
// values with keys that include text in any one of the excludeKeys will be ignored
2727
const excludeKeys: string[] = [];
2828

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

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

0 commit comments

Comments
 (0)