Skip to content

Commit 7aadb33

Browse files
authored
Merge pull request #265 from keithchong/10541-FixLabelsColumnAndSort
Add Labels column to App, AppSet, ImageUpdater list pages; Remove TP badge (#10541)
2 parents 87631ad + c186f7d commit 7aadb33

20 files changed

Lines changed: 131 additions & 170 deletions

locales/en/plugin__gitops-plugin.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@
141141
"Unable to load data": "Unable to load data",
142142
"There was an error retrieving ImageUpdaters. Check your connection and reload the page.": "There was an error retrieving ImageUpdaters. Check your connection and reload the page.",
143143
"ImageUpdaters": "ImageUpdaters",
144-
"This list page is under tech preview, but not necessarily the resources it represents": "This list page is under tech preview, but not necessarily the resources it represents",
145144
"Create ImageUpdater": "Create ImageUpdater",
146145
"Apps": "Apps",
147146
"Images": "Images",
148147
"Last Checked": "Last Checked",
148+
"Labels": "Labels",
149149
"Has Apps": "Has Apps",
150150
"No Apps": "No Apps",
151151
"Not Ready": "Not Ready",
@@ -218,7 +218,6 @@
218218
"There was an error retrieving App Projects. Check your connection and reload the page.": "There was an error retrieving App Projects. Check your connection and reload the page.",
219219
"AppProjects": "AppProjects",
220220
"Create AppProject": "Create AppProject",
221-
"Labels": "Labels",
222221
"Last Updated": "Last Updated",
223222
"Has Description": "Has Description",
224223
"No Description": "No Description",
@@ -343,18 +342,15 @@
343342
"Created at": "Created at",
344343
"Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.": "Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.",
345344
"Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.": "Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.",
346-
"This details page is under tech preview, but not necessarily the resource it represents": "This details page is under tech preview, but not necessarily the resource it represents",
347345
"List view": "List view",
348346
"Graph view": "Graph view",
349347
"Sync": "Sync",
350348
"Stop": "Stop",
351349
"Refresh": "Refresh",
352350
"Refresh (Hard)": "Refresh (Hard)",
353-
"Rollouts in the Topology View is under tech preview": "Rollouts in the Topology View is under tech preview",
354351
"Actions": "Actions",
355352
"You don't have permission to perform this action": "You don't have permission to perform this action",
356353
"annotations": "annotations",
357354
"annotation": "annotation",
358-
"No owner": "No owner",
359-
"Tech preview": "Tech preview"
355+
"No owner": "No owner"
360356
}

locales/en/plugin__gitops-public.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"View logs": "View logs",
66
"Open URL": "Open URL",
77
"Edit": "Edit",
8-
"Rollouts in the Topology View is under tech preview": "Rollouts in the Topology View is under tech preview",
98
"Rollout": "Rollout",
109
"Name": "Name",
1110
"Namespace": "Namespace",

locales/ja/plugin__gitops-plugin.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@
141141
"Unable to load data": "Unable to load data",
142142
"There was an error retrieving ImageUpdaters. Check your connection and reload the page.": "There was an error retrieving ImageUpdaters. Check your connection and reload the page.",
143143
"ImageUpdaters": "ImageUpdaters",
144-
"This list page is under tech preview, but not necessarily the resources it represents": "This list page is under tech preview, but not necessarily the resources it represents",
145144
"Create ImageUpdater": "Create ImageUpdater",
146145
"Apps": "Apps",
147146
"Images": "Images",
148147
"Last Checked": "Last Checked",
148+
"Labels": "Labels",
149149
"Has Apps": "Has Apps",
150150
"No Apps": "No Apps",
151151
"Not Ready": "Not Ready",
@@ -218,7 +218,6 @@
218218
"There was an error retrieving App Projects. Check your connection and reload the page.": "There was an error retrieving App Projects. Check your connection and reload the page.",
219219
"AppProjects": "AppProjects",
220220
"Create AppProject": "Create AppProject",
221-
"Labels": "Labels",
222221
"Last Updated": "Last Updated",
223222
"Has Description": "Has Description",
224223
"No Description": "No Description",
@@ -343,18 +342,15 @@
343342
"Created at": "Created at",
344343
"Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.": "Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.",
345344
"Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.": "Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.",
346-
"This details page is under tech preview, but not necessarily the resource it represents": "This details page is under tech preview, but not necessarily the resource it represents",
347345
"List view": "List view",
348346
"Graph view": "Graph view",
349347
"Sync": "Sync",
350348
"Stop": "Stop",
351349
"Refresh": "Refresh",
352350
"Refresh (Hard)": "Refresh (Hard)",
353-
"Rollouts in the Topology View is under tech preview": "Rollouts in the Topology View is under tech preview",
354351
"Actions": "Actions",
355352
"You don't have permission to perform this action": "You don't have permission to perform this action",
356353
"annotations": "annotations",
357354
"annotation": "annotation",
358-
"No owner": "No owner",
359-
"Tech preview": "Tech preview"
355+
"No owner": "No owner"
360356
}

locales/ja/plugin__gitops-public.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"View logs": "View logs",
66
"Open URL": "Open URL",
77
"Edit": "Edit",
8-
"Rollouts in the Topology View is under tech preview": "Rollouts in the Topology View is under tech preview",
98
"Rollout": "Rollout",
109
"Name": "Name",
1110
"Namespace": "Namespace",

locales/ko/plugin__gitops-plugin.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@
141141
"Unable to load data": "Unable to load data",
142142
"There was an error retrieving ImageUpdaters. Check your connection and reload the page.": "There was an error retrieving ImageUpdaters. Check your connection and reload the page.",
143143
"ImageUpdaters": "ImageUpdaters",
144-
"This list page is under tech preview, but not necessarily the resources it represents": "This list page is under tech preview, but not necessarily the resources it represents",
145144
"Create ImageUpdater": "Create ImageUpdater",
146145
"Apps": "Apps",
147146
"Images": "Images",
148147
"Last Checked": "Last Checked",
148+
"Labels": "Labels",
149149
"Has Apps": "Has Apps",
150150
"No Apps": "No Apps",
151151
"Not Ready": "Not Ready",
@@ -218,7 +218,6 @@
218218
"There was an error retrieving App Projects. Check your connection and reload the page.": "There was an error retrieving App Projects. Check your connection and reload the page.",
219219
"AppProjects": "AppProjects",
220220
"Create AppProject": "Create AppProject",
221-
"Labels": "Labels",
222221
"Last Updated": "Last Updated",
223222
"Has Description": "Has Description",
224223
"No Description": "No Description",
@@ -343,18 +342,15 @@
343342
"Created at": "Created at",
344343
"Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.": "Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.",
345344
"Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.": "Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.",
346-
"This details page is under tech preview, but not necessarily the resource it represents": "This details page is under tech preview, but not necessarily the resource it represents",
347345
"List view": "List view",
348346
"Graph view": "Graph view",
349347
"Sync": "Sync",
350348
"Stop": "Stop",
351349
"Refresh": "Refresh",
352350
"Refresh (Hard)": "Refresh (Hard)",
353-
"Rollouts in the Topology View is under tech preview": "Rollouts in the Topology View is under tech preview",
354351
"Actions": "Actions",
355352
"You don't have permission to perform this action": "You don't have permission to perform this action",
356353
"annotations": "annotations",
357354
"annotation": "annotation",
358-
"No owner": "No owner",
359-
"Tech preview": "Tech preview"
355+
"No owner": "No owner"
360356
}

locales/ko/plugin__gitops-public.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"View logs": "View logs",
66
"Open URL": "Open URL",
77
"Edit": "Edit",
8-
"Rollouts in the Topology View is under tech preview": "Rollouts in the Topology View is under tech preview",
98
"Rollout": "Rollout",
109
"Name": "Name",
1110
"Namespace": "Namespace",

locales/zh/plugin__gitops-plugin.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@
141141
"Unable to load data": "Unable to load data",
142142
"There was an error retrieving ImageUpdaters. Check your connection and reload the page.": "There was an error retrieving ImageUpdaters. Check your connection and reload the page.",
143143
"ImageUpdaters": "ImageUpdaters",
144-
"This list page is under tech preview, but not necessarily the resources it represents": "This list page is under tech preview, but not necessarily the resources it represents",
145144
"Create ImageUpdater": "Create ImageUpdater",
146145
"Apps": "Apps",
147146
"Images": "Images",
148147
"Last Checked": "Last Checked",
148+
"Labels": "Labels",
149149
"Has Apps": "Has Apps",
150150
"No Apps": "No Apps",
151151
"Not Ready": "Not Ready",
@@ -218,7 +218,6 @@
218218
"There was an error retrieving App Projects. Check your connection and reload the page.": "There was an error retrieving App Projects. Check your connection and reload the page.",
219219
"AppProjects": "AppProjects",
220220
"Create AppProject": "Create AppProject",
221-
"Labels": "Labels",
222221
"Last Updated": "Last Updated",
223222
"Has Description": "Has Description",
224223
"No Description": "No Description",
@@ -343,18 +342,15 @@
343342
"Created at": "Created at",
344343
"Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.": "Time is a wrapper around time. Time which supports correct marshaling to YAML and JSON.",
345344
"Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.": "Owner references link this resource to its parent object. For example, Applications generated by an ApplicationSet will have that ApplicationSet as their owner. This relationship enables proper resource lifecycle management and garbage collection.",
346-
"This details page is under tech preview, but not necessarily the resource it represents": "This details page is under tech preview, but not necessarily the resource it represents",
347345
"List view": "List view",
348346
"Graph view": "Graph view",
349347
"Sync": "Sync",
350348
"Stop": "Stop",
351349
"Refresh": "Refresh",
352350
"Refresh (Hard)": "Refresh (Hard)",
353-
"Rollouts in the Topology View is under tech preview": "Rollouts in the Topology View is under tech preview",
354351
"Actions": "Actions",
355352
"You don't have permission to perform this action": "You don't have permission to perform this action",
356353
"annotations": "annotations",
357354
"annotation": "annotation",
358-
"No owner": "No owner",
359-
"Tech preview": "Tech preview"
355+
"No owner": "No owner"
360356
}

locales/zh/plugin__gitops-public.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"View logs": "View logs",
66
"Open URL": "Open URL",
77
"Edit": "Edit",
8-
"Rollouts in the Topology View is under tech preview": "Rollouts in the Topology View is under tech preview",
98
"Rollout": "Rollout",
109
"Name": "Name",
1110
"Namespace": "Namespace",

src/gitops/components/imageupdater/ImageUpdaterList.tsx

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { useTranslation } from 'react-i18next';
33
import { useLocation } from 'react-router-dom-v5-compat';
4-
import TechPreviewBadge from 'src/plugin/import/badges/TechPreviewBadge';
4+
import * as YamlFormatter from 'yaml';
55

66
import ActionsDropdown from '@gitops/utils/components/ActionDropDown/ActionDropDown';
77
import { modelToGroupVersionKind } from '@gitops/utils/utils';
@@ -34,6 +34,7 @@ import {
3434
useShowOperandsInAllNamespaces,
3535
} from '../shared/AllNamespaces';
3636
import { GitOpsDataViewTable, useGitOpsDataViewSort } from '../shared/DataView';
37+
import MetadataLabels from '../shared/MetadataLabels';
3738

3839
import { useImageUpdaterActionsProvider } from './hooks/useImageUpdaterActionsProvider';
3940

@@ -71,6 +72,7 @@ const ImageUpdaterList: React.FC<ImageUpdaterListTabProps> = ({
7172
'images',
7273
'last-checked',
7374
'ready',
75+
'labels',
7476
'actions',
7577
].map((key) => ({ key }));
7678
}, [showNamespaceColumn]);
@@ -171,15 +173,6 @@ const ImageUpdaterList: React.FC<ImageUpdaterListTabProps> = ({
171173
{showTitle == undefined && (
172174
<ListPageHeader
173175
title={t('ImageUpdaters')}
174-
badge={
175-
location?.pathname?.includes('openshift-gitops-operator') ? null : (
176-
<TechPreviewBadge
177-
tooltipContent={t(
178-
'This list page is under tech preview, but not necessarily the resources it represents',
179-
)}
180-
/>
181-
)
182-
}
183176
helpText={
184177
location.pathname?.includes('openshift-gitops-operator') ? (
185178
<ShowOperandsInAllNamespacesRadioGroup />
@@ -251,6 +244,10 @@ export const sortData = (
251244
aValue = a.status?.conditions?.find((c) => c.type === 'Ready')?.status || '';
252245
bValue = b.status?.conditions?.find((c) => c.type === 'Ready')?.status || '';
253246
break;
247+
case 'labels':
248+
aValue = YamlFormatter.stringify(a.metadata?.labels || {});
249+
bValue = YamlFormatter.stringify(b.metadata?.labels || {});
250+
break;
254251
default:
255252
return 0;
256253
}
@@ -277,7 +274,7 @@ export const useColumnsDV = (
277274
cell: t('Name'),
278275
props: {
279276
'aria-label': 'name',
280-
className: 'pf-m-width-20',
277+
className: 'pf-m-width-30',
281278
sort: getSortParams(0),
282279
style: { minWidth: '200px' },
283280
},
@@ -299,23 +296,23 @@ export const useColumnsDV = (
299296
cell: t('Apps'),
300297
props: {
301298
'aria-label': 'apps',
302-
className: 'pf-m-width-10',
299+
className: 'pf-m-width-20',
303300
sort: getSortParams(1 + i),
304301
},
305302
},
306303
{
307304
cell: t('Images'),
308305
props: {
309306
'aria-label': 'images',
310-
className: 'pf-m-width-10',
307+
className: 'pf-m-width-20',
311308
sort: getSortParams(2 + i),
312309
},
313310
},
314311
{
315312
cell: t('Last Checked'),
316313
props: {
317314
'aria-label': 'last checked',
318-
className: 'pf-m-width-15',
315+
className: 'pf-m-width-20',
319316
sort: getSortParams(3 + i),
320317
},
321318
},
@@ -327,6 +324,14 @@ export const useColumnsDV = (
327324
sort: getSortParams(4 + i),
328325
},
329326
},
327+
{
328+
cell: t('Labels'),
329+
props: {
330+
'aria-label': 'labels',
331+
className: 'pf-m-width-10',
332+
sort: getSortParams(5 + i),
333+
},
334+
},
330335
{
331336
cell: '',
332337
props: { 'aria-label': 'actions' },
@@ -400,6 +405,25 @@ export const useImageUpdaterRowsDV = (
400405
cell: readyCondition ? String(isReady) : '-',
401406
dataLabel: 'Ready',
402407
},
408+
{
409+
id: 'labels',
410+
dataLabel: 'Labels',
411+
cell: (
412+
<div>
413+
<MetadataLabels
414+
kind={
415+
ImageUpdaterModel.apiGroup +
416+
'~' +
417+
ImageUpdaterModel.apiVersion +
418+
'~' +
419+
ImageUpdaterModel.kind
420+
}
421+
labels={obj?.metadata?.labels}
422+
numLabels={3}
423+
/>
424+
</div>
425+
),
426+
},
403427
{
404428
id: 'actions-' + index,
405429
cell: <ImageUpdaterActionsCell imageUpdater={obj} index={index} />,

src/gitops/components/project/ProjectList.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { useTranslation } from 'react-i18next';
33
import { useLocation } from 'react-router-dom-v5-compat';
4-
import TechPreviewBadge from 'src/plugin/import/badges/TechPreviewBadge';
4+
import * as YamlFormatter from 'yaml';
55

66
import ActionsDropdown from '@gitops/utils/components/ActionDropDown/ActionDropDown';
77
import { modelToGroupVersionKind, modelToRef } from '@gitops/utils/utils';
@@ -195,15 +195,6 @@ const ProjectList: React.FC<ProjectListTabProps> = ({
195195
{showTitle == undefined && (
196196
<ListPageHeader
197197
title={t('AppProjects')}
198-
badge={
199-
location?.pathname?.includes('openshift-gitops-operator') ? null : (
200-
<TechPreviewBadge
201-
tooltipContent={t(
202-
'This list page is under tech preview, but not necessarily the resources it represents',
203-
)}
204-
/>
205-
)
206-
}
207198
helpText={
208199
location.pathname?.includes('openshift-gitops-operator') ? (
209200
<ShowOperandsInAllNamespacesRadioGroup />
@@ -360,8 +351,8 @@ export const sortData = (
360351
bValue = getApplicationsCount(b, applications, appsLoaded);
361352
break;
362353
case 'labels':
363-
aValue = a.metadata?.labels || {};
364-
bValue = b.metadata?.labels || {};
354+
aValue = YamlFormatter.stringify(a.metadata?.labels || {});
355+
bValue = YamlFormatter.stringify(b.metadata?.labels || {});
365356
break;
366357
case 'last-updated':
367358
aValue = getLastUpdateTimestamp(a) || '';
@@ -422,10 +413,7 @@ export const useColumnsDV = (
422413
},
423414
{
424415
cell: t('Labels'),
425-
props: {
426-
'aria-label': 'labels',
427-
className: 'pf-m-width-20',
428-
},
416+
props: sortableHeaderProps('labels', 'pf-m-width-20', getSortParams(3 + i)),
429417
},
430418
{
431419
cell: t('Last Updated'),

0 commit comments

Comments
 (0)