diff --git a/webapp/src/components/labThingsComponents/inputFromSchema.vue b/webapp/src/components/labThingsComponents/inputFromSchema.vue index 32f78f63..39a492fa 100644 --- a/webapp/src/components/labThingsComponents/inputFromSchema.vue +++ b/webapp/src/components/labThingsComponents/inputFromSchema.vue @@ -6,14 +6,14 @@ - - refresh - +
@@ -27,9 +27,7 @@ /> {{ label }} - - refresh - +
@@ -83,9 +83,15 @@ @@ -217,11 +284,16 @@ export default { margin-right: 5px; width: 6em; } -.button-next-to-input { - flex-grow: 0; - padding-left: 5px; - padding-right: 5px; - vertical-align: middle; - cursor: pointer; +.edited { + background-color: #fff3cd; +} +@keyframes green-flash { + 0% { background-color: #3fda63; } + 100% { background-color: white; } +} +.flash { + animation: green-flash 0.7s ease; + /*Without this background-colour chrome will ignore the animation colour.*/ + background-color: white; } diff --git a/webapp/src/components/labThingsComponents/propertyControl.vue b/webapp/src/components/labThingsComponents/propertyControl.vue index 1ed1b477..e9bc99c2 100644 --- a/webapp/src/components/labThingsComponents/propertyControl.vue +++ b/webapp/src/components/labThingsComponents/propertyControl.vue @@ -3,8 +3,10 @@ v-model="value" :data-schema="propertyDescription" :label="label" + :animate="animate" @requestUpdate="readProperty" @sendValue="writeProperty" + @animationShown="resetAnimate" /> @@ -45,7 +47,8 @@ export default { data() { return { - value: undefined + value: undefined, + animate: false }; }, @@ -98,18 +101,25 @@ 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) { - this.modalError(error); // Let mixin handle error + // Use mixin to display error + this.modalError(error); + // Re-read property to try to update to server value + this.readProperty(); } + }, + resetAnimate: function() { + this.animate = false; } } }; diff --git a/webapp/src/components/labThingsComponents/syncPropertyButton.vue b/webapp/src/components/labThingsComponents/syncPropertyButton.vue new file mode 100644 index 00000000..4fd11d18 --- /dev/null +++ b/webapp/src/components/labThingsComponents/syncPropertyButton.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/webapp/src/components/tabContentComponents/backgroundDetectComponents/paneBackgroundDetect.vue b/webapp/src/components/tabContentComponents/backgroundDetectComponents/paneBackgroundDetect.vue index f7e4abdd..2e7f1eba 100644 --- a/webapp/src/components/tabContentComponents/backgroundDetectComponents/paneBackgroundDetect.vue +++ b/webapp/src/components/tabContentComponents/backgroundDetectComponents/paneBackgroundDetect.vue @@ -10,8 +10,10 @@ v-model="backgroundDetectorStatus.settings" :data-schema="backgroundDetectorStatus.settings_schema" label="" + :animate="animate" @requestUpdate="readSettings" @sendValue="writeSettings" + @animationShown="resetAnimate" /> @@ -57,6 +59,7 @@ export default { data() { return { backgroundDetectorStatus: undefined, + animate: false }; }, @@ -87,6 +90,11 @@ export default { "update_detector_settings", {"data": requestedValue} ); + this.animate = true; + this.readSettings(); + }, + resetAnimate: function() { + this.animate = false; } }, async created() { diff --git a/webapp/src/components/tabContentComponents/controlComponents/paneControl.vue b/webapp/src/components/tabContentComponents/controlComponents/paneControl.vue index 1bb601a4..b4e57b2b 100644 --- a/webapp/src/components/tabContentComponents/controlComponents/paneControl.vue +++ b/webapp/src/components/tabContentComponents/controlComponents/paneControl.vue @@ -85,9 +85,7 @@ type="number" @keyup.enter="startMoveTask" /> - - refresh - +

import axios from "axios"; import ActionButton from "../../labThingsComponents/actionButton.vue"; +import syncPropertyButton from "../../labThingsComponents/syncPropertyButton.vue"; // Export main app export default { name: "PaneControl", components: { - ActionButton + ActionButton, + syncPropertyButton }, data: function() { @@ -375,11 +375,4 @@ export default { -webkit-appearance: none; margin: 0; } -.button-next-to-input { - flex-grow: 0; - padding-left: 5px; - padding-right: 5px; - vertical-align: middle; - cursor: pointer; -}