Skip to content
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] Add explicit alignments to table columns #40680

Merged
merged 9 commits into from
Jul 17, 2019

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const MonitorListComponent = (props: Props) => {
// sorting={sorting}
columns={[
{
align: 'left',
field: 'monitor_id',
name: '',
sortable: true,
Expand Down Expand Up @@ -165,6 +166,7 @@ export const MonitorListComponent = (props: Props) => {
},
},
{
align: 'left',
field: 'state.monitor.status',
name: i18n.translate('xpack.uptime.monitorList.statusColumnLabel', {
defaultMessage: 'Status',
Expand All @@ -174,6 +176,7 @@ export const MonitorListComponent = (props: Props) => {
},
},
{
align: 'left',
field: 'state.monitor.name',
name: i18n.translate('xpack.uptime.monitorList.nameColumnLabel', {
defaultMessage: 'Name',
Expand All @@ -190,6 +193,7 @@ export const MonitorListComponent = (props: Props) => {
sortable: true,
},
{
align: 'left',
field: 'state.url.full',
name: i18n.translate('xpack.uptime.monitorList.urlColumnLabel', {
defaultMessage: 'URL',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ export interface ExpandedRowMap {
}

export interface Pagination {
hidePerPageOptions?: boolean;
initialPageSize: number;
pageIndex: number;
pageSize: number;
totalItemCount: number;
pageSizeOptions: number[];
hidePerPageOptions: boolean;
totalItemCount: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { convertMicrosecondsToMilliseconds as microsToMillis } from '../../lib/h
import { UptimeGraphQLQueryProps, withUptimeGraphQL } from '../higher_order';
import { pingsQuery } from '../../queries';
import { LocationName } from './location_name';
import { Criteria } from './monitor_list';
import { Criteria, Pagination } from './monitor_list';

interface PingListQueryResult {
allPings?: PingResults;
Expand Down Expand Up @@ -117,34 +117,43 @@ export const PingListComponent = ({
),
},
{
field: 'observer.geo.name',
align: 'left',
dataType: 'number',
field: 'observer.geo.name',
name: i18n.translate('xpack.uptime.pingList.locationNameColumnLabel', {
defaultMessage: 'Location',
}),
render: (location: string) => <LocationName location={location} />,
},
{
field: 'monitor.ip',
align: 'left',
dataType: 'number',
field: 'monitor.ip',
name: i18n.translate('xpack.uptime.pingList.ipAddressColumnLabel', {
defaultMessage: 'IP',
}),
},
{
align: 'right',
field: 'monitor.duration.us',
name: i18n.translate('xpack.uptime.pingList.durationMsColumnLabel', {
defaultMessage: 'Duration',
}),
render: (duration: number) => microsToMillis(duration),
render: (duration: number) =>
i18n.translate('xpack.uptime.pingList.durationMsColumnFormatting', {
values: { millis: microsToMillis(duration) },
defaultMessage: '{millis} ms',
}),
},
{
align: 'left',
field: 'error.type',
name: i18n.translate('xpack.uptime.pingList.errorTypeColumnLabel', {
defaultMessage: 'Error type',
}),
},
{
align: 'left',
field: 'error.message',
name: i18n.translate('xpack.uptime.pingList.errorMessageColumnLabel', {
defaultMessage: 'Error message',
Expand Down Expand Up @@ -192,6 +201,17 @@ export const PingListComponent = ({
});
}
}
const pagination: Pagination = {
initialPageSize: 20,
pageIndex: 0,
pageSize,
pageSizeOptions: [5, 10, 20, 50, 100],
/**
* we're not currently supporting pagination in this component
* so the first page is the only page
*/
totalItemCount: pageSize,
};

return (
<Fragment>
Expand Down Expand Up @@ -278,12 +298,7 @@ export const PingListComponent = ({
loading={loading}
columns={columns}
items={pings}
pagination={{
initialPageSize: 20,
pageIndex: 0,
pageSize,
pageSizeOptions: [5, 10, 20, 50, 100],
}}
pagination={pagination}
onChange={({ page: { size } }: Criteria) => onPageCountChange(size)}
/>
</EuiPanel>
Expand Down