Skip to content

Commit cc2d088

Browse files
authored
Merge pull request #2681 from devtron-labs/fix/kubeconfig-action-widget
fix: bulk selection action widget position in KubeConfig Bulk selection
2 parents 4a228d0 + 799b5f2 commit cc2d088

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

src/components/ClusterNodes/ClusterList/ClusterSelectionBody.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React, { useRef, useState } from 'react'
17+
import React, { useState } from 'react'
1818

1919
import {
2020
BulkSelectionEvents,
@@ -50,9 +50,8 @@ const ClusterSelectionBody: React.FC<ClusterSelectionBodyTypes> = ({
5050
clusterOptions,
5151
clusterListLoader,
5252
filteredList,
53+
parentRef,
5354
}) => {
54-
const parentRef = useRef<HTMLDivElement>(null)
55-
5655
const [showKubeConfigModal, setShowKubeConfigModal] = useState(false)
5756
const [selectedClusterName, setSelectedClusterName] = useState('')
5857

@@ -133,17 +132,19 @@ const ClusterSelectionBody: React.FC<ClusterSelectionBodyTypes> = ({
133132
}
134133

135134
return (
136-
<div ref={parentRef} className="flexbox-col flex-grow-1">
135+
<>
137136
{renderClusterBulkSelection()}
138-
{renderClusterList()}
139-
{showKubeConfigModal && KubeConfigModal && (
140-
<KubeConfigModal
141-
clusterName={selectedClusterName || identifierCount === 0}
142-
handleModalClose={onChangeCloseKubeConfigModal}
143-
isSingleClusterButton={!!selectedClusterName}
144-
/>
145-
)}
146-
</div>
137+
<div className="flexbox-col flex-grow-1">
138+
{renderClusterList()}
139+
{showKubeConfigModal && KubeConfigModal && (
140+
<KubeConfigModal
141+
clusterName={selectedClusterName || identifierCount === 0}
142+
handleModalClose={onChangeCloseKubeConfigModal}
143+
isSingleClusterButton={!!selectedClusterName}
144+
/>
145+
)}
146+
</div>
147+
</>
147148
)
148149
}
149150

src/components/ClusterNodes/ClusterList/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
import { MutableRefObject } from 'react'
2+
13
import { ClusterDetail } from '@devtron-labs/devtron-fe-common-lib'
24

35
export interface ClusterViewType {
46
clusterOptions: ClusterDetail[]
57
clusterListLoader: boolean
68
initialLoading: boolean
79
refreshData: () => void
10+
parentRef: MutableRefObject<HTMLDivElement>
811
}
912

1013
export interface ClusterListTypes {

src/components/ResourceBrowser/ResourceBrowser.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { sortObjectArrayAlphabetically } from '../common'
3434
import { AddClusterButton } from './PageHeader.buttons'
3535

3636
const ResourceBrowser: React.FC = () => {
37+
const parentRef = useRef<HTMLDivElement>(null)
3738
const abortControllerRef = useRef<AbortController>(new AbortController())
3839

3940
const [detailClusterListLoading, detailClusterList, , reloadDetailClusterList] = useAsync(async () => {
@@ -72,6 +73,7 @@ const ResourceBrowser: React.FC = () => {
7273

7374
return (
7475
<ClusterListView
76+
parentRef={parentRef}
7577
clusterOptions={sortedClusterList}
7678
clusterListLoader={detailClusterListLoading}
7779
initialLoading={initialLoading}
@@ -85,7 +87,7 @@ const ResourceBrowser: React.FC = () => {
8587
}
8688

8789
return (
88-
<div className="flexbox-col h-100 bg__primary">
90+
<div className="flexbox-col h-100 bg__primary" ref={parentRef}>
8991
<PageHeader
9092
isBreadcrumbs={false}
9193
headerName="Kubernetes Resource Browser"

0 commit comments

Comments
 (0)