From 0ccb8c06d6150320d7c1a03dd3b08cf059c6c574 Mon Sep 17 00:00:00 2001 From: Henry Taeschner Date: Mon, 22 Jan 2024 07:11:24 +0100 Subject: [PATCH] fix: minor code issues --- src/app/app.component.ts | 1 + .../product-detail/product-detail.component.html | 2 +- .../product-detail/product-detail.component.ts | 11 +++++++---- .../product.detail.component.spec.ts | 2 +- .../product-search/product-search.component.html | 3 ++- src/assets/i18n/de.json | 16 +++++++++++++--- src/assets/i18n/en.json | 16 +++++++++++++--- 7 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 260fa1f..bb7b23b 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core' + @Component({ selector: 'ps-root', templateUrl: './app.component.html' diff --git a/src/app/product-store/product-detail/product-detail.component.html b/src/app/product-store/product-detail/product-detail.component.html index 227954b..4a499b5 100644 --- a/src/app/product-store/product-detail/product-detail.component.html +++ b/src/app/product-store/product-detail/product-detail.component.html @@ -10,7 +10,7 @@
- +
diff --git a/src/app/product-store/product-detail/product-detail.component.ts b/src/app/product-store/product-detail/product-detail.component.ts index a1f6f20..6aeb9da 100644 --- a/src/app/product-store/product-detail/product-detail.component.ts +++ b/src/app/product-store/product-detail/product-detail.component.ts @@ -46,7 +46,6 @@ export class ProductDetailComponent implements OnInit { } ngOnInit(): void { - console.log('product detail ngOnInit()') if (this.productName !== '') { this.changeMode = 'VIEW' this.loadProduct() @@ -75,9 +74,10 @@ export class ProductDetailComponent implements OnInit { this.prepareTranslations() }, error: (err: any) => { + console.error('search: ', err) this.msgService.error({ - summaryKey: 'DIALOG.LOAD_ERROR' - // detailKey: err.error.indexOf('was not found') > 1 ? 'DIALOG.NOT_FOUND' : err.error + summaryKey: 'ACTIONS.SEARCH.PRODUCT.LOAD_ERROR' + // detailKey: err.error.indexOf('was not found') > 1 ? 'SEARCH.NOT_FOUND' : err.error }) this.close() } @@ -196,6 +196,7 @@ export class ProductDetailComponent implements OnInit { public onClose() { this.close() } + public onEdit() { this.getProduct() this.changeMode = 'EDIT' @@ -214,13 +215,14 @@ export class ProductDetailComponent implements OnInit { public onSave() { this.productPropsComponent.onSubmit() } + public onCreate(data: any) { this.product = data this.changeMode = 'VIEW' this.router.navigate(['./../', this.product?.name], { relativeTo: this.route }) } + public onChange(nameChanged: boolean) { - console.log('detail.onChange ') if (nameChanged) { this.close() } else { @@ -229,6 +231,7 @@ export class ProductDetailComponent implements OnInit { this.prepareTranslations() } } + public onDelete(ev: MouseEvent, item: Product): void { ev.stopPropagation() this.product = item diff --git a/src/app/product-store/product-detail/product.detail.component.spec.ts b/src/app/product-store/product-detail/product.detail.component.spec.ts index 89cc3e5..ec1e488 100644 --- a/src/app/product-store/product-detail/product.detail.component.spec.ts +++ b/src/app/product-store/product-detail/product.detail.component.spec.ts @@ -97,7 +97,7 @@ describe('ProductDetailComponent', () => { component.ngOnInit() expect(msgServiceSpy.error).toHaveBeenCalledWith({ - summaryKey: 'DIALOG.LOAD_ERROR' + summaryKey: 'ACTIONS.SEARCH.PRODUCT.LOAD_ERROR' }) }) diff --git a/src/app/product-store/product-search/product-search.component.html b/src/app/product-store/product-search/product-search.component.html index 4372ce4..6d870bb 100644 --- a/src/app/product-store/product-search/product-search.component.html +++ b/src/app/product-store/product-search/product-search.component.html @@ -20,7 +20,7 @@
- +