Run lint:fix and accept a huge formatting change
This commit is contained in:
parent
3900c3e1ad
commit
c085d2c0ac
68 changed files with 756 additions and 1047 deletions
|
|
@ -18,58 +18,56 @@ export default {
|
|||
name: "PropertyControl",
|
||||
|
||||
components: {
|
||||
InputFromSchema
|
||||
InputFromSchema,
|
||||
},
|
||||
|
||||
props: {
|
||||
label: {
|
||||
type: String,
|
||||
default: ""
|
||||
default: "",
|
||||
},
|
||||
propertyName: {
|
||||
type: String,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
thingName: {
|
||||
type: String,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
readBack: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
readBackDelay: {
|
||||
type: Number,
|
||||
default: 1000,
|
||||
required: false
|
||||
}
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
value: undefined,
|
||||
animate: false
|
||||
animate: false,
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
propertyDescription: function() {
|
||||
try {
|
||||
return this.thingDescription(this.thingName).properties[
|
||||
this.propertyName
|
||||
];
|
||||
return this.thingDescription(this.thingName).properties[this.propertyName];
|
||||
} catch (error) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
propertyDescription: function() {
|
||||
// Ensure we read the property once the URL is known
|
||||
this.readProperty();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
mounted: function() {
|
||||
|
|
@ -83,21 +81,14 @@ export default {
|
|||
|
||||
methods: {
|
||||
readProperty: async function() {
|
||||
let data = await this.readThingProperty(
|
||||
this.thingName,
|
||||
this.propertyName
|
||||
);
|
||||
let data = await this.readThingProperty(this.thingName, this.propertyName);
|
||||
this.value = data;
|
||||
return data;
|
||||
},
|
||||
writeProperty: async function(requestedValue) {
|
||||
try {
|
||||
this.value=requestedValue;
|
||||
await this.writeThingProperty(
|
||||
this.thingName,
|
||||
this.propertyName,
|
||||
requestedValue
|
||||
);
|
||||
this.value = requestedValue;
|
||||
await this.writeThingProperty(this.thingName, this.propertyName, requestedValue);
|
||||
if (this.readBack) {
|
||||
await new Promise(r => setTimeout(r, this.readBackDelay));
|
||||
let newVal = await this.readProperty();
|
||||
|
|
@ -106,7 +97,9 @@ export default {
|
|||
} else {
|
||||
this.animate = true;
|
||||
await this.modalNotify(
|
||||
`Set ${this.label} to ${formatValue(newVal)} (closest valid value to requested ${formatValue(requestedValue)}).`
|
||||
`Set ${this.label} to ${formatValue(
|
||||
newVal,
|
||||
)} (closest valid value to requested ${formatValue(requestedValue)}).`,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -120,9 +113,9 @@ export default {
|
|||
}
|
||||
},
|
||||
resetAnimate: function() {
|
||||
this.animate = false;
|
||||
}
|
||||
}
|
||||
this.animate = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue