Skip to content

feat: table in RB #732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 34 commits into
base: feat/resource-recommender-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5c39760
yoyoy
Elessar1802 May 7, 2025
a0d351a
feat: table in RB
Elessar1802 May 13, 2025
3747f38
fix: keep rows loading until rows is provided
Elessar1802 May 15, 2025
99010be
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
Elessar1802 May 19, 2025
98a1615
fix: popup menu ref
Elessar1802 May 19, 2025
0d590b3
revert: change in useAsync
Elessar1802 May 19, 2025
b5820c6
fix: RB table bulk actions props
Elessar1802 May 20, 2025
cf594e3
fix: sticky columns in table
Elessar1802 May 21, 2025
a28de9b
fix: loading state of table & checkbox alignment
Elessar1802 May 21, 2025
a2ee314
fix: alignment for CellComponents
Elessar1802 May 21, 2025
06f0059
feat: add icons to Icon component & fix style in table
Elessar1802 May 27, 2025
53d3548
fix: uat changes
Elessar1802 May 28, 2025
6fcae35
fix: loading during search causes search bar focus loss
Elessar1802 May 28, 2025
b8a37ff
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
Elessar1802 Jun 11, 2025
ec408e0
Merge branch 'feat/rb-table' into fix/rb-table
Elessar1802 Jun 11, 2025
041865c
fix: uat changes
Elessar1802 Jun 11, 2025
8ef90b3
feat: scale resize-btn on hover
Elessar1802 Jun 11, 2025
08ffe92
chore: override sortable-table-cell__resize-btn from table css
Elessar1802 Jun 11, 2025
fbcd109
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
Elessar1802 Jun 12, 2025
42f5460
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
Elessar1802 Jun 13, 2025
fe3db8d
Merge branch 'feat/rb-table' into fix/rb-table
Elessar1802 Jun 13, 2025
c8de7d5
feat(css): uat
Elessar1802 Jun 18, 2025
0c2fd13
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
Elessar1802 Jun 18, 2025
306753e
fix: scrollTo func instead of scrollToTop prop
Elessar1802 Jun 19, 2025
d1bf390
fix: bulk select all if not paginated
Elessar1802 Jun 23, 2025
9b8f2a9
Merge branch 'feat/resource-recommender-develop' of github.com:devtro…
Elessar1802 Jun 23, 2025
da9d3d9
fix: new pagination const
Elessar1802 Jun 24, 2025
eb2b1b0
fix: bulk selection count logic
Elessar1802 Jun 24, 2025
fa075f8
feat: add download icon and update icon map; add ResourceRecommenderA…
AbhishekA1509 Jun 24, 2025
b954eff
Merge branch 'fix/rb-table' of https://github.com/devtron-labs/devtro…
AbhishekA1509 Jun 24, 2025
e15749b
fix: filter if filter func provided
Elessar1802 Jun 25, 2025
f22829a
fix: add new clearFilters prop to table props
Elessar1802 Jun 26, 2025
74c4046
fix: update version from 1.15.3-pre-4 to 1.15.3-beta-3 in package.jso…
AbhishekA1509 Jun 26, 2025
2e1f380
fix: update version from 1.15.3-beta-3 to 1.15.3-beta-4 in package.js…
AbhishekA1509 Jun 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
"version": "1.15.3-pre-4",
"version": "1.15.3-beta-4",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
Expand Down
3 changes: 3 additions & 0 deletions src/Assets/IconV2/ic-bug.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/Assets/IconV2/ic-check-all.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/Assets/IconV2/ic-check-square.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Assets/IconV2/ic-clean-brush.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Assets/IconV2/ic-download.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Assets/IconV2/ic-file-code.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/Assets/IconV2/ic-info-filled-color.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Assets/IconV2/ic-logs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Assets/IconV2/ic-pause-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const IGNORE_TAGS_FALLBACK = ['input', 'textarea', 'select']
const DEFAULT_TIMEOUT = 300

const UseRegisterShortcutProvider = ({
containerRef,
ignoreTags,
preventDefault = false,
shortcutTimeout,
Expand Down Expand Up @@ -117,21 +118,22 @@ const UseRegisterShortcutProvider = ({
}, [])

const handleKeydownEvent = useCallback((event: KeyboardEvent) => {
if (preventDefault) {
event.preventDefault()
}

if (
// NOTE: in case of custom events generated by password managers autofill, the event.key is not set
!event.key ||
ignoredTags.map((tag) => tag.toUpperCase()).indexOf((event.target as HTMLElement).tagName?.toUpperCase()) >
-1 ||
(ignoredTags.map((tag) => tag.toUpperCase()).indexOf((event.target as HTMLElement).tagName?.toUpperCase()) >
-1 &&
(!containerRef || containerRef.current?.contains(event.target as HTMLElement))) ||
(event.target as HTMLElement)?.role === 'textbox' ||
disableShortcutsRef.current
) {
return
}

if (preventDefault) {
event.preventDefault()
}

keysDownRef.current.add(event.key.toUpperCase() as Uppercase<string>)

if (event.ctrlKey) {
Expand Down
4 changes: 4 additions & 0 deletions src/Common/Hooks/UseRegisterShortcut/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

import { RefObject } from 'react'

import { IS_PLATFORM_MAC_OS } from '@Common/Constants'

// NOTE: check this link for more info on keyboard keys: https://w3c.github.io/uievents-key/
Expand All @@ -28,6 +30,7 @@ export const KEYBOARD_KEYS_MAP = {
K: 'K',
X: 'X',
A: 'A',
N: 'N',
Escape: 'Esc',
Enter: '↩',
ArrowLeft: '←',
Expand Down Expand Up @@ -80,6 +83,7 @@ export interface UseRegisterShortcutContextType {
}

export interface UseRegisterShortcutProviderType {
containerRef?: RefObject<HTMLElement>
children: React.ReactNode
/**
* Defines how long after holding the keys down do we trigger the callback in milliseconds
Expand Down
5 changes: 3 additions & 2 deletions src/Common/Hooks/useStateFilters/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

import { UseUrlFiltersProps, UseUrlFiltersReturnType } from '../useUrlFilters'

export interface UseStateFiltersProps<T> extends Pick<UseUrlFiltersProps<T, never>, 'initialSortKey'> {}
export interface UseStateFiltersProps<T>
extends Pick<UseUrlFiltersProps<T, never>, 'initialSortKey' | 'defaultPageSize'> {}

export interface UseStateFiltersReturnType<T>
extends Pick<
Expand All @@ -31,7 +32,7 @@ export interface UseStateFiltersReturnType<T>
| 'pageSize'
| 'searchKey'
| 'handleSearch'
| 'isFilterApplied'
| 'areFiltersApplied'
> {}

export interface PaginationType<T> extends Pick<UseUrlFiltersReturnType<T>, 'pageSize'> {
Expand Down
5 changes: 3 additions & 2 deletions src/Common/Hooks/useStateFilters/useStateFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { PaginationType, UseStateFiltersProps, UseStateFiltersReturnType } from
*/
const useStateFilters = <T = string,>({
initialSortKey,
defaultPageSize = DEFAULT_BASE_PAGE_SIZE,
}: UseStateFiltersProps<T> = {}): UseStateFiltersReturnType<T> => {
const [sortingConfig, setSortingConfig] = useState({
sortOrder: SortingOrder.ASC,
Expand All @@ -45,7 +46,7 @@ const useStateFilters = <T = string,>({
const { sortBy, sortOrder } = sortingConfig

const [pagination, setPagination] = useState<PaginationType<T>>({
pageSize: DEFAULT_BASE_PAGE_SIZE,
pageSize: defaultPageSize,
pageNumber: DEFAULT_PAGE_NUMBER,
})
const offset = pagination.pageSize * (pagination.pageNumber - 1)
Expand Down Expand Up @@ -117,7 +118,7 @@ const useStateFilters = <T = string,>({
changePage,
changePageSize,
offset,
isFilterApplied: !!searchKey,
areFiltersApplied: !!searchKey,
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/Common/Hooks/useUrlFilters/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface UseUrlFiltersProps<T, K extends {}> {
* @default 'replace'
*/
redirectionMethod?: 'replace' | 'push'
defaultPageSize?: number
}

export type UpdateSearchParamsOptionsType<T, K = {}> = Partial<Pick<UseUrlFiltersProps<T, K>, 'redirectionMethod'>>
Expand Down Expand Up @@ -86,5 +87,5 @@ export type UseUrlFiltersReturnType<T, K = {}> = K & {
* Update the search params with the passed object
*/
updateSearchParams: (paramsToSerialize: Partial<K>, options?: UpdateSearchParamsOptionsType<T, K>) => void
isFilterApplied: boolean
areFiltersApplied: boolean
}
5 changes: 3 additions & 2 deletions src/Common/Hooks/useUrlFilters/useUrlFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const useUrlFilters = <T = string, K = {}>({
parseSearchParams,
localStorageKey,
redirectionMethod = 'replace',
defaultPageSize = DEFAULT_BASE_PAGE_SIZE,
}: UseUrlFiltersProps<T, K> = {}): UseUrlFiltersReturnType<T, K> => {
const location = useLocation()
const history = useHistory()
Expand Down Expand Up @@ -108,7 +109,7 @@ const useUrlFilters = <T = string, K = {}>({
const _parsedParams = getParsedSearchParams(searchParams)

return {
pageSize: Number(_pageSize) || DEFAULT_BASE_PAGE_SIZE,
pageSize: Number(_pageSize) || defaultPageSize,
pageNumber: Number(_pageNumber) || DEFAULT_PAGE_NUMBER,
searchKey: _searchKey || '',
sortBy: sortByKey,
Expand Down Expand Up @@ -223,7 +224,7 @@ const useUrlFilters = <T = string, K = {}>({
clearFilters,
...parsedParams,
updateSearchParams,
isFilterApplied: !!searchKey || areAnyAdditionalFiltersApplied(parsedParams),
areFiltersApplied: !!searchKey || areAnyAdditionalFiltersApplied(parsedParams),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Common/Pagination/PageSizeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const PageSizeSelector = ({ pageSizeOptions, pageSize, changePageSize }: PageSiz
</div>
)}

<button type="button" className="select__button" onClick={handleDropdownToggle}>
<button type="button" className="select__button flexbox" onClick={handleDropdownToggle}>
<span>{selectedOption ? selectedOption.value : ''}</span>
<span className="select__icon">
<i className={font} />
Expand Down
6 changes: 6 additions & 0 deletions src/Common/Pagination/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ export const FALLBACK_PAGE_SIZE_OPTIONS = [
{ value: 40, selected: false },
{ value: 50, selected: false },
]

export const LARGE_PAGE_SIZE_OPTIONS = [
{ value: 100, selected: true },
{ value: 150, selected: false },
{ value: 200, selected: false },
]
1 change: 1 addition & 0 deletions src/Common/Pagination/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@

/* eslint-disable import/prefer-default-export */
// Disabling since might need to export types as well
export { LARGE_PAGE_SIZE_OPTIONS } from './constants'
export { default as Pagination } from './Pagination'
export type { PaginationProps } from './types'
24 changes: 19 additions & 5 deletions src/Common/PopupMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import React, { useEffect } from 'react'
import React, { forwardRef, useEffect } from 'react'
import { Modal } from './Modals/Modal'
import { PopupMenuBodyType, PopupMenuButtonType, PopupMenuType } from './Types'

Expand Down Expand Up @@ -155,19 +155,33 @@ const PopupMenu = ({
)
}

const Button = ({
const Button = forwardRef(({
children = null,
disabled = false,
rootClassName = '',
tabIndex = 0,
onHover = false,
isKebab = false,
dataTestId = '',
}: PopupMenuButtonType) => {
}: PopupMenuButtonType, forwardedRef) => {
const { handleOpen, popupPosition, buttonRef, initialiseButtonWidth } = usePopupContext()

const refCallback = (node) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we require these changes now?

buttonRef.current = node

if (typeof forwardedRef === 'function') {
forwardedRef(node)
return
}

if (forwardedRef && typeof forwardedRef === 'object') {
forwardedRef.current = node
}
}

return (
<button
ref={initialiseButtonWidth}
ref={refCallback}
type="button"
tabIndex={tabIndex}
disabled={disabled}
Expand All @@ -181,7 +195,7 @@ const Button = ({
{children}
</button>
)
}
})

const Body = ({
children = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ const SortableTableHeaderCell = ({

return (
// Added w-100, h-100 when isResizable is true to ensure the cell takes full dimensions in wrapper flex layout (if any)
<div className={`flex dc__content-space dc__gap-6 dc__position-rel ${isResizable ? 'w-100 h-100' : ''}`}>
<div
className={`flex dc__content-space dc__gap-6 dc__position-rel ${isResizable ? 'w-100 h-100 sortable-table-header__container' : ''}`}
>
<button
type="button"
className={`dc__transparent p-0 cn-7 flex dc__content-start dc__gap-4 dc__select-text fw-6 ${!isSortable ? 'cursor-default' : ''} dc__position-rel`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
*/

.sortable-table-header {
&__container > :first-child {
margin-right: 6px;
}

&__resize-btn {
> div {
transition: all 0.1s ease-out;
Expand Down
11 changes: 6 additions & 5 deletions src/Pages/ResourceBrowser/ResourceBrowser.Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { Dispatch, RefObject, SetStateAction } from 'react'
import { Dispatch, ReactNode, RefObject, SetStateAction } from 'react'
import { GroupBase } from 'react-select'

import { ServerErrors } from '@Common/ServerError'
Expand Down Expand Up @@ -205,14 +205,15 @@ export interface GVKOptionValueType {
}

export interface GetResourceRecommenderResourceListPropsType {
resourceList: K8sResourceDetailType
reloadResourceListData: () => void
setShowAbsoluteValuesInResourceRecommender: Dispatch<SetStateAction<boolean>>
showAbsoluteValuesInResourceRecommender: boolean
gvkOptions: GroupBase<SelectPickerOptionType<GVKOptionValueType>>[]
areGVKOptionsLoading: boolean
reloadGVKOptions: () => void
gvkOptionsError: ServerErrors
isResourceListLoading: boolean
resourceListError: ServerErrors
}

export interface ResourceRecommenderActionMenuProps {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not being used

children: ReactNode
lastScannedOn: string
}
2 changes: 1 addition & 1 deletion src/Shared/Components/Badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Badge = ({
: {})}
>
{startIconProps && <Icon {...startIconProps} size={iconSize} color={fontColor || iconColor} />}
<span className="dc__truncate">{label}</span>
{label && <span className="dc__truncate">{label}</span>}
{endIconProps && <Icon {...endIconProps} size={iconSize} color={fontColor || iconColor} />}
</div>
)
Expand Down
Loading
Loading