Skip to content

Commit

Permalink
[discover] temporarily disable recent datasets (#8816)
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 authored Nov 6, 2024
1 parent 8efc5fb commit 4f6b287
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 [];
// return this.recentDatasets.values();
}

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

0 comments on commit 4f6b287

Please sign in to comment.