From 6577376642bb9f109fa6c31f5dcd779de10059e5 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sat, 11 Jul 2020 19:42:38 +0300 Subject: [PATCH] Move rendering Crontab settings to Editable keywords after updating its type --- src/store/modules/normalizers.js | 18 ++-- src/views/settings/components/Inputs.vue | 3 - .../inputComponents/CrontabInput.vue | 86 ------------------- .../inputComponents/EditableKeywordInput.vue | 39 ++++++++- .../components/inputComponents/index.js | 1 - 5 files changed, 47 insertions(+), 100 deletions(-) delete mode 100644 src/views/settings/components/inputComponents/CrontabInput.vue diff --git a/src/store/modules/normalizers.js b/src/store/modules/normalizers.js index 927d3d65..2fec92ab 100644 --- a/src/store/modules/normalizers.js +++ b/src/store/modules/normalizers.js @@ -93,14 +93,16 @@ 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] === ':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)}` }}] - }, []) - } else if (item.tuple[0] === ':crontab') { - accum[item.tuple[0]] = item.tuple[1].reduce((acc, group) => { - return { ...acc, [group.tuple[1]]: group.tuple[0] } - }, {}) + (item.tuple[0] === ':groups' || item.tuple[0] === ':replace' || item.tuple[0] === ':retries' || item.tuple[0] === ':headers' || item.tuple[0] === ':params' || item.tuple[0] === ':crontab')) { + if (item.tuple[0] === ':crontab') { + accum[item.tuple[0]] = item.tuple[1].reduce((acc, group) => { + return [...acc, { [group.tuple[1]]: { value: group.tuple[0], id: `f${(~~(Math.random() * 1e8)).toString(16)}` }}] + }, []) + } else { + 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)}` }}] + }, []) + } } else if (item.tuple[0] === ':match_actor') { accum[item.tuple[0]] = Object.keys(item.tuple[1]).reduce((acc, regex) => { return [...acc, { [regex]: { value: item.tuple[1][regex], id: `f${(~~(Math.random() * 1e8)).toString(16)}` }}] diff --git a/src/views/settings/components/Inputs.vue b/src/views/settings/components/Inputs.vue index ef4bf246..0ba74f55 100644 --- a/src/views/settings/components/Inputs.vue +++ b/src/views/settings/components/Inputs.vue @@ -95,7 +95,6 @@ - @@ -122,7 +121,6 @@ import i18n from '@/lang' import { AutoLinkerInput, - CrontabInput, EditableKeywordInput, IconsInput, MascotsInput, @@ -140,7 +138,6 @@ export default { name: 'Inputs', components: { AutoLinkerInput, - CrontabInput, EditableKeywordInput, IconsInput, MascotsInput, diff --git a/src/views/settings/components/inputComponents/CrontabInput.vue b/src/views/settings/components/inputComponents/CrontabInput.vue deleted file mode 100644 index 89a14915..00000000 --- a/src/views/settings/components/inputComponents/CrontabInput.vue +++ /dev/null @@ -1,86 +0,0 @@ - - - - - diff --git a/src/views/settings/components/inputComponents/EditableKeywordInput.vue b/src/views/settings/components/inputComponents/EditableKeywordInput.vue index ff641756..6939547a 100644 --- a/src/views/settings/components/inputComponents/EditableKeywordInput.vue +++ b/src/views/settings/components/inputComponents/EditableKeywordInput.vue @@ -1,6 +1,15 @@