mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-12-02 12:13:54 +01:00
@@ -8,7 +8,7 @@
|
||||
<div
|
||||
v-for="(lineChoices, index1) in formatedChoices"
|
||||
:key="index1"
|
||||
class="d-flex"
|
||||
class="d-flex flex-grow-0"
|
||||
>
|
||||
<div
|
||||
v-for="(choice, index2) in lineChoices"
|
||||
|
||||
@@ -150,7 +150,7 @@ async function goToNextStep(current, next) {
|
||||
}
|
||||
if (props.validateObject) {
|
||||
try {
|
||||
await props.validateObject()
|
||||
await props.validateObject(current)
|
||||
} catch (error) {
|
||||
emit('validationError', current, error.response.data)
|
||||
return
|
||||
|
||||
@@ -25,17 +25,16 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="js">
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, onUnmounted, onUpdated, nextTick } from 'vue'
|
||||
import { useDomainsStore } from '@/stores'
|
||||
import { useGettext } from 'vue3-gettext'
|
||||
import constants from '@/constants.json'
|
||||
|
||||
const { $gettext } = useGettext()
|
||||
const domainsStore = useDomainsStore()
|
||||
const props = defineProps({
|
||||
modelValue: { type: String, default: '' },
|
||||
allowAdd: { type: Boolean, default: false },
|
||||
role: { type: String, default: 'SimpleUsers' },
|
||||
role: { type: String, default: constants.USER },
|
||||
errorMsg: { type: Array, default: () => [] },
|
||||
})
|
||||
const emit = defineEmits(['domain-selected', 'update:model-value'])
|
||||
@@ -47,15 +46,11 @@ const input = computed({
|
||||
set(value) {
|
||||
errors.value = []
|
||||
if (value.indexOf('@') !== -1) {
|
||||
if (props.role !== 'SuperAdmins') {
|
||||
domainSearch.value = value.split('@')[1]
|
||||
if (props.allowAdd) {
|
||||
showMenu.value = filteredDomains.value.length > 0
|
||||
} else {
|
||||
showMenu.value = true
|
||||
}
|
||||
domainSearch.value = value.split('@')[1]
|
||||
if (props.allowAdd) {
|
||||
showMenu.value = filteredDomains.value.length > 0
|
||||
} else {
|
||||
errors.value = [$gettext('SuperAdmins cannot own a mailbox')]
|
||||
showMenu.value = true
|
||||
}
|
||||
} else {
|
||||
showMenu.value = false
|
||||
@@ -87,10 +82,6 @@ const inputRef = ref()
|
||||
const localErrors = ref([])
|
||||
|
||||
function onKeyDown(e) {
|
||||
if (props.role === 'SuperAdmins') {
|
||||
// No mailbox for SuperAdmins
|
||||
return
|
||||
}
|
||||
const keyCode = e.keyCode
|
||||
if (keyCode === 40 || keyCode === 34) {
|
||||
// on arrow down or page down
|
||||
|
||||
@@ -5,21 +5,40 @@
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<div v-for="resource in resources" :key="resource.name" class="mt-4">
|
||||
{{ resource.label }} ({{ Math.ceil(resource.usage) }}%)
|
||||
<v-progress-linear
|
||||
:value="resource.usage"
|
||||
:color="getProgressColor(resource.usage)"
|
||||
/>
|
||||
<template v-if="resource.max_value === -1">
|
||||
{{ resource.label }} ({{ $gettext('Unlimited') }})
|
||||
</template>
|
||||
<template v-else-if="resource.max_value === 0">
|
||||
{{ resource.label }} ({{ noLimitLabel(resource) }})
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ resource.label }} ({{ Math.ceil(resource.usage) }}%)
|
||||
<v-progress-linear
|
||||
:model-value="resource.usage"
|
||||
:color="getProgressColor(resource.usage)"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script setup lang="js">
|
||||
<script setup>
|
||||
import { useGettext } from 'vue3-gettext'
|
||||
|
||||
defineProps({
|
||||
resources: { type: Array, default: null },
|
||||
})
|
||||
|
||||
const { $gettext } = useGettext()
|
||||
|
||||
const noLimitLabel = (resource) => {
|
||||
if (resource.name === 'quota') {
|
||||
return $gettext('No quota')
|
||||
}
|
||||
return $gettext('Creation denied')
|
||||
}
|
||||
|
||||
function getProgressColor(value) {
|
||||
if (value < 50) {
|
||||
return 'primary'
|
||||
|
||||
Reference in New Issue
Block a user