diff --git a/src/store/modules/normalizers.js b/src/store/modules/normalizers.js index f2aaa9b5..3822f96f 100644 --- a/src/store/modules/normalizers.js +++ b/src/store/modules/normalizers.js @@ -70,6 +70,7 @@ export const valueHasTuples = (key, value) => { } export const wrapUpdatedSettings = (group, settings) => { + console.log(group, settings) return Object.keys(settings).map((key) => { const value = groupWithoutKey(settings[key]) || wrapValues(settings[key]) return { group, key, value } @@ -78,7 +79,8 @@ export const wrapUpdatedSettings = (group, settings) => { const wrapValues = settings => { return Object.keys(settings).map(setting => { - const [type, value] = settings[setting] + console.log(settings[setting]) + const [type, value] = Array.isArray(settings[setting]) ? settings[setting] : ['', settings[setting]] if (type === 'keyword' || type.includes('keyword')) { return { 'tuple': [setting, wrapValues(value)] } } else if (type === 'atom') { diff --git a/src/views/settings/components/Inputs.vue b/src/views/settings/components/Inputs.vue index 8ec62cab..16425bfc 100644 --- a/src/views/settings/components/Inputs.vue +++ b/src/views/settings/components/Inputs.vue @@ -148,20 +148,10 @@ class="value-input" @input="updateSetting($event, settingGroup.group, settingGroup.key, setting.key)"/> -
- -
-
-
-
- - -
- - -
- -
+ + + +
@@ -187,13 +177,14 @@ import AceEditor from 'vue2-ace-editor' import 'brace/mode/elixir' import 'default-passive-events' -import { AutoLinkerInput } from './inputComponents' +import { AutoLinkerInput, MascotsInput } from './inputComponents' export default { name: 'Inputs', components: { editor: AceEditor, - AutoLinkerInput + AutoLinkerInput, + MascotsInput }, props: { customLabelWidth: { @@ -265,11 +256,6 @@ export default { labelWidth() { return this.isMobile ? '100px' : '240px' }, - mascotsValue() { - return Object.keys(this.data) - .map(mascotName => - [mascotName, this.data[mascotName][':url'], this.data[mascotName][':mime_type']]) - }, proxyUrlData() { if (!this.data[this.setting.key]) { return null @@ -319,12 +305,6 @@ export default { }, {}) this.updateSetting({ ...updatedValue, '': [] }, this.settingGroup.group, this.settingGroup.key, this.setting.key) }, - addRowToMascots() { - const updatedValue = this.data[':mascots'].reduce((acc, el, i) => { - return { ...acc, [el[0]]: { url: el[1], mime_type: el[2] }} - }, {}) - this.updateSetting({ ...updatedValue, '': { url: '', mime_type: '' }}, this.settingGroup.group, 'assets', 'mascots') - }, deleteEditableKeywordRow(index) { const filteredValues = this.editableKeywordData(this.data).filter((el, i) => index !== i) const updatedValue = filteredValues.reduce((acc, el, i) => { @@ -334,13 +314,6 @@ export default { this.updateSetting(updatedValue, this.settingGroup.group, this.settingGroup.key, this.setting.key) }, deleteIcondRow(index) {}, - deleteMascotsRow(index) { - const filteredValues = this.data[':mascots'].filter((el, i) => index !== i) - const updatedValue = filteredValues.reduce((acc, el, i) => { - return { ...acc, [el[0]]: { url: el[1], mime_type: el[2] }} - }, {}) - this.updateSetting(updatedValue, this.settingGroup.group, 'assets', 'mascots') - }, editableKeywordWithInput(key) { return key === ':replace' }, @@ -367,21 +340,6 @@ export default { this.updateSetting(updatedValue, this.settingGroup.group, this.settingGroup.key, this.setting.key) }, parseIcons(value, inputType, index) {}, - parseMascots(value, inputType, index) { - const updatedValue = this.data[':mascots'].reduce((acc, el, i) => { - if (index === i) { - if (inputType === 'name') { - return { ...acc, [value]: { url: el[1], mime_type: el[2] }} - } else if (inputType === 'url') { - return { ...acc, [el[0]]: { url: value, mime_type: el[2] }} - } else { - return { ...acc, [el[0]]: { url: el[1], mime_type: value }} - } - } - return { ...acc, [el[0]]: { url: el[1], mime_type: el[2] }} - }, {}) - this.updateSetting(updatedValue, this.settingGroup.group, 'assets', 'mascots') - }, parseRateLimiter(value, input, typeOfInput, typeOfLimit, currentValue) { if (typeOfLimit === 'oneLimit') { const valueToSend = typeOfInput === 'scale' ? { 'tuple': [value, currentValue[1]] } : { 'tuple': [currentValue[0], value] } diff --git a/src/views/settings/components/inputComponents/AutoLinkerInput.vue b/src/views/settings/components/inputComponents/AutoLinkerInput.vue index 0a305f9b..97f7adf8 100644 --- a/src/views/settings/components/inputComponents/AutoLinkerInput.vue +++ b/src/views/settings/components/inputComponents/AutoLinkerInput.vue @@ -34,7 +34,6 @@ export default { } } }, - computed: {}, methods: { autoLinkerBooleanValue(key) { const value = this.data[this.setting.key] diff --git a/src/views/settings/components/inputComponents/MascotsInput.vue b/src/views/settings/components/inputComponents/MascotsInput.vue new file mode 100644 index 00000000..8bcc73cb --- /dev/null +++ b/src/views/settings/components/inputComponents/MascotsInput.vue @@ -0,0 +1,103 @@ + + + + + diff --git a/src/views/settings/components/inputComponents/index.js b/src/views/settings/components/inputComponents/index.js index ff6dfc2b..eb2d7b83 100644 --- a/src/views/settings/components/inputComponents/index.js +++ b/src/views/settings/components/inputComponents/index.js @@ -1 +1,2 @@ export { default as AutoLinkerInput } from './AutoLinkerInput' +export { default as MascotsInput } from './MascotsInput'