few fixes

This commit is contained in:
Spitap
2023-04-18 15:44:08 +02:00
committed by Antoine Nguyen
parent 9fa907fd0b
commit ee24ef7fba
11 changed files with 75 additions and 37 deletions
@@ -3,8 +3,8 @@ import repository from '@/api/repository'
const resource = 'migrations'
export default {
getMigrations (query) {
return repository.get(`/${resource}/`, query)
getMigrations (params) {
return repository.get(`/${resource}/`, { params })
},
getMigration (slug, query) {
return repository.get(`/${resource}/${slug}/`, query)
@@ -26,13 +26,18 @@
:headers="headers"
:items="migrations"
:search="search"
item-key="pk"
item-key="id"
:options.sync="options"
:server-items-length="totalMigrations"
:loading="loading"
class="elevation-1"
show-select
>
<template v-slot:item.mailbox="{ item }">
<router-link :to="{ name: 'AccountDetail', params: { id: item.mailbox.user } }">
{{ item.mailbox.full_address }}
</router-link>
</template>
<template v-slot:item.actions="{ item }">
<v-menu offset-y>
<template v-slot:activator="{ on, attrs }">
@@ -60,9 +65,9 @@ export default {
return {
migrations: [],
headers: [
{ text: this.$gettext('Provider'), value: 'provider' },
{ text: this.$gettext('Old account'), value: 'old_account' },
{ text: this.$gettext('New account'), value: 'new_account' },
{ text: this.$gettext('Provider'), value: 'provider.name' },
{ text: this.$gettext('Old account'), value: 'username' },
{ text: this.$gettext('New account'), value: 'mailbox' },
{ text: this.$gettext('Actions'), value: 'actions', sortable: false, align: 'right' }
],
@@ -75,17 +80,10 @@ export default {
},
methods: {
deleteMigration (migration) {
this.$dialog.confirm(
this.$gettext('Remove this migration?'), {
cancelText: this.$gettext('Cancel'),
okText: this.$gettext('Proceed')
}
).then(dialog => {
Migration.deleteMigration(migration.id).then(response => {
bus.$emit('notification', { msg: this.$gettext('Provider deleted') })
this.migrations = this.migrations.filter(item => {
return item.id !== migration.id
})
Migration.deleteMigration(migration.id).then(response => {
bus.$emit('notification', { msg: this.$gettext('Migration deleted') })
this.migrations = this.migrations.filter(item => {
return item.id !== migration.id
})
})
},
@@ -97,6 +95,7 @@ export default {
}
Migration.getMigrations(query).then(response => {
this.migrations = response.data
this.totalMigrations = this.migrations.length
this.loading = false
})
},
@@ -3,11 +3,11 @@
<validation-provider
v-slot="{ errors }"
rules=""
vid="initialdomain"
vid="name"
>
<v-text-field
ref="initialdomainField"
v-model="domain.initialdomain"
v-model="domain.name"
:error-messages="errors"
:placeholder="'Name of the domain to migrate' | translate"
outlined
@@ -68,7 +68,7 @@ export default {
return {
domains: [],
domain: {
initialdomain: '',
name: '',
new_domain: ''
},
localDomains: []
@@ -78,7 +78,7 @@ export default {
reset () {
this.domains = []
this.domain = {
initialdomain: '',
name: '',
new_domain: ''
}
},
@@ -93,15 +93,15 @@ export default {
providerApi.checkAssociatedDomain(this.domain).then(response => {
if (response.status === 200) {
this.domains.push({
name: this.domain.initialdomain,
name: this.domain.name,
new_domain: this.domain.new_domain
})
this.$emit('input', this.domains)
this.$refs.observer.reset()
this.domain = {
initialdomain: '',
name: '',
new_domain: ''
}
this.$emit('input', this.domains)
}
}).catch(error => {
this.$refs.observer.setErrors(error.response.data)
@@ -27,6 +27,8 @@
v-model="parameters[param.name]"
:label="param.label"
:hint="param.help_text"
:error="formErrors[param.name] !== undefined"
:error-messages="formErrors[param.name]"
persistent-hint
v-if="param.widget === 'BooleanField'"
/>
@@ -33,6 +33,7 @@
</template>
<script>
import { bus } from '@/main'
import accounts from '@/api/accounts'
import AccountAliases from '@/components/identities/AccountAliases'
import AccountSenderAddresses from '@/components/identities/AccountSenderAddresses'
@@ -58,6 +59,11 @@ export default {
mounted () {
accounts.get(this.$route.params.id).then(resp => {
this.account = resp.data
}).catch(error => {
if (error.response.status === 404) {
bus.$emit('notification', { msg: this.$gettext('Account not found!'), type: 'error' })
this.$router.push({ name: 'Identities' })
}
})
parameters.getApplication('limits').then(resp => {
this.limitsConfig = resp.data