Skip to content

Commit f250b19

Browse files
committed
Add Pods Tab to Details page in Dev Console (#7709)
Signed-off-by: Keith Chong <[email protected]>
1 parent ff5e533 commit f250b19

File tree

7 files changed

+701
-62
lines changed

7 files changed

+701
-62
lines changed

src/gitops/components/rollout/RolloutDetailsTab.tsx

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
import * as React from 'react';
22
import { RouteComponentProps } from 'react-router';
3-
import { Link } from 'react-router-dom-v5-compat';
43
import classNames from 'classnames';
54

65
import Conditions from '@gitops/utils/components/Conditions/Conditions';
76
import { useGitOpsTranslation } from '@gitops/utils/hooks/useGitOpsTranslation';
87
import { useObjectModifyPermissions } from '@gitops/utils/utils';
98
import { k8sUpdate } from '@openshift-console/dynamic-plugin-sdk';
109
import {
11-
Button,
1210
DescriptionList,
1311
Flex,
1412
FlexItem,
15-
Icon,
1613
NumberInput,
1714
PageSection,
1815
PageSectionVariants,
1916
Title,
20-
Tooltip,
2117
} from '@patternfly/react-core';
22-
import { TopologyIcon } from '@patternfly/react-icons';
2318

2419
import BaseDetailsSummary, {
2520
DetailsDescriptionGroup,
@@ -28,6 +23,7 @@ import BaseDetailsSummary, {
2823
import { RolloutModel } from './model/RolloutModel';
2924
import BlueGreenServices from './strategy/BlueGreenServices';
3025
import CanaryServices from './strategy/CanaryServices';
26+
import { topologyLink } from './utils/TopologyLink';
3127
import { RolloutStatusFragment } from './RolloutStatus';
3228

3329
type RolloutDetailsTabProps = RouteComponentProps<{
@@ -90,31 +86,7 @@ const RolloutDetailsTab: React.FC<RolloutDetailsTabProps> = ({ obj }) => {
9086
<BaseDetailsSummary
9187
obj={obj}
9288
model={RolloutModel}
93-
nameLink={
94-
<span style={{ display: 'inline-flex', alignItems: 'center' }}>
95-
<Tooltip position="top" content={'Topology view'}>
96-
<Link
97-
className="pf-v5-c-content"
98-
rel="noopener noreferrer"
99-
to={topologyUrl}
100-
role="button"
101-
aria-label={t('Topology view')}
102-
>
103-
<Button
104-
icon={
105-
<Icon size="md">
106-
<TopologyIcon />
107-
</Icon>
108-
}
109-
variant="plain"
110-
aria-label={t('Topology view')}
111-
className="pf-m-plain odc-topology__view-switcher"
112-
data-test-id="topology-switcher-view"
113-
></Button>
114-
</Link>
115-
</Tooltip>
116-
</span>
117-
}
89+
nameLink={topologyLink(topologyUrl, t)}
11890
/>
11991
</FlexItem>
12092
</Flex>

src/gitops/components/rollout/RolloutList.tsx

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,18 @@ import {
2828
} from '@openshift-console/dynamic-plugin-sdk';
2929
import { ResourceLink } from '@openshift-console/dynamic-plugin-sdk';
3030
import { ErrorState } from '@patternfly/react-component-groups';
31-
import {
32-
Button,
33-
EmptyState,
34-
EmptyStateBody,
35-
Icon,
36-
LabelGroup,
37-
Spinner,
38-
Tooltip,
39-
} from '@patternfly/react-core';
31+
import { EmptyState, EmptyStateBody, LabelGroup, Spinner } from '@patternfly/react-core';
4032
import { Label as PfLabel } from '@patternfly/react-core';
4133
import { DataViewTh, DataViewTr } from '@patternfly/react-data-view/dist/esm/DataViewTable';
42-
import { CubesIcon, SearchIcon, TopologyIcon } from '@patternfly/react-icons';
34+
import { CubesIcon, SearchIcon } from '@patternfly/react-icons';
4335
import { Tbody, Td, ThProps, Tr } from '@patternfly/react-table';
4436

4537
import { GitOpsDataViewTable, useGitOpsDataViewSort } from '../shared/DataView';
4638

4739
import { useRolloutActionsProvider } from './hooks/useRolloutActionsProvider';
4840
import { RolloutKind, RolloutModel } from './model/RolloutModel';
4941
import { RolloutStatus } from './utils/rollout-utils';
42+
import { topologyLink } from './utils/TopologyLink';
5043
import { RolloutStatusFragment } from './RolloutStatus';
5144

5245
import './rollout-list.scss';
@@ -198,28 +191,7 @@ const RolloutList: React.FC<RolloutListTabProps> = ({
198191
</span>
199192
{rows.length > 0 && !loadError && (
200193
<span className="rollout-list-page__topology-link pf-m-mb-sm">
201-
<Tooltip position="top" content={t('Topology view')}>
202-
<Link
203-
className="pf-v5-c-content"
204-
rel="noopener noreferrer"
205-
to={topologyUrl}
206-
role="button"
207-
aria-label={t('Graph view')}
208-
>
209-
<Button
210-
icon={
211-
<Icon size="md">
212-
<TopologyIcon />
213-
</Icon>
214-
}
215-
variant="plain"
216-
aria-label={t('Topology view')}
217-
className="pf-m-plain odc-topology__view-switcher"
218-
data-test-id="topology-switcher-view"
219-
onClick={() => console.log('Topology view')}
220-
></Button>
221-
</Link>
222-
</Tooltip>
194+
{topologyLink(topologyUrl, t)}
223195
</span>
224196
)}
225197
</span>

src/gitops/components/rollout/RolloutNavPage.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import ResourceYAMLTab from '../shared/ResourceYAMLTab/ResourceYAMLTab';
1212
import { useRolloutActionsProvider } from './hooks/useRolloutActionsProvider';
1313
import { RolloutKind, RolloutModel } from './model/RolloutModel';
1414
import RolloutDetailsTab from './RolloutDetailsTab';
15+
import RolloutPodsTab from './RolloutPodsTab';
1516

1617
type RolloutPageProps = {
1718
name: string;
@@ -46,6 +47,11 @@ const RolloutNavPage: React.FC<RolloutPageProps> = ({ name, namespace, kind }) =
4647
name: t('YAML'),
4748
component: ResourceYAMLTab,
4849
},
50+
{
51+
href: 'pods',
52+
name: t('Pods'),
53+
component: RolloutPodsTab,
54+
},
4955
{
5056
href: 'events',
5157
name: t('Events'),
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import * as React from 'react';
2+
import { RouteComponentProps } from 'react-router';
3+
4+
import { useGitOpsTranslation } from '@gitops/utils/hooks/useGitOpsTranslation';
5+
import { PageSection, Title } from '@patternfly/react-core';
6+
7+
import { PodList } from './components/PodList/PodList';
8+
import { RolloutKind } from './model/RolloutModel';
9+
10+
type RolloutPodsTabProps = RouteComponentProps<{
11+
ns: string;
12+
name: string;
13+
}> & {
14+
obj?: RolloutKind;
15+
};
16+
17+
const RolloutPodsTab: React.FC<RolloutPodsTabProps> = ({ obj: rollout }) => {
18+
const { t } = useGitOpsTranslation();
19+
return !rollout ? (
20+
<div>
21+
<PageSection>
22+
<Title headingLevel="h2" className="co-section-heading">
23+
{t('Rollout details')}
24+
</Title>
25+
</PageSection>
26+
</div>
27+
) : (
28+
<PodList
29+
rollout={rollout}
30+
namespace={rollout.metadata.namespace}
31+
selector={rollout.spec.selector}
32+
/>
33+
);
34+
};
35+
36+
export default RolloutPodsTab;

0 commit comments

Comments
 (0)