Skip to content

Commit

Permalink
fix: nav group not reflected when switching to analytics workspace
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <[email protected]>
  • Loading branch information
SuZhou-Joe committed Aug 7, 2024
1 parent 13940e9 commit 7afbff0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
17 changes: 10 additions & 7 deletions src/core/public/chrome/nav_group/nav_group_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,17 @@ export class ChromeNavGroupService {
if (appId && navGroupMap) {
const appIdNavGroupMap = new Map<string, Set<string>>();
// iterate navGroupMap
Object.keys(navGroupMap).forEach((navGroupId) => {
navGroupMap[navGroupId].navLinks.forEach((navLink) => {
const navLinkId = navLink.id;
const navGroupSet = appIdNavGroupMap.get(navLinkId) || new Set();
navGroupSet.add(navGroupId);
appIdNavGroupMap.set(navLinkId, navGroupSet);
Object.keys(navGroupMap)
// Nav group of Hidden status should be filtered out when counting navGroups the currentApp belongs to
.filter((navGroupId) => navGroupMap[navGroupId].status !== NavGroupStatus.Hidden)
.forEach((navGroupId) => {
navGroupMap[navGroupId].navLinks.forEach((navLink) => {
const navLinkId = navLink.id;
const navGroupSet = appIdNavGroupMap.get(navLinkId) || new Set();
navGroupSet.add(navGroupId);
appIdNavGroupMap.set(navLinkId, navGroupSet);
});
});
});

const navGroups = appIdNavGroupMap.get(appId);
if (navGroups && navGroups.size === 1) {
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/workspace/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ export class WorkspacePlugin
/**
* The following logic determines whether a navigation group should be hidden or not based on the workspace's feature configurations.
* It checks the following conditions:
* 1. The navigation group is not a system-level group (system groups are always visible).
* 1. The navigation group is not a system-level group (system groups are always visible except all use case).
* 2. The current workspace has feature configurations set up.
* 3. The current workspace's use case it not "All use case".
* 3. The current workspace's use case is not "All use case".
* 4. The current navigation group is not included in the feature configurations of the workspace.
*
* If all these conditions are true, it means that the navigation group should be hidden.
*/
if (
navGroup.type !== NavGroupType.SYSTEM &&
(navGroup.type !== NavGroupType.SYSTEM || navGroup.id === ALL_USE_CASE_ID) &&
currentWorkspace.features &&
getFirstUseCaseOfFeatureConfigs(currentWorkspace.features) !== ALL_USE_CASE_ID &&
!isNavGroupInFeatureConfigs(navGroup.id, currentWorkspace.features)
Expand Down

0 comments on commit 7afbff0

Please sign in to comment.