Manage domain and account resources.

This commit is contained in:
Antoine Nguyen
2022-04-07 12:00:44 +02:00
parent 45cce410c1
commit af044bd325
7 changed files with 134 additions and 22 deletions
@@ -0,0 +1,39 @@
<template>
<v-card>
<v-card-title>
<translate class="headline">Resources usage</translate>
</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)"
/>
</div>
</v-card-text>
</v-card>
</template>
<script>
export default {
props: {
resources: Array
},
methods: {
getProgressColor (value) {
if (value < 50) {
return 'primary'
}
if (value < 80) {
return 'warning'
}
return 'error'
}
}
}
</script>
@@ -0,0 +1,37 @@
<template>
<validation-observer ref="observer">
<validation-provider
v-for="resource in resources"
:key="resource.name"
v-slot="{ errors }"
rules="required"
>
<label class="m-label">{{ resource.label }}</label>
<v-text-field
v-model="resource.max_value"
type="number"
outlined
dense
:error-messages="errors"
/>
</validation-provider>
</validation-observer>
</template>
<script>
export default {
props: {
resources: Array
},
methods: {
async validateForm () {
return await this.$refs.observer.validate()
},
getPayload () {
return this.resources.map(r => {
return { name: r.name, max_value: r.max_value }
})
}
}
}
</script>