From f34157b1db1141f55db0ae6b8f0276ba893f3f14 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Fri, 10 Jul 2020 02:22:23 +0300 Subject: [PATCH] Add ability to wrap and parse nested settings in keyword inputs --- src/store/modules/normalizers.js | 2 +- src/views/settings/components/Inputs.vue | 5 ++- .../inputComponents/EditableKeywordInput.vue | 32 +++++++++++++++++-- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/store/modules/normalizers.js b/src/store/modules/normalizers.js index e4eb8816..927d3d65 100644 --- a/src/store/modules/normalizers.js +++ b/src/store/modules/normalizers.js @@ -93,7 +93,7 @@ export const parseTuples = (tuples, key) => { return [...acc, { [mascot.tuple[0]]: { ...mascot.tuple[1], id: `f${(~~(Math.random() * 1e8)).toString(16)}` }}] }, []) } else if (Array.isArray(item.tuple[1]) && - (item.tuple[0] === ':groups' || item.tuple[0] === ':replace' || item.tuple[0] === ':retries' || item.tuple[0] === ':headers')) { + (item.tuple[0] === ':groups' || item.tuple[0] === ':replace' || item.tuple[0] === ':retries' || item.tuple[0] === ':headers' || item.tuple[0] === ':params')) { accum[item.tuple[0]] = item.tuple[1].reduce((acc, group) => { return [...acc, { [group.tuple[0]]: { value: group.tuple[1], id: `f${(~~(Math.random() * 1e8)).toString(16)}` }}] }, []) diff --git a/src/views/settings/components/Inputs.vue b/src/views/settings/components/Inputs.vue index 44ee957f..52cce435 100644 --- a/src/views/settings/components/Inputs.vue +++ b/src/views/settings/components/Inputs.vue @@ -96,7 +96,7 @@ - + @@ -254,6 +254,9 @@ export default { } }, keywordData() { + if (this.settingParent.length > 0) { + return Array.isArray(this.data[this.setting.key]) ? this.data[this.setting.key] : [] + } return Array.isArray(this.data) ? this.data : [] }, reducedSelects() { diff --git a/src/views/settings/components/inputComponents/EditableKeywordInput.vue b/src/views/settings/components/inputComponents/EditableKeywordInput.vue index 76002dd7..a364b3ce 100644 --- a/src/views/settings/components/inputComponents/EditableKeywordInput.vue +++ b/src/views/settings/components/inputComponents/EditableKeywordInput.vue @@ -36,6 +36,8 @@