Skip to content

Commit

Permalink
Set Legacy Discover Table for Discover 2.0 (opensearch-project#8233)
Browse files Browse the repository at this point in the history
Signed-off-by: Suchit Sahoo <[email protected]>
  • Loading branch information
LDrago27 authored and virajsanghvi committed Sep 24, 2024
1 parent cff56e1 commit 1b8b8a7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export const DiscoverChart = ({
<EuiFlexItem grow={true} style={{ justifyContent: 'flex-start' }}>
{isTimeBased && timeChartHeader}
</EuiFlexItem>
<EuiFlexItem grow={false}>{discoverOptions}</EuiFlexItem>
</EuiFlexGroup>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { i18n } from '@osd/i18n';
import React, { useState } from 'react';
import { EuiPanel } from '@elastic/eui';
import { QUERY_ENHANCEMENT_ENABLED_SETTING } from '../../../../common';
import { IndexPattern, getServices } from '../../../opensearch_dashboards_services';
import { DataGridFlyout } from './data_grid_table_flyout';
import { DiscoverGridContextProvider } from './data_grid_table_context';
Expand Down Expand Up @@ -71,35 +72,37 @@ export const DataGridTable = ({
}

const newDiscoverEnabled = getNewDiscoverSetting(services.storage);
const isQueryEnhancementEnabled = services.uiSettings.get(QUERY_ENHANCEMENT_ENABLED_SETTING);

const panelContent = newDiscoverEnabled ? (
<DataGrid
columns={columns}
indexPattern={indexPattern}
sort={sort}
onSort={onSort}
rows={rows}
onSetColumns={onSetColumns}
isToolbarVisible={isToolbarVisible}
isContextView={isContextView}
/>
) : (
<DefaultDiscoverTable
columns={adjustedColumns}
indexPattern={indexPattern}
sort={sort}
onSort={onSort}
rows={rows}
hits={hits}
onAddColumn={onAddColumn}
onMoveColumn={onMoveColumn}
onRemoveColumn={onRemoveColumn}
onFilter={onFilter}
onClose={() => setInspectedHit(undefined)}
showPagination={showPagination}
scrollToTop={scrollToTop}
/>
);
const panelContent =
isQueryEnhancementEnabled || !newDiscoverEnabled ? (
<DefaultDiscoverTable
columns={adjustedColumns}
indexPattern={indexPattern}
sort={sort}
onSort={onSort}
rows={rows}
hits={hits}
onAddColumn={onAddColumn}
onMoveColumn={onMoveColumn}
onRemoveColumn={onRemoveColumn}
onFilter={onFilter}
onClose={() => setInspectedHit(undefined)}
showPagination={showPagination}
scrollToTop={scrollToTop}
/>
) : (
<DataGrid
columns={columns}
indexPattern={indexPattern}
sort={sort}
onSort={onSort}
rows={rows}
onSetColumns={onSetColumns}
isToolbarVisible={isToolbarVisible}
isContextView={isContextView}
/>
);

const tablePanelProps = {
paddingSize: 'none' as const,
Expand Down

0 comments on commit 1b8b8a7

Please sign in to comment.