-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[inspector] clusters tab search bar (#171806)
#167666 PR adds table sorting. In picture below, table is sorted by request time <img width="200" alt="Screenshot 2023-11-22 at 2 13 41 PM" src="https://github.com/elastic/kibana/assets/373691/710b0a3e-875b-463a-8344-f171b37df506"> PR adds search bar. Screen shot below shows status filter popover <img width="200" alt="Screenshot 2023-11-22 at 2 14 18 PM" src="https://github.com/elastic/kibana/assets/373691/644eeb47-0eba-4742-a381-4f997fbdf379"> Then, once search selections are made, the search bar filters the health bar and table. In the screen shot below, the table only display remote1 because its the only cluster that matches the status. <img width="200" alt="Screenshot 2023-11-22 at 2 14 11 PM" src="https://github.com/elastic/kibana/assets/373691/e9491c88-1f11-4179-ad4a-476f8fd210c0"> ### test instructions 1. Follow CCS setup instructions from #164350. 2. Open discover 3. Open inspector "clusters and shards" tab. Try sorting table and using search bar to narrow clusters --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
2b36209
commit 8af39c3
Showing
9 changed files
with
367 additions
and
155 deletions.
There are no files selected for viewing
96 changes: 0 additions & 96 deletions
96
...views/requests/components/details/clusters_view/__snapshots__/clusters_view.test.tsx.snap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...ic/views/requests/components/details/clusters_view/clusters_table/clusters_table.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { ClusterDetails } from '@kbn/es-types'; | ||
import { render, screen, fireEvent } from '@testing-library/react'; | ||
import { ClustersTable } from './clusters_table'; | ||
|
||
describe('ClustersTable', () => { | ||
describe('sorting', () => { | ||
const clusters = { | ||
remote1: { | ||
status: 'successful', | ||
took: 50, | ||
} as unknown as ClusterDetails, | ||
remote2: { | ||
status: 'skipped', | ||
took: 1000, | ||
} as unknown as ClusterDetails, | ||
remote3: { | ||
status: 'failed', | ||
took: 90, | ||
} as unknown as ClusterDetails, | ||
}; | ||
|
||
test('should render rows in native order', () => { | ||
render(<ClustersTable clusters={clusters} />); | ||
const tableRows = screen.getAllByRole('row'); | ||
expect(tableRows.length).toBe(4); // 1 header row, 3 data rows | ||
expect(tableRows[1]).toHaveTextContent('Nameremote1StatussuccessfulResponse time50ms'); | ||
expect(tableRows[2]).toHaveTextContent('Nameremote2StatusskippedResponse time1000ms'); | ||
expect(tableRows[3]).toHaveTextContent('Nameremote3StatusfailedResponse time90ms'); | ||
}); | ||
|
||
test('should sort by response time', () => { | ||
render(<ClustersTable clusters={clusters} />); | ||
const button = screen.getByRole('button', { | ||
name: 'Response time', | ||
}); | ||
fireEvent.click(button); | ||
const tableRowsAsc = screen.getAllByRole('row'); | ||
expect(tableRowsAsc.length).toBe(4); // 1 header row, 3 data rows | ||
expect(tableRowsAsc[1]).toHaveTextContent('Nameremote1StatussuccessfulResponse time50ms'); | ||
expect(tableRowsAsc[2]).toHaveTextContent('Nameremote3StatusfailedResponse time90ms'); | ||
expect(tableRowsAsc[3]).toHaveTextContent('Nameremote2StatusskippedResponse time1000ms'); | ||
|
||
fireEvent.click(button); | ||
const tableRowsDesc = screen.getAllByRole('row'); | ||
expect(tableRowsDesc.length).toBe(4); // 1 header row, 3 data rows | ||
expect(tableRowsDesc[1]).toHaveTextContent('Nameremote2StatusskippedResponse time1000ms'); | ||
expect(tableRowsDesc[2]).toHaveTextContent('Nameremote3StatusfailedResponse time90ms'); | ||
expect(tableRowsDesc[3]).toHaveTextContent('Nameremote1StatussuccessfulResponse time50ms'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.