config ESLINT, refactor theme component

This commit is contained in:
Nicolas Viot
2018-10-05 14:06:59 +02:00
committed by Antoine Nguyen
parent 357b8477b8
commit d0ae7a06e5
15 changed files with 14917 additions and 217 deletions
+53 -51
View File
@@ -53,60 +53,62 @@
<script>
export default {
data () {
return {
formErrors: {},
domain: {}
}
},
mounted () {
var domainPk = this.$route.params.domainPk
if (domainPk) {
if (!this.$store.state.domainsLoaded) {
this.$store.dispatch('getDomains').then(response => {
this.loadDomain(domainPk)
})
} else {
this.loadDomain(domainPk)
}
}
},
methods: {
loadDomain (pk) {
this.domain = JSON.parse(JSON.stringify(this.$store.getters.getDomainByPk(pk)))
},
onSaveError (response) {
this.formErrors = response.data
},
saveDomain () {
var action
var msg
if (this.domain.pk) {
action = 'updateDomain'
msg = 'Domain updated.'
} else {
action = 'createDomain'
msg = 'Domain created.'
}
this.$store.dispatch(action, this.domain).then(response => {
this.$router.push({ name: 'DomainList' })
this.$toast.open({
message: msg,
type: 'is-success',
position: 'is-bottom'
})
}, this.onSaveError)
},
cancel () {
this.$router.push({ name: 'DomainList' })
}
data() {
return {
formErrors: {},
domain: {}
}
},
mounted() {
var domainPk = this.$route.params.domainPk
if (domainPk) {
if (!this.$store.state.domainsLoaded) {
this.$store.dispatch('getDomains').then(response => {
this.loadDomain(domainPk)
})
} else {
this.loadDomain(domainPk)
}
}
},
methods: {
loadDomain(pk) {
this.domain = JSON.parse(
JSON.stringify(this.$store.getters.getDomainByPk(pk))
)
},
onSaveError(response) {
this.formErrors = response.data
},
saveDomain() {
var action
var msg
if (this.domain.pk) {
action = 'updateDomain'
msg = 'Domain updated.'
} else {
action = 'createDomain'
msg = 'Domain created.'
}
this.$store.dispatch(action, this.domain).then(response => {
this.$router.push({ name: 'DomainList' })
this.$toast.open({
message: msg,
type: 'is-success',
position: 'is-bottom'
})
}, this.onSaveError)
},
cancel() {
this.$router.push({ name: 'DomainList' })
}
}
}
</script>
<style>
form {
background: #ffffff;
padding: 20px;
}
form {
background: #ffffff;
padding: 20px;
}
</style>
+26 -29
View File
@@ -57,36 +57,33 @@
import { mapGetters } from 'vuex'
export default {
computed: mapGetters([
'domains'
]),
data () {
return {
}
},
created () {
this.$store.dispatch('getDomains')
},
methods: {
confirmDelete (domain) {
this.$dialog.prompt({
message: `Delete domain ${domain.name}?`,
inputAttrs: {
type: 'checkbox',
placeholder: 'Keep mailboxes on filesystem'
},
onConfirm: (value) => this.$toast.open(`Your age is: ${value}`)
})
computed: mapGetters(['domains']),
data() {
return {}
},
created() {
this.$store.dispatch('getDomains')
},
methods: {
confirmDelete(domain) {
this.$dialog.prompt({
message: `Delete domain ${domain.name}?`,
inputAttrs: {
type: 'checkbox',
placeholder: 'Keep mailboxes on filesystem'
},
getDNSTagType (value) {
if (value === 'unknown') {
return 'is-warning'
} else if (value === 'ok') {
return 'is-danger'
} else {
return 'is-success'
}
}
onConfirm: value => this.$toast.open(`Your age is: ${value}`)
})
},
getDNSTagType(value) {
if (value === 'unknown') {
return 'is-warning'
} else if (value === 'ok') {
return 'is-danger'
} else {
return 'is-success'
}
}
}
}
</script>