Skip to content

Commit

Permalink
Testing feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
edwh committed Aug 1, 2022
1 parent 34fd7f6 commit e51a470
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
15 changes: 14 additions & 1 deletion resources/js/components/DeviceCategorySelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
ref="multiselect"
@select=""
:selectedLabel="allowEmpty ? __('partials.remove') : null"
@open="onOpen"
>
</multiselect>
<div v-b-popover.html.left="__('devices.tooltip_category')" class="ml-3 mt-2">
Expand All @@ -28,7 +29,6 @@
</div>
</template>
<script>
import { CATEGORY_MISC } from '../constants'
export default {
Expand Down Expand Up @@ -120,6 +120,19 @@ export default {
return ret
},
},
methods: {
onOpen() {
this.$emit('open')
const select = this.$refs.multiselect
let position = select.filteredOptions.findIndex(
option => option[select.trackBy] === select.value[select.trackBy]
)
select.pointerSet(position)
this.$nextTick(() => {
select.$refs.list.scrollTop = select.pointerPosition
})
},
}
}
</script>
Expand Down
11 changes: 8 additions & 3 deletions resources/js/components/DeviceType.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="w-100 device-select-row">
<vue-typeahead-bootstrap v-model="currentType" :maxMatches="5" :data="suggestions" :minMatchingChars="1" size="lg" inputClass="marg form-control-lg" :disabled="disabled" :placeholder="__('devices.item_type')" @input="input" />
<vue-typeahead-bootstrap v-model="currentType" :maxMatches="5" :data="suggestions" :minMatchingChars="1" size="lg" inputClass="marg form-control-lg" :disabled="disabled" :placeholder="__('devices.item_type')" @hit="emit" />
<div v-b-popover.html.left="translatedTooltip" class="ml-3 mt-2">
<b-img class="icon clickable" src="/icons/info_ico_black.svg" v-if="iconVariant === 'black'" />
<b-img class="icon clickable" src="/icons/info_ico_green.svg" v-else />
Expand Down Expand Up @@ -100,13 +100,18 @@ export default {
type(newVal) {
this.currentType = newVal
},
currentType(newVal) {
if (!newVal.length) {
this.$emit('update:type', null)
}
},
unknownType(newVal) {
this.$emit('update:unknown', newVal)
}
},
methods: {
input(e) {
this.$emit('update:type', e)
emit() {
this.$emit('update:type', this.currentType)
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion resources/js/components/EventDevice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
'mb-2': true,
'border-thick': missingCategory,
'pulsate': pulsating,
}" :category.sync="currentDevice.category" :clusters="clusters" :powered="powered"
}" :category.sync="currentDevice.category" :clusters="clusters" :powered="powered" :key="currentDevice.item_type"
@open="pulsating = false"
:icon-variant="add ? 'black' : 'brand'" :disabled="disabled" @changed="categoryChange"/>

<DeviceBrand class="mb-2" :brand.sync="currentDevice.brand" :brands="brands" :disabled="disabled"
Expand Down Expand Up @@ -202,6 +203,8 @@ export default {
setTimeout(() => {
this.pulsating = false
}, 5000)
} else {
this.currentDevice.category = null
}
}
},
Expand Down

0 comments on commit e51a470

Please sign in to comment.