Skip to content

Commit

Permalink
Revert "[Discover-next] data set picker (#7426)" (#7479)
Browse files Browse the repository at this point in the history
This reverts commit 6a079d3.
  • Loading branch information
sejli authored and LDrago27 committed Jul 25, 2024
1 parent e9ca5a7 commit 69ace22
Show file tree
Hide file tree
Showing 88 changed files with 712 additions and 3,583 deletions.
2 changes: 0 additions & 2 deletions changelogs/fragments/7368.yml

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"start": "scripts/use_node scripts/opensearch_dashboards --dev",
"start:docker": "scripts/use_node scripts/opensearch_dashboards --dev --opensearch.hosts=$OPENSEARCH_HOSTS --opensearch.ignoreVersionMismatch=true --server.host=$SERVER_HOST",
"start:security": "scripts/use_node scripts/opensearch_dashboards --dev --security",
"start:enhancements": "scripts/use_node scripts/opensearch_dashboards --dev --uiSettings.overrides['query:enhancements:enabled']=true --uiSettings.overrides['home:useNewHomePage']=true",
"start:enhancements": "scripts/use_node scripts/opensearch_dashboards --dev --uiSettings.overrides['query:enhancements:enabled']=true",
"debug": "scripts/use_node --nolazy --inspect scripts/opensearch_dashboards --dev",
"debug-break": "scripts/use_node --nolazy --inspect-brk scripts/opensearch_dashboards --dev",
"lint": "yarn run lint:es && yarn run lint:style",
Expand Down
23 changes: 23 additions & 0 deletions src/plugins/data/common/data_frames/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,29 @@ export const getRawQueryString = (
);
};

/**
* Parses a raw query string and extracts the query string and data source.
* @param rawQueryString - The raw query string to parse.
* @returns An object containing the parsed query string and data source (if found).
*/
export const parseRawQueryString = (rawQueryString: string) => {
const rawDataSource = rawQueryString.match(/::(.*?)::/);
return {
qs: rawQueryString.replace(/::.*?::/, ''),
formattedQs(key: string = '.'): string {
const parts = rawQueryString.split('::');
if (parts.length > 1) {
return (parts.slice(0, 1).join('') + parts.slice(1).join(key)).replace(
new RegExp(key + '$'),
''
);
}
return rawQueryString;
},
...(rawDataSource && { dataSource: rawDataSource[1] }),
};
};

/**
* Returns the raw aggregations from the search request.
*
Expand Down
38 changes: 0 additions & 38 deletions src/plugins/data/common/data_sets/types.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/plugins/data/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
export * from './constants';
export * from './opensearch_query';
export * from './data_frames';
export * from './data_sets';
export * from './field_formats';
export * from './field_mapping';
export * from './index_patterns';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,13 +433,11 @@ export class IndexPatternsService {
/**
* Get an index pattern by id. Cache optimized
* @param id
* @param onlyCheckCache - Only check cache for index pattern if it doesn't exist it will not error out
*/

get = async (id: string, onlyCheckCache: boolean = false): Promise<IndexPattern> => {
get = async (id: string): Promise<IndexPattern> => {
const cache = indexPatternCache.get(id);

if (cache || onlyCheckCache) {
if (cache) {
return cache;
}

Expand Down
4 changes: 0 additions & 4 deletions src/plugins/data/common/search/opensearch_search/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ export interface ISearchOptions {
* Use this option to enable support for long numerals.
*/
withLongNumeralsSupport?: boolean;
/**
* Use this option to enable support for async.
*/
isAsync?: boolean;
}

export type ISearchRequestParams<T = Record<string, any>> = {
Expand Down
11 changes: 3 additions & 8 deletions src/plugins/data/common/search/search_source/search_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ import {
convertResult,
createDataFrame,
getRawQueryString,
parseRawQueryString,
} from '../../data_frames';
import { IOpenSearchSearchRequest, IOpenSearchSearchResponse, ISearchOptions } from '../..';
import { IOpenSearchDashboardsSearchRequest, IOpenSearchDashboardsSearchResponse } from '../types';
Expand Down Expand Up @@ -323,12 +324,7 @@ export class SearchSource {
const dataFrame = createDataFrame({
name: searchRequest.index.title || searchRequest.index,
fields: [],
...(rawQueryString && {
meta: {
queryConfig: { qs: rawQueryString },
...(searchRequest.dataSourceId && { dataSource: searchRequest.dataSourceId }),
},
}),
...(rawQueryString && { meta: { queryConfig: parseRawQueryString(rawQueryString) } }),
});
await this.setDataFrame(dataFrame);
return this.getDataFrame();
Expand Down Expand Up @@ -430,8 +426,7 @@ export class SearchSource {
private async fetchExternalSearch(searchRequest: SearchRequest, options: ISearchOptions) {
const { search, getConfig, onResponse } = this.dependencies;

const currentDataframe = this.getDataFrame();
if (!currentDataframe || currentDataframe.name !== searchRequest.index?.id) {
if (!this.getDataFrame()) {
await this.createDataFrame(searchRequest);
}

Expand Down
1 change: 0 additions & 1 deletion src/plugins/data/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export * from './query/types';
export * from './osd_field_types/types';
export * from './index_patterns/types';
export * from './data_frames/types';
export * from './data_sets/types';

/**
* If a service is being shared on both the client and the server, and
Expand Down
24 changes: 10 additions & 14 deletions src/plugins/data/public/antlr/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface IDataSourceRequestHandlerParams {
}

export const getRawSuggestionData$ = (
connectionsService: any,
connectionsService,
dataSourceReuqstHandler: ({
dataSourceId,
title,
Expand All @@ -21,11 +21,11 @@ export const getRawSuggestionData$ = (
) =>
connectionsService.getSelectedConnection$().pipe(
distinctUntilChanged(),
switchMap((connection: any) => {
switchMap((connection) => {
if (connection === undefined) {
return from(defaultReuqstHandler());
}
const dataSourceId = connection?.dataSource?.id;
const dataSourceId = connection?.id;
const title = connection?.attributes?.title;
return from(dataSourceReuqstHandler({ dataSourceId, title }));
})
Expand All @@ -34,8 +34,8 @@ export const getRawSuggestionData$ = (
export const fetchData = (
tables: string[],
queryFormatter: (table: string, dataSourceId?: string, title?: string) => any,
api: any,
connectionService: any
api,
connectionService
): Promise<any[]> => {
return new Promise((resolve, reject) => {
getRawSuggestionData$(
Expand Down Expand Up @@ -65,20 +65,16 @@ export const fetchData = (
);
}
).subscribe({
next: (dataFrames: any) => resolve(dataFrames),
error: (err: any) => {
next: (dataFrames) => resolve(dataFrames),
error: (err) => {
// TODO: pipe error to UI
reject(err);

Check warning on line 71 in src/plugins/data/public/antlr/shared/utils.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/public/antlr/shared/utils.ts#L71

Added line #L71 was not covered by tests
},
});
});
};

export const fetchTableSchemas = (
tables: string[],
api: any,
connectionService: any
): Promise<any[]> => {
export const fetchTableSchemas = (tables: string[], api, connectionService): Promise<any[]> => {
return fetchData(
tables,
(table, dataSourceId, title) => ({
Expand All @@ -100,8 +96,8 @@ export const fetchTableSchemas = (
export const fetchColumnValues = (
tables: string[],
column: string,
api: any,
connectionService: any
api,
connectionService
): Promise<any[]> => {
return fetchData(
tables,
Expand Down
1 change: 0 additions & 1 deletion src/plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ export {
QueryEditorTopRow,
// for BWC, keeping the old name
IUiStart as DataPublicPluginStartUi,
DataSetNavigator,
} from './ui';

/**
Expand Down

This file was deleted.

This file was deleted.

77 changes: 0 additions & 77 deletions src/plugins/data/public/query/dataset_manager/dataset_manager.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/plugins/data/public/query/dataset_manager/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/plugins/data/public/query/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export * from './lib';

export * from './query_service';
export * from './filter_manager';
export * from './dataset_manager';
export * from './timefilter';
export * from './saved_query';
export * from './persisted_log';
Expand Down
Loading

0 comments on commit 69ace22

Please sign in to comment.