Skip to content

Commit

Permalink
Set current item from selected name, fixes openhab#1079 (openhab#1093)
Browse files Browse the repository at this point in the history
Signed-off-by: Hubert Nusser <[email protected]>
Signed-off-by: Boris Krivonog <[email protected]>
  • Loading branch information
hubsif authored and crnjan committed Jun 9, 2021
1 parent 03135bd commit 7723ef6
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ export default {
channelUID: null,
configuration: {}
},
selectedItem: null,
selectedItemName: null,
selectedThingId: '',
selectedThing: {},
Expand All @@ -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]))
}
},
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 7723ef6

Please sign in to comment.