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

[Workspace] Hide dashboard overview #6625

Merged
merged 3 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/6625.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [Workspace] Hide dashboard overview ([#6625](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6625))
6 changes: 3 additions & 3 deletions src/plugins/workspace/public/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ describe('workspace utils: filterWorkspaceConfigurableApps', () => {
navLinkStatus: 1,
order: -2000,
status: 0,
workspaceAvailability: WorkspaceAvailability.outsideWorkspace,
},
{
appRoute: '/app/management',
Expand All @@ -255,9 +256,8 @@ describe('workspace utils: filterWorkspaceConfigurableApps', () => {
] as PublicAppInfo[];
it('should filters out apps that are not accessible in the workspace', () => {
const filteredApps = filterWorkspaceConfigurableApps(defaultApplications);
expect(filteredApps.length).toEqual(3);
expect(filteredApps.length).toEqual(2);
expect(filteredApps[0].id).toEqual('dashboards');
expect(filteredApps[1].id).toEqual('opensearchDashboardsOverview');
expect(filteredApps[2].id).toEqual('management');
expect(filteredApps[1].id).toEqual('management');
});
});
25 changes: 14 additions & 11 deletions src/plugins/workspace/public/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,21 @@ export function isAppAccessibleInWorkspace(app: App, workspace: WorkspaceObject)

// Get all apps that should be displayed in workspace when create/update a workspace.
export const filterWorkspaceConfigurableApps = (applications: PublicAppInfo[]) => {
const visibleApplications = applications.filter(({ navLinkStatus, chromeless, category, id }) => {
const filterCondition =
navLinkStatus !== AppNavLinkStatus.hidden &&
!chromeless &&
!DEFAULT_SELECTED_FEATURES_IDS.includes(id);
// If the category is management, only retain Dashboards Management which contains saved objets and index patterns.
// Saved objets can show all saved objects in the current workspace and index patterns is at workspace level.
if (category?.id === DEFAULT_APP_CATEGORIES.management.id) {
return filterCondition && id === 'management';
const visibleApplications = applications.filter(
({ navLinkStatus, chromeless, category, id, workspaceAvailability }) => {
const filterCondition =
navLinkStatus !== AppNavLinkStatus.hidden &&
!chromeless &&
!DEFAULT_SELECTED_FEATURES_IDS.includes(id) &&
workspaceAvailability !== WorkspaceAvailability.outsideWorkspace;
// If the category is management, only retain Dashboards Management which contains saved objets and index patterns.
// Saved objets can show all saved objects in the current workspace and index patterns is at workspace level.
if (category?.id === DEFAULT_APP_CATEGORIES.management.id) {
return filterCondition && id === 'management';
}
return filterCondition;
}
return filterCondition;
});
);

return visibleApplications;
};
Loading