Skip to content

Commit

Permalink
[discover] temporarily disable recent datasets
Browse files Browse the repository at this point in the history
With workspaces disabled, recent datasets works fine.
However the dataset service does not have the concept of workspaces yet so instead of adding a new
feature we are opting for recent datasets not yielding any results. The dataset selector already
handles displaying or not if no recent datasets.

Follow up issue:
#8814

Signed-off-by: Kawika Avilla <[email protected]>
  • Loading branch information
kavilla committed Nov 5, 2024
1 parent 758e4fb commit 7b1d801
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,11 @@ describe('DatasetService', () => {

service.addRecentDataset(mockDataset1);
const recents = service.getRecentDatasets();
expect(recents).toContainEqual(mockDataset1);
expect(recents.length).toEqual(1);
expect(sessionStorage.get('recentDatasets')).toContainEqual(mockDataset1);
// TODO: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/8814
expect(recents.length).toEqual(0);
// expect(recents).toContainEqual(mockDataset1);
// expect(recents.length).toEqual(1);
// expect(sessionStorage.get('recentDatasets')).toContainEqual(mockDataset1);
});

test('getRecentDatasets returns all datasets', () => {
Expand All @@ -211,17 +213,19 @@ describe('DatasetService', () => {
timeFieldName: 'timestamp',
});
}
expect(service.getRecentDatasets().length).toEqual(4);
for (let i = 0; i < 4; i++) {
const mockDataset = {
id: `dataset${i}`,
title: `Dataset ${i}`,
type: 'test-type',
timeFieldName: 'timestamp',
};
expect(service.getRecentDatasets()).toContainEqual(mockDataset);
expect(sessionStorage.get('recentDatasets')).toContainEqual(mockDataset);
}
// TODO: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/8814
expect(service.getRecentDatasets().length).toEqual(0);
// expect(service.getRecentDatasets().length).toEqual(4);
// for (let i = 0; i < 4; i++) {
// const mockDataset = {
// id: `dataset${i}`,
// title: `Dataset ${i}`,
// type: 'test-type',
// timeFieldName: 'timestamp',
// };
// expect(service.getRecentDatasets()).toContainEqual(mockDataset);
// expect(sessionStorage.get('recentDatasets')).toContainEqual(mockDataset);
// }
});

test('addRecentDatasets respects max size', () => {
Expand All @@ -233,7 +237,9 @@ describe('DatasetService', () => {
timeFieldName: 'timestamp',
});
}
expect(service.getRecentDatasets().length).toEqual(4);
// TODO: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/8814
expect(service.getRecentDatasets().length).toEqual(0);
// expect(service.getRecentDatasets().length).toEqual(4);
});

test('test get default dataset ', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export class DatasetService {
}

public getRecentDatasets(): Dataset[] {
return this.recentDatasets.values();
// TODO: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/8814
return [];

Check warning on line 84 in src/plugins/data/public/query/query_string/dataset_service/dataset_service.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/public/query/query_string/dataset_service/dataset_service.ts#L84

Added line #L84 was not covered by tests
// return this.recentDatasets.values();
}

public addRecentDataset(dataset: Dataset | undefined, serialize: boolean = true): void {
Expand Down

0 comments on commit 7b1d801

Please sign in to comment.