Skip to content

Commit afb7c46

Browse files
committed
Merge branch 'develop' of https://github.com/devtron-labs/devtron-fe-common-lib into feat/deploy-button-animation
2 parents 0ec0ad6 + bd6b48b commit afb7c46

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

src/Common/Helper.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
ZERO_TIME_STRING,
3333
TOAST_ACCESS_DENIED,
3434
UNCHANGED_ARRAY_ELEMENT_SYMBOL,
35+
DATE_TIME_FORMATS,
3536
} from './Constants'
3637
import { ServerErrors } from './ServerError'
3738
import { AsyncOptions, AsyncState, DeploymentNodeType, UseSearchString } from './Types'
@@ -233,6 +234,9 @@ export function handleUTCTime(ts: string, isRelativeTime = false) {
233234
return timestamp
234235
}
235236

237+
export const getFormattedUTCTimeForExport = (timeToConvert: string, fallback = '-') =>
238+
timeToConvert ? `${moment(timeToConvert).utc().format(DATE_TIME_FORMATS.TWELVE_HOURS_EXPORT_FORMAT)} (UTC)` : '-'
239+
236240
export function useSearchString(): UseSearchString {
237241
const location = useLocation()
238242
const queryParams: URLSearchParams = useMemo(() => {

src/Pages/GlobalConfigurations/Authorization/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
export * from './constants'
1818
export type { UserListFilterParams, UserRoleGroup, UserGroupDTO, UserGroupType } from './types'
19+
export { UserTypeToFetchType } from './types'
1920
export * from './shared'
2021
export * from './service'
2122
export { getUserAndApiTokenOption } from './utils'

src/Pages/GlobalConfigurations/Authorization/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@
1717
import { BaseFilterQueryParams } from '../../../Shared'
1818
import { UserListSortableKeys, UserStatus } from './constants'
1919

20+
export enum UserTypeToFetchType {
21+
includeDeleted = 'includeDeleted',
22+
excludeDelete = 'excludeDelete',
23+
onlyDeleted = 'onlyDeleted',
24+
}
25+
2026
export type UserListFilterParams = BaseFilterQueryParams<UserListSortableKeys> & {
2127
/**
2228
* Selected statuses (if any)
2329
*/
2430
status: UserStatus[]
31+
typeToFetch?: UserTypeToFetchType
2532
}
2633

2734
export interface UserMinType {

src/Shared/Components/DeploymentConfigDiff/DeploymentConfigDiffMain.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Fragment, useEffect, useRef, useState } from 'react'
1+
import { Fragment, useEffect, useState } from 'react'
22
import Tippy from '@tippyjs/react'
33

44
import { ReactComponent as ICSortArrowDown } from '@Icons/ic-sort-arrow-down.svg'
@@ -38,10 +38,6 @@ export const DeploymentConfigDiffMain = ({
3838
// STATES
3939
const [expandedView, setExpandedView] = useState<Record<string | number, boolean>>({})
4040

41-
// REFS
42-
/** Ref to track if the element should scroll into view after expanding */
43-
const scrollIntoViewAfterExpand = useRef(false)
44-
4541
const handleAccordionClick = (id: string) => () => {
4642
setExpandedView({
4743
...expandedView,
@@ -52,11 +48,12 @@ export const DeploymentConfigDiffMain = ({
5248
const onTransitionEnd =
5349
(id: string): DeploymentConfigDiffAccordionProps['onTransitionEnd'] =>
5450
(e) => {
55-
if (scrollIntoViewAfterExpand.current && scrollIntoViewId === id && e.target === e.currentTarget) {
56-
const element = document.querySelector(`#${scrollIntoViewId}`)
57-
element?.scrollIntoView({ block: 'start' })
58-
// Reset ref after scrolling into view
59-
scrollIntoViewAfterExpand.current = false
51+
if (scrollIntoViewId === id && e.target === e.currentTarget) {
52+
// Using setTimeout to ensure React state updates and DOM rendering are complete before scrolling to element.
53+
setTimeout(() => {
54+
const element = document.querySelector(`#${scrollIntoViewId}`)
55+
element?.scrollIntoView({ block: 'start' })
56+
})
6057
}
6158
}
6259

@@ -76,7 +73,6 @@ export const DeploymentConfigDiffMain = ({
7673

7774
useEffect(() => {
7875
if (scrollIntoViewId) {
79-
scrollIntoViewAfterExpand.current = true
8076
setExpandedView((prev) => ({ ...prev, [scrollIntoViewId]: true }))
8177
}
8278
}, [scrollIntoViewId])

0 commit comments

Comments
 (0)