Skip to content

Commit 623a13b

Browse files
co-author: rhamilto - Fixed label filter, column widths, dataLabel attribute, and integration-test-fix
1 parent 650edec commit 623a13b

File tree

8 files changed

+57
-48
lines changed

8 files changed

+57
-48
lines changed

frontend/packages/console-app/src/components/data-view/ResourceDataView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export const ResourceDataView = <
144144
);
145145
}
146146

147-
if (!hideNameLabelFilters && !hideLabelFilter) {
147+
if (!hideNameLabelFilters && !hideLabelFilter && loaded) {
148148
basicFilters.push(
149149
<DataViewLabelFilter key="label" filterId="label" title={t('public~Label')} data={data} />,
150150
);
@@ -156,7 +156,7 @@ export const ResourceDataView = <
156156

157157
// Can't use data in the deps array as it will recompute the filters and will cause the selected category to reset
158158
// eslint-disable-next-line react-hooks/exhaustive-deps
159-
}, [additionalFilterNodes, t]);
159+
}, [additionalFilterNodes, t, loaded]);
160160

161161
return mock ? (
162162
<EmptyBox label={label} />

frontend/packages/console-app/src/components/data-view/useResourceDataViewData.tsx

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -76,42 +76,35 @@ export const useResourceDataViewData = <
7676

7777
const dataViewColumns = React.useMemo<ResourceDataViewColumn<TData>[]>(
7878
() =>
79-
activeColumns.map(
80-
(
81-
{ id, title, sort, props: { classes, isStickyColumn, stickyMinWidth, modifier } },
82-
index,
83-
) => {
84-
const headerProps: ThProps = {
85-
className: classes,
86-
isStickyColumn,
87-
stickyMinWidth,
88-
modifier,
79+
activeColumns.map(({ id, title, sort, props }, index) => {
80+
const headerProps: ThProps = {
81+
...props,
82+
dataLabel: title,
83+
};
84+
85+
if (sort) {
86+
headerProps.sort = {
87+
columnIndex: index,
88+
sortBy: {
89+
index: 0,
90+
direction: SortByDirection.asc,
91+
defaultDirection: SortByDirection.asc,
92+
},
8993
};
90-
91-
if (sort) {
92-
headerProps.sort = {
93-
columnIndex: index,
94-
sortBy: {
95-
index: 0,
96-
direction: SortByDirection.asc,
97-
defaultDirection: SortByDirection.asc,
98-
},
99-
};
100-
}
101-
102-
return {
103-
id,
104-
title,
105-
sortFunction: sort,
106-
props: headerProps,
107-
cell: title ? (
108-
<span>{title}</span>
109-
) : (
110-
<span className="pf-v6-u-screen-reader">{t('public~Actions')}</span>
111-
),
112-
};
113-
},
114-
),
94+
}
95+
96+
return {
97+
id,
98+
title,
99+
sortFunction: sort,
100+
props: headerProps,
101+
cell: title ? (
102+
<span>{title}</span>
103+
) : (
104+
<span className="pf-v6-u-screen-reader">{t('public~Actions')}</span>
105+
),
106+
};
107+
}),
115108
[activeColumns, t],
116109
);
117110

frontend/packages/integration-tests-cypress/tests/app/debug-pod.cy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('Debug pod', () => {
5454

5555
it('Opens debug terminal page from Logs subsection', () => {
5656
cy.visit(`/k8s/ns/${testName}/pods`);
57-
listPage.dvRows.shouldExist(POD_NAME);
57+
listPage.rows.shouldExist(POD_NAME);
5858
cy.visit(`/k8s/ns/${testName}/pods/${POD_NAME}`);
5959
detailsPage.isLoaded();
6060
detailsPage.selectTab('Logs');
@@ -79,8 +79,8 @@ describe('Debug pod', () => {
7979

8080
it('Opens debug terminal page from Pods Page - Status tool tip', () => {
8181
cy.visit(`/k8s/ns/${testName}/pods`);
82-
listPage.dvRows.shouldExist(POD_NAME);
83-
listPage.dvRows.clickStatusButton(POD_NAME);
82+
listPage.rows.shouldExist(POD_NAME);
83+
listPage.rows.clickStatusButton(POD_NAME);
8484
// Click on first debug link
8585
cy.byTestID(`popup-debug-container-link-${CONTAINER_NAME}`).click();
8686
listPage.titleShouldHaveText(`Debug ${CONTAINER_NAME}`);

frontend/packages/integration-tests-cypress/tests/crud/resource-crud.cy.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,13 @@ describe('Kubernetes resource CRUD operations', () => {
107107
]);
108108

109109
const dataViewResources = new Set([
110-
'HorizontalPodAutoscaler',
111-
'Job',
112-
'Pod',
113-
'ReplicaSet',
114-
'ReplicationController',
115-
'StatefulSet',
110+
'Deployment',
111+
'DeploymentConfig',
112+
'Secret',
113+
'ConfigMap',
114+
'CronJob',
115+
'DaemonSet',
116+
'PodDisruptionBudget',
116117
]);
117118

118119
testObjs.forEach((testObj, resource) => {

frontend/packages/integration-tests-cypress/views/list-page.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ export const listPage = {
6464
cy.get('.pf-v6-c-menu__list-item').contains('Name').click();
6565
cy.get('[aria-label="Name filter"]').clear().type(name);
6666
},
67+
by: (checkboxLabel: string) => {
68+
cy.get('[data-ouia-component-id="DataViewCheckboxFilter"]').click();
69+
cy.get(
70+
`[data-ouia-component-id="DataViewCheckboxFilter-filter-item-${checkboxLabel}"]`,
71+
).click();
72+
cy.url().should('include', 'status=Running');
73+
cy.get('[data-ouia-component-id="DataViewCheckboxFilter"]').click();
74+
},
6775
},
6876
rows: {
6977
getFirstElementName: () => cy.get('[data-test-rows="resource-row"] a').first(),
@@ -145,6 +153,9 @@ export const listPage = {
145153
.contains(resourceName)
146154
.should('exist');
147155
},
156+
shouldNotExist: (resourceName: string) => {
157+
cy.get(`[data-test="data-view-cell-${resourceName}-name"]`).should('not.exist');
158+
},
148159
clickRowByName: (resourceName: string) =>
149160
cy.get(`[data-test="data-view-cell-${resourceName}-name"]`).find('a').click({ force: true }), // after applying row filter, resource rows detached from DOM according to cypress, need to force the click
150161
},

frontend/public/components/configmap.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
ResourceSummary,
1414
} from './utils';
1515
import { Timestamp } from '@console/shared/src/components/datetime/Timestamp';
16+
import { ConfigMapModel } from '../models/index';
1617
import { Grid, GridItem } from '@patternfly/react-core';
1718
import { ConfigMapKind, referenceForModel, TableColumn } from '../module/k8s';
1819
import { getGroupVersionKindForModel } from '@console/dynamic-plugin-sdk/src/utils/k8s/k8s-ref';
@@ -29,7 +30,6 @@ import { sortResourceByValue } from './factory/Table/sort';
2930
import { sorts } from './factory/table';
3031

3132
const menuActions = [...Kebab.factory.common];
32-
3333
const kind = referenceForModel(ConfigMapModel);
3434
const tableColumnInfo = [
3535
{ id: 'name' },

frontend/public/components/workload-table.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ export const useWorkloadColumns = <T extends K8sResourceKind>(): TableColumn<T>[
215215
props: {
216216
...cellIsStickyProps,
217217
modifier: 'nowrap',
218+
style: { width: 'auto' },
218219
},
219220
},
220221
{
@@ -223,6 +224,7 @@ export const useWorkloadColumns = <T extends K8sResourceKind>(): TableColumn<T>[
223224
sort: 'metadata.namespace',
224225
props: {
225226
modifier: 'nowrap',
227+
style: { width: 'auto' },
226228
},
227229
},
228230
{
@@ -239,6 +241,7 @@ export const useWorkloadColumns = <T extends K8sResourceKind>(): TableColumn<T>[
239241
sort: 'metadata.labels',
240242
props: {
241243
modifier: 'nowrap',
244+
width: 20,
242245
},
243246
},
244247
{
@@ -247,6 +250,7 @@ export const useWorkloadColumns = <T extends K8sResourceKind>(): TableColumn<T>[
247250
sort: 'spec.selector',
248251
props: {
249252
modifier: 'nowrap',
253+
width: 20,
250254
},
251255
},
252256
{

frontend/public/locales/en/public.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@
406406
"No": "No",
407407
"DaemonSet details": "DaemonSet details",
408408
"Volumes": "Volumes",
409-
"Pod selector": "Pod selector",
410409
"View events": "View events",
411410
"Activity": "Activity",
412411
"Updating": "Updating",
@@ -938,6 +937,7 @@
938937
"{{description}} for": "{{description}} for",
939938
"Labels for": "Labels for",
940939
"Labels have been updated. Click Cancel and reapply your changes.": "Labels have been updated. Click Cancel and reapply your changes.",
940+
"Pod selector": "Pod selector",
941941
"Determines the set of pods targeted by this {{kind}}.": "Determines the set of pods targeted by this {{kind}}.",
942942
"Remove identity provider from OAuth?": "Remove identity provider from OAuth?",
943943
"Are you sure you want to remove <1> {{name}}</1> identity provider from OAuth<3> {{type}}</3>?": "Are you sure you want to remove <1> {{name}}</1> identity provider from OAuth<3> {{type}}</3>?",

0 commit comments

Comments
 (0)