From 814b0dfc59cb049a600401846da69d8e9d202eb8 Mon Sep 17 00:00:00 2001 From: Tuukka Kataja Date: Mon, 27 Mar 2023 16:43:16 +0300 Subject: [PATCH] Fix project urls --- e2e/test/project.test.ts | 10 +++++----- frontend/src/App.tsx | 12 ++++++------ frontend/src/views/Project/InvestmentProject.tsx | 8 ++++---- frontend/src/views/Project/InvestmentProjectForm.tsx | 2 +- frontend/src/views/Project/Projects.tsx | 4 ++-- frontend/src/views/Project/RelationsContainer.tsx | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/e2e/test/project.test.ts b/e2e/test/project.test.ts index 5c3f419d..43e2002e 100644 --- a/e2e/test/project.test.ts +++ b/e2e/test/project.test.ts @@ -46,7 +46,7 @@ async function createProject(page: Page, project: InvestmentProject) { // Go to the new project page await page.getByRole('button', { name: 'Luo uusi hanke' }).click(); await page.getByRole('menuitem', { name: 'Uusi investointihanke' }).click(); - await expect(page).toHaveURL('https://localhost:1443/hanke/luo'); + await expect(page).toHaveURL('https://localhost:1443/investointihanke/luo'); // Fill in the project data and save the project await page.locator('input[name="projectName"]').fill(project.projectName); @@ -70,7 +70,7 @@ async function createProject(page: Page, project: InvestmentProject) { await page.getByRole('button', { name: 'Lisää hanke' }).click(); // URL should include the newly created project ID, parse it from the URL - await expect(page).toHaveURL(/https:\/\/localhost:1443\/hanke\/[0-9a-f-]+/); + await expect(page).toHaveURL(/https:\/\/localhost:1443\/investointihanke\/[0-9a-f-]+/); const projectId = page.url().split('/').at(-1); await client.project.updateGeometry.mutate(geometryPayload(projectId, keskustoriGeom)); @@ -88,7 +88,7 @@ async function createProject(page: Page, project: InvestmentProject) { async function deleteProject(page: Page, projectId: string) { // Go to the project page - await page.goto(`https://localhost:1443/hanke/${projectId}`); + await page.goto(`https://localhost:1443/investointihanke/${projectId}`); // Delete the project await page.getByRole('button', { name: 'Poista hanke' }).click(); @@ -96,7 +96,7 @@ async function deleteProject(page: Page, projectId: string) { await expect(page).toHaveURL('https://localhost:1443/hankkeet'); // Expect the project page to not exist anymore - await page.goto(`https://localhost:1443/hanke/${projectId}`); + await page.goto(`https://localhost:1443/investointihanke/${projectId}`); await expect(page.getByText('Hanketta ei löytynyt')).toBeVisible(); await page.goto('https://localhost:1443/hankkeet'); } @@ -118,7 +118,7 @@ test.describe('Projects', () => { // Click on the new project button to go back to the project page await page.locator(`text=${project.projectName}`).click(); - await expect(page).toHaveURL(`https://localhost:1443/hanke/${project.id}`); + await expect(page).toHaveURL(`https://localhost:1443/investointihanke/${project.id}`); // Check that all fields still have the same values await expect(page.locator('input[name="projectName"]')).toHaveValue(project.projectName); diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index aedcea0f..931d696b 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -39,19 +39,19 @@ const router = createBrowserRouter( }> } /> } /> - } /> - } /> + } /> + } /> } /> - } /> + } /> } /> } /> } /> diff --git a/frontend/src/views/Project/InvestmentProject.tsx b/frontend/src/views/Project/InvestmentProject.tsx index e6078bd0..b3cc668b 100644 --- a/frontend/src/views/Project/InvestmentProject.tsx +++ b/frontend/src/views/Project/InvestmentProject.tsx @@ -39,25 +39,25 @@ function projectTabs(projectId: string) { return [ { tabView: 'default', - url: `/hanke/${projectId}`, + url: `/investointihanke/${projectId}`, label: 'project.mapTabLabel', icon: , }, { tabView: 'talous', - url: `/hanke/${projectId}/talous`, + url: `/investointihanke/${projectId}/talous`, label: 'project.financeTabLabel', icon: , }, { tabView: 'kohteet', - url: `/hanke/${projectId}/kohteet`, + url: `/investointihanke/${projectId}/kohteet`, label: 'project.projectObjectsTabLabel', icon: , }, { tabView: 'sidoshankkeet', - url: `/hanke/${projectId}/sidoshankkeet`, + url: `/investointihanke/${projectId}/sidoshankkeet`, label: 'project.relatedProjectsTabLabel', icon: , }, diff --git a/frontend/src/views/Project/InvestmentProjectForm.tsx b/frontend/src/views/Project/InvestmentProjectForm.tsx index d36f9d08..85566c76 100644 --- a/frontend/src/views/Project/InvestmentProjectForm.tsx +++ b/frontend/src/views/Project/InvestmentProjectForm.tsx @@ -105,7 +105,7 @@ export function InvestmentProjectForm(props: InvestmentProjectFormProps) { onSuccess: (data) => { // Navigate to new url if we are creating a new project if (!props.project && data.id) { - navigate(`/hanke/${data.id}`); + navigate(`/investointihanke/${data.id}`); } else { queryClient.invalidateQueries({ queryKey: [['project', 'get'], { input: { id: data.id } }], diff --git a/frontend/src/views/Project/Projects.tsx b/frontend/src/views/Project/Projects.tsx index da7005e2..8c278155 100644 --- a/frontend/src/views/Project/Projects.tsx +++ b/frontend/src/views/Project/Projects.tsx @@ -67,7 +67,7 @@ function Toolbar() { horizontal: 'right', }} > - + @@ -99,7 +99,7 @@ const projectCardStyle = css` const projectTypeRootUrl = { detailplanProject: '/asemakaavahanke', - investmentProject: '/hanke', + investmentProject: '/investointihanke', }; function ProjectCard({ result }: { result: DbProject }) { diff --git a/frontend/src/views/Project/RelationsContainer.tsx b/frontend/src/views/Project/RelationsContainer.tsx index c67002a6..47fad8bd 100644 --- a/frontend/src/views/Project/RelationsContainer.tsx +++ b/frontend/src/views/Project/RelationsContainer.tsx @@ -150,7 +150,7 @@ export function RelationsContainer({ objectOfRelation.projectName )} > - + {objectOfRelation.projectName}