|
33 | 33 | </f7-list>
|
34 | 34 | </f7-block>
|
35 | 35 | <f7-block class="no-margin no-padding" v-else-if="category === 'item'">
|
| 36 | + <f7-list> |
| 37 | + <f7-list-item radio :checked="itemEventType === 'command'" name="MediaEventType" title="send a command to" @click="updateItemEventType('command')" /> |
| 38 | + <f7-list-item radio :checked="itemEventType === 'update'" name="MediaEventType" title="update the state of" @click="updateItemEventType('update')" /> |
| 39 | + </f7-list> |
36 | 40 | <f7-list>
|
37 | 41 | <item-picker :value="currentModule.configuration.itemName" title="Item" @input="(val) => $set(currentModule.configuration, 'itemName', val)" @itemSelected="(value) => { $set(this, 'currentItem', value); updateItemEventType('command') }" />
|
38 | 42 | </f7-list>
|
39 | 43 | <f7-list>
|
40 | 44 | <f7-list-input
|
| 45 | + v-if="itemEventType === 'command'" |
41 | 46 | label="Command to send"
|
42 | 47 | name="command"
|
43 | 48 | type="text"
|
44 | 49 | :value="currentModule.configuration.command"
|
45 | 50 | @blur="(evt) => $set(currentModule.configuration, 'command', evt.target.value)"
|
46 | 51 | />
|
| 52 | + <f7-list-input |
| 53 | + v-else-if="itemEventType === 'update'" |
| 54 | + label="to state" |
| 55 | + name="state" |
| 56 | + type="text" |
| 57 | + :value="currentModule.configuration.state" |
| 58 | + @blur="(evt) => $set(currentModule.configuration, 'state', evt.target.value)" |
| 59 | + /> |
47 | 60 | </f7-list>
|
48 |
| - <f7-list v-if="commandSuggestions.length"> |
| 61 | + <f7-list v-if="itemEventType === 'command' && commandSuggestions.length"> |
49 | 62 | <f7-list-item radio :checked="currentModule.configuration.command === suggestion.command" v-for="suggestion in commandSuggestions" :key="suggestion.command"
|
50 | 63 | :title="suggestion.label" @click="$set(currentModule.configuration, 'command', suggestion.command)" />
|
51 | 64 | </f7-list>
|
52 |
| - <!-- <f7-block v-if="currentItem && (currentItem.type === 'Dimmer' || currentItem.type === 'Rollershutter' || (currentItem.type === 'Number' && currentItem.stateDescription && currentItem.stateDescription.minimum !== undefined))"> |
| 65 | + <!-- <f7-block v-if="itemEventType === 'command' && currentItem && (currentItem.type === 'Dimmer' || currentItem.type === 'Rollershutter' || (currentItem.type === 'Number' && currentItem.stateDescription && currentItem.stateDescription.minimum !== undefined))"> |
53 | 66 | <f7-range :value="currentModule.configuration.command" @range:changed="(val) => $set(currentModule.configuration, 'command', val)"
|
54 | 67 | :min="(currentItem.stateDescription && currentItem.stateDescription.minimum) ? currentItem.stateDescription.minimum : 0"
|
55 | 68 | :max="(currentItem.stateDescription && currentItem.stateDescription.maximum) ? currentItem.stateDescription.maximum : 100"
|
56 | 69 | :step="(currentItem.stateDescription && currentItem.stateDescription.step) ? currentItem.stateDescription.step : 1"
|
57 | 70 | :scale="true" :label="true" :scaleSubSteps="5" />
|
58 | 71 | </f7-block> -->
|
59 |
| - <f7-list v-if="currentItem && currentItem.type === 'Color'" media-list> |
| 72 | + <f7-list v-if="itemEventType === 'command' && currentItem && currentItem.type === 'Color'" media-list> |
60 | 73 | <f7-list-input media-item type="colorpicker" label="Pick a color" :color-picker-params="{
|
61 | 74 | targetEl: '#color-picker-value',
|
62 | 75 | targetElSetBackgroundColor: true,
|
@@ -206,29 +219,34 @@ export default {
|
206 | 219 | this.itemEventType = type
|
207 | 220 | switch (type) {
|
208 | 221 | case 'command':
|
209 |
| - this.$emit('typeSelect', 'core.ItemCommandAction') |
| 222 | + this.$emit('typeSelect', 'core.ItemCommandAction', true) |
| 223 | + if (this.currentItem) this.$set(this.currentModule, 'configuration', Object.assign({}, { itemName: this.currentItem.name })) |
| 224 | + break |
| 225 | + case 'update': |
| 226 | + this.$emit('typeSelect', 'core.ItemStateUpdateAction', true) |
| 227 | + if (this.currentItem) this.$set(this.currentModule, 'configuration', Object.assign({}, { itemName: this.currentItem.name })) |
210 | 228 | break
|
211 | 229 | }
|
212 | 230 | },
|
213 | 231 | updateRulesEventType (type) {
|
214 | 232 | this.rulesEventType = type
|
215 | 233 | switch (type) {
|
216 | 234 | case 'run':
|
217 |
| - this.$emit('typeSelect', 'core.RunRuleAction') |
| 235 | + this.$emit('typeSelect', 'core.RunRuleAction', true) |
218 | 236 | break
|
219 | 237 | case 'enable':
|
220 |
| - this.$emit('typeSelect', 'core.RuleEnablementAction') |
| 238 | + this.$emit('typeSelect', 'core.RuleEnablementAction', true) |
221 | 239 | break
|
222 | 240 | }
|
223 | 241 | },
|
224 | 242 | updateMediaEventType (type) {
|
225 | 243 | this.mediaEventType = type
|
226 | 244 | switch (type) {
|
227 | 245 | case 'say':
|
228 |
| - this.$emit('typeSelect', 'media.SayAction') |
| 246 | + this.$emit('typeSelect', 'media.SayAction', true) |
229 | 247 | break
|
230 | 248 | case 'play':
|
231 |
| - this.$emit('typeSelect', 'media.PlayAction') |
| 249 | + this.$emit('typeSelect', 'media.PlayAction', true) |
232 | 250 | break
|
233 | 251 | }
|
234 | 252 | },
|
|
0 commit comments