Skip to content

Commit

Permalink
Merge branch 'main' into fix-lock-error-in-viewer-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt authored Nov 21, 2024
2 parents 3f37246 + 64e6d4a commit 77e9f6d
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 43 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- No scrollbar was displayed in the side drawer when many additional layers were added.
- There was no appropriate error message when the drawn box did not contain extractable coordinates.
- There was an internal error alert when navigating back from the borehole detail to the borehole table in anonymous mode.
- 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.

## v2.1.870 - 2024-09-27
Expand Down
6 changes: 3 additions & 3 deletions src/client/src/components/map/pointComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class PointComponent extends React.Component {
this.changefeature = this.updatePointAndGetAddress.bind(this);
this.detailMapStyleFunction = detailMapStyleFunction.bind(this);
this.getAddress = this.getAddress.bind(this);
this.setStateBound = this.setState.bind(this);
this.srs = "EPSG:2056";

_.forEach(projections, function (proj, srs) {
Expand Down Expand Up @@ -309,11 +308,11 @@ class PointComponent extends React.Component {
style={{
padding: "0px",
flex: "1 1 100%",
height: 525,
height: 380,
}}
/>
<MapControls onZoomIn={this.onZoomIn} onZoomOut={this.onZoomOut} onFitToExtent={this.onFitToExtent} />
<Box sx={{ position: "absolute", right: 0, top: 500 }}>
<Box sx={{ position: "absolute", right: 0, top: 355 }}>
<BasemapSelector marginBottom="0px" />
</Box>
<Box
Expand All @@ -329,6 +328,7 @@ class PointComponent extends React.Component {
<Box
sx={{
flex: "1 1 100%",
width: "300px",
}}>
<Label color="black">
<Icon name="map marker" />
Expand Down
1 change: 1 addition & 0 deletions src/client/src/pages/detail/detailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export const DetailPage: FC = () => {
onBoreholeFormSubmit={onBoreholeFormSubmit}
handleDirtyChange={handleDirtyChange}
borehole={borehole}
panelOpen={panelOpen}
/>
</MainContentBox>
{editingEnabled && panelOpen && <LabelingPanel boreholeId={Number(id)} />}
Expand Down
3 changes: 3 additions & 0 deletions src/client/src/pages/detail/detailPageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ interface DetailPageContentProps {
onBoreholeFormSubmit: (data: BoreholeFormInputs) => void;
handleDirtyChange: (isDirty: boolean) => void;
borehole: BoreholeV2;
panelOpen: boolean;
}
type DetailPageParams = {
id: string;
Expand All @@ -45,6 +46,7 @@ export const DetailPageContent = ({
onBoreholeFormSubmit,
handleDirtyChange,
borehole,
panelOpen,
}: DetailPageContentProps) => {
const { t } = useTranslation();
const { showAlert } = useContext(AlertContext);
Expand Down Expand Up @@ -95,6 +97,7 @@ export const DetailPageContent = ({
onSubmit={onLocationFormSubmit}
borehole={borehole}
onDirtyChange={handleDirtyChange}
labelingPanelOpen={panelOpen}
/>
)}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback, useContext, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { Card, CardContent, CardHeader } from "@mui/material";
import { Box, Card, CardContent, CardHeader } from "@mui/material";
import { Check, X } from "lucide-react";
import { LabelingButton } from "../../../../components/buttons/labelingButton";
import { FormContainer, FormCoordinate, FormDomainSelect, FormSelect } from "../../../../components/form/form";
Expand Down Expand Up @@ -261,12 +261,12 @@ const CoordinatesSegment: React.FC<CoordinatesSegmentProps> = ({
sx={{ p: 4, pb: 3 }}
titleTypographyProps={{ variant: "h5" }}
action={
editingEnabled && (
<Box sx={{ visibility: editingEnabled ? "visible" : "hidden" }}>
<LabelingButton
className={extractionObject?.type === "coordinates" ? "Mui-active" : ""}
onClick={() => startLabeling()}
/>
)
</Box>
}
/>
<CardContent sx={{ pt: 4, px: 3 }}>
Expand Down
20 changes: 9 additions & 11 deletions src/client/src/pages/detail/form/location/identifierSegment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ const IdentifierSegment = ({ borehole, editingEnabled, formMethods }: Identifier
return (
<Card>
<FormSegmentBox>
<Grid container spacing={2}>
<Stack sx={{ visibility: editingEnabled ? "visible" : "hidden" }} alignItems="flex-end">
<AddButton
label="addIdentifier"
onClick={() => {
append({ boreholeId: borehole.id, codelistId: null, value: "" });
}}
/>
</Stack>
<Grid container spacing={2} sx={{ mt: -6 }}>
<Grid item xs={6}>
<Typography variant="h6"> {t("borehole_identifier")}</Typography>
</Grid>
Expand Down Expand Up @@ -79,16 +87,6 @@ const IdentifierSegment = ({ borehole, editingEnabled, formMethods }: Identifier
</Grid>
</Grid>
))}
<Stack sx={{ mt: 2 }} alignItems="flex-end">
{editingEnabled && (
<AddButton
label="addIdentifier"
onClick={() => {
append({ boreholeId: borehole.id, codelistId: null, value: "" });
}}
/>
)}
</Stack>
</FormSegmentBox>
</Card>
);
Expand Down
3 changes: 2 additions & 1 deletion src/client/src/pages/detail/form/location/locationPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import NameSegment from "./nameSegment.tsx";
import RestrictionSegment from "./restrictionSegment.tsx";

export const LocationPanel = forwardRef(
({ editingEnabled, onSubmit, onDirtyChange, borehole }: LocationPanelProps, ref) => {
({ editingEnabled, onSubmit, onDirtyChange, borehole, labelingPanelOpen }: LocationPanelProps, ref) => {
const [resetKey, setResetKey] = useState(0);
const formMethods = useForm<LocationFormInputs>({
mode: "onChange",
Expand Down Expand Up @@ -73,6 +73,7 @@ export const LocationPanel = forwardRef(
borehole={borehole}
editingEnabled={editingEnabled}
formMethods={formMethods}
labelingPanelOpen={labelingPanelOpen}
key={resetKey}></LocationSegment>
</Stack>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface LocationBaseProps {
export interface LocationPanelProps extends LocationBaseProps {
onSubmit: (data: LocationFormInputs) => void;
onDirtyChange: (isDirty: boolean) => void;
labelingPanelOpen: boolean;
ref: RefObject<{ submit: () => void; reset: () => void }>;
}

Expand Down
53 changes: 29 additions & 24 deletions src/client/src/pages/detail/form/location/locationSegment.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback } from "react";
import { UseFormReturn } from "react-hook-form";
import { Card, Stack } from "@mui/material";
import { Card, Grid, Stack } from "@mui/material";
import { fetchApiV2 } from "../../../../api/fetchApiV2";
import PointComponent from "../../../../components/map/pointComponent";
import { FormSegmentBox } from "../../../../components/styledComponents";
Expand All @@ -13,9 +13,10 @@ import { LocationBaseProps, LocationFormInputs } from "./locationPanelInterfaces

interface LocationSegmentProps extends LocationBaseProps {
formMethods: UseFormReturn<LocationFormInputs>;
labelingPanelOpen: boolean;
}

const LocationSegment = ({ borehole, editingEnabled, formMethods }: LocationSegmentProps) => {
const LocationSegment = ({ borehole, editingEnabled, labelingPanelOpen, formMethods }: LocationSegmentProps) => {
const transformCoordinates = useCallback(async (referenceSystem: string, x: number, y: number) => {
let apiUrl;
if (referenceSystem === referenceSystems.LV95.name) {
Expand Down Expand Up @@ -103,8 +104,8 @@ const LocationSegment = ({ borehole, editingEnabled, formMethods }: LocationSegm
return (
<Stack direction="column" gap={3}>
<Card sx={{ py: 1, px: 1 }}>
<Stack direction="row" gap={2} sx={{ flexWrap: "wrap" }}>
<Stack gap={2} sx={{ flexGrow: 1, minWidth: 600 }}>
<Grid container spacing={2}>
<Grid xs={12} md={12} lg={labelingPanelOpen ? 12 : 6}>
<CoordinatesSegment
borehole={borehole}
editingEnabled={editingEnabled}
Expand All @@ -113,27 +114,31 @@ const LocationSegment = ({ borehole, editingEnabled, formMethods }: LocationSegm
handleCoordinateTransformation={handleCoordinateTransformation}
setValuesForCountryCantonMunicipality={setValuesForCountryCantonMunicipality}
/>
</Grid>
<Grid xs={12} md={12} lg={labelingPanelOpen ? 12 : 6}>
<FormSegmentBox>
<PointComponent
applyChange={(
x: string,
y: string,
height: number,
country: string,
canton: string,
municipality: string,
) => {
setValuesForNewMapPoint(x, y, height, country, canton, municipality);
}}
id={borehole.id}
isEditable={editingEnabled}
x={borehole.locationX ? Number(borehole.locationX) : null}
y={borehole.locationY ? Number(borehole.locationY) : null}
/>
</FormSegmentBox>
</Grid>
<Grid xs={12}>
<ElevationSegment borehole={borehole} editingEnabled={editingEnabled} formMethods={formMethods} />
</Stack>
<FormSegmentBox sx={{ flexGrow: 1 }}>
<PointComponent
applyChange={(
x: string,
y: string,
height: number,
country: string,
canton: string,
municipality: string,
) => {
setValuesForNewMapPoint(x, y, height, country, canton, municipality);
}}
id={borehole.id}
isEditable={editingEnabled}
x={borehole.locationX ? Number(borehole.locationX) : null}
y={borehole.locationY ? Number(borehole.locationY) : null}
/>
</FormSegmentBox>
</Stack>
</Grid>
</Grid>
</Card>
<CantonMunicipalitySegment
country={borehole.country}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export const BoreholeTable: FC<BoreholeTableProps> = ({

// Add workgroup column if not in anonymous mode
!auth.anonymousModeEnabled &&
columns.splice(1, 0, {
columns.splice(2, 0, {
field: "workgroup",
valueGetter: (value: { name: string }) => {
return value.name;
Expand Down

0 comments on commit 77e9f6d

Please sign in to comment.