diff --git a/frontend/packages/container-security/src/components/summary.tsx b/frontend/packages/container-security/src/components/summary.tsx index d601cd06d2e..36552d7ba5f 100644 --- a/frontend/packages/container-security/src/components/summary.tsx +++ b/frontend/packages/container-security/src/components/summary.tsx @@ -6,6 +6,7 @@ import * as _ from 'lodash'; import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom-v5-compat'; import { ResourceHealthHandler, WatchK8sResults } from '@console/dynamic-plugin-sdk'; +import { ProjectModel } from '@console/internal/models'; import { referenceForModel } from '@console/internal/module/k8s'; import { HealthState } from '@console/shared/src/components/dashboard/status-card/states'; import { ExternalLink } from '@console/shared/src/components/links/ExternalLink'; @@ -74,7 +75,7 @@ export const SecurityBreakdownPopup: React.FC = ({ const imageNameClamped = (imageName: string): string => imageName.length > 25 ? `${imageName.slice(0, 25)}...` : imageName; const baseVulnListUrl = namespace - ? `/k8s/cluster/projects/${namespace}/vulnerabilities` + ? `/k8s/cluster/${referenceForModel(ProjectModel)}/${namespace}/vulnerabilities` : `/k8s/all-namespaces/${referenceForModel(ImageManifestVulnModel)}`; const vulnDetailsUrl = `/k8s/ns/${namespace}/${referenceForModel(ImageManifestVulnModel)}`; diff --git a/frontend/packages/integration-tests-cypress/support/project.ts b/frontend/packages/integration-tests-cypress/support/project.ts index eae95a032d3..92df16a7605 100644 --- a/frontend/packages/integration-tests-cypress/support/project.ts +++ b/frontend/packages/integration-tests-cypress/support/project.ts @@ -19,7 +19,7 @@ declare global { // ex: cy.createProject(name) Cypress.Commands.add('createProject', (name: string, devConsole: boolean = false) => { cy.log(`create project`); - cy.visit(`/k8s/cluster/projects`); + cy.visit(`/k8s/cluster/project.openshift.io~v1~Project`); listPage.isCreateButtonVisible(); listPage.clickCreateYAMLbutton(); modal.shouldBeOpened(); @@ -38,7 +38,7 @@ Cypress.Commands.add('createProjectWithCLI', (name: string) => { Cypress.Commands.add('deleteProject', (name: string) => { cy.log(`delete project`); - cy.visit(`/k8s/cluster/projects/${name}`); + cy.visit(`/k8s/cluster/project.openshift.io~v1~Project/${name}`); detailsPage.isLoaded(); detailsPage.clickPageActionFromDropdown('Delete Project'); modal.shouldBeOpened(); diff --git a/frontend/packages/integration-tests-cypress/tests/app/overview.cy.ts b/frontend/packages/integration-tests-cypress/tests/app/overview.cy.ts index b4e5b0c55a1..47a531d02f7 100644 --- a/frontend/packages/integration-tests-cypress/tests/app/overview.cy.ts +++ b/frontend/packages/integration-tests-cypress/tests/app/overview.cy.ts @@ -55,7 +55,7 @@ describe('Visiting Overview page', () => { }); it(`displays a ${kindModel.id} in the overview list page`, () => { - cy.visit(`/k8s/cluster/projects/${testName}/workloads?view=list`); + cy.visit(`/k8s/cluster/project.openshift.io~v1~Project/${testName}/workloads?view=list`); overviewPage.projectOverviewShouldBeVisible(); overviewPage.itemsShouldBeVisible(); overviewPage.groupLabelItemContains(kindModel); @@ -63,7 +63,7 @@ describe('Visiting Overview page', () => { }); it(`shows ${kindModel.id} details sidebar when item is clicked`, () => { - cy.visit(`/k8s/cluster/projects/${testName}/workloads?view=list`); + cy.visit(`/k8s/cluster/project.openshift.io~v1~Project/${testName}/workloads?view=list`); overviewPage.detailsSidebarShouldExist(false); overviewPage.clickProjectOverviewListItem(resourceName); overviewPage.detailsSidebarShouldExist(true); diff --git a/frontend/packages/integration-tests-cypress/tests/crud/secrets/key-value.cy.ts b/frontend/packages/integration-tests-cypress/tests/crud/secrets/key-value.cy.ts index 5c67dde29ea..0f7dc886d4e 100644 --- a/frontend/packages/integration-tests-cypress/tests/crud/secrets/key-value.cy.ts +++ b/frontend/packages/integration-tests-cypress/tests/crud/secrets/key-value.cy.ts @@ -40,7 +40,7 @@ describe('Create key/value secrets', () => { beforeEach(() => { // ensure the test project is selected to avoid flakes - cy.visit(`/k8s/cluster/projects/${testName}`); + cy.visit(`/k8s/cluster/project.openshift.io~v1~Project/${testName}`); nav.sidenav.clickNavLink(['Workloads', 'Secrets']); listPage.titleShouldHaveText('Secrets'); secrets.clickCreateSecretDropdownButton('generic'); diff --git a/frontend/packages/integration-tests-cypress/tests/dashboards/cluster-dashboard.cy.ts b/frontend/packages/integration-tests-cypress/tests/dashboards/cluster-dashboard.cy.ts index db70249ce0b..cf0a76e9df4 100644 --- a/frontend/packages/integration-tests-cypress/tests/dashboards/cluster-dashboard.cy.ts +++ b/frontend/packages/integration-tests-cypress/tests/dashboards/cluster-dashboard.cy.ts @@ -93,15 +93,15 @@ describe('Cluster dashboard', () => { it('has all items', () => { cy.byLegacyTestID('inventory-card').should('be.visible'); const inventoryItems = [ - { title: 'Node', link: '/k8s/cluster/nodes' }, - { title: 'Pod', link: '/k8s/all-namespaces/pods' }, + { title: 'Node', link: '/k8s/cluster/core~v1~Node' }, + { title: 'Pod', link: '/k8s/all-namespaces/core~v1~Pod' }, { title: 'StorageClass', - link: '/k8s/cluster/storageclasses', + link: '/k8s/cluster/storage.k8s.io~v1~StorageClass', }, { title: 'PersistentVolumeClaim', - link: '/k8s/all-namespaces/persistentvolumeclaims', + link: '/k8s/all-namespaces/core~v1~PersistentVolumeClaim', }, ]; inventoryItems.forEach((item, i) => { diff --git a/frontend/packages/integration-tests-cypress/tests/dashboards/project-dashboard.cy.ts b/frontend/packages/integration-tests-cypress/tests/dashboards/project-dashboard.cy.ts index ee5b57864b5..158cd294f8c 100644 --- a/frontend/packages/integration-tests-cypress/tests/dashboards/project-dashboard.cy.ts +++ b/frontend/packages/integration-tests-cypress/tests/dashboards/project-dashboard.cy.ts @@ -9,7 +9,7 @@ describe('Project dashboard', () => { }); beforeEach(() => { - cy.visit(`/k8s/cluster/projects/${testName}`); + cy.visit(`/k8s/cluster/project.openshift.io~v1~Project/${testName}`); }); describe('Details Card', () => { @@ -36,7 +36,10 @@ describe('Project dashboard', () => { it('has View all link', () => { cy.byTestID('details-card-view-all').click(); - cy.url().should('include', `/k8s/cluster/projects/${testName}/details`); + cy.url().should( + 'include', + `/k8s/cluster/project.openshift.io~v1~Project/${testName}/details`, + ); }); }); @@ -50,7 +53,7 @@ describe('Project dashboard', () => { describe('Inventory Card', () => { it('has all items', () => { const inventoryItems = [ - { kind: 'Deployment', path: `/k8s/ns/${testName}/deployments` }, + { kind: 'Deployment', path: `/k8s/ns/${testName}/apps~v1~Deployment` }, { kind: 'DeploymentConfig', path: `/k8s/ns/${testName}/deploymentconfigs` }, { kind: 'StatefulSets', path: `/k8s/ns/${testName}/statefulsets` }, { kind: 'Pod', path: `/k8s/ns/${testName}/pods` }, diff --git a/frontend/packages/topology/src/components/export-app/__tests__/ExportViewLogButton.spec.tsx b/frontend/packages/topology/src/components/export-app/__tests__/ExportViewLogButton.spec.tsx index 6182bc80936..7c038dd75f3 100644 --- a/frontend/packages/topology/src/components/export-app/__tests__/ExportViewLogButton.spec.tsx +++ b/frontend/packages/topology/src/components/export-app/__tests__/ExportViewLogButton.spec.tsx @@ -50,7 +50,7 @@ describe('ExportViewLogButton', () => { , ); const logButton = screen.getByTestId('export-view-log-btn'); - expect(logButton).toHaveAttribute('href', '/k8s/ns/test/pods/test/logs'); + expect(logButton).toHaveAttribute('href', '/k8s/ns/test/core~v1~Pod/test/logs'); }); it('should call onViewLog callback', async () => { diff --git a/frontend/public/components/app-contents.tsx b/frontend/public/components/app-contents.tsx index 5f97cda6aa4..a43088ce6bf 100644 --- a/frontend/public/components/app-contents.tsx +++ b/frontend/public/components/app-contents.tsx @@ -31,6 +31,7 @@ import { AlertmanagerModel, CronJobModel, HorizontalPodAutoscalerModel, + ProjectModel, VolumeSnapshotModel, } from '../models'; import { referenceForModel } from '../module/k8s'; @@ -131,12 +132,14 @@ const DefaultPage = connectToFlags( // REDIRECT ROUTES FOR REACT-ROUTER-V6 const StatusProjectsRedirect = () => { const { ns } = useParams(); - return ; + return ; }; const OverviewProjectsRedirect = () => { const { ns } = useParams(); - return ; + return ( + + ); }; const AlertManagerRedirect = () => { diff --git a/frontend/public/components/utils/__tests__/resource-link.spec.ts b/frontend/public/components/utils/__tests__/resource-link.spec.ts index abf06fc6d97..aa21aef8f32 100644 --- a/frontend/public/components/utils/__tests__/resource-link.spec.ts +++ b/frontend/public/components/utils/__tests__/resource-link.spec.ts @@ -21,10 +21,20 @@ describe('resourcePathFromModel', () => { }); }; - testResourcePath(ClusterRoleModel, 'my-role', null, '/k8s/cluster/clusterroles/my-role'); - testResourcePath(ClusterRoleModel, null, null, '/k8s/cluster/clusterroles'); - testResourcePath(PodModel, 'my-pod', 'my-project', '/k8s/ns/my-project/pods/my-pod'); - testResourcePath(PodModel, null, null, '/k8s/all-namespaces/pods'); + testResourcePath( + ClusterRoleModel, + 'my-role', + null, + '/k8s/cluster/rbac.authorization.k8s.io~v1~ClusterRole/my-role', + ); + testResourcePath( + ClusterRoleModel, + null, + null, + '/k8s/cluster/rbac.authorization.k8s.io~v1~ClusterRole', + ); + testResourcePath(PodModel, 'my-pod', 'my-project', '/k8s/ns/my-project/core~v1~Pod/my-pod'); + testResourcePath(PodModel, null, null, '/k8s/all-namespaces/core~v1~Pod'); testResourcePath( MachineModel, 'my-machine', diff --git a/frontend/public/components/utils/resource-link.tsx b/frontend/public/components/utils/resource-link.tsx index dcbf1c75249..7e4aa3258f0 100644 --- a/frontend/public/components/utils/resource-link.tsx +++ b/frontend/public/components/utils/resource-link.tsx @@ -18,7 +18,7 @@ import { getReference } from '@console/dynamic-plugin-sdk/src/utils/k8s/k8s-ref' const unknownKinds = new Set(); export const resourcePathFromModel = (model: K8sModel, name?: string, namespace?: string) => { - const { plural, namespaced, crd } = model; + const { namespaced } = model; let url = '/k8s/'; @@ -30,11 +30,7 @@ export const resourcePathFromModel = (model: K8sModel, name?: string, namespace? url += namespace ? `ns/${namespace}/` : 'all-namespaces/'; } - if (crd) { - url += referenceForModel(model); - } else if (plural) { - url += plural; - } + url += referenceForModel(model); if (name) { // Some resources have a name that needs to be encoded. For instance,