Skip to content

Commit 9569949

Browse files
CONSOLE-4954: Add Workload tab to Node view
1 parent 684b6f0 commit 9569949

4 files changed

Lines changed: 47 additions & 4 deletions

File tree

frontend/packages/console-app/locales/en/console-app.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@
526526
"Kubelet version": "Kubelet version",
527527
"Kube-Proxy version": "Kube-Proxy version",
528528
"Configuration": "Configuration",
529+
"Workload": "Workload",
529530
"Machine set": "Machine set",
530531
"This count is based on your access permissions and might not include all virtual machines.": "This count is based on your access permissions and might not include all virtual machines.",
531532
"{{formattedCores}} cores / {{totalCores}} cores": "{{formattedCores}} cores / {{totalCores}} cores",

frontend/packages/console-app/src/components/nodes/NodeDetailsPage.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import NodeDashboard from './node-dashboard/NodeDashboard';
2121
import NodeDetails from './NodeDetails';
2222
import NodeLogs from './NodeLogs';
2323
import NodeTerminal from './NodeTerminal';
24+
import { NodeWorkload } from './NodeWorkload';
2425

2526
const NodePodsPage: FC<PageComponentProps<NodeKind>> = ({ obj }) => (
2627
<PodsPage
@@ -55,10 +56,15 @@ export const NodeDetailsPage: FC<ComponentProps<typeof DetailsPage>> = (props) =
5556
nameKey: 'console-app~Configuration',
5657
component: NodeConfiguration,
5758
},
59+
{
60+
href: 'workload',
61+
// t('console-app~Workload')
62+
nameKey: 'console-app~Workload',
63+
component: NodeWorkload,
64+
},
65+
navFactory.editYaml(),
5866
]
59-
: []),
60-
navFactory.editYaml(),
61-
navFactory.pods(NodePodsPage),
67+
: [navFactory.editYaml(), navFactory.pods(NodePodsPage)]),
6268
navFactory.logs(NodeLogs),
6369
navFactory.events(ResourceEventStream),
6470
...(!isWindowsNode(node) ? [navFactory.terminal(NodeTerminal)] : []),
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import type { FC } from 'react';
2+
import type { NodeKind } from '@console/dynamic-plugin-sdk/src';
3+
import { PodsPage } from '@console/internal/components/pod-list';
4+
import type { PageComponentProps } from '@console/internal/components/utils';
5+
import { NodeSubNavPage } from './NodeSubNavPage';
6+
7+
const NodePodsPage: FC<PageComponentProps<NodeKind>> = ({ obj }) => (
8+
<PodsPage
9+
fieldSelector={`spec.nodeName=${obj.metadata.name}`}
10+
showNamespaceOverride
11+
hideFavoriteButton
12+
/>
13+
);
14+
15+
type NodeWorkloadProps = {
16+
obj: NodeKind;
17+
};
18+
19+
const standardPages = [
20+
{
21+
tabId: 'pods',
22+
// t('console-app~Pods')
23+
nameKey: 'console-app~Pods',
24+
component: NodePodsPage,
25+
priority: 30,
26+
},
27+
];
28+
29+
export const NodeWorkload: FC<NodeWorkloadProps> = ({ obj }) => (
30+
<NodeSubNavPage obj={obj} pageId="workload" standardPages={standardPages} />
31+
);

frontend/public/components/pod-list.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ export const PodsPage: FC<PodPageProps> = ({
588588
hideLabelFilter,
589589
hideColumnManagement,
590590
showNamespaceOverride,
591+
hideFavoriteButton,
591592
}) => {
592593
const { t } = useTranslation();
593594
const dispatch = useConsoleDispatch();
@@ -638,7 +639,10 @@ export const PodsPage: FC<PodPageProps> = ({
638639

639640
return (
640641
<>
641-
<ListPageHeader title={showTitle ? t('public~Pods') : ''}>
642+
<ListPageHeader
643+
title={showTitle ? t('public~Pods') : ''}
644+
hideFavoriteButton={hideFavoriteButton}
645+
>
642646
{canCreate && (
643647
<ListPageCreate groupVersionKind={resourceKind} createAccessReview={accessReview}>
644648
{t('public~Create Pod')}
@@ -711,4 +715,5 @@ type PodPageProps = {
711715
hideNameLabelFilters?: boolean;
712716
hideColumnManagement?: boolean;
713717
showNamespaceOverride?: boolean;
718+
hideFavoriteButton?: boolean;
714719
};

0 commit comments

Comments
 (0)