From c7f69f3f2d47ee397fdd7cdc8e98dbe85210023b Mon Sep 17 00:00:00 2001 From: Hubert Nusser Date: Sat, 5 Jun 2021 19:58:50 +0200 Subject: [PATCH] Set current item from selected name, fixes #1079 Signed-off-by: Hubert Nusser --- .../web/src/pages/settings/things/link/link-add.vue | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/pages/settings/things/link/link-add.vue b/bundles/org.openhab.ui/web/src/pages/settings/things/link/link-add.vue index d3388fd1aa..5cd902c3a6 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/things/link/link-add.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/things/link/link-add.vue @@ -158,7 +158,6 @@ export default { channelUID: null, configuration: {} }, - selectedItem: null, selectedItemName: null, selectedThingId: '', selectedThing: {}, @@ -183,10 +182,10 @@ export default { }, computed: { currentItem () { - return this.item ? this.item : this.createItem ? this.newItem : this.selectedItemName + return this.item ? this.item : this.createItem ? this.newItem : this.items.find(item => item.name === this.selectedItemName) }, compatibleProfileTypes () { - let currentItemType = this.currentItem ? this.currentItem.type : null + let currentItemType = this.currentItem && this.currentItem.type ? this.currentItem.type : '' return this.profileTypes.filter(p => !p.supportedItemTypes.length || p.supportedItemTypes.includes(currentItemType.split(':', 1)[0])) } }, @@ -251,13 +250,7 @@ export default { link.channelUID = this.selectedChannel.uid } - if (this.item) { - link.itemName = this.item.name - } else if (this.createItem) { - link.itemName = this.newItem.name - } else if (this.selectedItemName) { - link.itemName = this.selectedItemName - } + link.itemName = this.currentItem.name link.configuration = Object.assign({}, this.configuration) if (this.currentProfileType) {