Skip to content

Commit

Permalink
Clean up types and hook usage to comply with kibana eslint rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkambic committed Dec 18, 2019
1 parent d39590c commit 380b50e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.

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 @@ -207,7 +207,6 @@ describe('PingList component', () => {
onPageCountChange={jest.fn()}
onSelectedLocationChange={(loc: EuiComboBoxOptionProps[]) => {}}
onSelectedStatusChange={jest.fn()}
onUpdateApp={jest.fn()}
pageSize={30}
selectedOption="down"
selectedLocation={AllLocationOption.value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { get } from 'lodash';
import moment from 'moment';
import React, { Fragment, useEffect, useState } from 'react';
// @ts-ignore formatNumber
import { formatNumber } from '@elastic/eui/lib/services/format';
import React, { Fragment, useState } from 'react';
import { Ping, PingResults } from '../../../../common/graphql/types';
import { convertMicrosecondsToMilliseconds as microsToMillis } from '../../../lib/helper';
import { UptimeGraphQLQueryProps, withUptimeGraphQL } from '../../higher_order';
Expand All @@ -40,7 +38,6 @@ interface PingListProps {
onSelectedStatusChange: (status: string | undefined) => void;
onSelectedLocationChange: (location: any) => void;
onPageCountChange: (itemCount: number) => void;
onUpdateApp: () => void;
pageSize: number;
selectedOption: string;
selectedLocation: string | undefined;
Expand Down Expand Up @@ -76,17 +73,12 @@ export const PingListComponent = ({
onPageCountChange,
onSelectedLocationChange,
onSelectedStatusChange,
onUpdateApp,
pageSize,
selectedOption,
selectedLocation,
}: Props) => {
const [itemIdToExpandedRowMap, setItemIdToExpandedRowMap] = useState<ExpandedRowMap>({});

useEffect(() => {
onUpdateApp();
}, [onUpdateApp, selectedOption]);

const statusOptions = [
{
text: i18n.translate('xpack.uptime.pingList.statusOptions.allStatusOptionLabel', {
Expand Down Expand Up @@ -181,9 +173,6 @@ export const PingListComponent = ({
render: (error: string) => error ?? '-',
},
];
useEffect(() => {
onUpdateApp();
}, [onUpdateApp, selectedOption]);
let pings: Ping[] = [];
if (data && data.allPings && data.allPings.pings) {
pings = data.allPings.pings;
Expand Down
8 changes: 4 additions & 4 deletions x-pack/legacy/plugins/uptime/public/pages/monitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ export const MonitorPage = ({
<PingList
onPageCountChange={setPingListPageCount}
onSelectedLocationChange={setSelectedLocation}
onSelectedStatusChange={(selectedStatus: string | undefined) =>
updateUrlParams({ selectedPingStatus: selectedStatus || '' })
}
onUpdateApp={refreshApp}
onSelectedStatusChange={(selectedStatus: string | undefined) => {
updateUrlParams({ selectedPingStatus: selectedStatus || '' });
refreshApp();
}}
pageSize={pingListPageCount}
selectedOption={selectedPingStatus}
selectedLocation={selectedLocation}
Expand Down

0 comments on commit 380b50e

Please sign in to comment.