Skip to content

Commit

Permalink
[APM] Change services sparkline condition to align with dependencies …
Browse files Browse the repository at this point in the history
…table (#176293)

Closes #175130 
## Summary

This PR changes the condition to show the sparkline in the transaction
table to check for `isLarge` size first to be consistent with the
dependencies table.
Big screen size:

<img width="1919" alt="image"
src="https://github.com/elastic/kibana/assets/14139027/2b232838-2f25-4319-95a9-9b962d0221ac">

Small screen size: 


![image](https://github.com/elastic/kibana/assets/14139027/ad4c64fe-a675-4027-9823-44bf4b40a399)


## Testing
- Compare the dependencies table and the transaction table on the
overview tab and check other tabs for the same behavior (big and small
screen sizes).
 


https://github.com/elastic/kibana/assets/14139027/f372bd84-3414-4425-b576-29dd1bedca72
  • Loading branch information
jennypavlova authored Feb 7, 2024
1 parent 74aad4f commit 79dbc47
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export function DependencyDetailOperationsList() {

const { core } = useApmPluginContext();

const breakpoints = useBreakpoints();
const { isLarge } = useBreakpoints();
const shouldShowSparkPlots = !isLarge;

const { start, end } = useTimeRange({
rangeFrom,
Expand Down Expand Up @@ -147,7 +148,7 @@ export function DependencyDetailOperationsList() {
render: (_, { spanName }) => <OperationLink spanName={spanName} />,
},
...getSpanMetricColumns({
breakpoints,
shouldShowSparkPlots,
comparisonFetchStatus: comparisonStatsFetch.status,
}),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ export function MobileServiceOverview() {
kuery={kueryWithMobileFilters}
environment={environment}
fixedHeight={true}
isSingleColumn={isSingleColumn}
start={start}
end={end}
showPerPageOptions={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ export function ServiceOverview() {
kuery={kuery}
environment={environment}
fixedHeight={true}
isSingleColumn={isSingleColumn}
start={start}
end={end}
showPerPageOptions={false}
numberOfTransactionsPerPage={5}
showSparkPlots={!isSingleColumn}
/>
</EuiPanel>
</EuiFlexItem>
Expand Down Expand Up @@ -209,6 +209,7 @@ export function ServiceOverview() {
)}
</EuiLink>
}
showSparkPlots={!isSingleColumn}
/>
</EuiPanel>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ interface ServiceOverviewDependenciesTableProps {
fixedHeight?: boolean;
link?: ReactNode;
showPerPageOptions?: boolean;
showSparkPlots?: boolean;
}

export function ServiceOverviewDependenciesTable({
fixedHeight,
link,
showPerPageOptions = true,
showSparkPlots,
}: ServiceOverviewDependenciesTableProps) {
const {
query: {
Expand Down Expand Up @@ -171,6 +173,7 @@ export function ServiceOverviewDependenciesTable({
link={link}
showPerPageOptions={showPerPageOptions}
initialPageSize={5}
showSparkPlots={showSparkPlots}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
RIGHT_ALIGNMENT,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { Breakpoints } from '../../../hooks/use_breakpoints';
import {
ChartType,
getTimeSeriesColor,
Expand Down Expand Up @@ -53,14 +52,12 @@ export interface SpanMetricGroup {
}

export function getSpanMetricColumns({
breakpoints,
comparisonFetchStatus,
shouldShowSparkPlots,
}: {
breakpoints: Breakpoints;
comparisonFetchStatus: FETCH_STATUS;
shouldShowSparkPlots: boolean;
}): Array<ITableColumn<SpanMetricGroup>> {
const { isLarge } = breakpoints;
const shouldShowSparkPlots = !isLarge;
const isLoading = isPending(comparisonFetchStatus);

return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ interface Props {
status: FETCH_STATUS;
compact?: boolean;
showPerPageOptions?: boolean;
showSparkPlots?: boolean;
}

type FormattedSpanMetricGroup = SpanMetricGroup & {
Expand All @@ -56,10 +57,11 @@ export function DependenciesTable(props: Props) {
compact = true,
showPerPageOptions = true,
initialPageSize,
showSparkPlots,
} = props;

// SparkPlots should be hidden if we're in two-column view and size XL (1200px)
const breakpoints = useBreakpoints();
const { isLarge } = useBreakpoints();
const shouldShowSparkPlots = showSparkPlots ?? !isLarge;

const items: FormattedSpanMetricGroup[] = dependencies.map((dependency) => ({
name: dependency.name,
Expand Down Expand Up @@ -95,7 +97,7 @@ export function DependenciesTable(props: Props) {
width: '30%',
},
...getSpanMetricColumns({
breakpoints,
shouldShowSparkPlots,
comparisonFetchStatus: status,
}),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const INITIAL_STATE: ApiResponse & { requestId: string } = {
interface Props {
hideTitle?: boolean;
hideViewTransactionsLink?: boolean;
isSingleColumn?: boolean;
numberOfTransactionsPerPage?: number;
showPerPageOptions?: boolean;
showMaxTransactionGroupsExceededWarning?: boolean;
Expand All @@ -58,13 +57,13 @@ interface Props {
start: string;
end: string;
saveTableOptionsToUrl?: boolean;
showSparkPlots?: boolean;
}

export function TransactionsTable({
fixedHeight = false,
hideViewTransactionsLink = false,
hideTitle = false,
isSingleColumn = true,
numberOfTransactionsPerPage = 10,
showPerPageOptions = true,
showMaxTransactionGroupsExceededWarning = false,
Expand All @@ -73,6 +72,7 @@ export function TransactionsTable({
start,
end,
saveTableOptionsToUrl = false,
showSparkPlots,
}: Props) {
const { link } = useApmRouter();

Expand All @@ -94,9 +94,8 @@ export function TransactionsTable({
latencyAggregationTypeFromQuery
);

// SparkPlots should be hidden if we're in two-column view and size XL (1200px)
const { isXl } = useBreakpoints();
const shouldShowSparkPlots = isSingleColumn || !isXl;
const { isLarge } = useBreakpoints();
const shouldShowSparkPlots = showSparkPlots ?? !isLarge;
const { transactionType, serviceName } = useApmServiceContext();
const [searchQuery, setSearchQueryDebounced] = useStateDebounced('');

Expand Down

0 comments on commit 79dbc47

Please sign in to comment.