Skip to content

Commit 9b0ef8e

Browse files
committed
Add Revisions Tab to Rollouts Details page (#8123)
Signed-off-by: Keith Chong <kykchong@redhat.com>
1 parent 6c6e75b commit 9b0ef8e

File tree

13 files changed

+1094
-16
lines changed

13 files changed

+1094
-16
lines changed

locales/en/plugin__gitops-plugin.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,16 @@
171171
"There are no pods associated with the rollout.": "There are no pods associated with the rollout.",
172172
"Edit Pod": "Edit Pod",
173173
"Promote": "Promote",
174-
"Full Promote": "Full Promote",
175174
"Abort": "Abort",
175+
"Full Promote": "Full Promote",
176176
"Retry": "Retry",
177177
"Restart": "Restart",
178178
"Edit Rollout": "Edit Rollout",
179-
"No revisions": "No revisions",
180-
"Revisions": "Revisions",
179+
"Age": "Age",
180+
"Info": "Info",
181+
"Ready containers": "Ready containers",
182+
"ready": "ready",
183+
"0 Pods": "0 Pods",
181184
"Rollout details": "Rollout details",
182185
"Replicas": "Replicas",
183186
"The number of desired replicas for the rollout": "The number of desired replicas for the rollout",
@@ -188,12 +191,13 @@
188191
"No Argo Rollouts": "No Argo Rollouts",
189192
"There are no Argo Rollouts in this project.": "There are no Argo Rollouts in this project.",
190193
"There are no Argo Rollouts in all projects.": "There are no Argo Rollouts in all projects.",
191-
"There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.",
194+
"There was an error retrieving rollouts. Check your connection and reload the page.": "There was an error retrieving rollouts. Check your connection and reload the page.",
192195
"Argo Rollouts": "Argo Rollouts",
193196
"Create Rollout": "Create Rollout",
194197
"Pods": "Pods",
195198
"Selector": "Selector",
196199
"Rollout Status": "Rollout Status",
200+
"Revisions": "Revisions",
197201
"There was an error retrieving the rollout. Check your connection and reload the page.": "There was an error retrieving the rollout. Check your connection and reload the page.",
198202
"There was an error retrieving the rollout revisions. Check your connection and reload the page.": "There was an error retrieving the rollout revisions. Check your connection and reload the page.",
199203
"Rollout Revisions": "Rollout Revisions",
@@ -216,6 +220,7 @@
216220
"Try removing the filter or selecting a different label to see more applications.": "Try removing the filter or selecting a different label to see more applications.",
217221
"There are no Argo CD Applications in this project.": "There are no Argo CD Applications in this project.",
218222
"There are no Argo CD Applications in all projects.": "There are no Argo CD Applications in all projects.",
223+
"There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.",
219224
"No Argo CD ApplicationSets match the label filter": "No Argo CD ApplicationSets match the label filter",
220225
"Try removing the filter or selecting a different label to see more ApplicationSets.": "Try removing the filter or selecting a different label to see more ApplicationSets.",
221226
"There are no Argo CD ApplicationSets in this project.": "There are no Argo CD ApplicationSets in this project.",

locales/ja/plugin__gitops-plugin.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,16 @@
171171
"There are no pods associated with the rollout.": "There are no pods associated with the rollout.",
172172
"Edit Pod": "Edit Pod",
173173
"Promote": "Promote",
174-
"Full Promote": "Full Promote",
175174
"Abort": "Abort",
175+
"Full Promote": "Full Promote",
176176
"Retry": "Retry",
177177
"Restart": "Restart",
178178
"Edit Rollout": "Edit Rollout",
179-
"No revisions": "No revisions",
180-
"Revisions": "Revisions",
179+
"Age": "Age",
180+
"Info": "Info",
181+
"Ready containers": "Ready containers",
182+
"ready": "ready",
183+
"0 Pods": "0 Pods",
181184
"Rollout details": "Rollout details",
182185
"Replicas": "Replicas",
183186
"The number of desired replicas for the rollout": "The number of desired replicas for the rollout",
@@ -188,12 +191,13 @@
188191
"No Argo Rollouts": "No Argo Rollouts",
189192
"There are no Argo Rollouts in this project.": "There are no Argo Rollouts in this project.",
190193
"There are no Argo Rollouts in all projects.": "There are no Argo Rollouts in all projects.",
191-
"There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.",
194+
"There was an error retrieving rollouts. Check your connection and reload the page.": "There was an error retrieving rollouts. Check your connection and reload the page.",
192195
"Argo Rollouts": "Argo Rollouts",
193196
"Create Rollout": "Create Rollout",
194197
"Pods": "Pods",
195198
"Selector": "Selector",
196199
"Rollout Status": "Rollout Status",
200+
"Revisions": "Revisions",
197201
"There was an error retrieving the rollout. Check your connection and reload the page.": "There was an error retrieving the rollout. Check your connection and reload the page.",
198202
"There was an error retrieving the rollout revisions. Check your connection and reload the page.": "There was an error retrieving the rollout revisions. Check your connection and reload the page.",
199203
"Rollout Revisions": "Rollout Revisions",
@@ -216,6 +220,7 @@
216220
"Try removing the filter or selecting a different label to see more applications.": "Try removing the filter or selecting a different label to see more applications.",
217221
"There are no Argo CD Applications in this project.": "There are no Argo CD Applications in this project.",
218222
"There are no Argo CD Applications in all projects.": "There are no Argo CD Applications in all projects.",
223+
"There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.",
219224
"No Argo CD ApplicationSets match the label filter": "No Argo CD ApplicationSets match the label filter",
220225
"Try removing the filter or selecting a different label to see more ApplicationSets.": "Try removing the filter or selecting a different label to see more ApplicationSets.",
221226
"There are no Argo CD ApplicationSets in this project.": "There are no Argo CD ApplicationSets in this project.",

locales/ko/plugin__gitops-plugin.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,16 @@
171171
"There are no pods associated with the rollout.": "There are no pods associated with the rollout.",
172172
"Edit Pod": "Edit Pod",
173173
"Promote": "Promote",
174-
"Full Promote": "Full Promote",
175174
"Abort": "Abort",
175+
"Full Promote": "Full Promote",
176176
"Retry": "Retry",
177177
"Restart": "Restart",
178178
"Edit Rollout": "Edit Rollout",
179-
"No revisions": "No revisions",
180-
"Revisions": "Revisions",
179+
"Age": "Age",
180+
"Info": "Info",
181+
"Ready containers": "Ready containers",
182+
"ready": "ready",
183+
"0 Pods": "0 Pods",
181184
"Rollout details": "Rollout details",
182185
"Replicas": "Replicas",
183186
"The number of desired replicas for the rollout": "The number of desired replicas for the rollout",
@@ -188,12 +191,13 @@
188191
"No Argo Rollouts": "No Argo Rollouts",
189192
"There are no Argo Rollouts in this project.": "There are no Argo Rollouts in this project.",
190193
"There are no Argo Rollouts in all projects.": "There are no Argo Rollouts in all projects.",
191-
"There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.",
194+
"There was an error retrieving rollouts. Check your connection and reload the page.": "There was an error retrieving rollouts. Check your connection and reload the page.",
192195
"Argo Rollouts": "Argo Rollouts",
193196
"Create Rollout": "Create Rollout",
194197
"Pods": "Pods",
195198
"Selector": "Selector",
196199
"Rollout Status": "Rollout Status",
200+
"Revisions": "Revisions",
197201
"There was an error retrieving the rollout. Check your connection and reload the page.": "There was an error retrieving the rollout. Check your connection and reload the page.",
198202
"There was an error retrieving the rollout revisions. Check your connection and reload the page.": "There was an error retrieving the rollout revisions. Check your connection and reload the page.",
199203
"Rollout Revisions": "Rollout Revisions",
@@ -216,6 +220,7 @@
216220
"Try removing the filter or selecting a different label to see more applications.": "Try removing the filter or selecting a different label to see more applications.",
217221
"There are no Argo CD Applications in this project.": "There are no Argo CD Applications in this project.",
218222
"There are no Argo CD Applications in all projects.": "There are no Argo CD Applications in all projects.",
223+
"There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.",
219224
"No Argo CD ApplicationSets match the label filter": "No Argo CD ApplicationSets match the label filter",
220225
"Try removing the filter or selecting a different label to see more ApplicationSets.": "Try removing the filter or selecting a different label to see more ApplicationSets.",
221226
"There are no Argo CD ApplicationSets in this project.": "There are no Argo CD ApplicationSets in this project.",

locales/zh/plugin__gitops-plugin.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,16 @@
171171
"There are no pods associated with the rollout.": "There are no pods associated with the rollout.",
172172
"Edit Pod": "Edit Pod",
173173
"Promote": "Promote",
174-
"Full Promote": "Full Promote",
175174
"Abort": "Abort",
175+
"Full Promote": "Full Promote",
176176
"Retry": "Retry",
177177
"Restart": "Restart",
178178
"Edit Rollout": "Edit Rollout",
179-
"No revisions": "No revisions",
180-
"Revisions": "Revisions",
179+
"Age": "Age",
180+
"Info": "Info",
181+
"Ready containers": "Ready containers",
182+
"ready": "ready",
183+
"0 Pods": "0 Pods",
181184
"Rollout details": "Rollout details",
182185
"Replicas": "Replicas",
183186
"The number of desired replicas for the rollout": "The number of desired replicas for the rollout",
@@ -188,12 +191,13 @@
188191
"No Argo Rollouts": "No Argo Rollouts",
189192
"There are no Argo Rollouts in this project.": "There are no Argo Rollouts in this project.",
190193
"There are no Argo Rollouts in all projects.": "There are no Argo Rollouts in all projects.",
191-
"There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.",
194+
"There was an error retrieving rollouts. Check your connection and reload the page.": "There was an error retrieving rollouts. Check your connection and reload the page.",
192195
"Argo Rollouts": "Argo Rollouts",
193196
"Create Rollout": "Create Rollout",
194197
"Pods": "Pods",
195198
"Selector": "Selector",
196199
"Rollout Status": "Rollout Status",
200+
"Revisions": "Revisions",
197201
"There was an error retrieving the rollout. Check your connection and reload the page.": "There was an error retrieving the rollout. Check your connection and reload the page.",
198202
"There was an error retrieving the rollout revisions. Check your connection and reload the page.": "There was an error retrieving the rollout revisions. Check your connection and reload the page.",
199203
"Rollout Revisions": "Rollout Revisions",
@@ -216,6 +220,7 @@
216220
"Try removing the filter or selecting a different label to see more applications.": "Try removing the filter or selecting a different label to see more applications.",
217221
"There are no Argo CD Applications in this project.": "There are no Argo CD Applications in this project.",
218222
"There are no Argo CD Applications in all projects.": "There are no Argo CD Applications in all projects.",
223+
"There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.",
219224
"No Argo CD ApplicationSets match the label filter": "No Argo CD ApplicationSets match the label filter",
220225
"Try removing the filter or selecting a different label to see more ApplicationSets.": "Try removing the filter or selecting a different label to see more ApplicationSets.",
221226
"There are no Argo CD ApplicationSets in this project.": "There are no Argo CD ApplicationSets in this project.",

src/gitops/components/rollout/RolloutNavPage.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { useRolloutActionsProvider } from './hooks/useRolloutActionsProvider';
1313
import { RolloutKind, RolloutModel } from './model/RolloutModel';
1414
import RolloutDetailsTab from './RolloutDetailsTab';
1515
import RolloutPodsTab from './RolloutPodsTab';
16+
import RolloutRevisionsTab from './RolloutRevisionsTab';
1617

1718
type RolloutPageProps = {
1819
name: string;
@@ -47,6 +48,11 @@ const RolloutNavPage: React.FC<RolloutPageProps> = ({ name, namespace, kind }) =
4748
name: t('YAML'),
4849
component: ResourceYAMLTab,
4950
},
51+
{
52+
href: 'revisions',
53+
name: t('Revisions'),
54+
component: RolloutRevisionsTab,
55+
},
5056
{
5157
href: 'pods',
5258
name: t('Pods'),
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import * as React from 'react';
2+
import { RouteComponentProps } from 'react-router';
3+
import classNames from 'classnames';
4+
import { PodKind } from 'src/components/topology/console/types';
5+
6+
import { useGitOpsTranslation } from '@gitops/utils/hooks/useGitOpsTranslation';
7+
import { resourceAsArray } from '@gitops/utils/utils';
8+
import { K8sResourceCommon, useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk';
9+
import { ErrorState } from '@patternfly/react-component-groups';
10+
import { Flex, FlexItem, PageSection, PageSectionVariants, Title } from '@patternfly/react-core';
11+
12+
import { ReplicaSetKind, RolloutKind } from './model/RolloutModel';
13+
import { Revisions } from './revisions/Revisions';
14+
15+
type RolloutRevisionsTabProps = RouteComponentProps<{
16+
ns: string;
17+
name: string;
18+
}> & {
19+
obj?: RolloutKind;
20+
};
21+
22+
const RolloutRevisionsTab: React.FC<RolloutRevisionsTabProps> = ({ obj: rollout }) => {
23+
const { t } = useGitOpsTranslation();
24+
25+
const [replicaSets, loaded, loadError] = useK8sWatchResource<K8sResourceCommon>({
26+
groupVersionKind: { group: 'apps', version: 'v1', kind: 'ReplicaSet' },
27+
isList: true,
28+
namespaced: true,
29+
namespace: rollout.metadata?.namespace,
30+
selector: rollout.spec.selector,
31+
});
32+
const [pods, podsloaded, podsloadError] = useK8sWatchResource({
33+
isList: true,
34+
groupVersionKind: {
35+
kind: 'Pod',
36+
version: 'v1',
37+
},
38+
namespaced: true,
39+
namespace: rollout.metadata?.namespace,
40+
});
41+
42+
const error = (
43+
<FlexItem>
44+
<ErrorState
45+
titleText={t('Unable to load data')}
46+
bodyText={t(
47+
'There was an error retrieving the rollout revisions. Check your connection and reload the page.',
48+
)}
49+
/>
50+
</FlexItem>
51+
);
52+
return (
53+
<PageSection
54+
variant={PageSectionVariants.default}
55+
className={classNames('co-m-pane__body', { 'co-m-pane__body--section-heading': true })}
56+
>
57+
<Title headingLevel="h2" className="co-section-heading">
58+
{t('Rollout Revisions')}
59+
</Title>
60+
61+
{loadError || !loaded || !podsloaded || podsloadError ? (
62+
<div>
63+
<Flex
64+
justifyContent={{ default: 'justifyContentSpaceEvenly' }}
65+
direction={{ default: 'column', lg: 'row' }}
66+
>
67+
<FlexItem fullWidth={{ default: 'fullWidth' }}>{error}</FlexItem>
68+
</Flex>
69+
</div>
70+
) : (
71+
<Revisions
72+
rollout={rollout}
73+
replicaSets={resourceAsArray(replicaSets) as ReplicaSetKind[]}
74+
pods={resourceAsArray(pods) as PodKind[]}
75+
/>
76+
)}
77+
</PageSection>
78+
);
79+
};
80+
81+
export default RolloutRevisionsTab;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.gitops_plugin__tight_description_list {
2+
--pf-c-description-list--m-compact--RowGap: 0.2rem;
3+
}

0 commit comments

Comments
 (0)