Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate the discover:newExpereince #9511

Merged
merged 2 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/9511.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecate:
- Discover:newExpereince and DataGridTable ([#9511](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9511))
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export interface DataGridProps {
isContextView?: boolean;
}

/**
* @deprecated - use DefaultDiscoverTable
*/
const DataGridUI = ({
columns,
indexPattern,
Expand Down Expand Up @@ -150,4 +153,7 @@ const DataGridUI = ({
);
};

/**
* @deprecated - use DefaultDiscoverTable
*/
export const DataGrid = React.memo(DataGridUI);
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { i18n } from '@osd/i18n';
import React, { useState } from 'react';
import { EuiPanel } from '@elastic/eui';
import { QUERY_ENHANCEMENT_ENABLED_SETTING } from '../../../../common';
Expand Down Expand Up @@ -71,6 +70,9 @@ export const DataGridTable = ({
adjustedColumns = [...adjustedColumns, '_source'];
}

/**
* deprecated - we will no longer support newDiscoveredEnabled
*/
const newDiscoverEnabled = getNewDiscoverSetting(services.storage);
const isQueryEnhancementEnabled = services.uiSettings.get(QUERY_ENHANCEMENT_ENABLED_SETTING);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { i18n } from '@osd/i18n';
import { IndexPatternField } from '../../../../../data/common';
import { useDataGridContext } from './data_grid_table_context';

/**
* @deprecated - use DefaultDiscoverTable
*/
export function getCellActions(field: IndexPatternField) {
const cellActions = field.filterable
? [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { IndexPattern } from '../../../opensearch_dashboards_services';
import { OpenSearchSearchHit } from '../../doc_views/doc_views_types';
import { shortenDottedString } from '../../helpers';

/**
* @deprecated - use DefaultDiscoverTable
*/
export function fetchSourceTypeDataCell(
idxPattern: IndexPattern,
row: Record<string, unknown>,
Expand Down Expand Up @@ -52,6 +55,9 @@ export function fetchSourceTypeDataCell(
);
}

/**
* @deprecated - use DefaultDiscoverTable
*/
export const fetchTableDataCell = (
idxPattern: IndexPattern,
dataRows: OpenSearchSearchHit[] | undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { i18n } from '@osd/i18n';
import { IndexPattern } from '../../../opensearch_dashboards_services';
import { getCellActions } from './data_grid_table_cell_actions';

/**
* @deprecated - use DefaultDiscoverTable
*/
export function buildDataGridColumns(
columnNames: string[],
idxPattern: IndexPattern,
Expand All @@ -27,6 +30,9 @@ export function buildDataGridColumns(
);
}

/**
* @deprecated - use DefaultDiscoverTable
*/
export function generateDataGridTableColumn(
colName: string,
idxPattern: IndexPattern,
Expand Down Expand Up @@ -72,6 +78,9 @@ export function generateDataGridTableColumn(
return dataGridCol;
}

/**
* @deprecated - use DefaultDiscoverTable
*/
export function computeVisibleColumns(
columnNames: string[],
idxPattern: IndexPattern,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import React from 'react';
import { IndexPattern } from '../../../opensearch_dashboards_services';
import { DocViewFilterFn, OpenSearchSearchHit } from '../../doc_views/doc_views_types';

/**
* @deprecated - use DefaultDiscoverTable
*/
export interface DataGridContextProps {
inspectedHit?: OpenSearchSearchHit;
onFilter: DocViewFilterFn;
Expand All @@ -15,9 +18,19 @@ export interface DataGridContextProps {
indexPattern: IndexPattern;
}

/**
* @deprecated - use DefaultDiscoverTable
*/
export const DataGridContext = React.createContext<DataGridContextProps>(
{} as DataGridContextProps
);

/**
* @deprecated - use DefaultDiscoverTable
*/
export const DiscoverGridContextProvider = DataGridContext.Provider;

/**
* @deprecated - use DefaultDiscoverTable
*/
export const useDataGridContext = () => React.useContext(DataGridContext);
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { i18n } from '@osd/i18n';
import { EuiToolTip, EuiSmallButtonIcon, EuiDataGridCellValueElementProps } from '@elastic/eui';
import { useDataGridContext } from './data_grid_table_context';

/**
* @deprecated - use DefaultDiscoverTable
*/
export const DocViewInspectButton = ({ rowIndex }: EuiDataGridCellValueElementProps) => {
const { inspectedHit, setInspectedHit, rows } = useDataGridContext();
const currentInspected = rows[rowIndex];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import { IndexPattern } from '../../../opensearch_dashboards_services';
import { DocViewFilterFn, OpenSearchSearchHit } from '../../doc_views/doc_views_types';
import { DocViewerLinks } from '../doc_viewer_links/doc_viewer_links';

/**
* @deprecated - use DefaultDiscoverTable
*/
interface Props {
columns: string[];
hit: OpenSearchSearchHit;
Expand All @@ -29,6 +32,9 @@ interface Props {
onRemoveColumn: (column: string) => void;
}

/**
* @deprecated - use DefaultDiscoverTable
*/
export function DataGridFlyout({
hit,
columns,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import {
import React, { useState } from 'react';
import { useLocalStorage } from 'react-use';

/**
* @deprecated - use DefaultDiscoverTable
*/
const AddtitionalControls = ({
setLineCount,
lineCount,
Expand Down Expand Up @@ -58,6 +61,9 @@ const AddtitionalControls = ({
);
};

/**
* @deprecated - use DefaultDiscoverTable
*/
export const useToolbarOptions = (): {
toolbarOptions: EuiDataGridToolBarVisibilityOptions | boolean;
lineCount: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@

import { Storage } from '../../../../../opensearch_dashboards_utils/public';

/**
* @deprecated - We will only support legacy discover
*/
export const NEW_DISCOVER_KEY = 'discover:newExpereince';

/**
* @deprecated - We will only support legacy discover
*/
export const getNewDiscoverSetting = (storage: Storage): boolean => {
const storedValue = storage.get(NEW_DISCOVER_KEY);
return storedValue !== null ? storedValue : false;
};

/**
* @deprecated - We will only support legacy discover
*/
export const setNewDiscoverSetting = (value: boolean, storage: Storage) => {
storage.set(NEW_DISCOVER_KEY, value);
};
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export const DiscoverChartContainer = ({ hits, bucketInterval, chartData }: Sear

if (!hits) return null;

/**
* deprecated - we will no longer support this option. Only legacyDiscoverTable will be supported
*/
const discoverOptions = (
<EuiPopover
button={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ interface SearchEmbeddableProps {
}
export type DiscoverEmbeddableProps = DataGridTableProps;

/**
* @deprecated - use DefaultDiscoverTable
*/
export const DataGridTableMemoized = React.memo((props: DataGridTableProps) => (
<DataGridTable {...props} />
));
Expand Down
Loading