gancio-upstream/pages/setup/_db.vue

63 lines
1.8 KiB
Vue
Raw Normal View History

2021-09-27 11:12:14 +02:00
<template lang="pug">
v-container.pa-6
h2.mb-2.text-center Gancio Setup
2023-02-21 00:55:44 +01:00
v-select(label='Select your language' single-line :items='$i18n.locales' item-text='name' item-value='code' @change='e => $i18n.setLocale(e)')
v-stepper.grey.lighten-5(v-model='step')
v-stepper-header
v-stepper-step(v-show='!dbdone' :complete='step > 1' step='1') Database
v-divider(v-show='!dbdone')
v-stepper-step(:complete='step > 2' step='2') Configuration
v-divider
v-stepper-step(:complete='step > 3' step='3') Finish
2021-09-27 11:12:14 +02:00
v-stepper-items
v-stepper-content(v-show='!dbdone' step='1')
DbStep(@complete='dbCompleted')
v-stepper-content(step='2')
Settings(setup, @complete='configCompleted')
v-stepper-content(step='3')
Completed(ref='completed' :isHttp='isHttp')
2021-09-27 11:12:14 +02:00
</template>
<script>
2022-05-26 11:10:21 +02:00
import DbStep from '@/components/DbStep'
import Settings from '@/components/admin/Settings'
import Completed from '@/components/Completed'
2021-09-27 11:12:14 +02:00
export default {
components: { DbStep, Settings, Completed },
middleware: 'setup',
2021-10-19 16:38:35 +02:00
layout: 'clean',
2021-09-30 11:06:59 +02:00
head: {
title: 'Setup',
},
2021-09-27 11:12:14 +02:00
auth: false,
asyncData ({ params, req }) {
const protocol = process.client ? window.location.protocol : req.protocol + ':'
2021-09-27 11:12:14 +02:00
return {
isHttp: protocol === 'http:',
2022-01-26 09:51:42 +01:00
dbdone: !!Number(params.db),
2021-09-27 11:12:14 +02:00
config: {
db: {
dialect: ''
}
},
2022-01-26 09:51:42 +01:00
step: 1 + Number(params.db)
2021-09-27 11:12:14 +02:00
}
},
methods: {
dbCompleted (db) {
this.step = this.step + 1
},
async configCompleted () {
2021-09-30 11:13:03 +02:00
try {
const user = await this.$axios.$post('/setup/restart')
this.step = this.step + 1
this.$refs.completed.start(user)
} catch (e) {
2021-10-29 15:24:26 +02:00
this.$root.$message(e.response ? e.response.data : e, { color: 'error' })
2021-09-30 11:13:03 +02:00
}
2021-09-27 11:12:14 +02:00
}
}
}
</script>