From 5ee75ee12e19f149a8a1a95ac9a614820c1c298b Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Fri, 8 Nov 2019 21:39:22 +0900 Subject: [PATCH] Update parsing tuples so it returns values with a colon --- src/store/modules/normalizers.js | 25 ++++++++++++++----------- src/views/emojiPacks/index.vue | 2 +- src/views/settings/styles/main.scss | 9 +++++++++ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/store/modules/normalizers.js b/src/store/modules/normalizers.js index c2a9d3e8..5913197c 100644 --- a/src/store/modules/normalizers.js +++ b/src/store/modules/normalizers.js @@ -104,24 +104,24 @@ export const filterIgnored = (settings, ignored) => { export const parseTuples = (tuples, key) => { return tuples.reduce((accum, item) => { if (key === 'rate_limit') { - accum[item.tuple[0].substr(1)] = item.tuple[1] + accum[item.tuple[0]] = item.tuple[1] } else if (Array.isArray(item.tuple[1]) && (typeof item.tuple[1][0] === 'object' && !Array.isArray(item.tuple[1][0])) && item.tuple[1][0]['tuple']) { nonAtomsTuples.includes(item.tuple[0]) - ? accum[item.tuple[0].substr(1)] = parseNonAtomTuples(item.tuple[1]) - : accum[item.tuple[0].substr(1)] = parseTuples(item.tuple[1]) + ? accum[item.tuple[0]] = parseNonAtomTuples(item.tuple[1]) + : accum[item.tuple[0]] = parseTuples(item.tuple[1]) } else if (Array.isArray(item.tuple[1])) { - accum[item.tuple[0].substr(1)] = item.tuple[1] + accum[item.tuple[0]] = item.tuple[1] } else if (item.tuple[1] && typeof item.tuple[1] === 'object' && 'tuple' in item.tuple[1]) { - accum[item.tuple[0].substr(1)] = item.tuple[1]['tuple'].join('.') + accum[item.tuple[0]] = item.tuple[1]['tuple'].join('.') } else if (item.tuple[1] && typeof item.tuple[1] === 'object') { nonAtomsObjects.includes(item.tuple[0]) - ? accum[item.tuple[0].substr(1)] = parseNonAtomObject(item.tuple[1]) - : accum[item.tuple[0].substr(1)] = parseObject(item.tuple[1]) + ? accum[item.tuple[0]] = parseNonAtomObject(item.tuple[1]) + : accum[item.tuple[0]] = parseObject(item.tuple[1]) } else { key === 'mrf_user_allowlist' ? accum[item.tuple[0]] = item.tuple[1] - : accum[item.tuple[0].substr(1)] = item.tuple[1] + : accum[item.tuple[0]] = item.tuple[1] } return accum }, {}) @@ -143,18 +143,21 @@ const parseNonAtomObject = (object) => { const parseObject = (object) => { return Object.keys(object).reduce((acc, item) => { - acc[item.substr(1)] = object[item] + acc[item] = object[item] return acc }, {}) } export const valueHasTuples = (key, value) => { const valueIsArrayOfNonObjects = Array.isArray(value) && value.length > 0 && typeof value[0] !== 'object' - return key === 'meta' || - key === 'types' || + return key === ':meta' || + key === ':types' || + key === ':compiled_template_engines' || + key === ':compiled_format_encoders' || typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean' || + value === null || valueIsArrayOfNonObjects } diff --git a/src/views/emojiPacks/index.vue b/src/views/emojiPacks/index.vue index 5e2e468d..4be41add 100644 --- a/src/views/emojiPacks/index.vue +++ b/src/views/emojiPacks/index.vue @@ -70,7 +70,7 @@ export default { return this.$store.state.app.device === 'mobile' }, labelWidth() { - return this.isMobile ? '100px' : '210px' + return this.isMobile ? '100px' : '240px' }, localPacks() { return this.$store.state.emojiPacks.localPacks diff --git a/src/views/settings/styles/main.scss b/src/views/settings/styles/main.scss index 9a72feaa..b0095e8b 100644 --- a/src/views/settings/styles/main.scss +++ b/src/views/settings/styles/main.scss @@ -11,6 +11,10 @@ .el-form-item { margin-right: 30px; } + .el-input-group__prepend { + padding-left: 10px; + padding-right: 10px; + } .el-select { width: 100%; } @@ -27,6 +31,11 @@ .highlight { background-color: #e6e6e6; } + label { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } .limit-button-container { display: flex; align-items: baseline;