From 27b23b7fae81735c6638b73bc2fa8c36f6eaf70e Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 9 Jan 2023 01:01:35 +0100 Subject: [PATCH] Normalize array/dict options for values on EnumSwitch --- .../src/components/panels/Entities/EnumSwitch.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/EnumSwitch.vue b/platypush/backend/http/webapp/src/components/panels/Entities/EnumSwitch.vue index a79554f5..c47bdc11 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/EnumSwitch.vue +++ b/platypush/backend/http/webapp/src/components/panels/Entities/EnumSwitch.vue @@ -32,7 +32,7 @@ :value="value_id" :selected="value_id == value.value" :key="value_id" - v-for="text, value_id in value.values" + v-for="text, value_id in displayValues" v-text="text" /> @@ -60,6 +60,16 @@ export default { computed: { hasValues() { return !!Object.values(this?.value?.values || {}).length + }, + + displayValues() { + if (this.value?.values instanceof Array) + return this.value.values.reduce((obj, value) => { + obj[value] = value + return obj + }, {}) + + return this.value?.values || {} } },