Skip to content

Commit 065841d

Browse files
Fix status filter (#1707)
2 parents e514769 + fef9e75 commit 065841d

File tree

4 files changed

+40
-8
lines changed

4 files changed

+40
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
- The responsive design of the coordinate segment in the detail view was broken.
3333
- When clicking the select all checkbox in the borehole table, only the boreholes on the current page were selected.
3434
- Some filter chips were missing translations or where not displayed correctly.
35-
- Filtering striae for "not specified" returned wrong results.
35+
- Filtering striae for `not specified` returned wrong results.
36+
- Filtering by `borehole status` did not work.
3637

3738
## v2.1.870 - 2024-09-27
3839

src/client/cypress/e2e/filters/filter.cy.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { showTableAndWaitForData, verifyPaginationText } from "../helpers/dataGridHelpers";
2-
import { createBorehole, createLithologyLayer, createStratigraphy, loginAsAdmin } from "../helpers/testHelpers.js";
2+
import {
3+
createBorehole,
4+
createLithologyLayer,
5+
createStratigraphy,
6+
loginAsAdmin,
7+
returnToOverview,
8+
startBoreholeEditing,
9+
} from "../helpers/testHelpers.js";
310

411
describe("Search filter tests", () => {
512
it("has search filters", () => {
@@ -220,6 +227,24 @@ describe("Search filter tests", () => {
220227
verifyPaginationText("1–100 of 1630");
221228
});
222229

230+
it("filters boreholes by status", () => {
231+
createBorehole({ "extended.original_name": "Filter by status" }).as("borehole_id");
232+
cy.get("@borehole_id").then(id => {
233+
loginAsAdmin(`/${id}/status`);
234+
startBoreholeEditing();
235+
cy.get('[data-cy="workflow_submit"]').click();
236+
cy.get('[data-cy="workflow_dialog_submit"]').click();
237+
returnToOverview();
238+
cy.get('[data-cy="show-filter-button"]').click();
239+
cy.contains("Status").click();
240+
cy.get('[data-cy="boreholes-number-preview"]').should("have.text", "1'627");
241+
cy.get('[data-cy="statuseditor"]').click();
242+
cy.get('[data-cy="boreholes-number-preview"]').should("have.text", "1'626");
243+
cy.get('[data-cy="statuscontroller"]').click();
244+
cy.get('[data-cy="boreholes-number-preview"]').should("have.text", "1");
245+
});
246+
});
247+
223248
it("filters boreholes by color and uscs3", () => {
224249
loginAsAdmin();
225250
cy.get('[data-cy="show-filter-button"]').click();

src/client/src/pages/detail/detailHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const DetailHeader = ({
123123
<Typography variant="h2"> {borehole?.alternateName}</Typography>
124124
{!auth.anonymousModeEnabled && (
125125
<Typography variant={"subtitle2"}>
126-
{t("lastUpdated")}: <DateText date={borehole?.updated} /> {t("by")} {borehole?.updatedBy.name}{" "}
126+
{t("lastUpdated")}: <DateText date={borehole?.updated} /> {t("by")} {borehole?.updatedBy?.name}
127127
</Typography>
128128
)}
129129
</Stack>

src/client/src/pages/overview/sidePanelContent/filter/statusFilter.jsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,28 @@ class StatusFilter extends Component {
3737
{capitalizeFirstLetter(t("alls"))}
3838
</span>
3939
</Form.Field>
40-
{["statuseditor", "statuscontroller", "statusvalidator", "statuspublisher"].map(role => (
41-
<Form.Field key={"sec-" + role}>
40+
{[
41+
{ name: "EDIT", translationKey: "statuseditor" },
42+
{ name: "CONTROL", translationKey: "statuscontroller" },
43+
{ name: "VALID", translationKey: "statusvalidator" },
44+
{ name: "PUBLIC", translationKey: "statuspublic" },
45+
].map(role => (
46+
<Form.Field key={"sec-" + role.translationKey}>
4247
<Radio
43-
checked={search.filter.role === role.replace("status", "").toUpperCase()}
48+
checked={search.filter.role === role.name}
4449
label={""}
50+
data-cy={role.translationKey}
4551
name="radioGroup"
4652
onChange={() => {
47-
this.props.setFilter("role", role.replace("status", "").toUpperCase());
53+
this.props.setFilter("role", role.name);
4854
}}
4955
/>
5056
<span
5157
style={{
5258
color: "black",
5359
fontSize: "1.1em",
5460
}}>
55-
{capitalizeFirstLetter(t(role))}
61+
{capitalizeFirstLetter(t(role.translationKey))}
5662
</span>
5763
</Form.Field>
5864
))}

0 commit comments

Comments
 (0)