Skip to content

Commit

Permalink
[Synthetics] Remove only show retests filter (#169358)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 authored Oct 19, 2023
1 parent c49ca31 commit 47cea09
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ export const GetPingsParamsType = t.intersection([
monitorId: t.string,
sort: t.string,
status: t.string,
finalAttempt: t.boolean,
}),
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { useSelectedLocation } from './use_selected_location';
import {
getMonitorRecentPingsAction,
selectMonitorPingsMetadata,
selectShowOnlyFinalAttempts,
selectStatusFilter,
} from '../../../state';

Expand All @@ -34,8 +33,6 @@ export const useMonitorPings = (props?: UseMonitorPingsProps) => {
const monitorId = monitor?.id;
const locationLabel = location?.label;

const showOnlyFinalAttempts = useSelector(selectShowOnlyFinalAttempts);

const statusFilter = useSelector(selectStatusFilter);

useEffect(() => {
Expand All @@ -48,7 +45,6 @@ export const useMonitorPings = (props?: UseMonitorPingsProps) => {
pageIndex: props?.pageIndex,
from: props?.from,
to: props?.to,
finalAttempt: showOnlyFinalAttempts,
statusFilter,
})
);
Expand All @@ -62,7 +58,6 @@ export const useMonitorPings = (props?: UseMonitorPingsProps) => {
props?.pageIndex,
props?.from,
props?.to,
showOnlyFinalAttempts,
statusFilter,
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,8 @@
import React from 'react';
import { useHistory } from 'react-router-dom';
import { i18n } from '@kbn/i18n';
import {
EuiButtonEmpty,
EuiFlexGroup,
EuiFlexItem,
EuiLink,
EuiSwitch,
EuiTitle,
} from '@elastic/eui';
import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiLink, EuiTitle } from '@elastic/eui';

import { useDispatch, useSelector } from 'react-redux';
import { selectShowOnlyFinalAttempts, showOnlyFinalAttemptsAction } from '../../../state';
import { StatusFilter } from './status_filter';
import { MONITOR_HISTORY_ROUTE } from '../../../../../../common/constants';
import { ConfigKey, Ping } from '../../../../../../common/runtime_types';
Expand All @@ -43,10 +34,6 @@ export const TestRunsTableHeader = ({

const { monitor } = useSelectedMonitor();

const showOnlyFinalAttempts = useSelector(selectShowOnlyFinalAttempts);

const dispatch = useDispatch();

return (
<EuiFlexGroup alignItems="center" gutterSize="l">
<EuiFlexItem grow={false}>
Expand All @@ -58,15 +45,6 @@ export const TestRunsTableHeader = ({
<EuiFlexItem grow={false}>
<StatusFilter />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiSwitch
compressed
data-test-subj="toggleRetestSwitch"
label={ONLY_SHOW_RETEST}
checked={showOnlyFinalAttempts}
onChange={(e) => dispatch(showOnlyFinalAttemptsAction(e.target.checked))}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
{showViewHistoryButton ? (
<EuiLink
Expand Down Expand Up @@ -106,10 +84,6 @@ const TEST_RUNS = i18n.translate('xpack.synthetics.monitorDetails.summary.testRu
defaultMessage: 'Test Runs',
});

const ONLY_SHOW_RETEST = i18n.translate('xpack.synthetics.monitorDetails.summary.onlyRetests', {
defaultMessage: 'Only show retests',
});

export const LAST_10_TEST_RUNS = i18n.translate(
'xpack.synthetics.monitorDetails.summary.lastTenTestRuns',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,4 @@ export const getMonitorRecentPingsAction = createAsyncAction<MostRecentPingsRequ
'[MONITOR DETAILS] GET RECENT PINGS'
);

export const showOnlyFinalAttemptsAction = createAction<boolean>('SHOW ONLY FINAL ATTEMPTS');
export const setStatusFilter = createAction<'up' | 'down' | undefined>('SET STATUS FILTER');
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export interface MostRecentPingsRequest {
to?: string;
size?: number;
pageIndex?: number;
finalAttempt?: boolean;
statusFilter?: 'up' | 'down';
}

Expand All @@ -43,7 +42,6 @@ export const fetchMonitorRecentPings = async ({
to,
size = 10,
pageIndex = 0,
finalAttempt,
statusFilter,
}: MostRecentPingsRequest): Promise<PingsResponse> => {
const locations = JSON.stringify([locationId]);
Expand All @@ -59,7 +57,6 @@ export const fetchMonitorRecentPings = async ({
sort,
size,
pageIndex,
finalAttempt,
status: statusFilter,
},
PingsResponseType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
getMonitorRecentPingsAction,
setMonitorDetailsLocationAction,
getMonitorAction,
showOnlyFinalAttemptsAction,
setStatusFilter,
} from './actions';

Expand All @@ -39,7 +38,6 @@ export interface MonitorDetailsState {
syntheticsMonitorDispatchedAt: number;
error: IHttpSerializedFetchError | null;
selectedLocationId: string | null;
showOnlyFinalAttempts?: boolean;
statusFilter?: 'up' | 'down' | undefined;
}

Expand All @@ -51,7 +49,6 @@ const initialState: MonitorDetailsState = {
syntheticsMonitorDispatchedAt: 0,
error: null,
selectedLocationId: null,
showOnlyFinalAttempts: false,
};

export const monitorDetailsReducer = createReducer(initialState, (builder) => {
Expand Down Expand Up @@ -116,9 +113,6 @@ export const monitorDetailsReducer = createReducer(initialState, (builder) => {
state.syntheticsMonitor = action.payload;
}
})
.addCase(showOnlyFinalAttemptsAction, (state, action) => {
state.showOnlyFinalAttempts = action.payload;
})
.addCase(setStatusFilter, (state, action) => {
state.statusFilter = action.payload;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,5 @@ export const selectPingsLoading = createSelector(getState, (state) => state.ping
export const selectMonitorPingsMetadata = createSelector(getState, (state) => state.pings);

export const selectPingsError = createSelector(getState, (state) => state.error);
export const selectShowOnlyFinalAttempts = createSelector(
getState,
(state) => state.showOnlyFinalAttempts ?? false
);

export const selectStatusFilter = createSelector(getState, (state) => state.statusFilter);
2 changes: 0 additions & 2 deletions x-pack/plugins/synthetics/server/common/pings/query_pings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export async function queryPings<F>(
pageIndex,
locations,
excludedLocations,
finalAttempt,
} = params;
const size = sizeParam ?? DEFAULT_PAGE_SIZE;

Expand All @@ -65,7 +64,6 @@ export async function queryPings<F>(
{ range: { '@timestamp': { gte: from, lte: to } } },
...(monitorId ? [{ term: { 'monitor.id': monitorId } }] : []),
...(status ? [{ term: { 'monitor.status': status } }] : []),
...(finalAttempt ? [{ term: { 'summary.final_attempt': finalAttempt } }] : []),
] as QueryDslQueryContainer[],
},
},
Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugins/synthetics/server/routes/pings/get_pings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const getPingsRouteQuerySchema = schema.object({
pageIndex: schema.maybe(schema.number()),
sort: schema.maybe(schema.string()),
status: schema.maybe(schema.string()),
finalAttempt: schema.maybe(schema.boolean()),
});

type GetPingsRouteRequest = TypeOf<typeof getPingsRouteQuerySchema>;
Expand All @@ -44,7 +43,6 @@ export const syntheticsGetPingsRoute: SyntheticsRestApiRouteFactory = () => ({
pageIndex,
locations,
excludedLocations,
finalAttempt,
} = request.query as GetPingsRouteRequest;

return await queryPings({
Expand All @@ -58,7 +56,6 @@ export const syntheticsGetPingsRoute: SyntheticsRestApiRouteFactory = () => ({
pageIndex,
locations: locations ? JSON.parse(locations) : [],
excludedLocations,
finalAttempt,
});
},
});

0 comments on commit 47cea09

Please sign in to comment.