Skip to content

Commit

Permalink
[Workspace] Hide dashboard overview (#6625)
Browse files Browse the repository at this point in the history
* feat: hide dashboard overview

Signed-off-by: yubonluo <[email protected]>

* Changeset file for PR #6625 created/updated

* Changeset file for PR #6625 created/updated

---------

Signed-off-by: yubonluo <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 17ce314)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and SuZhou-Joe committed Apr 25, 2024
1 parent 08770f4 commit cf8f988
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
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;
};

0 comments on commit cf8f988

Please sign in to comment.