diff --git a/gantt-chart/public/components/options_editor.tsx b/gantt-chart/public/components/options_editor.tsx index e5e24ef..cbbd547 100644 --- a/gantt-chart/public/components/options_editor.tsx +++ b/gantt-chart/public/components/options_editor.tsx @@ -99,10 +99,7 @@ export function OptionsEditor({ aggs, stateParams, setValue }: VisOptionsProps - setValue('colors', e)} - /> + setValue('colors', e)} /> ); diff --git a/gantt-chart/public/gantt_request_handler.ts b/gantt-chart/public/gantt_request_handler.ts index aba1278..714cc1c 100644 --- a/gantt-chart/public/gantt_request_handler.ts +++ b/gantt-chart/public/gantt_request_handler.ts @@ -6,7 +6,14 @@ import { IUiSettingsClient } from 'opensearch-dashboards/public'; import { IndexPattern } from 'src/plugins/data/public'; import { VisParams } from 'src/plugins/visualizations/public'; -import { buildOpenSearchQuery, Filter, Query, TimeRange, getTime } from '../../../src/plugins/data/common'; +import { + buildOpenSearchQuery, + Filter, + getTime, + OpenSearchQueryConfig, + Query, + TimeRange, +} from '../../../src/plugins/data/common'; import { GanttVisDependencies } from './plugin'; interface GanttRequestHandlerDeps { @@ -22,7 +29,18 @@ const constructRequest = ( uiSettings: IUiSettingsClient, { timeRange, filters, query, index, visParams }: GanttRequestHandlerDeps ) => { - const DSL = buildOpenSearchQuery(index, query, filters); + let DSL; + try { + const config: OpenSearchQueryConfig = { + allowLeadingWildcards: uiSettings.get('query:allowLeadingWildcards'), + queryStringOptions: uiSettings.get('query:queryString:options'), + ignoreFilterIfFieldNotInIndex: uiSettings.get('courier:ignoreFilterIfFieldNotInIndex'), + }; + DSL = buildOpenSearchQuery(index, query, filters, config); + } catch (error) { + DSL = buildOpenSearchQuery(index, query, filters); + } + const request: any = { index: index.title, size: visParams.size, diff --git a/gantt-chart/public/gantt_vis_type.ts b/gantt-chart/public/gantt_vis_type.ts index f217f33..4b7aa6b 100644 --- a/gantt-chart/public/gantt_vis_type.ts +++ b/gantt-chart/public/gantt_vis_type.ts @@ -3,13 +3,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Vis, PersistedState } from 'src/plugins/visualizations/public'; import { IAggConfigs } from 'src/plugins/data/public'; +import { PersistedState, Vis } from 'src/plugins/visualizations/public'; import { GanttChart } from './components/gantt_chart'; import { GanttChartEditor } from './components/gantt_chart_editor'; -import { GanttVisDependencies } from './plugin'; import { OptionsEditor } from './components/options_editor'; import { getGanttRequestHandler } from './gantt_request_handler'; +import { GanttVisDependencies } from './plugin'; export interface SearchResponse { _index: string; @@ -77,19 +77,15 @@ export interface GanttSuccessResponse { total: number; } -const getGanttResponseHandler = () => async ({ - total, - hits, -}: { - total: number; - hits: SearchResponse[]; -}) => { - const responseData: GanttSuccessResponse = { - total, - source: hits.map((hit) => hit._source), +const getGanttResponseHandler = + () => + async ({ total, hits }: { total: number; hits: SearchResponse[] }) => { + const responseData: GanttSuccessResponse = { + total, + source: hits.map((hit) => hit._source), + }; + return responseData; }; - return responseData; -}; export function getGanttVisDefinition(dependencies: GanttVisDependencies) { const ganttRequestHandler = getGanttRequestHandler(dependencies); diff --git a/gantt-chart/public/plugin.ts b/gantt-chart/public/plugin.ts index 403905d..7f945e2 100644 --- a/gantt-chart/public/plugin.ts +++ b/gantt-chart/public/plugin.ts @@ -3,7 +3,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CoreSetup, Plugin, CoreStart, IUiSettingsClient, HttpSetup } from 'opensearch-dashboards/public'; +import { + CoreSetup, + CoreStart, + HttpSetup, + IUiSettingsClient, + Plugin, +} from 'opensearch-dashboards/public'; import { VisualizationsSetup } from '../../../src/plugins/visualizations/public'; import { getGanttVisDefinition } from './gantt_vis_type'; @@ -17,7 +23,8 @@ export interface GanttVisDependencies extends Partial { } export class CustomVisualizationsPublicPlugin - implements Plugin { + implements Plugin +{ public setup(core: CoreSetup, setupDeps: SetupDependencies) { const dependencies: GanttVisDependencies = { uiSettings: core.uiSettings,