Colour propery box on input, flash green on update, only modal notify if value is not set exactly
This commit is contained in:
parent
80ee303ac9
commit
212b8fe062
3 changed files with 90 additions and 9 deletions
|
|
@ -3,8 +3,10 @@
|
|||
v-model="value"
|
||||
:data-schema="propertyDescription"
|
||||
:label="label"
|
||||
:animate="animate"
|
||||
@requestUpdate="readProperty"
|
||||
@sendValue="writeProperty"
|
||||
@animationShown="resetAnimate"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
|
@ -45,7 +47,8 @@ export default {
|
|||
|
||||
data() {
|
||||
return {
|
||||
value: undefined
|
||||
value: undefined,
|
||||
animate: false
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -98,14 +101,15 @@ export default {
|
|||
await new Promise(r => setTimeout(r, this.readBackDelay));
|
||||
let newVal = await this.readProperty();
|
||||
if (newVal == requestedValue) {
|
||||
await this.modalNotify(`Set ${this.label} to ${newVal}.`);
|
||||
this.animate = true;
|
||||
} else {
|
||||
this.animate = true;
|
||||
await this.modalNotify(
|
||||
`Set ${this.label} to ${newVal} (requested ${requestedValue}).`
|
||||
`Set ${this.label} to ${newVal} (closest valid value to requested ${requestedValue}).`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
await this.modalNotify(`Set ${this.label} to ${this.value}.`);
|
||||
this.animate = true;
|
||||
}
|
||||
} catch (error) {
|
||||
// Use mixin to display error
|
||||
|
|
@ -113,6 +117,9 @@ export default {
|
|||
// Re-read property to try to update to server value
|
||||
this.readProperty();
|
||||
}
|
||||
},
|
||||
resetAnimate: function() {
|
||||
this.animate = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue