-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Uptime] Waterfall filters #89185
[Uptime] Waterfall filters #89185
Conversation
46242f6
to
063d875
Compare
@dominiqueclarke / @shahzad31 there is a problem where the filter disappears if the “collapse” option is selected and there are no matches (either in the search, or selecting a MIME type that doesn’t have any corresponding requests). When this happens, there is no way of getting the filter back, to update it (have to refresh the browser). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a few comments but this is looking great, and I really enjoy using the filters. Really nice addition. 👍
@@ -19,17 +19,27 @@ export const useBarCharts = ({ data = [] }: UseBarHookProps) => { | |||
useEffect(() => { | |||
if (data.length > 0) { | |||
let chartIndex = 0; | |||
/* We want at most CANVAS_MAX_ITEMS **RESOURCES** per array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
...k/plugins/uptime/public/components/monitor/synthetics/waterfall/components/use_bar_charts.ts
Show resolved
Hide resolved
@@ -70,4 +75,35 @@ describe('useBarChartsHooks', () => { | |||
expect(lastChartItems[0].x).toBe(CANVAS_MAX_ITEMS * 4); | |||
expect(lastChartItems[lastChartItems.length - 1].x).toBe(CANVAS_MAX_ITEMS * 5 - 1); | |||
}); | |||
|
|||
it('returns result as expected for filtered data', () => { | |||
/* multiply x values to simulate filtered data, where x values can have gaps in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
})}{' '} | ||
{showHighlightedNetworkRequests && | ||
highlightedNetworkRequests >= 0 && | ||
`(${i18n.translate('xpack.uptime.synthetics.waterfall.requestsHighlightedMessage', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we switch this to use <FormattedMessage />
? This seems super un-readable by comparison.
return is400 || is500 || isSpecific300; | ||
}; | ||
|
||
const isHighlighted = item.isHighlighted; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably either skip this declaration and directly reference item.isHighlighted
, or destructure it from item.
const isHighlighted = item.isHighlighted; | |
const { isHighlighted } = item; |
compressed={true} | ||
disabled={!(query || activeFilters.length > 0)} | ||
id="onlyHighlighted" | ||
label="Collapse to only show matching requests" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requires translation.
|
||
// inout has debounce effect so hence the timer | ||
act(() => { | ||
jest.advanceTimersByTime(300); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL
|
||
const searchText = '.js'; | ||
|
||
act(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you want to modify this?
|
||
export const MIME_FILTERS = [ | ||
{ | ||
label: 'XHR', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking it's best to err on the side of caution and translate these labels. We have XHR
translated further up in this diff already, so it'd also be consistent.
@paulb-elastic This happened when 0 items matched the filter. This has been resolved. Please note, this is the new, current UI when there are 0 resources that match the filter. |
@elasticmachine merge upstream |
Thanks @dominiqueclarke, the empty filter result works much better now (doesn’t disappear). Thanks also for highlighting about the gridlines. I think that’s ok for now (especially as there are still open questions about keeping the collapse view longer term). Plus it's consistent with how we only show the gridlines where there are network requests, filter or not, such as this example where there are not many network requests: |
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - really great enhancement @dominiqueclarke @shahzad31
* WIP * Use multi canvas solution * type * fix test * adde unit tests * reduce item to 150 * update margins * use constant * update z-index * added key * wip * wip * wip filters * reorgnaise components * fix issue * update filter * only highlight button * water fall test * styling * fix styling * test * fix types * update test * update ari hidden * added click telemetry for waterfall filters * added input click telemetry * update filter behaviour * fixed typo * fix type * fix styling * persist original resource number in waterfall sidebar when showing only highlighted resources * update waterfall filter collapse checkbox content * update use_bar_charts to work with filtered data * update network request total label to include filtered requests * adjust telemetry * add accessible text * add waterfall chart view telemetry * updated mime type filter label translations * adjust total network requests to use FormattedMessage * adjust translations and tests * use FormattedMessage in NetworkRequestsTotal * ensure sidebar persists when 0 resources match filter * use destructuring in waterfall sidebar item * reset collapse requests checkbox when filters are removed * update license headers Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Backport result
|
* WIP * Use multi canvas solution * type * fix test * adde unit tests * reduce item to 150 * update margins * use constant * update z-index * added key * wip * wip * wip filters * reorgnaise components * fix issue * update filter * only highlight button * water fall test * styling * fix styling * test * fix types * update test * update ari hidden * added click telemetry for waterfall filters * added input click telemetry * update filter behaviour * fixed typo * fix type * fix styling * persist original resource number in waterfall sidebar when showing only highlighted resources * update waterfall filter collapse checkbox content * update use_bar_charts to work with filtered data * update network request total label to include filtered requests * adjust telemetry * add accessible text * add waterfall chart view telemetry * updated mime type filter label translations * adjust total network requests to use FormattedMessage * adjust translations and tests * use FormattedMessage in NetworkRequestsTotal * ensure sidebar persists when 0 resources match filter * use destructuring in waterfall sidebar item * reset collapse requests checkbox when filters are removed * update license headers Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Shahzad <shahzad.muhammad@elastic.co> Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
Summary
Fixes: #80167
WaterFall filters