Skip to content

Commit

Permalink
[discover] temporarily disable recent datasets (#8816) (#8817)
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


(cherry picked from commit 4f6b287)

Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent b9ea335 commit e1c5c93
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 @@ -144,9 +144,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 @@ -158,17 +160,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 @@ -180,6 +184,8 @@ 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);
});
});
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 e1c5c93

Please sign in to comment.