8080 ></v-select >
8181 </v-flex >
8282
83- <v-layout row >
84- <v-flex >
83+ <v-flex v-if =" selected.returnType === 'BOOLEAN'" >
84+ <v-layout row >
85+ <v-text-field
86+ v-model =" selected.boolOn"
87+ label =" On state label"
88+ :disabled =" selected.action=='REMOVE'"
89+ @input =" characteristicChanged()"
90+ />
91+ <v-text-field
92+ v-model =" selected.boolOff"
93+ label =" Off state label"
94+ :disabled =" selected.action=='REMOVE'"
95+ @input =" characteristicChanged()"
96+ />
97+ </v-layout >
98+ </v-flex >
99+ <v-flex >
85100 <v-checkbox
86101 v-model =" selected.writable"
87102 :disabled =" selected.action=='REMOVE'"
88- @change =" characteristicChanged ()"
103+ @change =" writableClicked ()"
89104 label =" Writable"
90105 ></v-checkbox >
91- </v-flex >
106+ </v-flex >
107+
108+ <v-flex v-if =" selected.writable" >
109+ <v-text-field
110+ v-model =" selected.cmdTopic"
111+ label =" Write command topic"
112+ :disabled =" selected.action=='REMOVE'"
113+ @input =" characteristicChanged()"
114+ />
115+ </v-flex >
116+ <v-layout row >
117+
92118 <v-flex v-if =" selected.icon" >
93119 Icon:
94120 <v-img
@@ -168,7 +194,7 @@ export default {
168194 title: String ,
169195 deleteButton: Boolean ,
170196 sensor: Object ,
171- createNew: Boolean
197+ createNew: Boolean ,
172198 },
173199
174200 watch: {
@@ -178,7 +204,7 @@ export default {
178204 if (! this .mSensor .transforms ) {
179205 this .$set (this .mSensor , " transforms" , []);
180206 }
181- }
207+ },
182208 },
183209 data () {
184210 return {
@@ -207,7 +233,7 @@ export default {
207233 " switch" ,
208234 " wallswitch" ,
209235 " washingmachine" ,
210- " window"
236+ " window" ,
211237 ],
212238
213239 intIcons: [
@@ -221,22 +247,22 @@ export default {
221247 " light" ,
222248 " qualityofservice" ,
223249 " rollershutter" ,
224- " sewerage"
225- ]
250+ " sewerage" ,
251+ ],
226252 };
227253 },
228254 mounted () {
229255 if (! this .mSensor .transforms ) {
230256 this .$set (this .mSensor , " transforms" , []);
231257 }
232- for (let transform of this .mSensor .transforms ) {
258+ for (const transform of this .mSensor .transforms ) {
233259 this .$set (transform, " action" , " " );
234260 }
235261 },
236262 methods: {
237263 onSelect (transform ) {
238264 this .selected = transform;
239- this .selectedBackup = clonedeep (transform)
265+ this .selectedBackup = clonedeep (transform);
240266 },
241267 saveClicked () {
242268 this .inProgress = true ;
@@ -253,11 +279,11 @@ export default {
253279 JSON .stringify (this .mSensor ),
254280 {
255281 headers: {
256- " Content-Type" : " application/json"
257- }
258- }
282+ " Content-Type" : " application/json" ,
283+ },
284+ },
259285 )
260- .then (response => {
286+ .then (( response ) => {
261287 this .inProgress = false ;
262288 if (response .status === 201 ) {
263289 this .$emit (" refresh" );
@@ -271,17 +297,17 @@ export default {
271297 JSON .stringify (this .mSensor ),
272298 {
273299 headers: {
274- " Content-Type" : " application/json"
275- }
276- }
300+ " Content-Type" : " application/json" ,
301+ },
302+ },
277303 )
278- .then (response => {
304+ .then (( response ) => {
279305 this .inProgress = false ;
280306 if (response .status === 200 ) {
281307 this .$emit (" refresh" );
282308 }
283309 })
284- .catch (error => {
310+ .catch (( error ) => {
285311 this .inProgress = false ;
286312 this .error = ` ${ error .response .status } - ${
287313 error .response .statusText
@@ -292,7 +318,7 @@ export default {
292318 this .inProgress = true ;
293319 axios
294320 .delete (` ${ process .env .VUE_APP_URL } /remove_sensor/${ this .mSensor .id } ` )
295- .then (response => {
321+ .then (( response ) => {
296322 this .inProgress = false ;
297323 if (response .status === 200 ) {
298324 this .$emit (" refresh" );
@@ -305,7 +331,7 @@ export default {
305331 if (this .selected .action === " ADD" ) {
306332 this .mSensor .transforms .splice (index, 1 );
307333 } else {
308- this .selected .action = " REMOVE" ;
334+ this .selected .action = " REMOVE" ;
309335 }
310336 },
311337 cancelUpdateClicked () {
@@ -322,6 +348,12 @@ export default {
322348 this .selected .action = " UPDATE" ;
323349 }
324350 },
351+ writableClicked (){
352+ if (this .selected .writable === false ){
353+ this .selected .cmdTopic = null ;
354+ }
355+ this .characteristicChanged ();
356+ },
325357 getBooleanIcon (name ) {
326358 return ` icons/booleanIcons/${ name} -true.png` ;
327359 },
@@ -342,8 +374,8 @@ export default {
342374 this .selected .icon = icon;
343375 this .chooseIcon = false ;
344376 this .characteristicChanged ();
345- }
346- }
377+ },
378+ },
347379};
348380 </script >
349381<style lang="scss" scoped>
0 commit comments