Fix wrapping values with type map and keyword

This commit is contained in:
Angelina Filippova 2020-07-12 00:55:07 +03:00
parent 0bc5cf9f6b
commit b6a66ebe20
2 changed files with 9 additions and 8 deletions

View file

@ -233,13 +233,13 @@ export const wrapUpdatedSettings = (group, settings, currentState) => {
const wrapValues = (settings, currentState) => {
return Object.keys(settings).map(setting => {
const [type, value] = settings[setting]
if (
type === 'keyword' ||
type.includes('keyword') ||
(type.includes('tuple') && type.includes('list')) ||
setting === ':replace' ||
(type.includes('map') && type.includes('string')) ||
type.includes('map') && type.findIndex(el => el.includes('list') && el.includes('string')) !== -1
if (type === 'keyword' ||
(Array.isArray(type) && (
type.includes('keyword') ||
(type.includes('tuple') && type.includes('list')) ||
(type.includes('map') && type.includes('string')) ||
type.includes('map') && type.findIndex(el => el.includes('list') && el.includes('string')) !== -1
))
) {
return { 'tuple': [setting, wrapValues(value, currentState)] }
} else if (type === 'atom' && value.length > 0) {

View file

@ -73,7 +73,8 @@ export default {
return this.setting.type.includes('keyword') && this.setting.type.includes('integer')
},
editableKeywordWithSelect() {
return this.setting.type.includes('map') && this.setting.type.findIndex(el => el.includes('list') && el.includes('string')) !== -1
return (this.setting.type.includes('map') && this.setting.type.findIndex(el => el.includes('list') && el.includes('string')) !== -1) ||
(this.setting.type.includes('keyword') && this.setting.type.findIndex(el => el.includes('list') && el.includes('string')) !== -1)
},
editableKeywordWithString() {
return this.setting.key !== ':crontab' && (