feat: setup wizard cleanup + upgrade UI

[ci skip]
This commit is contained in:
NGPixel
2017-10-09 00:16:08 -04:00
parent c94e2d5700
commit ca8451720f
6 changed files with 77 additions and 218 deletions

View File

@@ -8,6 +8,7 @@ import CONSTANTS from './constants'
import Vue from 'vue'
import VueResource from 'vue-resource'
import VueClipboards from 'vue-clipboards'
import VeeValidate from 'vee-validate'
import { ApolloClient, createBatchingNetworkInterface } from 'apollo-client'
import store from './store'
@@ -83,6 +84,17 @@ Vue.use(VueResource)
Vue.use(VueClipboards)
Vue.use(localization.VueI18Next)
Vue.use(helpers)
Vue.use(VeeValidate, {
enableAutoClasses: true,
classNames: {
touched: 'is-touched', // the control has been blurred
untouched: 'is-untouched', // the control hasn't been blurred
valid: 'is-valid', // model is valid
invalid: 'is-invalid', // model is invalid
pristine: 'is-pristine', // control has not been interacted with
dirty: 'is-dirty' // control has been interacted with
}
})
// ====================================
// Register Vue Components

View File

@@ -1,22 +1,7 @@
'use strict'
/* global siteConfig */
import VeeValidate from 'vee-validate'
import axios from 'axios'
Vue.use(VeeValidate, {
enableAutoClasses: true,
classNames: {
touched: 'is-touched', // the control has been blurred
untouched: 'is-untouched', // the control hasn't been blurred
valid: 'is-valid', // model is valid
invalid: 'is-invalid', // model is invalid
pristine: 'is-pristine', // control has not been interacted with
dirty: 'is-dirty' // control has been interacted with
}
})
export default {
name: 'configManager',
data() {
@@ -42,12 +27,12 @@ export default {
results: []
},
conf: {
upgrade: false,
title: siteConfig.title || 'Wiki',
host: siteConfig.host || 'http://',
port: siteConfig.port || 80,
lang: siteConfig.lang || 'en',
public: (siteConfig.public === true),
db: siteConfig.db || 'mongodb://localhost:27017/wiki',
pathData: './data',
pathRepo: './repo',
gitUseRemote: (siteConfig.git !== false),
@@ -82,28 +67,19 @@ export default {
perc = (this.syscheck.ok) ? '15%' : '5%'
break
case 'general':
perc = '20%'
perc = '25%'
break
case 'considerations':
perc = '30%'
break
case 'db':
perc = '35%'
break
case 'dbcheck':
perc = (this.dbcheck.ok) ? '50%' : '40%'
break
case 'paths':
perc = '55%'
break
case 'git':
perc = '60%'
perc = '50%'
break
case 'gitcheck':
perc = (this.gitcheck.ok) ? '75%' : '65%'
perc = (this.gitcheck.ok) ? '70%' : '55%'
break
case 'admin':
perc = '80%'
perc = '75%'
break
}
return perc
@@ -176,48 +152,6 @@ export default {
this.state = 'considerations'
this.loading = false
},
proceedToDb: function (ev) {
let self = this
self.state = 'db'
self.loading = false
self.$nextTick(() => {
self.$validator.validateAll('db')
})
},
proceedToDbcheck: function (ev) {
let self = this
this.state = 'dbcheck'
this.loading = true
self.dbcheck = {
ok: false,
error: ''
}
this.$helpers._.delay(() => {
axios.post('/dbcheck', {
db: self.conf.db
}).then(resp => {
if (resp.data.ok === true) {
self.dbcheck.ok = true
} else {
self.dbcheck.ok = false
self.dbcheck.error = resp.data.error
}
self.loading = false
self.$nextTick()
}).catch(err => {
window.alert(err.message)
})
}, 1000)
},
proceedToPaths: function (ev) {
let self = this
self.state = 'paths'
self.loading = false
self.$nextTick(() => {
self.$validator.validateAll('paths')
})
},
proceedToGit: function (ev) {
let self = this
self.state = 'git'