diff --git a/public/app/features/logs/components/LogDetailsRow.test.tsx b/public/app/features/logs/components/LogDetailsRow.test.tsx index 987322b5dbd..3745df514f7 100644 --- a/public/app/features/logs/components/LogDetailsRow.test.tsx +++ b/public/app/features/logs/components/LogDetailsRow.test.tsx @@ -2,6 +2,7 @@ import { screen, render, fireEvent } from '@testing-library/react'; import React, { ComponentProps } from 'react'; import { LogRowModel } from '@grafana/data'; +import config from 'app/core/config'; import { LogDetailsRow } from './LogDetailsRow'; @@ -64,11 +65,22 @@ describe('LogDetailsRow', () => { setup(); expect(screen.getAllByRole('button', { name: 'Filter out value' })).toHaveLength(1); }); - it('should render remove filter button', async () => { + it('should render filter buttons when toggleLabelsInLogsUI false', async () => { + setup({ + isFilterLabelActive: jest.fn().mockResolvedValue(true), + }); + expect(screen.getByRole('button', { name: 'Filter for value' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Filter out value' })).toBeInTheDocument(); + }); + + it('should render remove filter button when toggleLabelsInLogsUI true', async () => { + const defaultValue = config.featureToggles.toggleLabelsInLogsUI; + config.featureToggles.toggleLabelsInLogsUI = true; setup({ isFilterLabelActive: jest.fn().mockResolvedValue(true), }); expect(await screen.findByRole('button', { name: 'Remove filter' })).toBeInTheDocument(); + config.featureToggles.toggleLabelsInLogsUI = defaultValue; }); }); diff --git a/public/app/features/logs/components/LogDetailsRow.tsx b/public/app/features/logs/components/LogDetailsRow.tsx index 18436e9d5a2..fc2a6cb054e 100644 --- a/public/app/features/logs/components/LogDetailsRow.tsx +++ b/public/app/features/logs/components/LogDetailsRow.tsx @@ -4,7 +4,7 @@ import memoizeOne from 'memoize-one'; import React, { PureComponent, useState } from 'react'; import { CoreApp, Field, GrafanaTheme2, IconName, LinkModel, LogLabelStatsModel, LogRowModel } from '@grafana/data'; -import { reportInteraction } from '@grafana/runtime'; +import { config, reportInteraction } from '@grafana/runtime'; import { ClipboardButton, DataLinkButton, IconButton, Themeable2, withTheme2 } from '@grafana/ui'; import { LogLabelStats } from './LogLabelStats'; @@ -274,10 +274,20 @@ class UnThemedLogDetailsRow extends PureComponent {
{hasFilteringFunctionality && ( - - )} - {hasFilteringFunctionality && ( - + <> + {config.featureToggles.toggleLabelsInLogsUI && ( + // If we are using the new label toggling, we want to use the async icon button + + )} + {!config.featureToggles.toggleLabelsInLogsUI && ( + + )} + + )} {!disableActions && displayedFields && toggleFieldButton} {!disableActions && (