From 6f9746269cb36f8d0d9344873c96127eb814a66f Mon Sep 17 00:00:00 2001 From: Arsenije Savic Date: Fri, 8 Sep 2023 08:54:31 -0600 Subject: [PATCH] fix(settings-token): disable field if user not admin --- src/components/dao/settings-tokens.vue | 35 +++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/components/dao/settings-tokens.vue b/src/components/dao/settings-tokens.vue index de004e64d..8f71f266d 100644 --- a/src/components/dao/settings-tokens.vue +++ b/src/components/dao/settings-tokens.vue @@ -32,7 +32,6 @@ export default { data () { return { - tokens: { // Treasury token (aka peg_token = treasuryDigits treasurySymbol) treasuryName: null, @@ -241,7 +240,7 @@ export default { .col-12 label.h-label {{ $t('configuration.settings-tokens.tresury.form.digits.label') }} input-slider( - :disable="selectedDao.hasCustomToken" + :disable="selectedDao.hasCustomToken || !isAdmin" :max="3" :maxLabel="$t('configuration.settings-tokens.tresury.form.digits.morePrecise')" :min="1" @@ -262,8 +261,8 @@ export default { label.h-label {{ $t('configuration.settings-tokens.utility.form.name.label') }} q-input.q-my-xs( :debounce="200" - :disable="selectedDao.hasCustomToken" - :filled="selectedDao.hasCustomToken" + :disable="selectedDao.hasCustomToken || !isAdmin" + :filled="selectedDao.hasCustomToken || !isAdmin" :placeholder="$t('configuration.settings-tokens.utility.form.name.placeholder')" :rules="[rules.required]" color="accent" @@ -280,8 +279,8 @@ export default { label.h-label {{ $t('configuration.settings-tokens.utility.form.symbol.label') }} q-input.q-my-xs( :debounce="200" - :disable="selectedDao.hasCustomToken" - :filled="selectedDao.hasCustomToken" + :disable="selectedDao.hasCustomToken || !isAdmin" + :filled="selectedDao.hasCustomToken || !isAdmin" :placeholder="$t('configuration.settings-tokens.utility.form.symbol.placeholder')" :rules="[rules.required, rules.isTokenAvailable]" dense @@ -299,8 +298,8 @@ export default { label.h-label {{ $t('configuration.settings-tokens.utility.form.value.label') }} q-input.q-my-xs( :debounce="200" - :disable="selectedDao.hasCustomToken" - :filled="selectedDao.hasCustomToken" + :disable="selectedDao.hasCustomToken || !isAdmin" + :filled="selectedDao.hasCustomToken || !isAdmin" :placeholder="$t('configuration.settings-tokens.utility.form.value.placeholder')" :rules="[rules.requiredIf(tokens.utilityAmount > 0)]" color="accent" @@ -317,8 +316,8 @@ export default { label.h-label {{ $t('configuration.settings-tokens.utility.form.multiplier.label') }} q-input.q-my-xs( :debounce="200" - :disable="selectedDao.hasCustomToken" - :filled="selectedDao.hasCustomToken" + :disable="selectedDao.hasCustomToken || !isAdmin" + :filled="selectedDao.hasCustomToken || !isAdmin" :rules="[rules.required]" color="accent" dense @@ -334,7 +333,7 @@ export default { .col-12 label.h-label {{ $t('configuration.settings-tokens.utility.form.digits.label') }} input-slider( - :disable="selectedDao.hasCustomToken" + :disable="selectedDao.hasCustomToken || !isAdmin" :max="3" :maxLabel="$t('configuration.settings-tokens.tresury.form.digits.morePrecise')" :min="1" @@ -384,15 +383,17 @@ export default { .row.q-col-gutter-md .col-12.col-md-8(:class="{'q-mt-sm': !$q.screen.gt.md}") label.h-label {{ $t('configuration.settings-tokens.voice.form.decayPeriod.label') }} - custom-period-input.q-my-xs(:disable="selectedDao.hasCustomToken" v-model='tokens.voiceDecayPeriod') + custom-period-input.q-my-xs(:disable="selectedDao.hasCustomToken || !isAdmin" v-model='tokens.voiceDecayPeriod') q-tooltip(:content-style="{ 'font-size': '1em' }" anchor="top middle" self="bottom middle" v-if="!selectedDao.hasCustomToken") {{ $t('common.onlyDaoAdmins') }} .col-12.col-md-4(:class="{'q-mt-sm': !$q.screen.gt.md}") label.h-label {{ $t('configuration.settings-tokens.voice.form.decayPercent.label') }} q-input.q-my-xs( :debounce="200" - :disable="selectedDao.hasCustomToken" - :filled="selectedDao.hasCustomToken" + :disable="selectedDao.hasCustomToken || !isAdmin" + :filled="selectedDao.hasCustomToken || !isAdmin" + :max="100" + :min="0" :placeholder="$t('configuration.settings-tokens.voice.form.decayPercent.placeholder')" :rules="[rules.required]" color="accent" @@ -411,8 +412,8 @@ export default { label.h-label {{ $t('configuration.settings-tokens.voice.form.multiplier.label') }} q-input.q-my-xs( :debounce="200" - :disable="selectedDao.hasCustomToken" - :filled="selectedDao.hasCustomToken" + :disable="selectedDao.hasCustomToken || !isAdmin" + :filled="selectedDao.hasCustomToken || !isAdmin" :rules="[rules.required]" color="accent" dense @@ -428,7 +429,7 @@ export default { .col-12 label.h-label {{ $t('configuration.settings-tokens.voice.form.digits.label') }} input-slider( - :disable="selectedDao.hasCustomToken" + :disable="selectedDao.hasCustomToken || !isAdmin" :max="3" :maxLabel="$t('configuration.settings-tokens.tresury.form.digits.morePrecise')" :min="1"