Skip to content

Commit

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

Signed-off-by: yubonluo <yubonluo@amazon.com>

* Changeset file for PR opensearch-project#6625 created/updated

* Changeset file for PR opensearch-project#6625 created/updated

---------

Signed-off-by: yubonluo <yubonluo@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and LDrago27 committed Jun 3, 2024
1 parent c28f933 commit b022ec2
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 b022ec2

Please sign in to comment.