Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implemented delivery information in the frontend #362

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ public boolean validate(OwnDelivery delivery) {
delivery.getMeasurementUnit() != null &&
delivery.getMaterial() != null &&
delivery.getPartner() != null &&
delivery.getTrackingNumber() != null &&
validateResponsibility(delivery) &&
this.validateTransitEvent(delivery) &&
validateTransitEvent(delivery) &&
!delivery.getPartner().equals(ownPartnerEntity) &&
((
delivery.getCustomerOrderNumber() != null &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,8 @@ public boolean validate(ReportedDelivery delivery) {
delivery.getMeasurementUnit() != null &&
delivery.getMaterial() != null &&
delivery.getPartner() != null &&
delivery.getTrackingNumber() != null &&
validateResponsibility(delivery) &&
this.validateTransitEvent(delivery) &&
validateTransitEvent(delivery) &&
((
delivery.getCustomerOrderNumber() != null &&
delivery.getCustomerOrderPositionNumber() != null
Expand Down Expand Up @@ -148,12 +147,12 @@ private boolean validateResponsibility(ReportedDelivery delivery) {
return delivery.getIncoterm() != null && switch (delivery.getIncoterm().getResponsibility()) {
case CUSTOMER ->
delivery.getMaterial().isProductFlag() &&
ownPartnerEntity.getSites().stream().anyMatch(site -> site.getBpns().equals(delivery.getDestinationBpns())) &&
delivery.getPartner().getSites().stream().anyMatch(site -> site.getBpns().equals(delivery.getOriginBpns()));
ownPartnerEntity.getSites().stream().anyMatch(site -> site.getBpns().equals(delivery.getOriginBpns())) &&
delivery.getPartner().getSites().stream().anyMatch(site -> site.getBpns().equals(delivery.getDestinationBpns()));
case SUPPLIER ->
delivery.getMaterial().isMaterialFlag() &&
delivery.getPartner().getSites().stream().anyMatch(site -> site.getBpns().equals(delivery.getDestinationBpns())) &&
ownPartnerEntity.getSites().stream().anyMatch(site -> site.getBpns().equals(delivery.getOriginBpns()));
delivery.getPartner().getSites().stream().anyMatch(site -> site.getBpns().equals(delivery.getOriginBpns())) &&
ownPartnerEntity.getSites().stream().anyMatch(site -> site.getBpns().equals(delivery.getDestinationBpns()));
case PARTIAL ->
(
delivery.getMaterial().isMaterialFlag() &&
Expand Down
2 changes: 1 addition & 1 deletion charts/puris/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies:
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 2.2.0
version: 2.3.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
10 changes: 8 additions & 2 deletions charts/puris/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# puris

![Version: 2.0.1](https://img.shields.io/badge/Version-2.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)
![Version: 2.3.0](https://img.shields.io/badge/Version-2.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)

A helm chart for Kubernetes deployment of PURIS

Expand Down Expand Up @@ -64,6 +64,8 @@ $ helm install puris --namespace puris --create-namespace .
| backend.puris.datasource.password | string | `nil` | Password for the database user. Ignored if postgres.enabled is true. |
| backend.puris.datasource.url | string | `"jdbc:postgresql://postgresql-name:5432/puris-database"` | URL of the database. Ignored if postgres.enabled is true. |
| backend.puris.datasource.username | string | `"db-user"` | Username of the database. Ignored if postgres.enabled is true. |
| backend.puris.deliverysubmodel.apiassetid | string | `"deliverysubmodel-api-asset"` | Asset ID for DeliverySubmodel API |
| backend.puris.demandsubmodel.apiassetid | string | `"demandsubmodel-api-asset"` | Asset ID for DemandSubmodel API |
| backend.puris.demonstrator.role | string | `nil` | Current role of the PURIS demonstrator. Default value should be empty. Can be set to "customer" or "supplier" to enable demonstration setup |
| backend.puris.dtr.url | string | `"http://localhost:4243"` | Endpoint for DTR |
| backend.puris.edc.controlplane.host | string | `"172.17.0.2"` | |
Expand All @@ -86,6 +88,7 @@ $ helm install puris --namespace puris --create-namespace .
| backend.puris.own.site.name | string | `"YOUR-SITE-NAME"` | Own site name |
| backend.puris.own.streetnumber | string | `"Musterstraße 110A"` | Own street and number |
| backend.puris.own.zipcodeandcity | string | `"12345 Musterhausen"` | Own zipcode and city |
| backend.puris.productionsubmodel.apiassetid | string | `"productionsubmodel-api-asset"` | Asset ID for ProductionSubmodel API |
| backend.readinessProbe | object | `{"failureThreshold":3,"initialDelaySeconds":120,"periodSeconds":25,"successThreshold":1,"timeoutSeconds":1}` | Checks if the pod is fully ready to operate |
| backend.readinessProbe.failureThreshold | int | `3` | Number of failures (threshold) for a readiness probe |
| backend.readinessProbe.initialDelaySeconds | int | `120` | Delay in seconds after which an initial readiness probe is checked |
Expand Down Expand Up @@ -137,10 +140,14 @@ $ helm install puris --namespace puris --create-namespace .
| frontend.puris.appName | string | `"PURIS"` | The name of the app displayed in the frontend |
| frontend.puris.baseUrl | string | `"your-backend-host-address.com"` | The base URL for the backend base URL without further endpoints |
| frontend.puris.endpointCustomer | string | `"stockView/customer?ownMaterialNumber="` | The endpoint for the customers who buy a material identified via the own material number for the stock view |
| frontend.puris.endpointDelivery | string | `"delivery"` | The endpoint for the delivery submodel |
| frontend.puris.endpointDemand | string | `"demand"` | The endpoint for the demand submodel |
| frontend.puris.endpointMaterialStocks | string | `"stockView/material-stocks"` | The endpoint for material stocks for the stock view |
| frontend.puris.endpointMaterials | string | `"stockView/materials"` | The endpoint for materials for the stock view |
| frontend.puris.endpointPartnerOwnSites | string | `"partners/ownSites"` | The endpoint for the partners BPNS |
| frontend.puris.endpointProductStocks | string | `"stockView/product-stocks"` | The endpoint for product stocks for the stock view |
| frontend.puris.endpointProduction | string | `"production"` | The endpoint for the production submodel |
| frontend.puris.endpointProductionRange | string | `"production/range"` | The endpoint for the production range of the production submodel |
| frontend.puris.endpointProducts | string | `"stockView/products"` | The endpoint for products for the stock view |
| frontend.puris.endpointReportedMaterialStocks | string | `"stockView/reported-material-stocks?ownMaterialNumber="` | The endpoint for the partners' (supplier) material stocks that they potentially will deliver to me |
| frontend.puris.endpointReportedProductStocks | string | `"stockView/reported-product-stocks?ownMaterialNumber="` | The endpoint for the partners' (customer) product stocks that they received from me |
Expand Down Expand Up @@ -184,4 +191,3 @@ $ helm install puris --namespace puris --create-namespace .
| postgresql.enabled | bool | `true` | Enable postgres by default, set to false to use existing postgres. Make sure to set backend.puris.jpa.hibernate.ddl-auto accordingly (by default database is created using hibernate ddl from backend). |
| postgresql.fullnameOverride | string | `"backend-postgresql"` | Possibility to override the fullname |
| postgresql.service.ports.postgresql | int | `5432` | Port of postgres database. |

10 changes: 9 additions & 1 deletion charts/puris/templates/frontend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
{{- toYaml .Values.frontend.podSecurityContext | nindent 8 }}
containers:
- name: {{ include "frontend.fullname" . }}
securityContext:

Check warning on line 53 in charts/puris/templates/frontend-deployment.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Container Running With Low UID

Check if containers are running with low UID, which might cause conflicts with the host's user table.
{{- toYaml .Values.frontend.securityContext | nindent 12 }}
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
Expand Down Expand Up @@ -80,7 +80,15 @@
- name: ENDPOINT_UPDATE_REPORTED_PRODUCT_STOCKS
value: "{{ .Values.frontend.puris.endpointUpdateReportedProductStocks }}"
- name: ENDPOINT_PARTNER_OWNSITES
value: "{{ .Values.frontend.puris.endpointPartnerOwnSites }}"
value: "{{ .Values.frontend.puris.endpointPartnerOwnSites }}"
- name: ENDPOINT_DEMAND
value: "{{ .Values.frontend.puris.endpointDemand }}"
- name: ENDPOINT_PRODUCTION
value: "{{ .Values.frontend.puris.endpointProduction }}"
- name: ENDPOINT_PRODUCTION_RANGE
value: "{{ .Values.frontend.puris.endpointProductionRange }}"
- name: ENDPOINT_DELIVERY
value: "{{ .Values.frontend.puris.endpointDelivery }}"
- name: BACKEND_API_KEY
value: "{{ .Values.backend.puris.api.key}}"
- name: IDP_DISABLE
Expand Down
8 changes: 8 additions & 0 deletions charts/puris/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ frontend:
endpointUpdateReportedProductStocks: stockView/update-reported-product-stocks?ownMaterialNumber=
# -- The endpoint for the partners BPNS
endpointPartnerOwnSites: partners/ownSites
# -- The endpoint for the demand submodel
endpointDemand: demand
# -- The endpoint for the production submodel
endpointProduction: production
# -- The endpoint for the production range of the production submodel
endpointProductionRange: production/range
# -- The endpoint for the delivery submodel
endpointDelivery: delivery
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run helm-docs to update the readme of the chart

keycloak:
# -- Disable the Keycloak integration.
disabled: true
Expand Down
1 change: 1 addition & 0 deletions frontend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ VITE_ENDPOINT_PARTNER_OWNSITES=partners/ownSites
VITE_ENDPOINT_DEMAND=demand
VITE_ENDPOINT_PRODUCTION=production
VITE_ENDPOINT_PRODUCTION_RANGE=production/range
VITE_ENDPOINT_DELIVERY=delivery
tom-rm-meyer-ISST marked this conversation as resolved.
Show resolved Hide resolved

VITE_IDP_DISABLE=true
VITE_IDP_URL=http://localhost:10081/
Expand Down
1 change: 1 addition & 0 deletions frontend/.env.dockerbuild
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ VITE_ENDPOINT_PARTNER_OWNSITES=\$ENDPOINT_PARTNER_OWNSITES
VITE_ENDPOINT_DEMAND=\$ENDPOINT_DEMAND
VITE_ENDPOINT_PRODUCTION=\$ENDPOINT_PRODUCTION
VITE_ENDPOINT_PRODUCTION_RANGE=\$ENDPOINT_PRODUCTION_RANGE
VITE_ENDPOINT_DELIVERY=\$ENDPOINT_DELIVERY

VITE_IDP_DISABLE=\$IDP_DISABLE
VITE_IDP_URL=\$IDP_URL
Expand Down
2 changes: 1 addition & 1 deletion frontend/DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ npm/npmjs/-/path-key/3.1.1, MIT, approved, clearlydefined
npm/npmjs/-/path-parse/1.0.7, MIT, approved, clearlydefined
npm/npmjs/-/path-scurry/1.10.1, BlueOak-1.0.0, approved, #9370
npm/npmjs/-/path-type/4.0.0, MIT, approved, clearlydefined
npm/npmjs/-/picocolors/1.0.0, ISC, approved, clearlydefined
npm/npmjs/-/picocolors/1.0.0, ISC, approved, #14718
npm/npmjs/-/picomatch/2.3.1, MIT, approved, clearlydefined
npm/npmjs/-/pify/2.3.0, MIT, approved, clearlydefined
npm/npmjs/-/pirates/4.0.6, MIT, approved, #680
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ui/DateTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const DateTime = ({ error, value, onValueChange, ...props }: DateTimeProp
<Box display="flex" flexGrow="1" sx={{ '& .MuiFormControl-root, & .MuiBox-root': { minWidth: '100% !important' } }}>
<Datepicker
{...props}
error={error && !date}
error={error}
value={date?.toISOString().split('T')[0]}
readOnly={false}
onChangeItem={(event) => handleDateChange(event)}
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"ENDPOINT_UPDATE_REPORTED_MATERIAL_STOCKS":"$ENDPOINT_UPDATE_REPORTED_MATERIAL_STOCKS",
"ENDPOINT_UPDATE_REPORTED_PRODUCT_STOCKS":"$ENDPOINT_UPDATE_REPORTED_MATERIAL_STOCKS",
"ENDPOINT_PARTNER_OWNSITES": "$ENDPOINT_PARTNER_OWNSITES",
"ENDPOINT_DEMAND": "$ENDPOINT_DEMAND",
"ENDPOINT_PRODUCTION": "$ENDPOINT_PRODUCTION",
"ENDPOINT_PRODUCTION_RANGE": "$ENDPOINT_PRODUCTION_RANGE",
"ENDPOINT_DELIVERY": "$ENDPOINT_DELIVERY",
"IDP_DISABLE": "$IDP_DISABLE",
"IDP_URL": "$IDP_URL",
"IDP_REALM": "$IDP_REALM",
Expand Down
Loading
Loading