diff --git a/public/app/plugins/datasource/tempo/SearchTraceQLEditor/TraceQLSearch.test.tsx b/public/app/plugins/datasource/tempo/SearchTraceQLEditor/TraceQLSearch.test.tsx index 29a32a89c22..97405e906d5 100644 --- a/public/app/plugins/datasource/tempo/SearchTraceQLEditor/TraceQLSearch.test.tsx +++ b/public/app/plugins/datasource/tempo/SearchTraceQLEditor/TraceQLSearch.test.tsx @@ -1,6 +1,7 @@ import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; +import { act } from 'react-dom/test-utils'; import { initTemplateSrv } from 'test/helpers/initTemplateSrv'; import { config } from '@grafana/runtime'; @@ -121,6 +122,27 @@ describe('TraceQLSearch', () => { } }); + it('should not render static filter when no tag is configured', async () => { + const datasource: TempoDatasource = { + search: { + filters: [ + { + id: 'service-name', + operator: '=', + scope: TraceqlSearchScope.Resource, + }, + ], + }, + } as TempoDatasource; + datasource.languageProvider = new TempoLanguageProvider(datasource); + await act(async () => { + const { container } = render(); + const serviceNameValue = container.querySelector(`input[aria-label="select service-name value"]`); + expect(serviceNameValue).toBeNull(); + expect(serviceNameValue).not.toBeInTheDocument(); + }); + }); + it('should not render group by when feature toggle is not enabled', async () => { await waitFor(() => { render(); diff --git a/public/app/plugins/datasource/tempo/SearchTraceQLEditor/TraceQLSearch.tsx b/public/app/plugins/datasource/tempo/SearchTraceQLEditor/TraceQLSearch.tsx index 5be54f1ba7b..aeaa7a8d166 100644 --- a/public/app/plugins/datasource/tempo/SearchTraceQLEditor/TraceQLSearch.tsx +++ b/public/app/plugins/datasource/tempo/SearchTraceQLEditor/TraceQLSearch.tsx @@ -104,26 +104,29 @@ const TraceQLSearch = ({ datasource, query, onChange }: Props) => { <>
- {datasource.search?.filters?.map((f) => ( - - - - ))} + {datasource.search?.filters?.map( + (f) => + f.tag && ( + + + + ) + )} !f.tag); + return ( <> {datasource ? ( @@ -99,6 +101,9 @@ export function TraceQLSearchTags({ options, onOptionsChange, datasource }: Prop {error.message} )} + {missingTag && ( + + )} ); }