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

Lnse/dataset selector 4 rocky #69

Merged
merged 64 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
e2fa399
initial implementation for dataset dropdown
sejli Jul 11, 2024
7fc9d4b
initial metadata commit
sejli Jul 11, 2024
d0d5ec9
bug fixes
sejli Jul 11, 2024
d60ead0
hiding datasource cluster selctor and other bug fixes
sejli Jul 11, 2024
8506e88
refactoring and fixing datasource selector button
sejli Jul 15, 2024
32bfcb5
fix breaking loop
sejli Jul 15, 2024
326c0c2
last working commit
sejli Jul 16, 2024
d3a4519
WIP indices
sejli Jul 17, 2024
4d09c35
refactor to query editor
sejli Jul 18, 2024
de7818f
cleanup dataset dropdown
sejli Jul 18, 2024
5779503
running linter
sejli Jul 18, 2024
7296be5
removing exports for deleted components
sejli Jul 18, 2024
dc81d51
Changeset file for PR #7289 created/updated
opensearch-changeset-bot[bot] Jul 18, 2024
d406b87
running linter
sejli Jul 18, 2024
1a0b413
removing connections bar component
sejli Jul 18, 2024
e2f80be
remove unused property
sejli Jul 18, 2024
6b61983
use default search interceptor for get indices
sejli Jul 18, 2024
a23b6b9
removing unused file
sejli Jul 18, 2024
43a44b6
adding onselect for dataset navigator
sejli Jul 19, 2024
f43621a
trying to make a commponetto call
kavilla Jul 19, 2024
f61ca07
no clue if it works
kavilla Jul 19, 2024
73710a5
trying out changes
sejli Jul 19, 2024
b287f60
initial commit for external datasources work
sejli Jul 22, 2024
1fbeb3a
caching recently used and external datasources
sejli Jul 22, 2024
e0d4931
still porting over
kavilla Jul 22, 2024
8cb6905
more ported over
kavilla Jul 22, 2024
2cee188
no linter complaints
kavilla Jul 22, 2024
6376950
update to sidebar
kavilla Jul 22, 2024
ddb4330
handle import errors
kavilla Jul 22, 2024
1ccf16f
rebased
kavilla Jul 22, 2024
7de0fe2
fix a messy merge for package.json
kavilla Jul 22, 2024
204cde0
so lnse for catching this
kavilla Jul 22, 2024
238efad
fix nav
kavilla Jul 23, 2024
f8aee58
no recalling
kavilla Jul 23, 2024
a687417
number panels
kavilla Jul 23, 2024
4ab55c9
add wait
kavilla Jul 23, 2024
bbdbdd1
index patterns worknig agan
kavilla Jul 23, 2024
b651b94
fix and clearing it df out
kavilla Jul 23, 2024
7a0a81d
disable hooks dependency
kavilla Jul 23, 2024
db519de
fix the issue with import
kavilla Jul 23, 2024
2cd93b8
fixed passing the data source id
kavilla Jul 23, 2024
f017dc5
loading spinner
kavilla Jul 23, 2024
10f2e1e
pading
kavilla Jul 23, 2024
38d93fc
conditionally show s3
kavilla Jul 23, 2024
56b2510
remove sql
kavilla Jul 23, 2024
7b19eb9
let it fail
kavilla Jul 23, 2024
6b5e2db
s3 datasources
sejli Jul 23, 2024
43a83e0
set data set for table
kavilla Jul 23, 2024
e303635
pass it in the options
kavilla Jul 23, 2024
41ae189
run query different
kavilla Jul 23, 2024
2540a92
dont parse query string
kavilla Jul 23, 2024
52b7bd1
not capitalization
kavilla Jul 23, 2024
ccebb74
Merge remote-tracking branch 'upstream/main' into lnse/dataset-select…
kavilla Jul 23, 2024
046526b
Changeset file for PR #7368 created/updated
opensearch-changeset-bot[bot] Jul 23, 2024
8a57b08
connections imported right
kavilla Jul 23, 2024
4d70f5f
Merge branch 'lnse/dataset-selector-4-rocky' of github.com:kavilla/Op…
kavilla Jul 23, 2024
f2ca5b0
handle select external
kavilla Jul 23, 2024
7f1a07d
initial implementation for url state
sejli Jul 23, 2024
9bb5e21
Merge remote-tracking branch 'upstream/main' into lnse/dataset-select…
kavilla Jul 23, 2024
d15b39a
Merge pull request #68 from sejli/url-update
kavilla Jul 23, 2024
6a1f4d1
restore the dataset metadata stuff
kavilla Jul 23, 2024
7b39378
build dataset in state
kavilla Jul 23, 2024
3cdda3c
Merge remote-tracking branch 'upstream/main' into lnse/dataset-select…
kavilla Jul 23, 2024
d6f8485
null pointer
kavilla Jul 23, 2024
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/7289.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Add DataSet dropdown with index patterns and indices ([#7289](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7289))
2 changes: 2 additions & 0 deletions changelogs/fragments/7368.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [Discover] Adds a dataset selector for Discover ([#7368](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7368))
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",
"start:enhancements": "scripts/use_node scripts/opensearch_dashboards --dev --uiSettings.overrides['query:enhancements:enabled']=true --uiSettings.overrides['home:useNewHomePage']=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
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
* SPDX-License-Identifier: Apache-2.0
*/

export * from './create_extension';
export * from './types';
37 changes: 37 additions & 0 deletions src/plugins/data/common/data_sets/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

/** @public **/
export enum SIMPLE_DATA_SOURCE_TYPES {
DEFAULT = 'data-source',
EXTERNAL = 'external-source',
}

/** @public **/
export enum SIMPLE_DATA_SET_TYPES {
INDEX_PATTERN = 'index-pattern',
TEMPORARY = 'temporary',
TEMPORARY_ASYNC = 'temporary-async',
}

export interface SimpleObject {
id?: string;
title?: string;
dataSourceRef?: SimpleDataSource;
}

export interface SimpleDataSource {
id: string;
name: string;
indices?: SimpleObject[];
type: SIMPLE_DATA_SOURCE_TYPES;
}

export interface SimpleDataSet extends SimpleObject {
fields?: any[];
timeFieldName?: string;
timeFields?: any[];
type?: SIMPLE_DATA_SET_TYPES;
}
1 change: 1 addition & 0 deletions src/plugins/data/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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
4 changes: 4 additions & 0 deletions src/plugins/data/common/search/opensearch_search/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ 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: 10 additions & 1 deletion src/plugins/data/common/search/search_source/search_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,12 @@ export class SearchSource {
const dataFrame = createDataFrame({
name: searchRequest.index.title || searchRequest.index,
fields: [],
...(rawQueryString && { meta: { queryConfig: parseRawQueryString(rawQueryString) } }),
...(rawQueryString && {
meta: {
queryConfig: parseRawQueryString(rawQueryString),
...(searchRequest.dataSourceId && { dataSource: searchRequest.dataSourceId }),
},
}),
});
await this.setDataFrame(dataFrame);
return this.getDataFrame();
Expand Down Expand Up @@ -353,6 +358,10 @@ export class SearchSource {
if (getConfig(UI_SETTINGS.COURIER_BATCH_SEARCHES)) {
response = await this.legacyFetch(searchRequest, options);
} else if (this.isUnsupportedRequest(searchRequest)) {
const indexPattern = this.getField('index');
searchRequest.dataSourceId = indexPattern?.dataSourceRef?.id;

options = { ...options, isAsync: this.getField('type')?.includes('async') };
response = await this.fetchExternalSearch(searchRequest, options);
} else {
const indexPattern = this.getField('index');
Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ 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: 14 additions & 10 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,
connectionsService: { getSelectedConnection$: any },
dataSourceReuqstHandler: ({
dataSourceId,
title,
Expand All @@ -21,11 +21,11 @@ export const getRawSuggestionData$ = (
) =>
connectionsService.getSelectedConnection$().pipe(
distinctUntilChanged(),
switchMap((connection) => {
switchMap((connection: any) => {
if (connection === undefined) {
return from(defaultReuqstHandler());
}
const dataSourceId = connection?.id;
const dataSourceId = connection?.dataSource?.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,
connectionService
api: any,
connectionService: any
): Promise<any[]> => {
return new Promise((resolve, reject) => {
getRawSuggestionData$(
Expand Down Expand Up @@ -65,16 +65,20 @@ export const fetchData = (
);
}
).subscribe({
next: (dataFrames) => resolve(dataFrames),
error: (err) => {
next: (dataFrames: any) => resolve(dataFrames),
error: (err: any) => {
// TODO: pipe error to UI
reject(err);
},
});
});
};

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

/**
Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/public/ui/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
@import "./typeahead/index";
@import "./saved_query_management/index";
@import "./query_string_input/index";
@import "./dataset_navigator/index";
@import "./query_editor/index";
@import "./shard_failure_modal/shard_failure_modal";
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
.datasetNavigator {
min-width: 350px;
border-bottom: $euiBorderThin !important;
}

.dataSetNavigatorFormWrapper {
padding: $euiSizeS;
}

.dataSetNavigator__loading {
padding: $euiSizeS;
}
1 change: 1 addition & 0 deletions src/plugins/data/public/ui/dataset_navigator/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "./dataset_navigator";
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import { HttpStart, SavedObjectsClientContract } from 'opensearch-dashboards/public';
import { DataSetNavigator, DataSetNavigatorProps } from './';

// Updated function signature to include additional dependencies
export function createDataSetNavigator(
savedObjectsClient: SavedObjectsClientContract,
http: HttpStart
) {
// Return a function that takes props, omitting the dependencies from the props type
return (props: Omit<DataSetNavigatorProps, 'savedObjectsClient' | 'http'>) => (
<DataSetNavigator {...props} savedObjectsClient={savedObjectsClient} http={http} />
);
}
Loading
Loading