From 75c766814bae420d08d179265743c12df771bf48 Mon Sep 17 00:00:00 2001 From: Andrey Rusakov Date: Wed, 6 Nov 2024 15:47:31 +0100 Subject: [PATCH 01/10] Download OrderItem results with default name --- package-lock.json | 9 +++- package.json | 2 + .../order-item-view.component.html | 4 +- .../order-item-view.component.ts | 50 +++++++------------ src/app/_models/IOrder.ts | 3 ++ src/app/_services/api-order.service.ts | 11 +++- 6 files changed, 43 insertions(+), 36 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6587eb46..ab915e6e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,10 +21,12 @@ "@ngrx/effects": "^16.2.0", "@ngrx/entity": "^16.2.0", "@ngrx/store": "^16.2.0", + "@types/mime-types": "^2.1.4", "angular-auth-oidc-client": "18.0.1", "angular-split": "^16.2.1", "jasmine-spec-reporter": "^7.0.0", "lodash-es": "^4.17.21", + "mime-types": "^2.1.35", "ol": "^8.1.0", "ol-ext": "^4.0.24", "ol-geocoder": "^4.3.1", @@ -5011,6 +5013,11 @@ "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", "dev": true }, + "node_modules/@types/mime-types": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.4.tgz", + "integrity": "sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w==" + }, "node_modules/@types/node": { "version": "12.20.55", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", @@ -11362,7 +11369,6 @@ "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, "engines": { "node": ">= 0.6" } @@ -11371,7 +11377,6 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, "dependencies": { "mime-db": "1.52.0" }, diff --git a/package.json b/package.json index 4d06ee96..45d8847d 100644 --- a/package.json +++ b/package.json @@ -24,10 +24,12 @@ "@ngrx/effects": "^16.2.0", "@ngrx/entity": "^16.2.0", "@ngrx/store": "^16.2.0", + "@types/mime-types": "^2.1.4", "angular-auth-oidc-client": "18.0.1", "angular-split": "^16.2.1", "jasmine-spec-reporter": "^7.0.0", "lodash-es": "^4.17.21", + "mime-types": "^2.1.35", "ol": "^8.1.0", "ol-ext": "^4.0.24", "ol-geocoder": "^4.3.1", diff --git a/src/app/_components/order-item-view/order-item-view.component.html b/src/app/_components/order-item-view/order-item-view.component.html index bf39f650..6a80a9dc 100644 --- a/src/app/_components/order-item-view/order-item-view.component.html +++ b/src/app/_components/order-item-view/order-item-view.component.html @@ -48,8 +48,8 @@ {{ DOWNLAOD }} {{ getOrderStatus(element) }} diff --git a/src/app/_components/order-item-view/order-item-view.component.ts b/src/app/_components/order-item-view/order-item-view.component.ts index 5737caa6..e899e45c 100644 --- a/src/app/_components/order-item-view/order-item-view.component.ts +++ b/src/app/_components/order-item-view/order-item-view.component.ts @@ -1,9 +1,9 @@ -import {Component, Input, OnInit} from '@angular/core'; -import {IOrderItem, Order} from '../../_models/IOrder'; -import {GeoshopUtils} from '../../_helpers/GeoshopUtils'; -import {ApiOrderService} from '../../_services/api-order.service'; -import {MatLegacySnackBar as MatSnackBar} from '@angular/material/legacy-snack-bar'; -import {ConstantsService} from '../../constants.service'; +import { Component, Input, OnInit } from '@angular/core'; +import { IOrderItem, Order } from '../../_models/IOrder'; +import { ApiOrderService } from '../../_services/api-order.service'; +import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar'; +import { ConstantsService } from '../../constants.service'; +import { HttpResponse } from '@angular/common/http'; @Component({ selector: 'gs2-order-item-view', @@ -21,7 +21,7 @@ export class OrderItemViewComponent implements OnInit { readonly DOWNLAOD = ConstantsService.DOWNLAOD; constructor(private apiOrderService: ApiOrderService, - private snackBar: MatSnackBar) { + private snackBar: MatSnackBar) { } ngOnInit(): void { @@ -42,34 +42,22 @@ export class OrderItemViewComponent implements OnInit { return returnValue; } - downloadOrder(event: MouseEvent, id: number) { + downloadOrder(event: MouseEvent, item: IOrderItem) { event.stopPropagation(); event.preventDefault(); - this.apiOrderService.downloadOrder(id, true).subscribe(link => { - if (!link) { - this.snackBar.open( - 'Aucun fichier disponible', 'Ok', {panelClass: 'notification-info'} - ); - return; + this.apiOrderService.downloadResult(item.download_guid!).subscribe({ + next: (response: HttpResponse) => { + const link = document.createElement('a'); + // TODO: resolve filename properly after upgrading to the latest Angular + link.download = 'result.zip'; + link.href = window.URL.createObjectURL(response.body!); + link.click(); + window.URL.revokeObjectURL(link.href); + }, + error: (error: any) => { + this.snackBar.open(error.detail ?? 'Aucun fichier disponible', 'Ok', { panelClass: 'notification-info' }); } - - if (link.detail) { - this.snackBar.open( - link.detail, 'Ok', {panelClass: 'notification-info'} - ); - return; - } - - if (link.download_link) { - const downloadLink = link.download_link; - if (downloadLink) { - const urlsParts = downloadLink.split('/'); - const filename = urlsParts.pop() || urlsParts.pop(); - GeoshopUtils.downloadData(downloadLink, filename || 'download.zip'); - } - } - }); } } diff --git a/src/app/_models/IOrder.ts b/src/app/_models/IOrder.ts index f2a3d3de..29201f8c 100644 --- a/src/app/_models/IOrder.ts +++ b/src/app/_models/IOrder.ts @@ -49,6 +49,7 @@ export interface IOrderItem { /** id of the order */ order?: number; status?: OrderItemStatus; + download_guid?: string; } export interface IOrderToPost { @@ -82,6 +83,7 @@ export interface IOrderSummary { date_processed: string | undefined; statusAsReadableIconText?: IStatusAsReadableIcon; id?: number; + download_guid?: string; } export interface IOrderDowloadLink { @@ -164,6 +166,7 @@ export class Order { date_ordered: Date | undefined; date_processed: Date | undefined; invoice_contact: number; + download_guid: string|undefined; statusAsReadableIconText: IStatusAsReadableIcon; private readonly _isAllOrderItemCalculated: boolean = true; diff --git a/src/app/_services/api-order.service.ts b/src/app/_services/api-order.service.ts index 19ff1470..19b47bf7 100644 --- a/src/app/_services/api-order.service.ts +++ b/src/app/_services/api-order.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable, of, zip } from 'rxjs'; import { IOrder, IOrderDowloadLink, IOrderItem, IOrderSummary, IOrderToPost, IOrderType, Order } from '../_models/IOrder'; -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpResponse } from '@angular/common/http'; import { ConfigService } from './config.service'; import { IApiResponse } from '../_models/IApi'; import { catchError, flatMap, map } from 'rxjs/operators'; @@ -244,6 +244,15 @@ export class ApiOrderService { ); } + public downloadResult(guid: string): Observable> { + this._getApiUrl(); + const url = new URL(`${this.apiUrl}/download/${guid}/result`); + return this.http.get(url.toString(), { + observe: 'response', + responseType: 'blob' + }); + } + public downloadOrder(orderId: number, isOrderItem = false) { this._getApiUrl(); From 3122878cb688af46693eab03c4d860ec80cbed34 Mon Sep 17 00:00:00 2001 From: Andrey Rusakov Date: Wed, 6 Nov 2024 16:37:02 +0100 Subject: [PATCH 02/10] Fix order.status to order_status everywhere because of backend incompatibility --- src/app/_helpers/GeoshopUtils.ts | 2 +- src/app/_models/IOrder.ts | 12 +++---- src/app/_services/api-order.service.ts | 27 --------------- src/app/_store/cart/cart.reducer.ts | 4 +-- .../account/orders/order/order.component.html | 9 ++--- .../account/orders/order/order.component.ts | 34 +++++++------------ .../welcome/download/download.component.html | 6 ++-- .../welcome/download/download.component.ts | 34 +++++++------------ 8 files changed, 41 insertions(+), 87 deletions(-) diff --git a/src/app/_helpers/GeoshopUtils.ts b/src/app/_helpers/GeoshopUtils.ts index c81deb65..946fa72a 100644 --- a/src/app/_helpers/GeoshopUtils.ts +++ b/src/app/_helpers/GeoshopUtils.ts @@ -30,7 +30,7 @@ export class GeoshopUtils { total_with_vat_currency: '', total_with_vat: '', title: '', - status: 'DRAFT', + order_status: 'DRAFT', processing_fee_currency: '', processing_fee: '', part_vat_currency: '', diff --git a/src/app/_models/IOrder.ts b/src/app/_models/IOrder.ts index 29201f8c..e3d21894 100644 --- a/src/app/_models/IOrder.ts +++ b/src/app/_models/IOrder.ts @@ -78,7 +78,7 @@ export interface IOrderSummary { total_with_vat: string; invoice_reference: string; email_deliver: string; - status: OrderStatus; + order_status: OrderStatus; date_ordered: string | undefined; date_processed: string | undefined; statusAsReadableIconText?: IStatusAsReadableIcon; @@ -115,7 +115,7 @@ export interface IOrder { geom: string | undefined; invoice_reference: string; email_deliver: string; - status: OrderStatus; + order_status: OrderStatus; date_ordered: string | undefined; date_processed: string | undefined; invoice_contact: string | number; @@ -162,7 +162,7 @@ export class Order { geom: Polygon; invoice_reference: string; email_deliver: string; - status: OrderStatus; + order_status: OrderStatus; date_ordered: Date | undefined; date_processed: Date | undefined; invoice_contact: number; @@ -175,7 +175,7 @@ export class Order { } get isQuotationCalculationFinished() { - return this.status === 'QUOTE_DONE'; + return this.order_status === 'QUOTE_DONE'; } private _invoiceContact: Contact | undefined; @@ -237,7 +237,7 @@ export class Order { part_vat_currency: this.part_vat_currency, processing_fee: this.processing_fee, processing_fee_currency: this.processing_fee_currency, - status: this.status, + order_status: this.order_status, title: this.title, total_with_vat: this.total_with_vat, total_with_vat_currency: this.total_with_vat_currency, @@ -286,7 +286,7 @@ export class Order { color: '' }; - switch (order.status) { + switch (order.order_status) { case 'DRAFT': result = { text: ConstantsService.ORDER_STATUS.DRAFT, diff --git a/src/app/_services/api-order.service.ts b/src/app/_services/api-order.service.ts index 19b47bf7..721dda7d 100644 --- a/src/app/_services/api-order.service.ts +++ b/src/app/_services/api-order.service.ts @@ -253,33 +253,6 @@ export class ApiOrderService { }); } - public downloadOrder(orderId: number, isOrderItem = false) { - this._getApiUrl(); - - const orderText = isOrderItem ? 'orderitem' : 'order'; - const url = new URL(`${this.apiUrl}/${orderText}/${orderId}/download_link/`); - - return this.http.get(url.toString()) - .pipe( - catchError(() => { - return of(null); - }) - ); - } - - public downloadOrderByUUID(uuid: string) { - this._getApiUrl(); - - const url = new URL(`${this.apiUrl}/download/${uuid}/get_link/`); - - return this.http.get(url.toString()) - .pipe( - catchError(() => { - return of(null); - }) - ); - } - getContact(contactId: number | string) { this._getApiUrl(); diff --git a/src/app/_store/cart/cart.reducer.ts b/src/app/_store/cart/cart.reducer.ts index 8282ee0e..f4cd83b9 100644 --- a/src/app/_store/cart/cart.reducer.ts +++ b/src/app/_store/cart/cart.reducer.ts @@ -12,7 +12,7 @@ export const initialState: CartState = { total_with_vat_currency: '', total_with_vat: '', title: '', - status: 'DRAFT', + order_status: 'DRAFT', processing_fee_currency: '', processing_fee: '', part_vat_currency: '', @@ -38,7 +38,7 @@ const cartReducer = createReducer(initialState, total_with_vat_currency: '', total_with_vat: '', title: '', - status: 'DRAFT', + order_status: 'DRAFT', processing_fee_currency: '', processing_fee: '', part_vat_currency: '', diff --git a/src/app/account/orders/order/order.component.html b/src/app/account/orders/order/order.component.html index 08ba40f4..30b29887 100644 --- a/src/app/account/orders/order/order.component.html +++ b/src/app/account/orders/order/order.component.html @@ -3,6 +3,7 @@ (afterExpand)="displayMiniMap()"> + STATIS: {{order?.order_status}} {{order?.description}} @@ -46,8 +47,8 @@ (click)="confirmOrder()" i18n="@@order.confirm"> Confirmer la commande - - + + diff --git a/src/app/account/orders/order/order.component.ts b/src/app/account/orders/order/order.component.ts index 2dc117ed..2660e9a5 100644 --- a/src/app/account/orders/order/order.component.ts +++ b/src/app/account/orders/order/order.component.ts @@ -15,6 +15,7 @@ import {MatLegacyDialog as MatDialog, MatLegacyDialogRef as MatDialogRef} from ' import {ConfirmDialogComponent} from '../../../_components/confirm-dialog/confirm-dialog.component'; import Geometry from 'ol/geom/Geometry'; import { ConstantsService } from 'src/app/constants.service'; +import { HttpResponse } from '@angular/common/http'; // TODO tranlsate after updating SnackBar! @Component({ @@ -56,28 +57,17 @@ export class OrderComponent implements OnInit { return; } - this.apiOrderService.downloadOrder(this.order.id).subscribe(link => { - if (!link) { - this.snackBar.open( - 'Aucun fichier disponible', 'Ok', {panelClass: 'notification-info'} - ); - return; - } - - if (link.detail) { - this.snackBar.open( - link.detail, 'Ok', {panelClass: 'notification-info'} - ); - return; - } - - if (link.download_link) { - const downloadLink = (link as IOrderDowloadLink).download_link; - if (downloadLink) { - const urlsParts = downloadLink.split('/'); - const filename = urlsParts.pop() || urlsParts.pop(); - GeoshopUtils.downloadData(downloadLink, filename || 'download.zip'); - } + this.apiOrderService.downloadResult(this.order.download_guid!).subscribe({ + next: (response: HttpResponse) => { + const link = document.createElement('a'); + // TODO: resolve filename properly after upgrading to the latest Angular + link.download = 'result.zip'; + link.href = window.URL.createObjectURL(response.body!); + link.click(); + window.URL.revokeObjectURL(link.href); + }, + error: (error: any) => { + this.snackBar.open(error.detail ?? 'Aucun fichier disponible', 'Ok', { panelClass: 'notification-info' }); } }); } diff --git a/src/app/welcome/download/download.component.html b/src/app/welcome/download/download.component.html index a7b58ef4..cfb96842 100644 --- a/src/app/welcome/download/download.component.html +++ b/src/app/welcome/download/download.component.html @@ -15,14 +15,14 @@ Commande du {{order.date_ordered | date}}.{{order.description}} -
+
-
+

Votre commande n'est plus disponible.

Les liens de téléchargement ne sont valables que pendant un mois.
N'hésitez pas à nous contacter si vous souhaitez une nouvelle extraction.

@@ -33,4 +33,4 @@
-
\ No newline at end of file +
diff --git a/src/app/welcome/download/download.component.ts b/src/app/welcome/download/download.component.ts index ac88b95d..8cd008b8 100644 --- a/src/app/welcome/download/download.component.ts +++ b/src/app/welcome/download/download.component.ts @@ -15,6 +15,7 @@ import { ConfigService} from '../../_services/config.service'; import { MapService} from '../../_services/map.service'; import Geometry from 'ol/geom/Geometry'; import { ConstantsService } from 'src/app/constants.service'; +import { HttpResponse } from '@angular/common/http'; @Component({ @@ -69,28 +70,17 @@ export class DownloadComponent implements OnInit, OnDestroy { event.stopPropagation(); event.preventDefault(); - this.apiOrderService.downloadOrderByUUID(this.uuid).subscribe(link => { - if (!link) { - this.snackBar.open( - 'Aucun fichier disponible', 'Ok', {panelClass: 'notification-info'} - ); - return; - } - - if (link.detail) { - this.snackBar.open( - link.detail, 'Ok', {panelClass: 'notification-info'} - ); - return; - } - - if (link.download_link) { - const downloadLink = (link as IOrderDowloadLink).download_link; - if (downloadLink) { - const urlsParts = downloadLink.split('/'); - const filename = urlsParts.pop() || urlsParts.pop(); - GeoshopUtils.downloadData(downloadLink, filename || 'download.zip'); - } + this.apiOrderService.downloadResult(this.uuid).subscribe({ + next: (response: HttpResponse) => { + const link = document.createElement('a'); + // TODO: resolve filename properly after upgrading to the latest Angular + link.download = 'result.zip'; + link.href = window.URL.createObjectURL(response.body!); + link.click(); + window.URL.revokeObjectURL(link.href); + }, + error: (error: any) => { + this.snackBar.open(error.detail ?? 'Aucun fichier disponible', 'Ok', { panelClass: 'notification-info' }); } }); } From a7691b256698ec3950372e1a102cb01652ef0d2a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 04:36:12 +0000 Subject: [PATCH 03/10] Bump ol-geocoder from 4.3.1 to 4.3.3 Bumps [ol-geocoder](https://github.com/Dominique92/ol-geocoder) from 4.3.1 to 4.3.3. - [Release notes](https://github.com/Dominique92/ol-geocoder/releases) - [Commits](https://github.com/Dominique92/ol-geocoder/compare/v4.3.1...v4.3.3) --- updated-dependencies: - dependency-name: ol-geocoder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index ab915e6e..8f3f2fec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "mime-types": "^2.1.35", "ol": "^8.1.0", "ol-ext": "^4.0.24", - "ol-geocoder": "^4.3.1", + "ol-geocoder": "^4.3.3", "proj4": "^2.9.2", "rxjs": "~7.8.1", "tslib": "^2.6.3", @@ -12472,9 +12472,9 @@ } }, "node_modules/ol-geocoder": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/ol-geocoder/-/ol-geocoder-4.3.1.tgz", - "integrity": "sha512-058XXp6ZWCkz/g0B/aU1SZeMx/TClxo7Ns7XwbdZ0X/xlwt4XHoyTjsfe2mghg+uaY9olLYllhPD3vq5IRlggw==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/ol-geocoder/-/ol-geocoder-4.3.3.tgz", + "integrity": "sha512-uCXygiNVldMNGgi7H0pLMMMnEey8Nlx/k3brq4knCnmtapC9P1lbel7NydMNGgdymUgm1jq4T5ENvIngTJW44A==", "peerDependencies": { "ol": ">=6.0.0" } diff --git a/package.json b/package.json index 45d8847d..8013ae6b 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "mime-types": "^2.1.35", "ol": "^8.1.0", "ol-ext": "^4.0.24", - "ol-geocoder": "^4.3.1", + "ol-geocoder": "^4.3.3", "proj4": "^2.9.2", "rxjs": "~7.8.1", "tslib": "^2.6.3", From d0cd3c438a4f2a621f369a50bea95a8436e6a8f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 04:36:23 +0000 Subject: [PATCH 04/10] Bump @angular/platform-browser-dynamic from 16.2.7 to 16.2.12 Bumps [@angular/platform-browser-dynamic](https://github.com/angular/angular/tree/HEAD/packages/platform-browser-dynamic) from 16.2.7 to 16.2.12. - [Release notes](https://github.com/angular/angular/releases) - [Changelog](https://github.com/angular/angular/blob/main/CHANGELOG.md) - [Commits](https://github.com/angular/angular/commits/16.2.12/packages/platform-browser-dynamic) --- updated-dependencies: - dependency-name: "@angular/platform-browser-dynamic" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8f3f2fec..be77682f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@angular/forms": "^16.2.7", "@angular/material": "^16.2.14", "@angular/platform-browser": "^16.2.12", - "@angular/platform-browser-dynamic": "^16.2.7", + "@angular/platform-browser-dynamic": "^16.2.12", "@angular/router": "^16.2.7", "@ngrx/effects": "^16.2.0", "@ngrx/entity": "^16.2.0", @@ -965,9 +965,9 @@ } }, "node_modules/@angular/platform-browser-dynamic": { - "version": "16.2.7", - "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-16.2.7.tgz", - "integrity": "sha512-raeuYEQfByHByLnA5YRR7fYD/5u6hMjONH77p08IjmtdmLb0XYP18l/C4YqsIOQG6kZLNCVWknEHZu3kuvAwtQ==", + "version": "16.2.12", + "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-16.2.12.tgz", + "integrity": "sha512-ya54jerNgreCVAR278wZavwjrUWImMr2F8yM5n9HBvsMBbFaAQ83anwbOEiHEF2BlR+gJiEBLfpuPRMw20pHqw==", "dependencies": { "tslib": "^2.3.0" }, @@ -975,10 +975,10 @@ "node": "^16.14.0 || >=18.10.0" }, "peerDependencies": { - "@angular/common": "16.2.7", - "@angular/compiler": "16.2.7", - "@angular/core": "16.2.7", - "@angular/platform-browser": "16.2.7" + "@angular/common": "16.2.12", + "@angular/compiler": "16.2.12", + "@angular/core": "16.2.12", + "@angular/platform-browser": "16.2.12" } }, "node_modules/@angular/router": { diff --git a/package.json b/package.json index 8013ae6b..01456573 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "@angular/forms": "^16.2.7", "@angular/material": "^16.2.14", "@angular/platform-browser": "^16.2.12", - "@angular/platform-browser-dynamic": "^16.2.7", + "@angular/platform-browser-dynamic": "^16.2.12", "@angular/router": "^16.2.7", "@ngrx/effects": "^16.2.0", "@ngrx/entity": "^16.2.0", From 8cf51553bd15872546faf9ed91004b77f0d9d804 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 04:36:38 +0000 Subject: [PATCH 05/10] Bump @angular/common from 16.2.7 to 16.2.12 Bumps [@angular/common](https://github.com/angular/angular/tree/HEAD/packages/common) from 16.2.7 to 16.2.12. - [Release notes](https://github.com/angular/angular/releases) - [Changelog](https://github.com/angular/angular/blob/main/CHANGELOG.md) - [Commits](https://github.com/angular/angular/commits/16.2.12/packages/common) --- updated-dependencies: - dependency-name: "@angular/common" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 10 +++++----- package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index be77682f..383d0957 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@angular/animations": "^16.2.7", "@angular/cdk": "^16.2.6", - "@angular/common": "^16.2.7", + "@angular/common": "^16.2.12", "@angular/compiler": "^16.2.12", "@angular/core": "^16.2.7", "@angular/forms": "^16.2.7", @@ -565,9 +565,9 @@ } }, "node_modules/@angular/common": { - "version": "16.2.7", - "resolved": "https://registry.npmjs.org/@angular/common/-/common-16.2.7.tgz", - "integrity": "sha512-vcKbbtDXNmJ8dj1GF52saJRT5U3P+phnIwnv+hQ2c+VVj/S2alWlBkT12iM+KlvnWdxsa0q4yW0G4WvpPJPaMQ==", + "version": "16.2.12", + "resolved": "https://registry.npmjs.org/@angular/common/-/common-16.2.12.tgz", + "integrity": "sha512-B+WY/cT2VgEaz9HfJitBmgdk4I333XG/ybC98CMC4Wz8E49T8yzivmmxXB3OD6qvjcOB6ftuicl6WBqLbZNg2w==", "dependencies": { "tslib": "^2.3.0" }, @@ -575,7 +575,7 @@ "node": "^16.14.0 || >=18.10.0" }, "peerDependencies": { - "@angular/core": "16.2.7", + "@angular/core": "16.2.12", "rxjs": "^6.5.3 || ^7.4.0" } }, diff --git a/package.json b/package.json index 01456573..eace7fef 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "dependencies": { "@angular/animations": "^16.2.7", "@angular/cdk": "^16.2.6", - "@angular/common": "^16.2.7", + "@angular/common": "^16.2.12", "@angular/compiler": "^16.2.12", "@angular/core": "^16.2.7", "@angular/forms": "^16.2.7", From ad41f5ba4c624b40d6c0c92a24f46d2a3106671b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 04:36:52 +0000 Subject: [PATCH 06/10] Bump angular-auth-oidc-client from 18.0.1 to 18.0.2 Bumps [angular-auth-oidc-client](https://github.com/damienbod/angular-auth-oidc-client) from 18.0.1 to 18.0.2. - [Release notes](https://github.com/damienbod/angular-auth-oidc-client/releases) - [Changelog](https://github.com/damienbod/angular-auth-oidc-client/blob/main/CHANGELOG.md) - [Commits](https://github.com/damienbod/angular-auth-oidc-client/compare/18.0.1...18.0.2) --- updated-dependencies: - dependency-name: angular-auth-oidc-client dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 9 ++++----- package.json | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 383d0957..c671a8fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,8 +21,7 @@ "@ngrx/effects": "^16.2.0", "@ngrx/entity": "^16.2.0", "@ngrx/store": "^16.2.0", - "@types/mime-types": "^2.1.4", - "angular-auth-oidc-client": "18.0.1", + "angular-auth-oidc-client": "18.0.2", "angular-split": "^16.2.1", "jasmine-spec-reporter": "^7.0.0", "lodash-es": "^4.17.21", @@ -5938,9 +5937,9 @@ } }, "node_modules/angular-auth-oidc-client": { - "version": "18.0.1", - "resolved": "https://registry.npmjs.org/angular-auth-oidc-client/-/angular-auth-oidc-client-18.0.1.tgz", - "integrity": "sha512-r+PWZuni5msVEKFyA8HQ1lTTbSrrrsgFnU3qGK6P3TMl6+G3d2KdsXztBaRCNFU4oZq8mbDnmwShyvvVYSvxig==", + "version": "18.0.2", + "resolved": "https://registry.npmjs.org/angular-auth-oidc-client/-/angular-auth-oidc-client-18.0.2.tgz", + "integrity": "sha512-Vqe2EDh7YofOAQz7t6mublO9gKhMzonKSu8vXzym2WRwIhYd0kbf4j3JW83zDzkjlICFnML+uS8SfOSu7b2GQQ==", "dependencies": { "rfc4648": "^1.5.0", "tslib": "^2.3.0" diff --git a/package.json b/package.json index eace7fef..be00ac3d 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,7 @@ "@ngrx/effects": "^16.2.0", "@ngrx/entity": "^16.2.0", "@ngrx/store": "^16.2.0", - "@types/mime-types": "^2.1.4", - "angular-auth-oidc-client": "18.0.1", + "angular-auth-oidc-client": "18.0.2", "angular-split": "^16.2.1", "jasmine-spec-reporter": "^7.0.0", "lodash-es": "^4.17.21", From 7d2b6d23dbe94d8744e81b899c5be5b292b7e559 Mon Sep 17 00:00:00 2001 From: Andrey Rusakov Date: Wed, 30 Oct 2024 13:07:51 +0100 Subject: [PATCH 07/10] Set DE as default locale --- Dockerfile | 4 ++-- angular.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 43b4ddfd..5197b793 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM node:22.6.0-slim AS builder WORKDIR /usr/app COPY package*.json ./. -RUN npm ci +RUN npm ci --legacy-peer-deps COPY . . @@ -17,4 +17,4 @@ FROM nginxinc/nginx-unprivileged:stable COPY nginx/default.conf /etc/nginx/conf.d/default.conf # Copy build artifacts -COPY --from=builder /usr/app/dist/ /usr/share/nginx/html \ No newline at end of file +COPY --from=builder /usr/app/dist/ /usr/share/nginx/html diff --git a/angular.json b/angular.json index 9f8746a4..40a81fcd 100644 --- a/angular.json +++ b/angular.json @@ -5,7 +5,7 @@ "projects": { "front": { "i18n": { - "sourceLocale": "fr-CH", + "sourceLocale": "de-CH", "locales": { "de": { "translation": "src/locale/messages.de.xlf" From 9d415432a2a55d1b8aaf643aa598ee2bf2c9177d Mon Sep 17 00:00:00 2001 From: Andrey Rusakov Date: Wed, 30 Oct 2024 16:17:42 +0100 Subject: [PATCH 08/10] Use localized configuration for the geoshop-front container --- Dockerfile | 4 ++-- angular.json | 5 ++++- nginx/default.conf | 23 +++++++++++++++-------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5197b793..3cd407a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN npm ci --legacy-peer-deps COPY . . -RUN npm run build +RUN npm run build -- --localize && ls dist/ # Serve with nginx unpprevileged FROM nginxinc/nginx-unprivileged:stable @@ -17,4 +17,4 @@ FROM nginxinc/nginx-unprivileged:stable COPY nginx/default.conf /etc/nginx/conf.d/default.conf # Copy build artifacts -COPY --from=builder /usr/app/dist/ /usr/share/nginx/html +COPY --from=builder /usr/app/dist/ /usr/share/nginx/html/ diff --git a/angular.json b/angular.json index 40a81fcd..848d7eec 100644 --- a/angular.json +++ b/angular.json @@ -5,10 +5,13 @@ "projects": { "front": { "i18n": { - "sourceLocale": "de-CH", + "sourceLocale": "fr", "locales": { "de": { "translation": "src/locale/messages.de.xlf" + }, + "en": { + "translation": "src/locale/messages.en.xlf" } } }, diff --git a/nginx/default.conf b/nginx/default.conf index a850d844..ebbfa9bd 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -1,19 +1,26 @@ +map $http_accept_language $accept_language { + ~*^de de; + ~*^fr fr; + ~*^en en; +} + server { listen 8080; server_name localhost; root /usr/share/nginx/html; index index.html; - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; + # Fallback to default language if no preference defined by browser + if ($accept_language ~ "^$") { + set $accept_language "de"; } - location / { - try_files $uri $uri/ /index.html =404; - } + # Redirect "/" to Angular application in the preferred language of the browser + rewrite ^/$ /$accept_language permanent; - location /welcome { - rewrite ^/welcome/?$ / break; + # Everything under the Angular application is always redirected to Angular in the + # correct language + location ~ ^/(fr|de|en) { + try_files $uri /$1/index.html?$args; } } From 29349049e7ee1e1d9562cf00acae5274dc70b9d9 Mon Sep 17 00:00:00 2001 From: Andrey Rusakov Date: Thu, 31 Oct 2024 11:17:49 +0100 Subject: [PATCH 09/10] Force German by default, but keep the language selector for future use --- nginx/default.conf | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/nginx/default.conf b/nginx/default.conf index ebbfa9bd..f7882cf1 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -1,8 +1,11 @@ -map $http_accept_language $accept_language { - ~*^de de; - ~*^fr fr; - ~*^en en; -} + +# Extract default language from the headers +# +# map $http_accept_language $accept_language { +# ~*^de de; +# ~*^fr fr; +# ~*^en en; +# } server { listen 8080; @@ -10,6 +13,9 @@ server { root /usr/share/nginx/html; index index.html; + # Temporarily setting German as default language + set $accept_language "de"; + # Fallback to default language if no preference defined by browser if ($accept_language ~ "^$") { set $accept_language "de"; From 5012b163f2acaa40274103f307c05058c7b3badd Mon Sep 17 00:00:00 2001 From: Andrey Rusakov Date: Wed, 6 Nov 2024 16:51:21 +0100 Subject: [PATCH 10/10] Removed debug output --- src/app/account/orders/order/order.component.html | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/account/orders/order/order.component.html b/src/app/account/orders/order/order.component.html index 30b29887..ff3e2528 100644 --- a/src/app/account/orders/order/order.component.html +++ b/src/app/account/orders/order/order.component.html @@ -3,7 +3,6 @@ (afterExpand)="displayMiniMap()"> - STATIS: {{order?.order_status}}