Skip to content

Commit

Permalink
Indexed views framework (#8851)
Browse files Browse the repository at this point in the history
* indexed-view-working

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* working skeleton

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* Changeset file for PR #8851 created/updated

* removed unwanted changes

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* fixed linter errors; failing UT

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* added some UTs

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* added more UTs

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* refactored code to address comments

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* minor updates

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* minor updates

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* updated tests

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* fixed UT

Signed-off-by: Amardeepsingh Siglani <[email protected]>

---------

Signed-off-by: Amardeepsingh Siglani <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
amsiglan and opensearch-changeset-bot[bot] authored Nov 14, 2024
1 parent 66ea096 commit 413697d
Show file tree
Hide file tree
Showing 15 changed files with 597 additions and 16 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/8851.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
feat:
- Add framework to show banner at the top in discover results canvas ([#8851](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8851))
- Show indexed views in dataset selector ([#8851](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8851))
7 changes: 7 additions & 0 deletions src/plugins/data/common/datasets/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,13 @@ export interface Dataset extends BaseDataset {
timeFieldName?: string;
/** Optional language to default to from the language selector */
language?: string;
/** Optional reference to the source dataset. Example usage is for indexed views to store the
* reference to the table dataset
*/
sourceDatasetRef?: {
id: string;
type: string;
};
}

export interface DatasetField {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ export {
QueryStart,
PersistedLog,
LanguageReference,
DatasetIndexedViewsService,
} from './query';

export { AggsStart } from './search/aggs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { EuiIconProps } from '@elastic/eui';
import { Dataset, DatasetField, DatasetSearchOptions, DataStructure } from '../../../../common';
import {
Dataset,
DatasetField,
DatasetSearchOptions,
DataStructure,
SavedObject,
} from '../../../../common';
import { IDataPluginServices } from '../../../types';

/**
Expand All @@ -16,6 +22,18 @@ export interface DataStructureFetchOptions {
paginationToken?: string;
}

export interface DatasetIndexedView {
name: string;
}

export interface DatasetIndexedViewsService {
getIndexedViews: (dataset: Dataset) => Promise<DatasetIndexedView[]>;
/**
* Returns the data source saved object connected with the data connection object
*/
getConnectedDataSource: (dataset: Dataset) => Promise<SavedObject>;
}

/**
* Configuration for handling dataset operations.
*/
Expand Down Expand Up @@ -84,4 +102,8 @@ export interface DatasetTypeConfig {
* Returns a list of sample queries for this dataset type
*/
getSampleQueries?: (dataset?: Dataset, language?: string) => Promise<any> | any;
/**
* Service used for indexedViews related operations
*/
indexedViewsService?: DatasetIndexedViewsService;
}
1 change: 1 addition & 0 deletions src/plugins/data/public/query/query_string/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export {
DatasetService,
DatasetServiceContract,
DatasetTypeConfig,
DatasetIndexedViewsService,
} from './dataset_service';
export {
LanguageServiceContract,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ describe('QueryStringManager', () => {
storage = new DataStorage(window.localStorage, 'opensearchDashboards.');
sessionStorage = new DataStorage(window.sessionStorage, 'opensearchDashboards.');
mockSearchInterceptor = {} as jest.Mocked<ISearchInterceptor>;

service = new QueryStringManager(
storage,
sessionStorage,
Expand Down
Loading

0 comments on commit 413697d

Please sign in to comment.