2018-01-28 18:34:37 +00:00
< template lang = "pug" >
2018-03-11 05:11:32 +00:00
v - app . setup
v - toolbar ( color = 'blue darken-2' , dark , app , clipped - left , fixed , flat )
v - spacer
v - toolbar - title
span . subheading Wiki . js Setup
v - spacer
v - content
v - progress - linear . ma - 0 ( indeterminate , height = '4' , : active = 'loading' )
v - stepper . elevation - 0 ( v - model = 'state' )
v - stepper - header
v - stepper - step ( step = '1' : complete = 'state > 1' )
| Welcome
small Wiki . js Installation Wizard
v - divider
v - stepper - step ( step = '2' : complete = 'state > 2' )
| Administration Account
small Create the admin account
v - divider ( v - if = 'this.conf.upgrade' )
2018-08-27 02:38:08 +00:00
v - stepper - step ( step = '3' : complete = 'state > 3' , v - if = 'this.conf.upgrade' )
2018-03-11 05:11:32 +00:00
| Upgrade from Wiki . js 1. x
small Migrate your existing installation
v - divider
2018-08-27 02:38:08 +00:00
v - stepper - step ( : step = 'this.conf.upgrade ? 4 : 3' : complete = 'this.conf.upgrade ? state > 3 : state > 4' )
2018-03-11 05:11:32 +00:00
| Final Steps
small Finalizing your installation
2018-01-28 18:34:37 +00:00
2018-03-11 05:11:32 +00:00
v - stepper - items
//- ==============================================
//- WELCOME
//- ==============================================
2018-01-28 18:34:37 +00:00
2018-03-11 05:11:32 +00:00
v - stepper - content ( step = '1' )
v - card . text - xs - center . pa - 3 ( flat )
2018-03-12 04:09:54 +00:00
img ( src = '/svg/logo-wikijs.svg' , alt = 'Wiki.js Logo' , style = 'width: 300px;' )
2018-03-11 05:11:32 +00:00
v - container
. body - 2. py - 2 This installation wizard will guide you through the steps needed to get your wiki up and running in no time !
. body - 1
| Detailed information about installation and usage can be found on the # [ a ( href = 'https://wiki.requarks.io/docs' ) official documentation site ] .
br
| Should you have any question or would like to report something that doesn 't look right, feel free to create a new issue on the #[a(href=' https : //github.com/Requarks/wiki/issues') GitHub project].
. body - 1. pt - 3
2018-08-16 01:57:28 +00:00
v - icon . mr - 2 system _update
2018-03-11 05:11:32 +00:00
span You are about to install Wiki . js # [ strong { { wikiVersion } } ] .
2018-07-23 01:13:01 +00:00
v - divider . mt - 3
2018-03-11 05:11:32 +00:00
v - form
v - checkbox (
color = 'primary' ,
v - model = 'conf.telemetry' ,
label = 'Allow Telemetry' ,
persistent - hint ,
hint = 'Help Wiki.js developers improve this app with anonymized telemetry.'
)
v - checkbox . mt - 3 (
color = 'primary' ,
v - model = 'conf.upgrade' ,
label = 'Upgrade from Wiki.js 1.x' ,
persistent - hint ,
hint = 'Check this box if you are upgrading from Wiki.js 1.x and wish to migrate your existing data.'
)
v - divider
2018-07-23 01:13:01 +00:00
. pt - 3. text - xs - center
2018-08-27 02:38:08 +00:00
v - btn ( color = 'primary' , @ click = 'proceedToAdmin' , : disabled = 'loading' ) Start
2018-01-28 18:34:37 +00:00
2018-03-11 05:11:32 +00:00
//- ==============================================
//- ADMINISTRATOR ACCOUNT
//- ==============================================
2018-01-28 18:34:37 +00:00
2018-08-27 02:38:08 +00:00
v - stepper - content ( step = '2' )
2018-03-11 05:11:32 +00:00
v - card . text - xs - center ( flat )
svg . icons . is - 64 : use ( xlink : href = '#nc-man-black' )
. subheading Administrator Account
. body - 2 A root administrator account will be created for local authentication . From this account , you can create or authorize more users .
v - form
v - container
v - layout ( row , wrap )
v - flex ( xs12 )
v - text - field (
2018-07-23 01:13:01 +00:00
outline
background - color = 'grey lighten-2'
2018-03-11 05:11:32 +00:00
v - model = 'conf.adminEmail' ,
label = 'Administrator Email' ,
hint = 'The email address of the administrator account' ,
v - validate = '{ required: true, email: true }' ,
data - vv - name = 'adminEmail' ,
data - vv - as = 'Administrator Email' ,
data - vv - scope = 'admin' ,
: error - messages = 'errors.collect(`adminEmail`)'
)
v - flex . pr - 3 ( xs6 )
v - text - field (
2018-07-23 01:13:01 +00:00
outline
background - color = 'grey lighten-2'
2018-03-11 05:11:32 +00:00
ref = 'adminPassword' ,
2018-05-28 18:46:55 +00:00
counter = '255'
2018-03-11 05:11:32 +00:00
v - model = 'conf.adminPassword' ,
label = 'Password' ,
2018-05-28 18:46:55 +00:00
: append - icon = "pwdMode ? 'visibility' : 'visibility_off'"
: append - icon - cb = "() => (pwdMode = !pwdMode)"
: type = "pwdMode ? 'password' : 'text'"
2018-03-11 05:11:32 +00:00
hint = 'At least 8 characters long.' ,
v - validate = '{ required: true, min: 8 }' ,
data - vv - name = 'adminPassword' ,
data - vv - as = 'Password' ,
data - vv - scope = 'admin' ,
: error - messages = 'errors.collect(`adminPassword`)'
)
v - flex ( xs6 )
v - text - field (
2018-07-23 01:13:01 +00:00
outline
background - color = 'grey lighten-2'
2018-05-19 20:40:07 +00:00
ref = 'adminPasswordConfirm' ,
2018-05-28 18:46:55 +00:00
counter = '255'
2018-03-11 05:11:32 +00:00
v - model = 'conf.adminPasswordConfirm' ,
label = 'Confirm Password' ,
2018-05-28 18:46:55 +00:00
: append - icon = "pwdConfirmMode ? 'visibility' : 'visibility_off'"
: append - icon - cb = "() => (pwdConfirmMode = !pwdConfirmMode)"
: type = "pwdConfirmMode ? 'password' : 'text'"
2018-03-11 05:11:32 +00:00
hint = 'Verify your password again.' ,
2018-05-19 20:40:07 +00:00
v - validate = '{ required: true, min: 8 }' ,
2018-03-11 05:11:32 +00:00
data - vv - name = 'adminPasswordConfirm' ,
data - vv - as = 'Confirm Password' ,
data - vv - scope = 'admin' ,
: error - messages = 'errors.collect(`adminPasswordConfirm`)'
)
2018-07-23 01:13:01 +00:00
. pt - 3. text - xs - center
2018-08-27 02:38:08 +00:00
v - btn ( @ click = 'proceedToWelcome' , : disabled = 'loading' ) Back
2018-03-11 05:11:32 +00:00
v - btn ( color = 'primary' , @ click = 'proceedToUpgrade' , : disabled = 'loading' ) Continue
2018-01-28 18:34:37 +00:00
2018-03-11 05:11:32 +00:00
//- ==============================================
//- UPGRADE FROM 1.x
//- ==============================================
2018-01-28 18:34:37 +00:00
2018-08-27 02:38:08 +00:00
v - stepper - content ( step = '3' , v - if = 'conf.upgrade' )
2018-03-11 05:11:32 +00:00
v - card . text - xs - center ( flat )
svg . icons . is - 64 : use ( xlink : href = '#nc-spaceship' )
. subheading Upgrade from Wiki . js 1. x
. body - 2 Migrating from a Wiki . js 1. x installation is quick and simple .
v - form
v - container
v - layout ( row )
v - flex ( xs12 )
v - text - field (
2018-07-23 01:13:01 +00:00
outline
background - color = 'grey lighten-2'
2018-03-11 05:11:32 +00:00
v - model = 'conf.upgMongo' ,
placeholder = 'mongodb://' ,
label = 'Connection String to Wiki.js 1.x MongoDB database' ,
persistent - hint ,
hint = 'A MongoDB database connection string where a Wiki.js 1.x installation is located. No alterations will be made to this database.' ,
v - validate = '{ required: true, min: 2 }' ,
data - vv - name = 'upgMongo' ,
data - vv - as = 'MongoDB Connection String' ,
data - vv - scope = 'upgrade' ,
: error - messages = 'errors.collect(`upgMongo`)'
)
2018-07-23 01:13:01 +00:00
. pt - 3. text - xs - center
2018-03-11 05:11:32 +00:00
v - btn ( @ click = 'proceedToAdmin' , : disabled = 'loading' ) Back
v - btn ( color = 'primary' , @ click = 'proceedToFinal' , : disabled = 'loading' ) Continue
2018-01-28 18:34:37 +00:00
2018-03-11 05:11:32 +00:00
//- ==============================================
//- FINAL
//- ==============================================
2018-01-28 18:34:37 +00:00
2018-08-27 02:38:08 +00:00
v - stepper - content ( : step = 'conf.upgrade ? 4 : 3' )
2018-03-11 05:11:32 +00:00
v - card . text - xs - center ( flat )
template ( v - if = 'loading' )
2018-08-05 15:27:46 +00:00
. mt - 3 ( style = 'width: 64px; display:inline-block;' )
atom - spinner (
: animation - duration = '800'
: size = '64'
color = '#1976d2'
)
. subheading . primary -- text . mt - 3 Finalizing your installation ...
2018-03-11 05:11:32 +00:00
template ( v - else - if = 'final.ok' )
2018-01-28 18:34:37 +00:00
svg . icons . is - 64 : use ( xlink : href = '#nc-check-bold' )
2018-08-05 15:27:46 +00:00
. subheading . green -- text Installation complete !
2018-03-11 05:11:32 +00:00
template ( v - else )
svg . icons . is - 64 : use ( xlink : href = '#nc-square-remove' )
2018-08-05 15:27:46 +00:00
. subheading . red -- text Something went wrong ...
2018-03-11 05:11:32 +00:00
v - container
v - alert ( type = 'success' , outline , : value = '!loading && final.ok' ) Wiki . js was configured successfully and is now ready for use .
v - alert ( type = 'error' , outline , : value = '!loading && !final.ok' ) { { final . error } }
v - divider
2018-07-23 01:13:01 +00:00
. pt - 3. text - xs - center
2018-03-11 05:11:32 +00:00
v - btn ( @ click = '!conf.upgrade ? proceedToAdmin() : proceedToUpgrade()' , : disabled = 'loading' ) Back
v - btn ( color = 'primary' , @ click = 'proceedToFinal' , v - if = '!loading && !final.ok' ) Try Again
v - btn ( color = 'success' , @ click = 'finish' , v - if = 'loading || final.ok' , : disabled = 'loading' ) Continue
2018-01-28 18:34:37 +00:00
2018-03-11 05:11:32 +00:00
v - footer . pa - 3 ( app , absolute , color = 'grey darken-3' , height = 'auto' )
. caption . grey -- text Wiki . js
v - spacer
. caption . grey -- text ( v - if = 'conf.telemetry' ) Telemetry Client ID : { { telemetryId } }
2018-01-28 18:34:37 +00:00
< / template >
< script >
/* global siteConfig */
import axios from 'axios'
2018-02-04 05:53:13 +00:00
import _ from 'lodash'
2018-08-05 15:27:46 +00:00
import { AtomSpinner } from 'epic-spinners'
2018-01-28 18:34:37 +00:00
export default {
2018-08-05 15:27:46 +00:00
components : {
AtomSpinner
} ,
2018-01-28 18:34:37 +00:00
props : {
telemetryId : {
type : String ,
required : true
} ,
wikiVersion : {
type : String ,
required : true
}
} ,
data ( ) {
return {
loading : false ,
2018-03-11 05:11:32 +00:00
state : 1 ,
2018-01-28 18:34:37 +00:00
final : {
ok : false ,
error : '' ,
redirectUrl : ''
} ,
conf : {
adminEmail : '' ,
adminPassword : '' ,
adminPasswordConfirm : '' ,
telemetry : true ,
upgrade : false ,
upgMongo : 'mongodb://'
2018-05-28 18:46:55 +00:00
} ,
pwdMode : true ,
pwdConfirmMode : true
2018-01-28 18:34:37 +00:00
}
} ,
methods : {
2018-03-11 05:11:32 +00:00
proceedToWelcome ( ) {
this . state = 1
2018-01-28 18:34:37 +00:00
this . loading = false
} ,
2018-03-11 05:11:32 +00:00
async proceedToAdmin ( ) {
2018-08-27 02:38:08 +00:00
if ( this . state < 2 ) {
2018-03-11 05:11:32 +00:00
const validationSuccess = await this . $validator . validateAll ( 'general' )
if ( ! validationSuccess ) {
2018-08-27 02:38:08 +00:00
this . state = 1
2018-03-11 05:11:32 +00:00
return
}
2018-01-28 18:34:37 +00:00
}
2018-08-27 02:38:08 +00:00
this . state = 2
2018-01-28 18:34:37 +00:00
this . loading = false
} ,
2018-03-11 05:11:32 +00:00
async proceedToUpgrade ( ) {
2018-08-27 02:38:08 +00:00
if ( this . state < 3 ) {
2018-03-11 05:11:32 +00:00
const validationSuccess = await this . $validator . validateAll ( 'admin' )
2018-05-19 20:40:07 +00:00
if ( ! validationSuccess || this . conf . adminPassword !== this . conf . adminPasswordConfirm ) {
2018-08-27 02:38:08 +00:00
this . state = 2
2018-03-11 05:11:32 +00:00
return
}
2018-01-28 18:34:37 +00:00
}
if ( this . conf . upgrade ) {
2018-08-27 02:38:08 +00:00
this . state = 3
2018-01-28 18:34:37 +00:00
this . loading = false
} else {
this . proceedToFinal ( )
}
} ,
2018-03-11 05:11:32 +00:00
async proceedToFinal ( ) {
2018-08-27 02:38:08 +00:00
if ( this . conf . upgrade && this . state < 4 ) {
2018-03-11 05:11:32 +00:00
const validationSuccess = await this . $validator . validateAll ( 'upgrade' )
if ( ! validationSuccess ) {
2018-08-27 02:38:08 +00:00
this . state = 3
2018-03-11 05:11:32 +00:00
return
}
}
2018-08-27 02:38:08 +00:00
this . state = this . conf . upgrade ? 4 : 3
2018-03-11 05:11:32 +00:00
this . loading = true
this . final = {
2018-01-28 18:34:37 +00:00
ok : false ,
error : '' ,
redirectUrl : ''
}
2018-03-11 05:11:32 +00:00
this . $forceUpdate ( )
let self = this
2018-01-28 18:34:37 +00:00
2018-02-04 05:53:13 +00:00
_ . delay ( ( ) => {
2018-01-28 18:34:37 +00:00
axios . post ( '/finalize' , self . conf ) . then ( resp => {
if ( resp . data . ok === true ) {
2018-03-11 05:11:32 +00:00
_ . delay ( ( ) => {
2018-01-28 18:34:37 +00:00
self . final . ok = true
switch ( resp . data . redirectPort ) {
case 80 :
self . final . redirectUrl = ` http:// ${ window . location . hostname } ${ resp . data . redirectPath } /login `
break
case 443 :
self . final . redirectUrl = ` https:// ${ window . location . hostname } ${ resp . data . redirectPath } /login `
break
default :
self . final . redirectUrl = ` http:// ${ window . location . hostname } : ${ resp . data . redirectPort } ${ resp . data . redirectPath } /login `
break
}
self . loading = false
} , 5000 )
} else {
self . final . ok = false
self . final . error = resp . data . error
self . loading = false
}
self . $nextTick ( )
} ) . catch ( err => {
window . alert ( err . message )
} )
} , 1000 )
} ,
2018-03-11 05:11:32 +00:00
finish ( ) {
2018-01-28 18:34:37 +00:00
window . location . assign ( this . final . redirectUrl )
}
}
}
< / script >
2018-03-11 05:11:32 +00:00
< style lang = 'scss' >
< / style >