forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overview heights and loading states (elastic#83360)
* Overview heights and loading states * Set the chart height to fill the whole container * Remove the initial loading spinner for the tables and always show the progress bar * Make the last seen column on the errors table a bit wider so it doesn't wrap * Make a `ServiceOverviewTable` component that pins the pagination to the bottom of the panel * Show the loading spinner on charts when doing updates
- Loading branch information
Showing
6 changed files
with
103 additions
and
50 deletions.
There are no files selected for viewing
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
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
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
56 changes: 56 additions & 0 deletions
56
x-pack/plugins/apm/public/components/app/service_overview/service_overview_table.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,56 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { EuiBasicTable, EuiBasicTableProps } from '@elastic/eui'; | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
/** | ||
* The height for a table on the overview page. Is the height of a 5-row basic | ||
* table. | ||
*/ | ||
const tableHeight = 298; | ||
|
||
/** | ||
* A container for the table. Sets height and flex properties on the EUI Basic | ||
* Table contained within and the first child div of that. This makes it so the | ||
* pagination controls always stay fixed at the bottom in the same position. | ||
* | ||
* Hide the empty message when we don't yet have any items and are still loading. | ||
*/ | ||
const ServiceOverviewTableContainer = styled.div<{ | ||
isEmptyAndLoading: boolean; | ||
}>` | ||
height: ${tableHeight}px; | ||
display: flex; | ||
flex-direction: column; | ||
.euiBasicTable { | ||
display: flex; | ||
flex-direction: column; | ||
flex-grow: 1; | ||
> :first-child { | ||
flex-grow: 1; | ||
} | ||
} | ||
.euiTableRowCell { | ||
visibility: ${({ isEmptyAndLoading }) => | ||
isEmptyAndLoading ? 'hidden' : 'visible'}; | ||
} | ||
`; | ||
|
||
export function ServiceOverviewTable<T>(props: EuiBasicTableProps<T>) { | ||
const { items, loading } = props; | ||
const isEmptyAndLoading = !!(items.length === 0 && loading); | ||
|
||
return ( | ||
<ServiceOverviewTableContainer isEmptyAndLoading={isEmptyAndLoading}> | ||
<EuiBasicTable {...props} /> | ||
</ServiceOverviewTableContainer> | ||
); | ||
} |
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
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