From f21648386b71cddc2313abb1778ffa7483f4818c Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Wed, 8 Jan 2020 14:43:24 +0100 Subject: [PATCH] AW-823 implementcorrect editor navigation --- .../selected-item/selected-item.component.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/projects/common-map/src/fm-map/components/selected-item/selected-item.component.ts b/projects/common-map/src/fm-map/components/selected-item/selected-item.component.ts index 9efc52c..aee61ee 100644 --- a/projects/common-map/src/fm-map/components/selected-item/selected-item.component.ts +++ b/projects/common-map/src/fm-map/components/selected-item/selected-item.component.ts @@ -15,19 +15,21 @@ export abstract class AbstractSelectedItemComponent { } handleOnView(item: IItem) { - var itemType = this.itemTypeService.itemTypes[item.itemType]; - if (itemType) { - if (itemType.viewer) { - let url = `/viewer/${itemType.viewer}/item/${item.code}`; - this.router.navigate([url]); - } + if (this.itemTypeService.hasViewer(item)) { + let viewer = this.itemTypeService.itemTypes[item.itemType]; + let url = `/viewer/${viewer}/item/${item.code}`; + this.router.navigate([url]); } return false; } - handleOnEdit(item: IItem) { - let url = `/editor/property/item/${item.code}`; - this.router.navigate([url]); + handleOnEdit(item: IItem) { + var editor = "property"; + if(this.itemTypeService.hasEditor(item)) { + editor = this.itemTypeService.itemTypes[item.itemType].editor; + } + let url = `/editor/${editor}/item/${item.code}` + this.router.navigate([url]); return false; }