Skip to content

Commit

Permalink
Use extra picker for dimension
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
  • Loading branch information
florian-h05 committed Oct 9, 2023
1 parent 17bccd7 commit a5b161d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
23 changes: 13 additions & 10 deletions bundles/org.openhab.ui/web/src/components/item/group-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
<f7-list inline-labels no-hairlines-md>
<f7-list-item v-if="item.type === 'Group'" title="Members Base Type" smart-select :smart-select-params="{openIn: 'popup', closeOnSelect: true}">
<select name="select-basetype" @change="setGroupType($event.target.value)">
<optgroup label="Basic Types">
<option v-for="type in types.GroupTypes" :key="type" :value="type" :selected="type === item.groupType">
{{ type }}
</option>
</optgroup>
<optgroup label="Numbers with Dimensions">
<option v-for="dimension in dimensions" :key="dimension.name" :value="'Number:' + dimension.name" :selected="item.groupType === 'Number:' + dimension.name">
{{ 'Number:' + dimension.label }}
</option>
</optgroup>
<option v-for="type in types.GroupTypes" :key="type" :value="type" :selected="type === item.groupType.split(':')[0]">
{{ type }}
</option>
</select>
</f7-list-item>
<f7-list-item v-if="dimensions.length && item.groupType && item.groupType.startsWith('Number')" title="Dimension" type="text" smart-select :smart-select-params="{searchbar: true, openIn: 'popup', closeOnSelect: true}">
<select name="select-dimension" @change="setGroupType($event.target.value)">
<option key="Number" value="Number" :selected="item.type === 'Number'">
&nbsp;
</option>
<option v-for="d in dimensions" :key="d.name" :value="'Number:' + d.name" :selected="'Number:' + d.name === item.groupType">
{{ d.label }}
</option>
</select>
</f7-list-item>
<f7-list-item key="function-picker-arithmetic" v-if="item.type === 'Group' && item.groupType && (['Dimmer', 'Rollershutter'].indexOf(item.groupType) >= 0 || item.groupType.indexOf('Number') === 0)" title="Aggregation Function" smart-select :smart-select-params="{openIn: 'popover', closeOnSelect: true}">
Expand Down
23 changes: 13 additions & 10 deletions bundles/org.openhab.ui/web/src/components/item/item-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@
@input="item.label = $event.target.value" clear-button />
<f7-list-item v-if="item.type && !hideType" title="Type" type="text" smart-select :smart-select-params="{searchbar: true, openIn: 'popup', closeOnSelect: true}">
<select name="select-type" @change="item.type = $event.target.value">
<optgroup label="Basic Types">
<option v-for="type in types.ItemTypes" :key="type" :value="type" :selected="type === item.type">
{{ type }}
</option>
</optgroup>
<optgroup label="Numbers with Dimensions">
<option v-for="dimension in dimensions" :key="dimension.name" :value="'Number:' + dimension.name" :selected="item.type === 'Number:' + dimension.name">
{{ 'Number:' + dimension.label }}
</option>
</optgroup>
<option v-for="t in types.ItemTypes" :key="t" :value="t" :selected="t === item.type.split(':')[0]">
{{ t }}
</option>
</select>
</f7-list-item>
<f7-list-item v-if="dimensions.length && item.type && !hideType && item.type.startsWith('Number')" title="Dimension" type="text" smart-select :smart-select-params="{searchbar: true, openIn: 'popup', closeOnSelect: true}">
<select name="select-dimension" @change="item.type = $event.target.value">
<option key="Number" value="Number" :selected="item.type === 'Number'">
&nbsp;
</option>
<option v-for="d in dimensions" :key="d.name" :value="'Number:' + d.name" :selected="'Number:' + d.name === item.type">
{{ d.label }}
</option>
</select>
</f7-list-item>
<f7-list-input v-if="!hideCategory" ref="category" label="Category" autocomplete="off" type="text" placeholder="temperature, firstfloor..." :value="item.category"
Expand Down

0 comments on commit a5b161d

Please sign in to comment.