Skip to content

Commit 411cd63

Browse files
committed
fix: hook PodRestart modal to k8sResourceList component
1 parent 75d9a83 commit 411cd63

File tree

1 file changed

+72
-60
lines changed

1 file changed

+72
-60
lines changed

src/components/ResourceBrowser/ResourceList/K8SResourceList.tsx

Lines changed: 72 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { useLocation, useParams } from 'react-router-dom'
2020
import {
2121
abortPreviousRequests,
2222
FiltersTypeEnum,
23+
getAIAnalyticsEvents,
2324
LARGE_PAGE_SIZE_OPTIONS,
2425
Nodes,
2526
PaginationEnum,
@@ -35,6 +36,7 @@ import emptyCustomChart from '@Images/[email protected]'
3536
import { importComponentFromFELibrary } from '@Components/common'
3637
import {
3738
getManifestResource,
39+
getPodRestartRBACPayload,
3840
updateManifestResourceHelmApps,
3941
} from '@Components/v2/appDetails/k8Resource/nodeDetail/nodeDetail.api'
4042

@@ -59,6 +61,7 @@ const RESOURCE_FILTER_KEYS: Record<string, unknown> = importComponentFromFELibra
5961
)
6062
const RBBulkSelectionActions = importComponentFromFELibrary('RBBulkSelectionActions', null, 'function')
6163
const RBBulkOperations = importComponentFromFELibrary('RBBulkOperations', null, 'function')
64+
const PodRestart = importComponentFromFELibrary('PodRestart')
6265

6366
const K8SResourceListViewWrapper = ({
6467
children,
@@ -235,66 +238,75 @@ export const K8SResourceList = ({
235238
}
236239

237240
return (
238-
<Table
239-
// key={JSON.stringify(selectedResource)}
240-
loading={resourceListLoader || !resourceList}
241-
columns={columns}
242-
rows={rows}
243-
{...(RBBulkSelectionActions && !isEventListing
244-
? {
245-
bulkSelectionConfig: {
246-
BulkActionsComponent: RBBulkSelectionActions,
247-
getSelectAllDialogStatus: () => SelectAllDialogStatus.CLOSED,
248-
BulkOperationModal: RBBulkOperations,
249-
bulkOperationModalData: {
250-
selectedResource,
251-
isNodeListing,
252-
getManifestResource,
253-
updateManifestResourceHelmApps,
254-
clusterId: +clusterId,
255-
clusterName: selectedCluster?.label ?? '',
256-
handleReloadDataAfterBulkOperation: handleClearCacheAndReload,
241+
<>
242+
<Table
243+
// key={JSON.stringify(selectedResource)}
244+
loading={resourceListLoader || !resourceList}
245+
columns={columns}
246+
rows={rows}
247+
{...(RBBulkSelectionActions && !isEventListing
248+
? {
249+
bulkSelectionConfig: {
250+
BulkActionsComponent: RBBulkSelectionActions,
251+
getSelectAllDialogStatus: () => SelectAllDialogStatus.CLOSED,
252+
BulkOperationModal: RBBulkOperations,
253+
bulkOperationModalData: {
254+
selectedResource,
255+
isNodeListing,
256+
getManifestResource,
257+
updateManifestResourceHelmApps,
258+
clusterId: +clusterId,
259+
clusterName: selectedCluster?.label ?? '',
260+
handleReloadDataAfterBulkOperation: handleClearCacheAndReload,
261+
},
262+
bulkActionsData: {
263+
showBulkRestartOption:
264+
window._env_.FEATURE_BULK_RESTART_WORKLOADS_FROM_RB.split(',')
265+
.map((feat: string) => feat.trim().toUpperCase())
266+
.indexOf(selectedResource?.gvk.Kind.toUpperCase()) > -1,
267+
showNodeListingOptions: isNodeListing,
268+
},
257269
},
258-
bulkActionsData: {
259-
showBulkRestartOption:
260-
window._env_.FEATURE_BULK_RESTART_WORKLOADS_FROM_RB.split(',')
261-
.map((feat: string) => feat.trim().toUpperCase())
262-
.indexOf(selectedResource?.gvk.Kind.toUpperCase()) > -1,
263-
showNodeListingOptions: isNodeListing,
264-
},
265-
},
266-
}
267-
: {})}
268-
emptyStateConfig={{
269-
noRowsConfig: {
270-
image: emptyCustomChart,
271-
title: `No ${selectedResource?.gvk.Kind ?? 'Resource'} found`,
272-
subTitle: `We could not find any ${selectedResource?.gvk.Kind ?? 'Resource'}. Try selecting a different cluster or namespace.`,
273-
},
274-
}}
275-
filtersVariant={FiltersTypeEnum.URL}
276-
paginationVariant={PaginationEnum.PAGINATED}
277-
areColumnsConfigurable={isNodeListing}
278-
id="table__gvk-resource-list"
279-
additionalFilterProps={{
280-
parseSearchParams: parseK8sResourceListSearchParams,
281-
defaultPageSize: LARGE_PAGE_SIZE_OPTIONS[0].value,
282-
initialSortKey: getDefaultSortKey(),
283-
}}
284-
ViewWrapper={K8SResourceListViewWrapper}
285-
filter={tableFilter}
286-
additionalProps={{
287-
renderRefreshBar,
288-
selectedResource,
289-
selectedCluster,
290-
addTab,
291-
isNodeListing,
292-
isEventListing,
293-
lowercaseKindToResourceGroupMap,
294-
reloadResourceListData: handleClearCacheAndReload,
295-
clusterName: selectedCluster?.label ?? '',
296-
}}
297-
pageSizeOptions={!isNodeListing ? LARGE_PAGE_SIZE_OPTIONS : undefined}
298-
/>
270+
}
271+
: {})}
272+
emptyStateConfig={{
273+
noRowsConfig: {
274+
image: emptyCustomChart,
275+
title: `No ${selectedResource?.gvk.Kind ?? 'Resource'} found`,
276+
subTitle: `We could not find any ${selectedResource?.gvk.Kind ?? 'Resource'}. Try selecting a different cluster or namespace.`,
277+
},
278+
}}
279+
filtersVariant={FiltersTypeEnum.URL}
280+
paginationVariant={PaginationEnum.PAGINATED}
281+
areColumnsConfigurable={isNodeListing}
282+
id="table__gvk-resource-list"
283+
additionalFilterProps={{
284+
parseSearchParams: parseK8sResourceListSearchParams,
285+
defaultPageSize: LARGE_PAGE_SIZE_OPTIONS[0].value,
286+
initialSortKey: getDefaultSortKey(),
287+
}}
288+
ViewWrapper={K8SResourceListViewWrapper}
289+
filter={tableFilter}
290+
additionalProps={{
291+
renderRefreshBar,
292+
selectedResource,
293+
selectedCluster,
294+
addTab,
295+
isNodeListing,
296+
isEventListing,
297+
lowercaseKindToResourceGroupMap,
298+
reloadResourceListData: handleClearCacheAndReload,
299+
clusterName: selectedCluster?.label ?? '',
300+
}}
301+
pageSizeOptions={!isNodeListing ? LARGE_PAGE_SIZE_OPTIONS : undefined}
302+
/>
303+
304+
{PodRestart && (
305+
<PodRestart
306+
aiWidgetAnalyticsEvent={getAIAnalyticsEvents('RB_POD_RESTART')}
307+
rbacPayload={getPodRestartRBACPayload()}
308+
/>
309+
)}
310+
</>
299311
)
300312
}

0 commit comments

Comments
 (0)