Skip to content

Commit 39991aa

Browse files
authored
Merge pull request #153 from keithchong/8123-RevisionsTab
Add Revisions Tab to Rollouts Details page (#8123)
2 parents 6c6e75b + 382cce8 commit 39991aa

File tree

13 files changed

+1091
-16
lines changed

13 files changed

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