Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Commit c180740

Browse files
authored
Merge branch 'master' into feature/horenso/758-conflict-on-new-map-with-taken-name
2 parents 8625be0 + 4bdb7ae commit c180740

12 files changed

Lines changed: 238 additions & 37 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ We will help you, but we cannot accept PRs that do not fulfill the basics.
2323

2424
<!--
2525
For documentation fixes, spell checking, and similar none of these points below need to be checked.
26-
Otherwise please check these points when getting a PR done:
26+
Otherwise please check below points when getting a PR done.
27+
If nothing is to be done, please check them, too.
2728
-->
2829

2930
- [ ] I fully described what my PR does in the documentation
@@ -58,9 +59,11 @@ Also the checklist above can be used.
5859
But also the PR creator should check these points when getting a PR done:
5960
-->
6061

61-
- [ ] I've tested the code
62-
- [ ] I've read through the whole code
63-
- [ ] I've read through the whole documentation
62+
- [ ] I've tested the code via issue description
63+
- [ ] I've tested the code via requirements
64+
- [ ] I've tested the code with concurrency (several browsers on the same map)
65+
- [ ] I've read through the code
66+
- [ ] I've read through the documentation
6467
- [ ] I've checked conformity to guidelines
6568
- [ ] I've checked conformity to requirements
66-
- [ ] I've checked that the requirements are tested
69+
- [ ] I've checked that the requirements are automatically tested

ci/Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def node_info() {
99

1010
// Function duplicated in `Jenkinsfile.release` without the command parameter
1111
def wait_for_db(String command) {
12-
retry(6) {
12+
retry(10) {
1313
sleep(time: 5, unit: 'SECONDS')
1414
sh "${command}"
1515
}

doc/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
FROM rust:1.67.1-slim-bookworm AS builder
44

55
ENV MDBOOK_VERSION=0.4.23 \
6-
MDBOOK_MERMAID_VERSION=0.12.6
6+
MDBOOK_MERMAID_VERSION=0.12.6 \
7+
CARGO_NET_RETRY=10
78

89
RUN apt-get update && \
910
apt-get install -y --no-install-recommends \

doc/changelog.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ Syntax: `- short text describing the change _(Your Name)_`
88

99
## UNRELEASED
1010

11-
- _()_
12-
- Return 409 Conflict when creating a map with taken name _(Jannis Adamek)_
13-
- _()_
14-
- _()_
11+
- Added Meeting Agenda&Notes for 15.04.2024 9:00 _(Markus Raab, Daniel)_
1512
- _()_
1613
- _()_
1714
- _()_
1815
- _()_
1916
- _()_
2017
- _()_
2118
- _()_
19+
- Add tests for hooks in frontend/layers _(Lukas Anton Lakits)_
2220
- _()_
21+
- Add warn signs to sizes for multi-selected plant-areas _(Lukas Anton Lakits)_
2322
- _()_
23+
- Return 409 Conflict when creating a map with taken name _(Jannis Adamek)_
2424
- _()_
2525
- _()_
2626
- _()_
@@ -37,6 +37,7 @@ Syntax: `- short text describing the change _(Your Name)_`
3737
- _()_
3838
- _()_
3939
- _()_
40+
- Increase cargo net.retry configuration to handle random network errors during CI. _(Christoph Schreiner)_
4041
- _()_
4142
- _()_
4243
- _()_

doc/meetings/2024_04_15.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Meeting 15.04.2024
2+
3+
## Attendees
4+
5+
- Markus
6+
- Yvonne
7+
- Christoph
8+
- Moritz
9+
- Lukas
10+
- Daniel
11+
- Jannis
12+
13+
Not here:
14+
15+
- Filip
16+
17+
Sick:
18+
19+
- Andrei (Scrum Master)
20+
21+
## Buddies
22+
23+
- Daniel & Andrei
24+
- Moritz & Christoph
25+
- Jannis & Lukas
26+
27+
## Agenda
28+
29+
- 09:00 start
30+
- protocol: Daniel
31+
- release v0.4.0 done
32+
- GitLab Tuwien migration
33+
- https://github.com/supabase/index_advisor
34+
- scrum with Andrei:
35+
- issues
36+
- reviews -> later
37+
- (manual) e2e tests -> later Christoph+Filip
38+
- create issues:
39+
- rework notification system (Jannis+Andrei)
40+
- Jannis: raw SQL
41+
- [sprint plan](https://project.permaplant.net)
42+
43+
## Tasks for Everyone
44+
45+
To be done until **Friday 19.04.2024**:
46+
47+
- create or update TISS.txt in submissions repo
48+
- buddy talk: scoping with mistakes
49+
- approve [meeting PR](https://pull.permaplant.net/1284/files)
50+
- request and approve for requested reviews [requested reviews](https://pulls.permaplant.net/?q=is%3Aopen+user-review-requested%3A%40me)
51+
- do/update [sprint plan](https://project.permaplant.net)
52+
53+
## Individual Tasks
54+
55+
To be done until **Friday 19.04.2024**:
56+
57+
- Daniel: finish timeline, drawing
58+
- Filip: GitLab migration
59+
- Jannis: creation times, create issues: (1) tutorial for layer creation (creation/update metadata + (2) what interface should any layer have), (3) notification profilen (4) drawing layer db design, (5) unify layer design
60+
- Christoph: SQL heatmap benchmark, hierarchy PR
61+
- Lukas: documenting how to create+test layers, create issues: investigate performance (profile)
62+
- Moritz: heatmap rebase, meeting refactoring, issues restructure, write if all stale branches can be removed
63+
- Andrei: create issues
64+
65+
## Meeting Notes
66+
67+
- great job with release, please rebase your PRs
68+
- christoph asked if properties should be able to get overwritten in child ranks of plants -> will be discussed in separate meeting. Christoph and Lukas should attend.
69+
- automatic hierarchy based on unique name
70+
- usually no new properties or plants (apart from adding to CSV)
71+
- drawing layer PR will be created so that handling can be tested
72+
- groupfolder for nextcloud images has to be implemented, so that images on one map can be shared between different users
73+
- we shouldn't have to many different tasks in progress but always enough issues created to always have enough for next sprints

doc/usecases/assigned/map_deletion.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
- **Precondition:**
1414
The user has opened the app and is on the map management screen.
1515
- **Main success scenario:**
16-
- The user delete a map by selecting it from the list of maps and confirming the deletion.
17-
- If the user decides to undo the deletion within one month, the map is restored.
16+
- The user deletes a map by selecting it from the list of maps.
17+
- The user confirms the deletion with the information:
18+
- a warning that the whole map including all layers will be deleted, but
19+
- it is possible to contact the PermaplanT service team within one month to restore the map.
20+
- Within one month, the PermaplanT service team can restore the map via provided SQL commands.
1821
- **Error scenario:**
1922
There is an error in the map deletion process and the map is not deleted as intended.
2023
In this case, the app displays an error message and allows the user to try again.

doc/usecases/assigned/remember_viewing_state.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
He zooms into the map.
1818
He scrolls/drags the map's viewport.
1919
He sets layer _B_ invisible.
20+
He sets layer _C_ with transparency.
2021
He turns off the grid display.
2122
He hides the plant labels.
2223
He closes the browser, opens it again and logs in.
@@ -26,6 +27,7 @@
2627
- zoomed-in on the map
2728
- all plants visible on the map's viewport
2829
- layer _B_ invisible
30+
- layer _C_ has the same transparency
2931
- grid display turned off
3032
- plant labels hidden
3133
- **Alternative scenario:**

frontend/src/__test_utils__/msw_handlers/plants.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { http, HttpResponse } from 'msw';
2-
import { Page, PlantsSummaryDto } from '@/api_types/definitions';
2+
import {
3+
Page,
4+
PlantsSummaryDto,
5+
RelationDto,
6+
RelationsDto,
7+
RelationType,
8+
} from '@/api_types/definitions';
39
import { baseApiUrl } from '@/config';
410

511
const allPlants: PlantsSummaryDto[] = [
@@ -20,6 +26,24 @@ const allPlants: PlantsSummaryDto[] = [
2026
},
2127
];
2228

29+
const allRelationPartners: RelationDto[] = [
30+
{
31+
id: 1,
32+
relation: RelationType.Neutral,
33+
},
34+
{
35+
id: 2,
36+
relation: RelationType.Antagonist,
37+
},
38+
];
39+
40+
const allRelations: RelationsDto[] = [
41+
{
42+
id: 1,
43+
relations: [allRelationPartners[0], allRelationPartners[1]],
44+
},
45+
];
46+
2347
export const handlers = [
2448
http.get(`${baseApiUrl}/api/plants/:id`, () => {
2549
return HttpResponse.json(allPlants[0]);
@@ -40,4 +64,13 @@ export const handlers = [
4064

4165
return HttpResponse.json(response);
4266
}),
67+
68+
http.get(`${baseApiUrl}/api/:mapId/1/layers/plants/relations`, ({ request }) => {
69+
const url = new URL(request.url);
70+
71+
const plantId = parseInt(url.searchParams.get('plant_id') ?? '-1');
72+
return HttpResponse.json(allRelations[plantId - 1]);
73+
}),
4374
];
75+
76+
export const allPlantsForTesting = allPlants;

frontend/src/features/map_planning/layers/plant/components/PlantLayerLeftToolbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ export function PlantLayerLeftToolbar() {
8080
id: selectedPlanting.id,
8181
x: selectedPlanting.x,
8282
y: selectedPlanting.y,
83-
sizeX: Math.round(sizeX),
84-
sizeY: Math.round(sizeY),
83+
sizeX: isNaN(sizeX) ? selectedPlanting.sizeX : Math.round(sizeX),
84+
sizeY: isNaN(sizeY) ? selectedPlanting.sizeY : Math.round(sizeY),
8585
rotation: selectedPlanting.rotation,
8686
}));
8787

frontend/src/features/map_planning/layers/plant/components/PlantingAttributeEditForm.tsx

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ const PlantingAttributeEditFormSchema = z
2323
addDate: z.nullable(z.string()).transform((value) => value || undefined),
2424
removeDate: z.nullable(z.string()).transform((value) => value || undefined),
2525
plantingNotes: z.nullable(z.string()),
26-
sizeX: z.optional(z.number().int()),
27-
sizeY: z.optional(z.number().int()),
26+
sizeX: z.optional(z.number().int().or(z.nan())),
27+
sizeY: z.optional(z.number().int().or(z.nan())),
2828
})
2929
.refine((schema) => !schema.removeDate || !schema.addDate || schema.addDate < schema.removeDate, {
3030
path: ['dateRelation'],
@@ -58,6 +58,8 @@ export type PlantingAttributeEditFormProps = EditPlantingAttributesProps & {
5858
addDateShowDifferentValueWarning?: boolean;
5959
removeDateShowDifferentValueWarning?: boolean;
6060
plantingNoteShowDifferentValueWarning?: boolean;
61+
sizeXDifferentValueWarning?: boolean;
62+
sizeYDifferentValueWarning?: boolean;
6163
removeDateDefaultValue: string;
6264
plantingNotesDefaultValue: string;
6365
widthDefaultValue: number | undefined;
@@ -164,6 +166,12 @@ export function MultiplePlantingsAttributeForm({
164166
plantingNoteShowDifferentValueWarning={plantings.some(
165167
(planting) => planting.plantingNotes !== getCommonPlantingNotes(),
166168
)}
169+
sizeXDifferentValueWarning={plantings.some(
170+
(planting) => planting.sizeX !== getCommonWidth(),
171+
)}
172+
sizeYDifferentValueWarning={plantings.some(
173+
(planting) => planting.sizeY !== getCommonHeight(),
174+
)}
167175
removeDateDefaultValue={getCommonRemoveDate() ?? ''}
168176
plantingNotesDefaultValue={getCommonPlantingNotes() ?? ''}
169177
widthDefaultValue={getCommonWidth()}
@@ -183,6 +191,8 @@ function PlantingAttributeEditForm({
183191
addDateShowDifferentValueWarning,
184192
removeDateShowDifferentValueWarning,
185193
plantingNoteShowDifferentValueWarning,
194+
sizeXDifferentValueWarning,
195+
sizeYDifferentValueWarning,
186196
removeDateDefaultValue,
187197
plantingNotesDefaultValue,
188198
onWidthChange,
@@ -264,25 +274,30 @@ function PlantingAttributeEditForm({
264274
<span className="text-neutral-500">{plantCountInfo.total}</span>
265275
</div>
266276
)}
267-
<DebouncedSimpleFormInput
268-
onValid={onWidthChange}
269-
type="number"
270-
id="sizeX"
271-
data-testid="planting-attribute-edit-form__size-x"
272-
disabled={isReadOnlyMode}
273-
labelContent={t('plantings:width')}
274-
className="w-36"
275-
/>
276-
277-
<DebouncedSimpleFormInput
278-
onValid={onHeightChange}
279-
type="number"
280-
id="sizeY"
281-
data-testid="planting-attribute-edit-form__size-y"
282-
disabled={isReadOnlyMode}
283-
labelContent={t('plantings:height')}
284-
className="w-36"
285-
/>
277+
<div className="flex gap-2">
278+
<DebouncedSimpleFormInput
279+
onValid={onWidthChange}
280+
type="number"
281+
id="sizeX"
282+
data-testid="planting-attribute-edit-form__size-x"
283+
disabled={isReadOnlyMode}
284+
labelContent={t('plantings:width')}
285+
className="w-36"
286+
/>
287+
{sizeXDifferentValueWarning && <MultiplePlantingsDifferentValueAlert />}
288+
</div>
289+
<div className="flex gap-2">
290+
<DebouncedSimpleFormInput
291+
onValid={onHeightChange}
292+
type="number"
293+
id="sizeY"
294+
data-testid="planting-attribute-edit-form__size-y"
295+
disabled={isReadOnlyMode}
296+
labelContent={t('plantings:height')}
297+
className="w-36"
298+
/>
299+
{sizeYDifferentValueWarning && <MultiplePlantingsDifferentValueAlert />}
300+
</div>
286301
<hr className="my-4 border-neutral-700" />
287302
</div>
288303
)}

0 commit comments

Comments
 (0)