Skip to content

Commit ec132f1

Browse files
Merge branch 'kubecon-2025' into feat/refactor-material-view
2 parents 8ff1a57 + 1a658cb commit ec132f1

File tree

7 files changed

+45
-19
lines changed

7 files changed

+45
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "1.20.0-pre-5",
7+
"@devtron-labs/devtron-fe-common-lib": "1.20.0-alpha-4",
88
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
99
"@rjsf/core": "^5.13.3",
1010
"@rjsf/utils": "^5.13.3",

src/Pages/Shared/CommandBar/CommandBarBackdrop.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ const CommandBarBackdrop = ({ handleClose, isLoadingAppList, appList }: CommandB
9797

9898
const additionalGroups = getAdditionalNavGroups(searchText, appList)
9999
const parsedGroups = navigationGroups.reduce<typeof navigationGroups>((acc, group) => {
100-
const filteredItems = group.items.filter((item) => item.title.toLowerCase().includes(lowerCaseSearchText))
100+
const filteredItems = group.items.filter(
101+
(item) =>
102+
item.title.toLowerCase().includes(lowerCaseSearchText) ||
103+
item.keywords?.some((keyword) => keyword.toLowerCase().includes(lowerCaseSearchText)),
104+
)
101105

102106
if (filteredItems.length > 0) {
103107
acc.push({
@@ -146,7 +150,7 @@ const CommandBarBackdrop = ({ handleClose, isLoadingAppList, appList }: CommandB
146150
const item = itemFlatList[newIndex]
147151
const itemElement = itemRefMap.current[item.id]
148152
if (itemElement) {
149-
itemElement.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: 'smooth' })
153+
itemElement.scrollIntoView({ block: 'nearest', inline: 'nearest' })
150154
}
151155
return newIndex
152156
})
@@ -202,7 +206,7 @@ const CommandBarBackdrop = ({ handleClose, isLoadingAppList, appList }: CommandB
202206

203207
const itemElement = itemRefMap.current[itemFlatList[selectedIndex]?.id]
204208
if (itemElement) {
205-
itemElement.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: 'smooth' })
209+
itemElement.scrollIntoView({ block: 'nearest', inline: 'nearest' })
206210
}
207211

208212
setSelectedItemIndex(selectedIndex)
@@ -295,7 +299,7 @@ const CommandBarBackdrop = ({ handleClose, isLoadingAppList, appList }: CommandB
295299
}
296300

297301
const renderKeyboardShortcuts = (keys: SupportedKeyboardKeysType[], label: string) => (
298-
<div className="flexbox dc__gap-8 dc__align-items-center">
302+
<div className="flexbox dc__gap-6 dc__align-items-center">
299303
{keys.map((key) => (
300304
<KeyboardShortcut key={key} keyboardKey={key} />
301305
))}
@@ -312,10 +316,10 @@ const CommandBarBackdrop = ({ handleClose, isLoadingAppList, appList }: CommandB
312316
>
313317
<div
314318
onClick={stopPropagation}
315-
className="dc__mxw-720 mxh-500 flexbox-col dc__overflow-hidden dc__content-space br-12 bg__modal--primary command-bar__container w-100 h-100"
319+
className="dc__mxw-720 mxh-500 flexbox-col dc__overflow-hidden dc__content-space br-12 bg__modal--primary command-bar__container border__secondary-translucent w-100 h-100"
316320
>
317321
<div className="flexbox-col dc__overflow-hidden flex-grow-1">
318-
<div className="px-16 py-12">
322+
<div className="px-16 py-12 bg__modal--secondary border__primary--bottom">
319323
<SearchBar
320324
inputProps={{
321325
autoFocus: true,
@@ -340,7 +344,7 @@ const CommandBarBackdrop = ({ handleClose, isLoadingAppList, appList }: CommandB
340344
/>
341345
) : (
342346
<div
343-
className="flexbox-col dc__overflow-auto border__primary--top"
347+
className="flexbox-col dc__overflow-auto"
344348
role="listbox"
345349
aria-label="Command Menu"
346350
aria-activedescendant={itemFlatList[selectedItemIndex]?.id}
@@ -364,7 +368,7 @@ const CommandBarBackdrop = ({ handleClose, isLoadingAppList, appList }: CommandB
364368
)}
365369
</div>
366370

367-
<div className="flexbox dc__content-space dc__align-items-center px-20 py-12 border__primary--top bg__secondary">
371+
<div className="flexbox dc__content-space dc__align-items-center px-20 py-12 border__secondary--top bg__secondary">
368372
<div
369373
className={`flexbox dc__gap-20 dc__align-items-center flex-grow-1 ${showEmptyState ? 'dc__content-center' : ''}`}
370374
>

src/Pages/Shared/CommandBar/constants.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SupportedKeyboardKeysType } from '@devtron-labs/devtron-fe-common-lib'
1+
import { IconName, NavigationItemID, SupportedKeyboardKeysType } from '@devtron-labs/devtron-fe-common-lib'
22

33
import { CommandBarGroupType } from './types'
44

@@ -31,3 +31,9 @@ export const SHORT_CUTS: Record<
3131
description: 'Select Item',
3232
},
3333
}
34+
35+
export const NAV_SUB_ITEMS_ICON_MAPPING: Partial<Record<NavigationItemID, IconName>> = {
36+
'application-management-configurations': 'ic-gear',
37+
'application-management-policies': 'ic-gavel',
38+
'global-configuration-authorization': 'ic-key',
39+
}

src/Pages/Shared/CommandBar/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ export type CommandBarItemType = {
1313
id: CommandBarActionIdType | `${typeof RECENT_NAVIGATION_ITEM_ID_PREFIX}${CommandBarActionIdType}`
1414
title: string
1515
icon: IconsProps['name']
16-
iconColor?: IconBaseColorType | 'none'
16+
keywords: string[]
1717
href: NavigationItemType['href']
18+
iconColor?: IconBaseColorType | 'none'
1819
} & (
1920
| {
2021
onSelect?: never

src/Pages/Shared/CommandBar/utils.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import { SERVER_MODE, URLS as COMMON_URLS } from '@devtron-labs/devtron-fe-commo
33
import { NAVIGATION_LIST } from '@Components/Navigation/constants'
44
import { URLS } from '@Config/routes'
55

6-
import { DEVTRON_APPLICATIONS_COMMAND_GROUP_ID, RECENT_NAVIGATION_ITEM_ID_PREFIX } from './constants'
6+
import {
7+
DEVTRON_APPLICATIONS_COMMAND_GROUP_ID,
8+
NAV_SUB_ITEMS_ICON_MAPPING,
9+
RECENT_NAVIGATION_ITEM_ID_PREFIX,
10+
} from './constants'
711
import { CommandBarActionIdType, CommandBarBackdropProps, CommandBarGroupType, CommandBarItemType } from './types'
812

913
export const sanitizeItemId = (item: CommandBarItemType) =>
@@ -30,6 +34,7 @@ const getAppManagementAdditionalNavItems = (
3034
icon: 'ic-devtron-app',
3135
iconColor: 'none',
3236
href: URLS.DEVTRON_APP_LIST,
37+
keywords: [],
3338
} satisfies CommandBarGroupType['items'][number],
3439
]
3540
: []),
@@ -39,6 +44,7 @@ const getAppManagementAdditionalNavItems = (
3944
icon: 'ic-helm-app',
4045
iconColor: 'none',
4146
href: URLS.HELM_APP_LIST,
47+
keywords: [],
4248
},
4349
...(window._env_?.ENABLE_EXTERNAL_ARGO_CD && isSuperAdmin
4450
? [
@@ -48,6 +54,7 @@ const getAppManagementAdditionalNavItems = (
4854
icon: 'ic-argocd-app',
4955
iconColor: 'none',
5056
href: URLS.ARGO_APP_LIST,
57+
keywords: [],
5158
} satisfies CommandBarGroupType['items'][number],
5259
]
5360
: []),
@@ -59,6 +66,7 @@ const getAppManagementAdditionalNavItems = (
5966
icon: 'ic-fluxcd-app',
6067
iconColor: 'none',
6168
href: URLS.FLUX_APP_LIST,
69+
keywords: [],
6270
} satisfies CommandBarGroupType['items'][number],
6371
]
6472
: []),
@@ -70,15 +78,16 @@ export const getNavigationGroups = (serverMode: SERVER_MODE, isSuperAdmin: boole
7078
const additionalItems = isAppManagementBlock ? getAppManagementAdditionalNavItems(serverMode, isSuperAdmin) : []
7179

7280
const parsedItems = group.items.flatMap<CommandBarGroupType['items'][number]>(
73-
({ hasSubMenu, subItems, title, href, id, icon }) => {
81+
({ hasSubMenu, subItems, title, href, id, icon, keywords }) => {
7482
if (hasSubMenu && subItems?.length) {
7583
return subItems.map<CommandBarGroupType['items'][number]>((subItem) => ({
7684
title: `${title} / ${subItem.title}`,
7785
id: subItem.id,
7886
// Since icon is not present for some subItems, using from group
79-
icon: group.icon,
87+
icon: NAV_SUB_ITEMS_ICON_MAPPING[id] || group.icon,
8088
// TODO: No href present for some subItems
8189
href: subItem.href ?? null,
90+
keywords: subItem.keywords || [],
8291
}))
8392
}
8493

@@ -88,6 +97,7 @@ export const getNavigationGroups = (serverMode: SERVER_MODE, isSuperAdmin: boole
8897
icon: icon || 'ic-arrow-right',
8998
// TODO: No href present for some items
9099
href: href ?? null,
100+
keywords: keywords || [],
91101
}
92102
},
93103
)
@@ -114,6 +124,7 @@ export const parseAppListToNavItems = (appList: CommandBarBackdropProps['appList
114124
icon: 'ic-devtron-app',
115125
iconColor: 'none',
116126
href: `${COMMON_URLS.APPLICATION_MANAGEMENT_APP}/${app.id}/${URLS.APP_OVERVIEW}`,
127+
keywords: [],
117128
})),
118129
},
119130
]

src/css/base.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3247,6 +3247,10 @@ button.anchor {
32473247
height: 2px;
32483248
}
32493249

3250+
.h-6 {
3251+
height: 6px;
3252+
}
3253+
32503254
.h-8 {
32513255
height: 8px;
32523256
}

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,9 +1722,9 @@ __metadata:
17221722
languageName: node
17231723
linkType: hard
17241724

1725-
"@devtron-labs/devtron-fe-common-lib@npm:1.20.0-pre-5":
1726-
version: 1.20.0-pre-5
1727-
resolution: "@devtron-labs/devtron-fe-common-lib@npm:1.20.0-pre-5"
1725+
"@devtron-labs/devtron-fe-common-lib@npm:1.20.0-alpha-4":
1726+
version: 1.20.0-alpha-4
1727+
resolution: "@devtron-labs/devtron-fe-common-lib@npm:1.20.0-alpha-4"
17281728
dependencies:
17291729
"@codemirror/autocomplete": "npm:6.18.6"
17301730
"@codemirror/lang-json": "npm:6.0.1"
@@ -1775,7 +1775,7 @@ __metadata:
17751775
react-select: 5.8.0
17761776
rxjs: ^7.8.1
17771777
yaml: ^2.4.1
1778-
checksum: 10c0/190b37bc39c5a49c2e91d7b004027856a6bdc1a4a579c651765bbd2b008eb9ccc7d47b66748de131c8230d91f90be8df51cd792712a3719191da012b0bc5304a
1778+
checksum: 10c0/11ba2ff55c064ea6ded61867cddec7e67ce9aba14a8f5c9db171dbbbc0a50375cc5d6954f642584ea0975546822d8bd206a169aacad9f481302f8d688923c6ad
17791779
languageName: node
17801780
linkType: hard
17811781

@@ -5738,7 +5738,7 @@ __metadata:
57385738
version: 0.0.0-use.local
57395739
resolution: "dashboard@workspace:."
57405740
dependencies:
5741-
"@devtron-labs/devtron-fe-common-lib": "npm:1.20.0-pre-5"
5741+
"@devtron-labs/devtron-fe-common-lib": "npm:1.20.0-alpha-4"
57425742
"@esbuild-plugins/node-globals-polyfill": "npm:0.2.3"
57435743
"@playwright/test": "npm:^1.32.1"
57445744
"@rjsf/core": "npm:^5.13.3"

0 commit comments

Comments
 (0)