Skip to content

Commit 1eece41

Browse files
Merge pull request #1035 from devtron-labs/chore/main-sync
chore: update timeout references to support number type
2 parents c296d5a + c5a8068 commit 1eece41

10 files changed

Lines changed: 38 additions & 23 deletions

File tree

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v22
1+
v24.14.1

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.23.4-pre-2",
3+
"version": "1.23.5-pre-1",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/ClipboardButton/ClipboardButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const ClipboardButton = ({
4545
size,
4646
}: ClipboardProps) => {
4747
const [copied, setCopied] = useState<boolean>(false)
48-
const setCopiedFalseTimeoutRef = useRef<ReturnType<typeof setTimeout>>(-1)
48+
const setCopiedFalseTimeoutRef = useRef<ReturnType<typeof setTimeout> | number>(-1)
4949

5050
const handleTriggerCopy = () => {
5151
setCopied(true)
@@ -90,7 +90,7 @@ export const ClipboardButton = ({
9090

9191
useEffect(
9292
() => () => {
93-
if (setCopiedFalseTimeoutRef.current > -1) {
93+
if ((setCopiedFalseTimeoutRef.current as number) > -1) {
9494
clearTimeout(setCopiedFalseTimeoutRef.current)
9595
}
9696
},

src/Common/Hooks/UseRegisterShortcut/UseRegisterShortcutProvider.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const UseRegisterShortcutProvider = ({
3636
const disableShortcutsRef = useRef<boolean>(false)
3737
const shortcutsRef = useRef<Record<string, ShortcutType>>({})
3838
const keysDownRef = useRef<Set<Uppercase<string>>>(new Set())
39-
const keyDownTimeoutRef = useRef<ReturnType<typeof setTimeout>>(-1)
39+
const keyDownTimeoutRef = useRef<ReturnType<typeof setTimeout> | number>(-1)
4040
const ignoredTags = ignoreTags ?? IGNORE_TAGS_FALLBACK
4141

4242
const registerShortcut: UseRegisterShortcutContextType['registerShortcut'] = useCallback(
@@ -113,7 +113,7 @@ const UseRegisterShortcutProvider = ({
113113

114114
keysDownRef.current.clear()
115115

116-
if (keyDownTimeoutRef.current > -1) {
116+
if ((keyDownTimeoutRef.current as number) > -1) {
117117
clearTimeout(keyDownTimeoutRef.current)
118118
keyDownTimeoutRef.current = -1
119119
}
@@ -178,7 +178,7 @@ const UseRegisterShortcutProvider = ({
178178
window.removeEventListener('keyup', handleKeyupEvent)
179179
window.removeEventListener('blur', handleBlur)
180180

181-
if (keyDownTimeoutRef.current > -1) {
181+
if ((keyDownTimeoutRef.current as number) > -1) {
182182
clearTimeout(keyDownTimeoutRef.current)
183183
}
184184
}

src/Shared/Components/BulkOperations/BulkOperations.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ const BulkOperations = ({
7070
try {
7171
setApiCallInProgress(true)
7272

73-
let timeout = -1
73+
let timeout: ReturnType<typeof setTimeout> | number = -1
7474

7575
const triggerUpdate = () => {
76-
if (timeout >= 0) {
76+
if ((timeout as number) >= 0) {
7777
return
7878
}
7979

src/Shared/Components/CodeEditor/Extensions/readOnlyTooltip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const createTooltip = (view: EditorView): Tooltip => {
7474
// Plugin to show and remove tooltip on keypress
7575
const keypressTooltipPlugin = ViewPlugin.fromClass(
7676
class {
77-
private timeoutId: number | null = null
77+
private timeoutId: ReturnType<typeof setTimeout> | number | null = null
7878

7979
constructor(public view: EditorView) {
8080
this.view.dom.addEventListener('keydown', this.handleKeyPress)

src/Shared/Components/Table/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ export type ConfigurableColumnsConfigType<
450450
> = Record<string, ConfigurableColumnsType<RowData, FilterVariant, AdditionalProps>['visibleColumns']>
451451

452452
export interface GetFilteringPromiseProps<RowData extends unknown> {
453-
searchSortTimeoutRef: React.MutableRefObject<number>
453+
searchSortTimeoutRef: React.MutableRefObject<ReturnType<typeof setTimeout> | number>
454454
callback: () => Promise<RowsType<RowData>> | RowsType<RowData>
455455
}
456456

src/Shared/Store/IndexStore.tsx

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,33 @@ export function getiNodesByRootNodeWithChildNodes(
116116
})
117117
})
118118

119-
// Add containers to Pod type nodes
119+
// Add init containers and containers to Pod type nodes
120120
children
121121
.filter((_child) => _child.kind.toLowerCase() == Nodes.Pod.toLowerCase())
122122
.map((_pn) => {
123+
const podMeta = (podMetadata || _appDetailsSubject.getValue().resourceTree?.podMetadata)?.filter(
124+
(_pmd) => _pmd.uid === _pn.uid,
125+
)[0]
126+
127+
const initNodes: iNode[] = (podMeta?.initContainers || []).map((_c: string) => {
128+
const initNode = {} as iNode
129+
initNode.kind = Nodes.Containers
130+
initNode.name = _c
131+
initNode.pNode = _pn
132+
initNode.isInitContainer = true
133+
return initNode
134+
})
135+
136+
const containerNodes: iNode[] = (podMeta?.containers || []).map((_c: string) => {
137+
const childNode = {} as iNode
138+
childNode.kind = Nodes.Containers
139+
childNode.name = _c
140+
childNode.pNode = _pn
141+
return childNode
142+
})
143+
123144
// eslint-disable-next-line no-param-reassign
124-
_pn.childNodes = (podMetadata || _appDetailsSubject.getValue().resourceTree?.podMetadata)
125-
?.filter((_pmd) => _pmd.uid === _pn.uid)[0]
126-
?.containers?.map((_c) => {
127-
const childNode = {} as iNode
128-
childNode.kind = Nodes.Containers
129-
childNode.pNode = _pn
130-
childNode.name = _c
131-
return childNode
132-
})
145+
_pn.childNodes = [...initNodes, ...containerNodes]
133146
})
134147
children = children.flatMap((_node) => _node.childNodes ?? [])
135148
}

src/Shared/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ export interface iNode extends Node {
347347
type: NodeType
348348
status: string
349349
pNode?: iNode
350+
/** Marks a node as an init container, used for display purposes in the resource tree. */
351+
isInitContainer?: boolean
350352
}
351353

352354
export interface HelmReleaseStatus {

0 commit comments

Comments
 (0)