diff --git a/CHANGELOG.md b/CHANGELOG.md index 3206a2dae..eb5ac3f47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,8 @@ - The responsive design of the coordinate segment in the detail view was broken. - When clicking the select all checkbox in the borehole table, only the boreholes on the current page were selected. - Some filter chips were missing translations or where not displayed correctly. -- Filtering striae for "not specified" returned wrong results. +- Filtering striae for `not specified` returned wrong results. +- Filtering by `borehole status` did not work. ## v2.1.870 - 2024-09-27 diff --git a/src/client/cypress/e2e/filters/filter.cy.js b/src/client/cypress/e2e/filters/filter.cy.js index d8d4e8cd0..ac679ab18 100644 --- a/src/client/cypress/e2e/filters/filter.cy.js +++ b/src/client/cypress/e2e/filters/filter.cy.js @@ -1,5 +1,12 @@ import { showTableAndWaitForData, verifyPaginationText } from "../helpers/dataGridHelpers"; -import { createBorehole, createLithologyLayer, createStratigraphy, loginAsAdmin } from "../helpers/testHelpers.js"; +import { + createBorehole, + createLithologyLayer, + createStratigraphy, + loginAsAdmin, + returnToOverview, + startBoreholeEditing, +} from "../helpers/testHelpers.js"; describe("Search filter tests", () => { it("has search filters", () => { @@ -220,6 +227,24 @@ describe("Search filter tests", () => { verifyPaginationText("1–100 of 1630"); }); + it("filters boreholes by status", () => { + createBorehole({ "extended.original_name": "Filter by status" }).as("borehole_id"); + cy.get("@borehole_id").then(id => { + loginAsAdmin(`/${id}/status`); + startBoreholeEditing(); + cy.get('[data-cy="workflow_submit"]').click(); + cy.get('[data-cy="workflow_dialog_submit"]').click(); + returnToOverview(); + cy.get('[data-cy="show-filter-button"]').click(); + cy.contains("Status").click(); + cy.get('[data-cy="boreholes-number-preview"]').should("have.text", "1'627"); + cy.get('[data-cy="statuseditor"]').click(); + cy.get('[data-cy="boreholes-number-preview"]').should("have.text", "1'626"); + cy.get('[data-cy="statuscontroller"]').click(); + cy.get('[data-cy="boreholes-number-preview"]').should("have.text", "1"); + }); + }); + it("filters boreholes by color and uscs3", () => { loginAsAdmin(); cy.get('[data-cy="show-filter-button"]').click(); diff --git a/src/client/src/pages/detail/detailHeader.tsx b/src/client/src/pages/detail/detailHeader.tsx index ed0ba3d78..ea654d3ca 100644 --- a/src/client/src/pages/detail/detailHeader.tsx +++ b/src/client/src/pages/detail/detailHeader.tsx @@ -123,7 +123,7 @@ const DetailHeader = ({ {borehole?.alternateName} {!auth.anonymousModeEnabled && ( - {t("lastUpdated")}: {t("by")} {borehole?.updatedBy.name}{" "} + {t("lastUpdated")}: {t("by")} {borehole?.updatedBy?.name} )} diff --git a/src/client/src/pages/overview/sidePanelContent/filter/statusFilter.jsx b/src/client/src/pages/overview/sidePanelContent/filter/statusFilter.jsx index b126f03e6..5e91d8dee 100644 --- a/src/client/src/pages/overview/sidePanelContent/filter/statusFilter.jsx +++ b/src/client/src/pages/overview/sidePanelContent/filter/statusFilter.jsx @@ -37,14 +37,20 @@ class StatusFilter extends Component { {capitalizeFirstLetter(t("alls"))} - {["statuseditor", "statuscontroller", "statusvalidator", "statuspublisher"].map(role => ( - + {[ + { name: "EDIT", translationKey: "statuseditor" }, + { name: "CONTROL", translationKey: "statuscontroller" }, + { name: "VALID", translationKey: "statusvalidator" }, + { name: "PUBLIC", translationKey: "statuspublic" }, + ].map(role => ( + { - this.props.setFilter("role", role.replace("status", "").toUpperCase()); + this.props.setFilter("role", role.name); }} /> - {capitalizeFirstLetter(t(role))} + {capitalizeFirstLetter(t(role.translationKey))} ))}