Skip to content

Commit

Permalink
Fix stratigraphy add button (#1460)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt authored Aug 21, 2024
2 parents 19e907f + 54d0f4e commit ae1db7c
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 39 deletions.
3 changes: 2 additions & 1 deletion src/client/cypress/e2e/editor/layerform.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { newEditableBorehole, returnToOverview, stopBoreholeEditing } from "../helpers/testHelpers";
import { addItem } from "../helpers/buttonHelpers";

describe("Tests for the layer form.", () => {
it("Creates a layer and fills all dropdowns with multiple selection.", () => {
Expand All @@ -8,7 +9,7 @@ describe("Tests for the layer form.", () => {
// navigate to stratigraphy
cy.get('[data-cy="stratigraphy-menu-item"]').click();
cy.get('[data-cy="lithology-menu-item"]').click();
cy.get('[data-cy="add-stratigraphy-button"]').click();
addItem("addStratigraphy");
cy.wait("@stratigraphy_POST");
cy.get('[data-cy="add-layer-icon"]').click();
cy.wait("@layer");
Expand Down
4 changes: 2 additions & 2 deletions src/client/cypress/e2e/editor/lithologicalDescription.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { newEditableBorehole, returnToOverview, stopBoreholeEditing } from "../helpers/testHelpers";
import { deleteItem } from "../helpers/buttonHelpers";
import { addItem, deleteItem } from "../helpers/buttonHelpers";

describe("Tests for the lithological description column.", () => {
it("Creates, updates and deletes lithological descriptions ", () => {
Expand All @@ -9,7 +9,7 @@ describe("Tests for the lithological description column.", () => {
// navigate to stratigraphy
cy.get('[data-cy="stratigraphy-menu-item"]').click();
cy.get('[data-cy="lithology-menu-item"]').click();
cy.get('[data-cy="add-stratigraphy-button"]').click();
addItem("addStratigraphy");
cy.wait("@stratigraphy_POST");

// add three layers
Expand Down
1 change: 1 addition & 0 deletions src/client/cypress/e2e/filters/polygonFilter.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function drawPolygon() {
canvas.trigger("pointerdown", { x: 550, y: 810 }).trigger("pointerup", { x: 550, y: 810 });
canvas.trigger("pointerdown", { x: 640, y: 810 }).trigger("pointerup", { x: 640, y: 810 });
canvas.trigger("pointerdown", { x: 450, y: 300 }).trigger("pointerup", { x: 450, y: 300 });
cy.wait(2000);
}

function assertIsFilteredByPolygon() {
Expand Down
1 change: 1 addition & 0 deletions src/client/public/locale/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"addInstrument": "Instrument hinzufügen",
"addSection": "Sektion hinzufügen",
"addSectionElement": "Aufbohrung/Überkernung hinzufügen",
"addStratigraphy": "Stratigraphie hinzufügen",
"addWaterIngress": "Wasserzutritt hinzufügen",
"admin": "Administrator",
"afterdate": "von Datum",
Expand Down
1 change: 1 addition & 0 deletions src/client/public/locale/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"addInstrument": "Add instrument",
"addSection": "Add section",
"addSectionElement": "Add reaming/overcoring",
"addStratigraphy": "Add stratigraphy",
"addWaterIngress": "Add water ingress",
"admin": "Administrator",
"afterdate": "after this date",
Expand Down
1 change: 1 addition & 0 deletions src/client/public/locale/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"addInstrument": "Ajouter un instrument",
"addSection": "Ajouter une section",
"addSectionElement": "Ajouter alésage/surcarottage",
"addStratigraphy": "Ajouter une stratigraphie",
"addWaterIngress": "Ajouter une venue d'eau",
"admin": "Administrateur",
"afterdate": "À partir de cette date",
Expand Down
1 change: 1 addition & 0 deletions src/client/public/locale/it/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"addInstrument": "Aggiungere uno strumento",
"addSection": "Aggiungere una sezione",
"addSectionElement": "Aggiungere alesatura/tecnica di overcoring",
"addStratigraphy": "Aggiungere una stratigrafia",
"addWaterIngress": "Aggiungere un ingresso d'acqua",
"admin": "Amministratore",
"afterdate": "a partire da questa data",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { useCallback, useEffect, useState } from "react";
import * as Styled from "./styles.js";
import { Button } from "semantic-ui-react";
import { createNewStratigraphy } from "./api";
import { fetchStratigraphyByBoreholeId } from "../../../../../../api/fetchApiV2.js";
import ProfileHeaderList from "./profileHeaderList";
import { useTranslation } from "react-i18next";
import { AddButton } from "../../../../../../components/buttons/buttons";
import { Box, Stack } from "@mui/material";

const ProfileHeader = props => {
const { boreholeID, isEditable, reloadHeader, selectedStratigraphy, setSelectedStratigraphy, setIsLoadingData } =
props;
const { t } = useTranslation();
const [profiles, setProfiles] = useState([]);

const setStratigraphy = useCallback(
Expand Down Expand Up @@ -53,26 +51,18 @@ const ProfileHeader = props => {
};

return (
<Styled.Container>
<Styled.ButtonContainer>
{isEditable && (
<Button
data-cy="add-stratigraphy-button"
content={t("stratigraphy")}
icon="add"
onClick={createStratigraphy}
secondary
size="small"
/>
)}

<ProfileHeaderList
profiles={profiles}
selectedStratigraphy={selectedStratigraphy}
setSelectedStratigraphy={setStratigraphy}
/>
</Styled.ButtonContainer>
</Styled.Container>
<Stack direction="row">
<ProfileHeaderList
profiles={profiles}
selectedStratigraphy={selectedStratigraphy}
setSelectedStratigraphy={setStratigraphy}
/>
{isEditable && (
<Box sx={{ marginLeft: "auto" }}>
<AddButton label={"addStratigraphy"} onClick={createStratigraphy} />
</Box>
)}
</Stack>
);
};

Expand Down

This file was deleted.

0 comments on commit ae1db7c

Please sign in to comment.