Skip to content

Commit

Permalink
Fix build errors and address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gbamparop committed Mar 28, 2022
1 parent a0fa40d commit c0276e6
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function BackendDetailOverview() {
refreshPaused,
environment,
kuery,
comparisonEnabled,
},
} = useApmParams('/backends/overview');

Expand All @@ -54,6 +55,7 @@ export function BackendDetailOverview() {
refreshPaused,
environment,
kuery,
comparisonEnabled,
},
}),
},
Expand All @@ -68,6 +70,7 @@ export function BackendDetailOverview() {
refreshPaused,
environment,
kuery,
comparisonEnabled,
},
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,14 @@ export function ErrorGroupDetails() {

const {
path: { groupId },
query: { rangeFrom, rangeTo, environment, kuery, serviceGroup },
query: {
rangeFrom,
rangeTo,
environment,
kuery,
serviceGroup,
comparisonEnabled,
},
} = useApmParams('/services/{serviceName}/errors/{groupId}');

const { start, end } = useTimeRange({ rangeFrom, rangeTo });
Expand All @@ -130,6 +137,7 @@ export function ErrorGroupDetails() {
environment,
kuery,
serviceGroup,
comparisonEnabled,
},
}),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const query = {
environment: ENVIRONMENT_ALL.value,
kuery: '',
serviceGroup: '',
comparisonEnabled: false,
};

const service: any = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,14 @@ export function ServiceContents({

const focusUrl = apmRouter.link('/services/{serviceName}/service-map', {
path: { serviceName },
query: { rangeFrom, rangeTo, environment, kuery, serviceGroup },
query: {
rangeFrom,
rangeTo,
environment,
kuery,
serviceGroup,
comparisonEnabled,
},
});

const { serviceAnomalyStats } = nodeData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { i18n } from '@kbn/i18n';
import React from 'react';
import { Outlet } from '@kbn/typed-react-router-config';
import { toBooleanRt, toNumberRt } from '@kbn/io-ts-utils';
import { comparisonTypeRt } from '../../../../common/runtime_types/comparison_type_rt';
import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values';
import { environmentRt } from '../../../../common/environment_rt';
import { ServiceOverview } from '../../app/service_overview';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ Example.args = {
kuery: '',
rangeFrom: 'now-15m',
rangeTo: 'now',
comparisonEnabled: false,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useApmRouter } from '../../../hooks/use_apm_router';
import { isRouteWithTimeRange } from '../is_route_with_time_range';
import {
TimeRangeComparisonEnum,
dayAndWeekBeforeToOffsetMap,
dayAndWeekBeforeToOffset,
} from '../../../components/shared/time_comparison/get_comparison_options';
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { getComparisonEnabled } from '../../../components/shared/time_comparison/get_comparison_enabled';
Expand All @@ -29,6 +29,8 @@ export function RedirectWithOffset({
const matchesRoute = isRouteWithTimeRange({ apmRouter, location });
const query = qs.parse(location.search);

// Redirect when 'comparisonType' is set as we now use offset instead
// or when 'comparisonEnabled' is not set as it's now required
if (
matchesRoute &&
('comparisonType' in query || !('comparisonEnabled' in query))
Expand Down Expand Up @@ -56,7 +58,7 @@ export function RedirectWithOffset({
url: location.pathname,
query: {
comparisonEnabled,
offset: dayAndWeekBeforeToOffsetMap[comparisonTypeEnumValue] ?? '',
offset: dayAndWeekBeforeToOffset[comparisonTypeEnumValue] ?? '',
...queryRest,
},
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Example.args = {
rangeFrom: 'now-15m',
rangeTo: 'now',
serviceGroup: '',
comparisonEnabled: false,
},
serviceName: 'opbeans-java',
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export enum TimeRangeComparisonEnum {
PeriodBefore = 'period',
}

export const dayAndWeekBeforeToOffsetMap = {
export const dayAndWeekBeforeToOffset = {
[TimeRangeComparisonEnum.DayBefore]: '1d',
[TimeRangeComparisonEnum.WeekBefore]: '1w',
} as const;
Expand Down Expand Up @@ -56,16 +56,15 @@ function getSelectOptions({
switch (value) {
case TimeRangeComparisonEnum.DayBefore: {
return {
value: dayAndWeekBeforeToOffsetMap[TimeRangeComparisonEnum.DayBefore],
value: dayAndWeekBeforeToOffset[TimeRangeComparisonEnum.DayBefore],
text: i18n.translate('xpack.apm.timeComparison.select.dayBefore', {
defaultMessage: 'Day before',
}),
};
}
case TimeRangeComparisonEnum.WeekBefore: {
return {
value:
dayAndWeekBeforeToOffsetMap[TimeRangeComparisonEnum.WeekBefore],
value: dayAndWeekBeforeToOffset[TimeRangeComparisonEnum.WeekBefore],
text: i18n.translate('xpack.apm.timeComparison.select.weekBefore', {
defaultMessage: 'Week before',
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function getColumns({
transactionGroupDetailedStatistics?: TransactionGroupDetailedStatistics;
comparisonEnabled?: boolean;
shouldShowSparkPlots?: boolean;
comparisonType?: TimeRangeComparisonType;
offset?: string;
}): Array<EuiBasicTableColumn<ServiceTransactionGroupItem>> {
return [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function TransactionsTable({
const {
query: {
comparisonEnabled,
comparisonType,
offset,
latencyAggregationType,
page: urlPage = 0,
pageSize: urlPageSize = numberOfTransactionsPerPage,
Expand Down

0 comments on commit c0276e6

Please sign in to comment.