From 6c20ad0013273190ff7b02df83c4eb4fc3845f35 Mon Sep 17 00:00:00 2001 From: Alyssa Joyner <58453566+alyssajoyner@users.noreply.github.com> Date: Tue, 8 Jul 2025 15:19:22 -0600 Subject: [PATCH] [InfluxDB] Change default HTTP method to POST (#107787) --- .../UrlAndAuthenticationSection.test.tsx | 58 +++++++++---------- .../config-v2/UrlAndAuthenticationSection.tsx | 6 +- .../components/editor/config-v2/constants.ts | 2 +- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/public/app/plugins/datasource/influxdb/components/editor/config-v2/UrlAndAuthenticationSection.test.tsx b/public/app/plugins/datasource/influxdb/components/editor/config-v2/UrlAndAuthenticationSection.test.tsx index db5f9172a67..9e72fbb491e 100644 --- a/public/app/plugins/datasource/influxdb/components/editor/config-v2/UrlAndAuthenticationSection.test.tsx +++ b/public/app/plugins/datasource/influxdb/components/editor/config-v2/UrlAndAuthenticationSection.test.tsx @@ -36,55 +36,55 @@ describe('UrlAndAuthenticationSection', () => { expect(onOptionsChangeMock).toHaveBeenCalled(); }); - it('renders DRBP warning for InfluxDB OSS 1.x and InfluxQL', () => { - const props = { - ...defaultProps, - options: { - ...defaultProps.options, - jsonData: { product: 'InfluxDB OSS 1.x', version: InfluxVersion.InfluxQL }, - }, - }; + const productsRequiringDBRP = [ + 'InfluxDB OSS 1.x', + 'InfluxDB OSS 2.x', + 'InfluxDB Enterprise 1.x', + 'InfluxDB Cloud (TSM)', + 'InfluxDB Cloud Serverless', + ]; - render(); - expect(screen.getByText(/requires DRBP mapping/i)).toBeInTheDocument(); + describe('UrlAndAuthenticationSection', () => { + it.each(productsRequiringDBRP)('renders DBRP warning for %s and InfluxQL', (product) => { + const props = { + ...defaultProps, + options: { + ...defaultProps.options, + jsonData: { + product, + version: InfluxVersion.InfluxQL, + }, + }, + }; + + render(); + expect(screen.getByText(/requires DBRP mapping/i)).toBeInTheDocument(); + }); }); - it('renders DRBP warning for InfluxDB OSS 2.x and InfluxQL', () => { + it('does not render DBRP warning for SQL', () => { const props = { ...defaultProps, options: { ...defaultProps.options, - jsonData: { product: 'InfluxDB OSS 2.x', version: InfluxVersion.InfluxQL }, + jsonData: { version: InfluxVersion.SQL }, }, }; render(); - expect(screen.getByText(/requires DRBP mapping/i)).toBeInTheDocument(); + expect(screen.queryByText(/requires DBRP mapping/i)).not.toBeInTheDocument(); }); - it('does not render DRBP warning for InfluxDB OSS 1.x and Flux', () => { + it('does not render DBRP warning for Flux', () => { const props = { ...defaultProps, options: { ...defaultProps.options, - jsonData: { product: 'InfluxDB OSS 1.x', version: InfluxVersion.Flux }, + jsonData: { version: InfluxVersion.Flux }, }, }; render(); - expect(screen.queryByText(/requires DRBP mapping/i)).not.toBeInTheDocument(); - }); - - it('does not render DRBP warning for InfluxDB OSS 2.x and Flux', () => { - const props = { - ...defaultProps, - options: { - ...defaultProps.options, - jsonData: { product: 'InfluxDB OSS 2.x', version: InfluxVersion.Flux }, - }, - }; - - render(); - expect(screen.queryByText(/requires DRBP mapping/i)).not.toBeInTheDocument(); + expect(screen.queryByText(/requires DBRP mapping/i)).not.toBeInTheDocument(); }); }); diff --git a/public/app/plugins/datasource/influxdb/components/editor/config-v2/UrlAndAuthenticationSection.tsx b/public/app/plugins/datasource/influxdb/components/editor/config-v2/UrlAndAuthenticationSection.tsx index cb3e632cba8..263e0b45865 100644 --- a/public/app/plugins/datasource/influxdb/components/editor/config-v2/UrlAndAuthenticationSection.tsx +++ b/public/app/plugins/datasource/influxdb/components/editor/config-v2/UrlAndAuthenticationSection.tsx @@ -38,7 +38,7 @@ export const UrlAndAuthenticationSection = (props: Props) => { typeof v === 'string' && (v === InfluxVersion.Flux || v === InfluxVersion.InfluxQL || v === InfluxVersion.SQL); // Database + Retention Policy (DBRP) mapping is required for InfluxDB OSS 1.x and 2.x when using InfluxQL - const requiresDrbpMapping = + const requiresDbrpMapping = options.jsonData.product && options.jsonData.version === InfluxVersion.InfluxQL && [ @@ -119,8 +119,8 @@ export const UrlAndAuthenticationSection = (props: Props) => { - {requiresDrbpMapping && ( - + {requiresDbrpMapping && ( + InfluxDB OSS 1.x and 2.x users must configure a Database + Retention Policy (DBRP) mapping via the CLI or API before data can be queried.{' '} diff --git a/public/app/plugins/datasource/influxdb/components/editor/config-v2/constants.ts b/public/app/plugins/datasource/influxdb/components/editor/config-v2/constants.ts index 3ae3122bffd..07b4b3fc35e 100644 --- a/public/app/plugins/datasource/influxdb/components/editor/config-v2/constants.ts +++ b/public/app/plugins/datasource/influxdb/components/editor/config-v2/constants.ts @@ -30,8 +30,8 @@ export const CONFIG_SECTION_HEADERS_WITH_PDC = [ ]; export const HTTP_MODES: ComboboxOption[] = [ - { label: 'GET', value: 'GET' }, { label: 'POST', value: 'POST' }, + { label: 'GET', value: 'GET' }, ]; export const getInlineLabelStyles = (theme: GrafanaTheme2, transparent = false, width?: number | 'auto') => {