Skip to content

Commit 8711114

Browse files
committed
chore: add breakdown items in command bar
1 parent 64ecd68 commit 8711114

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

src/Pages/Shared/CommandBar/utils.tsx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import {
44
Icon,
55
ImageWithFallback,
66
InfrastructureManagementAppListType,
7+
NavigationItemID,
78
SERVER_MODE,
89
URL_FILTER_KEYS,
910
URLS as COMMON_URLS,
1011
} from '@devtron-labs/devtron-fe-common-lib'
1112

1213
import { QueryParams as ChartStoreQueryParams } from '@Components/charts/constants'
1314
import { NAVIGATION_LIST } from '@Components/Navigation/constants'
14-
import { NavigationRootItemID } from '@Components/Navigation/types'
1515
import { getClusterChangeRedirectionUrl } from '@Components/ResourceBrowser/Utils'
1616
import { URLS } from '@Config/routes'
1717

@@ -37,7 +37,7 @@ export const getNewSelectedIndex = (prevIndex: number, type: 'up' | 'down', tota
3737
return prevIndex === totalItems - 1 ? 0 : prevIndex + 1
3838
}
3939

40-
const getAppManagementAdditionalNavItems = (serverMode: SERVER_MODE): CommandBarGroupType['items'] => [
40+
const getAppManagementNavItemsBreakdown = (serverMode: SERVER_MODE): CommandBarGroupType['items'] => [
4141
...(serverMode === SERVER_MODE.FULL
4242
? [
4343
{
@@ -52,7 +52,7 @@ const getAppManagementAdditionalNavItems = (serverMode: SERVER_MODE): CommandBar
5252
: []),
5353
]
5454

55-
const getInfraManagementAdditionalNavItems = (isSuperAdmin: boolean): CommandBarGroupType['items'] => [
55+
const getInfraManagementNavItemsBreakdown = (isSuperAdmin: boolean): CommandBarGroupType['items'] => [
5656
{
5757
id: 'app-management-helm-app-list',
5858
title: 'Helm Applications',
@@ -93,25 +93,23 @@ const getInfraManagementAdditionalNavItems = (isSuperAdmin: boolean): CommandBar
9393
: []),
9494
]
9595

96-
const getAdditionalItems = (
97-
groupId: NavigationRootItemID,
96+
const getNavItemBreakdownItems = (
97+
rootId: NavigationItemID,
9898
serverMode: SERVER_MODE,
9999
isSuperAdmin: boolean,
100100
): CommandBarGroupType['items'] => {
101-
switch (groupId) {
102-
case 'application-management':
103-
return getAppManagementAdditionalNavItems(serverMode)
104-
case 'infrastructure-management':
105-
return getInfraManagementAdditionalNavItems(isSuperAdmin)
101+
switch (rootId) {
102+
case 'application-management-devtron-applications':
103+
return getAppManagementNavItemsBreakdown(serverMode)
104+
case 'infrastructure-management-applications':
105+
return getInfraManagementNavItemsBreakdown(isSuperAdmin)
106106
default:
107107
return []
108108
}
109109
}
110110

111111
export const getNavigationGroups = (serverMode: SERVER_MODE, isSuperAdmin: boolean): CommandBarGroupType[] =>
112112
NAVIGATION_LIST.map<CommandBarGroupType>((group) => {
113-
const additionalItems = getAdditionalItems(group.id, serverMode, isSuperAdmin)
114-
115113
const parsedItems = group.items.flatMap<CommandBarGroupType['items'][number]>(
116114
({ hasSubMenu, subItems, title, href, id, icon, keywords }) => {
117115
if (hasSubMenu && subItems?.length) {
@@ -126,6 +124,12 @@ export const getNavigationGroups = (serverMode: SERVER_MODE, isSuperAdmin: boole
126124
}))
127125
}
128126

127+
const breakdownItems = getNavItemBreakdownItems(id, serverMode, isSuperAdmin)
128+
129+
if (breakdownItems.length) {
130+
return breakdownItems
131+
}
132+
129133
return {
130134
title,
131135
id,
@@ -140,7 +144,7 @@ export const getNavigationGroups = (serverMode: SERVER_MODE, isSuperAdmin: boole
140144
return {
141145
title: group.title,
142146
id: group.id,
143-
items: [...additionalItems, ...parsedItems],
147+
items: parsedItems,
144148
}
145149
})
146150

src/components/app/list/DevtronAppListContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ const DevtronAppList = ({
264264
<div className="app-list" data-testid="app-list-container">
265265
<div
266266
ref={stickyElementRef}
267-
className={`app-list__header ${!isArgoInstalled ? 'app-list__header--argo-not-installed' : ''} ${getClassNameForStickyHeaderWithShadow(
267+
className={`app-list__header border__secondary--bottom ${!isArgoInstalled ? 'app-list__header--argo-not-installed' : ''} ${getClassNameForStickyHeaderWithShadow(
268268
isHeaderStuck,
269269
'dc__top-47',
270270
)}`}

0 commit comments

Comments
 (0)