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

Revert "[Discover-next] data set picker" #7479

Merged
merged 1 commit into from
Jul 25, 2024
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: 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 @@ -65,7 +65,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 @@
);
};

/**
* 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 {

Check warning on line 55 in src/plugins/data/common/data_frames/utils.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/common/data_frames/utils.ts#L54-L55

Added lines #L54 - L55 were not covered by tests
qs: rawQueryString.replace(/::.*?::/, ''),
formattedQs(key: string = '.'): string {
const parts = rawQueryString.split('::');

Check warning on line 58 in src/plugins/data/common/data_frames/utils.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/common/data_frames/utils.ts#L58

Added line #L58 was not covered by tests
if (parts.length > 1) {
return (parts.slice(0, 1).join('') + parts.slice(1).join(key)).replace(

Check warning on line 60 in src/plugins/data/common/data_frames/utils.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/common/data_frames/utils.ts#L60

Added line #L60 was not covered by tests
new RegExp(key + '$'),
''
);
}
return rawQueryString;

Check warning on line 65 in src/plugins/data/common/data_frames/utils.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/common/data_frames/utils.ts#L65

Added line #L65 was not covered by tests
},
...(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);
},
});
});
};

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.

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
Loading