You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2021/09/16 20:54:33 UTC
[airavata-django-portal] branch master updated: AIRAVATA-3509 When
parsed slider value changes, update the value
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
The following commit(s) were added to refs/heads/master by this push:
new ce2da1d AIRAVATA-3509 When parsed slider value changes, update the value
ce2da1d is described below
commit ce2da1dfae84f856e3c74c635faaa1eaa89d5ea2
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Sep 16 16:54:14 2021 -0400
AIRAVATA-3509 When parsed slider value changes, update the value
---
.../experiment/input-editors/RangeSliderInputEditor.vue | 15 +++++++++++----
.../experiment/input-editors/SliderInputEditor.vue | 15 +++++++++++----
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/RangeSliderInputEditor.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/RangeSliderInputEditor.vue
index dfa4fdc..8276bb2 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/RangeSliderInputEditor.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/RangeSliderInputEditor.vue
@@ -34,8 +34,7 @@ export default {
};
},
created() {
- // computed properties are only available at *created* step of lifecycle
- this.sliderValues = this.parseValue(this.value);
+ this.initializeSliderValues();
},
computed: {
min: function () {
@@ -54,6 +53,14 @@ export default {
},
},
methods: {
+ initializeSliderValues() {
+ this.sliderValues = this.parseValue(this.data);
+ // If parsing the value resulted in it changing (failed to parse so
+ // initialized to ['min', 'max']), update the value
+ if (this.data !== this.formatValue(this.sliderValues)) {
+ this.onChange(this.sliderValues);
+ }
+ },
parseValue(value) {
// Just remove any percentage signs
const result = value
@@ -87,8 +94,8 @@ export default {
},
},
watch: {
- data(newValue) {
- this.sliderValues = this.parseValue(newValue);
+ data() {
+ this.initializeSliderValues();
},
},
};
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/SliderInputEditor.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/SliderInputEditor.vue
index 82b8d7f..0c2b0c9 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/SliderInputEditor.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/SliderInputEditor.vue
@@ -33,8 +33,7 @@ export default {
};
},
created() {
- // computed properties are only available at *created* step of lifecycle
- this.sliderValue = this.parseValue(this.value);
+ this.initializeSliderValue();
},
computed: {
min: function () {
@@ -48,6 +47,14 @@ export default {
},
},
methods: {
+ initializeSliderValue() {
+ this.sliderValue = this.parseValue(this.data);
+ // If parsing the value resulted in it changing (failed to parse so
+ // initialized to the 'min'), update the value
+ if (this.data !== this.formatValue(this.sliderValue)) {
+ this.onChange(this.sliderValue);
+ }
+ },
parseValue(value) {
// Just remove any percentage signs
const result = parseInt(value.replaceAll("%", ""));
@@ -75,8 +82,8 @@ export default {
},
},
watch: {
- data(newValue) {
- this.sliderValue = this.parseValue(newValue);
+ data() {
+ this.initializeSliderValue();
},
},
};