Skip to content

Commit

Permalink
Merge branch 'main' into reorder-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt authored Sep 30, 2024
2 parents e7fdfe5 + 32484bf commit 06c53fd
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 30 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
### Changed

- Updated the style of bulk edit form.
- Hide the `help` button in the navigation bar in read-only mode.
- Hide the `original_name` field in the borehole detail view in read-only mode.

### Fixed

- _view-sync_ did not clean up unpublished boreholes.

## v2.1.870 - 2024-09-27

Expand All @@ -15,7 +21,7 @@
- Language dropdown in the header.
- Added health check endpoint for the .NET API.
- Added possibility to run the boreholes web application in read-only mode.
- New view-sync Docker image for syncing free/published boreholes from a source to a target database.
- New _view-sync_ Docker image for syncing free/published boreholes from a source to a target database.

### Changed

Expand Down
6 changes: 3 additions & 3 deletions src/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 21 additions & 17 deletions src/client/src/pages/detail/form/location/nameSegment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { Form, Input } from "semantic-ui-react";
import { Borehole, User } from "../../../../api-lib/ReduxStateInterfaces.ts";
import { useAuth } from "../../../../auth/useBdmsAuth.tsx";
import { FormSegmentBox } from "../../../../components/styledComponents";

interface NameSegmentProps {
Expand All @@ -13,6 +14,7 @@ interface NameSegmentProps {
const NameSegment = ({ borehole, updateChange, user }: NameSegmentProps) => {
const [alternateName, setAlternateName] = useState("");
const { t } = useTranslation();
const auth = useAuth();

const isEditable =
borehole?.data.role === "EDIT" && borehole?.data.lock !== null && borehole?.data.lock?.id === user?.data.id;
Expand All @@ -25,23 +27,25 @@ const NameSegment = ({ borehole, updateChange, user }: NameSegmentProps) => {
<FormSegmentBox>
<Form autoComplete="off" error>
<Form.Group widths="equal">
<Form.Field error={borehole.data.extended.original_name === ""} required>
<label>{t("original_name")}</label>
<Input
data-cy="original-name"
autoCapitalize="off"
autoComplete="off"
autoCorrect="off"
onChange={e => {
setAlternateName(e.target.value);
updateChange("extended.original_name", e.target.value);
updateChange("custom.alternate_name", e.target.value);
}}
spellCheck="false"
value={borehole.data.extended.original_name ?? ""}
readOnly={!isEditable}
/>
</Form.Field>
{!auth.anonymousModeEnabled && (
<Form.Field error={borehole.data.extended.original_name === ""} required>
<label>{t("original_name")}</label>
<Input
data-cy="original-name"
autoCapitalize="off"
autoComplete="off"
autoCorrect="off"
onChange={e => {
setAlternateName(e.target.value);
updateChange("extended.original_name", e.target.value);
updateChange("custom.alternate_name", e.target.value);
}}
spellCheck="false"
value={borehole.data.extended.original_name ?? ""}
readOnly={!isEditable}
/>
</Form.Field>
)}
<Form.Field>
<label>{t("project_name")}</label>
<Input
Expand Down
14 changes: 8 additions & 6 deletions src/client/src/pages/overview/layout/mainSideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,14 @@ const MainSideNav = ({
label={t("header_settings")}
onClick={() => history.push(`/setting`)}
/>
<NavButton
data-cy="help-button"
icon={<HelpIcon />}
label={t("header_help")}
onClick={() => window.open(`/help`)}
/>
{!auth.anonymousModeEnabled && (
<NavButton
data-cy="help-button"
icon={<HelpIcon />}
label={t("header_help")}
onClick={() => window.open(`/help`)}
/>
)}
</Stack>
<ImportModal
creating={creating}
Expand Down
8 changes: 5 additions & 3 deletions src/view-sync/db-init/04_delete_from_borehole.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ DELETE FROM bdms.files WHERE true;

-- Purge non-free and non-published boreholes
DELETE FROM bdms.borehole WHERE id_bho NOT IN (
SELECT DISTINCT id_bho FROM bdms.borehole
SELECT id_bho FROM bdms.borehole
JOIN bdms.codelist ON codelist.id_cli = borehole.restriction_id_cli
JOIN bdms.workflow ON workflow.id_bho_fk = borehole.id_bho
JOIN bdms.roles ON roles.id_rol = workflow.id_rol_fk
WHERE codelist.schema_cli = 'restriction'
WHERE workflow.id_wkf IN (SELECT MAX(id_wkf) FROM bdms.workflow GROUP BY id_bho_fk)
AND finished_wkf IS NOT NULL -- get latest publication status
AND roles.name_rol = 'PUBLIC' -- publication status: published
AND codelist.schema_cli = 'restriction'
AND codelist.code_cli = 'f' -- restriction: free
AND roles.name_rol = 'PUBLIC' -- publication status: published
);

-- Purge workflow data
Expand Down

0 comments on commit 06c53fd

Please sign in to comment.