diff --git a/vue/src/apps/TestView/TestView.vue b/vue/src/apps/TestView/TestView.vue
index 9c7235ad..25a4dd0f 100644
--- a/vue/src/apps/TestView/TestView.vue
+++ b/vue/src/apps/TestView/TestView.vue
@@ -12,13 +12,9 @@
{{ $t('Properties_Food_Amount') }} |
{{ $t('Properties_Food_Unit') }} |
-
-
-
- {{ pt.unit }}
-
-
-
+
+
+ {{ pt.name }} ({{ pt.unit }})
|
@@ -29,26 +25,27 @@
-
+
-
+
|
-
+
|
+ :multiple="false"
+ :disabled="loading"/>
|
-
+
|
@@ -94,7 +91,7 @@ export default {
if (this.recipe !== null && this.property_types !== []) {
this.recipe.steps.forEach(s => {
s.ingredients.forEach(i => {
- let food = {food: i.food, properties: {}}
+ let food = {food: i.food, properties: {}, loading: false}
this.property_types.forEach(pt => {
food.properties[pt.id] = {changed: false, property_amount: 0, property_type: pt}
@@ -121,6 +118,7 @@ export default {
recipe: null,
property_types: [],
editing_property_type: null,
+ loading: false,
}
},
mounted() {
@@ -135,6 +133,17 @@ export default {
apiClient.retrieveRecipe("112").then(result => {
this.recipe = result.data
+ this.loading = false;
+ }).catch((err) => {
+ StandardToasts.makeStandardToast(this, StandardToasts.FAIL_FETCH, err)
+ })
+ },
+ loadPropertyTypes: function () {
+ let apiClient = new ApiApiFactory()
+ apiClient.listPropertyTypes().then(result => {
+ this.property_types = result.data
+ }).catch((err) => {
+ StandardToasts.makeStandardToast(this, StandardToasts.FAIL_FETCH, err)
})
},
updateFood: function (food) {
@@ -145,23 +154,16 @@ export default {
StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err)
})
},
- loadPropertyTypes: function () {
- let apiClient = new ApiApiFactory()
- apiClient.listPropertyTypes().then(result => {
- this.property_types = result.data
- StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE)
- }).catch((err) => {
- StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err)
- })
- },
updateFoodFromFDC: function (food) {
+ this.loading = true;
let apiClient = new ApiApiFactory()
apiClient.fdcFood(food.id).then(result => {
- this.loadRecipe()
StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE)
+ this.loadRecipe()
}).catch((err) => {
StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err)
+ this.loading = false;
})
}
},