[8.8] [Synthetics] - Fix broken sort behavior on overview page. (#158411) (#158550)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Synthetics] - Fix broken sort behavior on overview page.
(#158411)](https://github.com/elastic/kibana/pull/158411)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Abdul Wahab
Zahid","email":"awahab07@yahoo.com"},"sourceCommit":{"committedDate":"2023-05-26T10:38:35Z","message":"[Synthetics]
- Fix broken sort behavior on overview page. (#158411)\n\nWhen sorting
on Synthetics -> Overview page, cards keep loading until\r\nthe next
periodic update. This PR fixes this
behavior.","sha":"bb495c2d5088456208ca26980d7c4c122f2743d9","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Team:uptime","release_note:skip","v8.8.0","v8.9.0"],"number":158411,"url":"https://github.com/elastic/kibana/pull/158411","mergeCommit":{"message":"[Synthetics]
- Fix broken sort behavior on overview page. (#158411)\n\nWhen sorting
on Synthetics -> Overview page, cards keep loading until\r\nthe next
periodic update. This PR fixes this
behavior.","sha":"bb495c2d5088456208ca26980d7c4c122f2743d9"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/158411","number":158411,"mergeCommit":{"message":"[Synthetics]
- Fix broken sort behavior on overview page. (#158411)\n\nWhen sorting
on Synthetics -> Overview page, cards keep loading until\r\nthe next
periodic update. This PR fixes this
behavior.","sha":"bb495c2d5088456208ca26980d7c4c122f2743d9"}}]}]
BACKPORT-->

Co-authored-by: Abdul Wahab Zahid <awahab07@yahoo.com>
This commit is contained in:
Kibana Machine 2023-05-26 07:43:52 -04:00 committed by GitHub
parent dc74b994f6
commit 82c4eac47b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View file

@ -35,6 +35,16 @@ journey('OverviewSorting', async ({ page, params }) => {
await syntheticsApp.navigateToOverview(true, 15);
});
step('sort should reload monitor cards', async () => {
await page.waitForSelector(`[data-test-subj="syntheticsOverviewGridItem"]`);
await page.click('[data-test-subj="syntheticsOverviewSortButton"]');
await page.click('button:has-text("Alphabetical")');
await page.waitForSelector(`[data-test-subj="syntheticsOverviewMonitorsLoading"]`);
await page.waitForSelector(`text=${testMonitor1}`);
await page.waitForSelector(`text=${testMonitor2}`);
await page.waitForSelector(`text=${testMonitor3}`);
});
step('sort alphabetical asc', async () => {
await page.waitForSelector(`[data-test-subj="syntheticsOverviewGridItem"]`);
await page.click('[data-test-subj="syntheticsOverviewSortButton"]');

View file

@ -70,7 +70,7 @@ export const OverviewPaginationInfo = ({
)}
</EuiText>
) : (
<EuiText size="xs">
<EuiText size="xs" data-test-subj="syntheticsOverviewMonitorsLoading">
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiLoadingSpinner size="m" />

View file

@ -72,11 +72,11 @@ export const OverviewPage: React.FC = () => {
// fetch overview for all other page state changes
useEffect(() => {
if (!monitorsLoaded) {
if (!overviewLoaded) {
dispatch(fetchMonitorOverviewAction.get(pageState));
}
// change only needs to be triggered on pageState change
}, [dispatch, pageState, monitorsLoaded]);
}, [dispatch, pageState, overviewLoaded]);
// fetch overview for refresh
useEffect(() => {