Skip to content

Commit 136ac60

Browse files
Updated CRD list pages(secret, deployment, deployment-config, configmap) in workloads
1 parent f37dbad commit 136ac60

File tree

14 files changed

+903
-443
lines changed

14 files changed

+903
-443
lines changed

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

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,33 @@ import { ResourceFilters, GetDataViewRows } from './types';
2929
import { useResourceDataViewData } from './useResourceDataViewData';
3030
import { useResourceDataViewFilters } from './useResourceDataViewFilters';
3131

32+
export const cellIsStickyProps = {
33+
isStickyColumn: true,
34+
stickyMinWidth: 0,
35+
};
36+
37+
const nameCellProps = {
38+
...cellIsStickyProps,
39+
hasRightBorder: true,
40+
};
41+
export const getNameCellProps = (name: string) => {
42+
return {
43+
...nameCellProps,
44+
'data-test': `data-view-cell-${name}-name`,
45+
};
46+
};
47+
48+
export const actionsCellProps = {
49+
'data-test': 'actions',
50+
hasLeftBorder: true,
51+
isActionCell: true,
52+
};
53+
54+
export const initialFiltersDefault = {
55+
name: '',
56+
label: '',
57+
};
58+
3259
export type ResourceDataViewProps<TData, TCustomRowData, TFilters> = {
3360
label?: string;
3461
data: TData[];
@@ -132,7 +159,14 @@ export const ResourceDataView = <
132159
const basicFilters: React.ReactNode[] = [];
133160

134161
if (!hideNameLabelFilters) {
135-
basicFilters.push(<DataViewTextFilter key="name" filterId="name" title={t('public~Name')} />);
162+
basicFilters.push(
163+
<DataViewTextFilter
164+
key="name"
165+
filterId="name"
166+
title={t('public~Name')}
167+
placeholder={t('public~Filter by name')}
168+
/>,
169+
);
136170
}
137171

138172
if (!hideNameLabelFilters && !hideLabelFilter) {
@@ -195,11 +229,13 @@ export const ResourceDataView = <
195229
/>
196230
<InnerScrollContainer>
197231
<DataViewTable
232+
aria-label={t(`public~{{label}} table`, { label })}
198233
columns={dataViewColumns}
199234
rows={dataViewRows}
200235
bodyStates={{ empty: bodyEmpty, loading: bodyLoading }}
201236
gridBreakPoint=""
202237
variant="compact"
238+
data-test="data-view-table"
203239
/>
204240
</InnerScrollContainer>
205241
</DataView>

frontend/packages/integration-tests-cypress/tests/crd-extensions/console-cli-download.cy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ describe(`${crd} CRD`, () => {
4141
it(`creates, displays, and deletes a new ${crd} instance`, () => {
4242
cy.visit(`/k8s/cluster/customresourcedefinitions?custom-resource-definition-name=${crd}`);
4343
listPage.isCreateButtonVisible();
44-
listPage.rows.shouldBeLoaded();
45-
listPage.rows.clickKebabAction(crd, 'View instances');
44+
listPage.dvRows.shouldBeLoaded();
45+
listPage.dvRows.clickKebabAction(crd, 'View instances');
4646
listPage.titleShouldHaveText(crd);
4747
listPage.clickCreateYAMLbutton();
4848
yamlEditor.isLoaded();
@@ -61,8 +61,8 @@ describe(`${crd} CRD`, () => {
6161
cy.get(`[data-test-id=${name}]`).should('contain', name);
6262

6363
cy.visit(`/k8s/cluster/console.openshift.io~v1~${crd}`);
64-
listPage.rows.shouldBeLoaded();
65-
listPage.rows.clickKebabAction(name, `Delete ${crd}`);
64+
listPage.dvRows.shouldBeLoaded();
65+
listPage.dvRows.clickKebabAction(name, `Delete ${crd}`);
6666
modal.shouldBeOpened();
6767
modal.modalTitleShouldContain(`Delete ${crd}`);
6868
modal.submit();

frontend/packages/integration-tests-cypress/tests/crd-extensions/console-external-log-link.cy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe(`${crd} CRD`, () => {
3232

3333
it(`creates, displays, modifies, and deletes a new ${crd} instance`, () => {
3434
cy.visit(`/k8s/cluster/customresourcedefinitions?custom-resource-definition-name=${crd}`);
35-
listPage.rows.shouldBeLoaded();
35+
listPage.dvRows.shouldBeLoaded();
3636
listPage.rows.clickRowByName(crd);
3737
detailsPage.titleShouldContain('consoleexternalloglinks.console.openshift.io');
3838
detailsPage.selectTab('Instances');
@@ -94,8 +94,8 @@ describe(`${crd} CRD`, () => {
9494
modal.shouldBeClosed();
9595

9696
cy.visit(`/k8s/cluster/console.openshift.io~v1~${crd}`);
97-
listPage.rows.shouldBeLoaded();
98-
listPage.rows.clickKebabAction(name, `Delete ${crd}`);
97+
listPage.dvRows.shouldBeLoaded();
98+
listPage.dvRows.clickKebabAction(name, `Delete ${crd}`);
9999
modal.shouldBeOpened();
100100
modal.modalTitleShouldContain(`Delete ${crd}`);
101101
modal.submit();

frontend/packages/integration-tests-cypress/tests/crd-extensions/console-link.cy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ describe(`${crd} CRD`, () => {
5757
it(`creates, displays, and deletes a new ${crd} ${dropdownMenuName} instance`, () => {
5858
cy.visit(`/k8s/cluster/customresourcedefinitions?custom-resource-definition-name=${crd}`);
5959
listPage.isCreateButtonVisible();
60-
listPage.rows.shouldBeLoaded();
61-
listPage.rows.clickKebabAction(crd, 'View instances');
60+
listPage.dvRows.shouldBeLoaded();
61+
listPage.dvRows.clickKebabAction(crd, 'View instances');
6262
listPage.titleShouldHaveText(crd);
6363
listPage.clickCreateYAMLbutton();
6464
yamlEditor.isLoaded();
@@ -88,8 +88,8 @@ describe(`${crd} CRD`, () => {
8888
.should('exist');
8989

9090
cy.visit(`/k8s/cluster/console.openshift.io~v1~${crd}`);
91-
listPage.rows.shouldBeLoaded();
92-
listPage.rows.clickKebabAction(name, `Delete ${crd}`);
91+
listPage.dvRows.shouldBeLoaded();
92+
listPage.dvRows.clickKebabAction(name, `Delete ${crd}`);
9393
modal.shouldBeOpened();
9494
modal.modalTitleShouldContain(`Delete ${crd}`);
9595
modal.submit();

frontend/packages/integration-tests-cypress/tests/crd-extensions/console-notification.cy.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ describe(`${crd} CRD`, () => {
3232
it(`creates, displays, modifies, and deletes a new ${crd} instance`, () => {
3333
cy.visit(`/k8s/cluster/customresourcedefinitions?custom-resource-definition-name=${crd}`);
3434
listPage.isCreateButtonVisible();
35-
listPage.rows.shouldBeLoaded();
36-
listPage.rows.clickKebabAction(crd, 'View instances');
35+
listPage.dvRows.shouldBeLoaded();
36+
listPage.dvRows.clickKebabAction(crd, 'View instances');
3737
listPage.titleShouldHaveText(crd);
3838
listPage.clickCreateYAMLbutton();
3939
yamlEditor.isLoaded();
@@ -50,7 +50,7 @@ describe(`${crd} CRD`, () => {
5050
});
5151

5252
cy.visit(`/k8s/cluster/console.openshift.io~v1~${crd}`);
53-
listPage.rows.shouldBeLoaded();
53+
listPage.dvRows.shouldBeLoaded();
5454
cy.log('Additional printer columns should exist.');
5555
cy.byTestID('has-additional-printer-columns').should('exist');
5656
cy.byTestID('additional-printer-column-header-Text').should('have.text', 'Text');
@@ -100,8 +100,8 @@ describe(`${crd} CRD`, () => {
100100
cy.get(altNotification).contains(altText).should('exist').and('be.visible');
101101

102102
cy.visit(`/k8s/cluster/console.openshift.io~v1~${crd}`);
103-
listPage.rows.shouldBeLoaded();
104-
listPage.rows.clickKebabAction(name, `Delete ${crd}`);
103+
listPage.dvRows.shouldBeLoaded();
104+
listPage.dvRows.clickKebabAction(name, `Delete ${crd}`);
105105
modal.shouldBeOpened();
106106
modal.modalTitleShouldContain(`Delete ${crd}`);
107107
modal.submit();

frontend/packages/integration-tests-cypress/tests/crd-extensions/console-yaml-sample.cy.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ metadata:
6262
it(`creates, displays, tests and deletes a new ${crd} instance`, () => {
6363
cy.visit(`/k8s/cluster/customresourcedefinitions?custom-resource-definition-name=${crd}`);
6464
listPage.isCreateButtonVisible();
65-
listPage.rows.shouldBeLoaded();
66-
listPage.rows.clickKebabAction(crd, 'View instances');
65+
listPage.dvRows.shouldBeLoaded();
66+
listPage.dvRows.clickKebabAction(crd, 'View instances');
6767
listPage.titleShouldHaveText(crd);
6868
listPage.clickCreateYAMLbutton();
6969
yamlEditor.isLoaded();
@@ -76,7 +76,7 @@ metadata:
7676
});
7777

7878
cy.visit(`/k8s/cluster/console.openshift.io~v1~${crd}`);
79-
listPage.rows.shouldBeLoaded();
79+
listPage.dvRows.shouldBeLoaded();
8080
cy.log('Additional printer columns should not exist.');
8181
cy.byTestID('has-additional-printer-columns').should('not.exist');
8282
cy.log('Created date should exist since Age does not.');
@@ -106,8 +106,8 @@ metadata:
106106

107107
// Delete CRD
108108
cy.visit(`/k8s/cluster/console.openshift.io~v1~${crd}`);
109-
listPage.rows.shouldBeLoaded();
110-
listPage.rows.clickKebabAction(name, `Delete ${crd}`);
109+
listPage.dvRows.shouldBeLoaded();
110+
listPage.dvRows.clickKebabAction(name, `Delete ${crd}`);
111111
modal.shouldBeOpened();
112112
modal.modalTitleShouldContain(`Delete ${crd}`);
113113
modal.submit();

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ export const listPage = {
100100
shouldNotExist: (resourceName: string) =>
101101
cy.get(`[data-test-id="${resourceName}"]`, { timeout: 90000 }).should('not.exist'),
102102
},
103+
dvRows: {
104+
shouldBeLoaded: () => {
105+
cy.get(`[data-test="data-view-table"]`).should('be.visible');
106+
},
107+
clickKebabAction: (resourceName: string, actionName: string) => {
108+
cy.get(`[data-test="data-view-cell-${resourceName}-name"]`)
109+
.contains(resourceName)
110+
.parents('tr')
111+
.within(() => {
112+
cy.get('[data-test-id="kebab-button"]').click();
113+
});
114+
cy.byTestActionID(actionName).click();
115+
},
116+
},
103117
};
104118

105119
export namespace ListPageSelector {

0 commit comments

Comments
 (0)