refactor: vue fixes + modal-upgrade-system.vue

This commit is contained in:
NGPixel
2017-06-10 10:41:15 -04:00
parent 5a8c5237af
commit 28fb2aee70
14 changed files with 130 additions and 68 deletions

View File

@@ -32,7 +32,7 @@
},
methods: {
cancel () {
this.$store.dispatch('anchorClose')
this.$store.dispatch('anchor/close')
},
clipboardSuccess () {
this.$store.dispatch('alert', {
@@ -40,7 +40,7 @@
icon: 'clipboard',
msg: this.$t('modal.anchorsuccess')
})
this.$store.dispatch('anchorClose')
this.$store.dispatch('anchor/close')
},
clipboardError () {
this.$store.dispatch('alert', {

View File

@@ -28,7 +28,7 @@
p.control.is-fullwidth
input.input(type='password', placeholder='', v-model='password')
section(v-if='provider=="local"')
label.label {{ $t('modal.createuserfullname') }}
label.label {{ $t('modal.createusername') }}
p.control.is-fullwidth
input.input(type='text', :placeholder='$t("modal.createusernameplaceholder")', v-model='name')
footer

View File

@@ -0,0 +1,70 @@
<template lang="pug">
transition(:duration="400")
.modal(v-show='isShown', v-cloak)
transition(name='modal-background')
.modal-background(v-show='isShown')
.modal-container
transition(name='modal-content')
.modal-content(v-show='isShown')
template(v-if='step === "running"')
header.is-blue Install
section.modal-loading
i
span Wiki.js {{ mode }} in progress...
em Please wait
template(v-if='step === "error"')
header.is-red Installation Error
section.modal-loading
span {{ error }}
footer
a.button.is-grey.is-outlined(@click='upgradeCancel') Abort
a.button.is-deep-orange(@click='upgradeStart') Try Again
template(v-if='step === "confirm"')
header.is-deep-orange Are you sure?
section
label.label You are about to {{ mode }} Wiki.js.
span.note You will not be able to access your wiki during the operation. Content will not be affected. However, it is your responsability to ensure you have a backup in the unexpected event content gets lost or corrupted.
footer
a.button.is-grey.is-outlined(@click='upgradeCancel') Abort
a.button.is-deep-orange(@click='upgradeStart') Start
</template>
<script>
export default {
name: 'modal-upgrade-system',
data() {
return {
isLoading: false
}
},
computed: {
isShown() {
return this.$store.state.modalUpgradeSystem.shown
},
mode() {
return this.$store.state.modalUpgradeSystem.mode
},
step() {
return this.$store.state.modalUpgradeSystem.step
}
},
methods: {
upgradeCancel() {
this.isLoading = false
this.$store.dispatch('modalUpgradeSystem/close')
},
upgradeStart() {
this.$store.commit('modalUpgradeSystem/stepChange', 'running')
this.$http.post('/admin/settings/install', {
mode: this.mode
}).then(resp => {
// todo
}).catch(err => {
this.$store.commit('modalUpgradeSystem/stepChange', 'error')
this.error = err.body
})
}
}
}
</script>