Commit 98d31114 authored by NGPixel's avatar NGPixel

fix: eslint for vue components

parent 72e3bacc
{
"extends": "requarks",
"env": {
"node": true,
"es6": true,
"jest": true
},
"globals": {
"document": false,
"navigator": false,
"window": false,
"FuseBox": false
}
}
extends:
- requarks
- plugin:vue/recommended
env:
node: true
es6: true
jest: true
globals:
document: false
navigator: false
window: false
FuseBox: false
\ No newline at end of file
...@@ -4,5 +4,9 @@ ...@@ -4,5 +4,9 @@
"puglint.enable": true, "puglint.enable": true,
"standard.enable": false, "standard.enable": false,
"editor.formatOnSave": false, "editor.formatOnSave": false,
"editor.tabSize": 2 "editor.tabSize": 2,
"eslint.validate": [
"javascript",
"vue"
]
} }
...@@ -6,16 +6,16 @@ ...@@ -6,16 +6,16 @@
</template> </template>
<script> <script>
export default { export default {
name: 'alert', name: 'alert',
data () { data () {
return {} return {}
}, },
computed: { computed: {
shown() { return this.$store.state.alert.shown }, shown() { return this.$store.state.alert.shown },
style() { return 'is-' + this.$store.state.alert.style }, style() { return 'is-' + this.$store.state.alert.style },
icon() { return 'nc-icon-outline ' + this.$store.state.alert.icon }, icon() { return 'nc-icon-outline ' + this.$store.state.alert.icon },
msg() { return this.$store.state.alert.msg }, msg() { return this.$store.state.alert.msg }
}
} }
}
</script> </script>
...@@ -17,39 +17,39 @@ ...@@ -17,39 +17,39 @@
</template> </template>
<script> <script>
export default { export default {
name: 'anchor', name: 'anchor',
data () { data () {
return {} return {}
},
computed: {
anchorURL () {
return window.location.href.split('#')[0] + '#' + this.$store.state.anchor.hash
}, },
computed: { isShown () {
anchorURL () { return this.$store.state.anchor.shown
return window.location.href.split('#')[0] + '#' + this.$store.state.anchor.hash }
}, },
isShown () { methods: {
return this.$store.state.anchor.shown cancel () {
} this.$store.dispatch('anchor/close')
},
clipboardSuccess () {
this.$store.dispatch('alert', {
style: 'blue',
icon: 'business_notes',
msg: this.$t('modal.anchorsuccess')
})
this.$store.dispatch('anchor/close')
}, },
methods: { clipboardError () {
cancel () { this.$store.dispatch('alert', {
this.$store.dispatch('anchor/close') style: 'red',
}, icon: 'business_notes',
clipboardSuccess () { msg: this.$t('modal.anchorerror')
this.$store.dispatch('alert', { })
style: 'blue', this.$refs.anchorURLinput.select()
icon: 'business_notes',
msg: this.$t('modal.anchorsuccess')
})
this.$store.dispatch('anchor/close')
},
clipboardError () {
this.$store.dispatch('alert', {
style: 'red',
icon: 'business_notes',
msg: this.$t('modal.anchorerror')
})
this.$refs.anchorURLinput.select()
}
} }
} }
}
</script> </script>
...@@ -4,38 +4,38 @@ ...@@ -4,38 +4,38 @@
</template> </template>
<script> <script>
export default { export default {
name: 'color-picker', name: 'color-picker',
props: ['value'], props: ['value'],
data () { data () {
return { return {
colors: [ colors: [
'red', 'red',
'pink', 'pink',
'purple', 'purple',
'deep-purple', 'deep-purple',
'indigo', 'indigo',
'blue', 'blue',
'light-blue', 'light-blue',
'cyan', 'cyan',
'teal', 'teal',
'green', 'green',
'light-green', 'light-green',
'lime', 'lime',
'yellow', 'yellow',
'amber', 'amber',
'orange', 'orange',
'deep-orange', 'deep-orange',
'brown', 'brown',
'grey', 'grey',
'blue-grey' 'blue-grey'
] ]
} }
}, },
methods: { methods: {
setColor(color) { setColor(color) {
this.$emit('input', color) this.$emit('input', color)
}
} }
} }
}
</script> </script>
...@@ -27,29 +27,28 @@ export default { ...@@ -27,29 +27,28 @@ export default {
results: [] results: []
}, },
conf: { conf: {
telemetry: true, adminEmail: '',
upgrade: false, adminPassword: '',
title: siteConfig.title || 'Wiki', adminPasswordConfirm: '',
path: siteConfig.path || '/',
port: siteConfig.port || 80,
lang: siteConfig.lang || 'en',
public: (siteConfig.public === true),
pathData: './data',
pathRepo: './repo',
gitUseRemote: (siteConfig.git !== false),
gitUrl: '',
gitBranch: 'master',
gitAuthType: 'ssh',
gitAuthSSHKey: '',
gitAuthUser: '',
gitAuthPass: '', gitAuthPass: '',
gitAuthSSHKey: '',
gitAuthSSL: true, gitAuthSSL: true,
gitShowUserEmail: true, gitAuthType: 'ssh',
gitAuthUser: '',
gitBranch: 'master',
gitServerEmail: '', gitServerEmail: '',
gitShowUserEmail: true,
gitUrl: '',
gitUseRemote: (siteConfig.git !== false),
lang: siteConfig.lang || 'en',
mongo: 'mongodb://', mongo: 'mongodb://',
adminEmail: '', path: siteConfig.path || '/',
adminPassword: '', pathRepo: './repo',
adminPasswordConfirm: '' port: siteConfig.port || 80,
public: (siteConfig.public === true),
telemetry: true,
title: siteConfig.title || 'Wiki',
upgrade: false
}, },
considerations: { considerations: {
https: false, https: false,
......
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
self.isLoading = true self.isLoading = true
self.$http.get('/js/ace/mode-' + m + '.js').then(resp => { self.$http.get('/js/ace/mode-' + m + '.js').then(resp => {
if (resp.ok) { if (resp.ok) {
eval(resp.bodyText) eval(resp.bodyText) // eslint-disable-line no-eval
self.modelistLoaded.push(m) self.modelistLoaded.push(m)
ace.acequire('ace/mode/' + m) ace.acequire('ace/mode/' + m)
codeEditor.getSession().setMode('ace/mode/' + m) codeEditor.getSession().setMode('ace/mode/' + m)
......
...@@ -33,62 +33,62 @@ ...@@ -33,62 +33,62 @@
</template> </template>
<script> <script>
const videoRules = { const videoRules = {
'youtube': new RegExp('/(?:(?:youtu\\.be\\/|v\\/|vi\\/|u\\/\\w\\/|embed\\/)|(?:(?:watch)?\\?v(?:i)?=|&v(?:i)?=))([^#&?]*).*/', 'i'), 'youtube': new RegExp('/(?:(?:youtu\\.be\\/|v\\/|vi\\/|u\\/\\w\\/|embed\\/)|(?:(?:watch)?\\?v(?:i)?=|&v(?:i)?=))([^#&?]*).*/', 'i'),
'vimeo': new RegExp('/vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/(?:[^/]*)\\/videos\\/|album\\/(?:\\d+)\\/video\\/|)(\\d+)(?:$|\\/|\\?)/', 'i'), 'vimeo': new RegExp('/vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/(?:[^/]*)\\/videos\\/|album\\/(?:\\d+)\\/video\\/|)(\\d+)(?:$|\\/|\\?)/', 'i'),
'dailymotion': new RegExp('/(?:dailymotion\\.com(?:\\/embed)?(?:\\/video|\\/hub)|dai\\.ly)\\/([0-9a-z]+)(?:[-_0-9a-zA-Z]+(?:#video=)?([a-z0-9]+)?)?/', 'i') 'dailymotion': new RegExp('/(?:dailymotion\\.com(?:\\/embed)?(?:\\/video|\\/hub)|dai\\.ly)\\/([0-9a-z]+)(?:[-_0-9a-zA-Z]+(?:#video=)?([a-z0-9]+)?)?/', 'i')
} }
export default { export default {
name: 'editor-video', name: 'editor-video',
data () { data () {
return { return {
link: '', link: '',
isInvalid: false isInvalid: false
} }
},
computed: {
isShown () {
return this.$store.state.editorVideo.shown
}
},
methods: {
init () {
let self = this
self.isInvalid = false
self._.delay(() => {
self.$refs.editorVideoInput.focus()
}, 100)
}, },
computed: { cancel () {
isShown () { this.$store.dispatch('editorVideo/close')
return this.$store.state.editorVideo.shown
}
}, },
methods: { insertVideo () {
init () { let self = this
let self = this
self.isInvalid = false
self._.delay(() => {
self.$refs.editorVideoInput.focus()
}, 100)
},
cancel () {
this.$store.dispatch('editorVideo/close')
},
insertVideo () {
let self = this
if (this._.isEmpty(self.link) || self.link.length < 5) { if (this._.isEmpty(self.link) || self.link.length < 5) {
this.isInvalid = true this.isInvalid = true
return return
} }
let videoType = this._.findKey(videoRules, (vr) => { let videoType = this._.findKey(videoRules, (vr) => {
return vr.test(self.link) return vr.test(self.link)
}) })
if (this._.isNil(videoType)) { if (this._.isNil(videoType)) {
videoType = 'video' videoType = 'video'
}
let videoText = '[video](' + this.link + '){.' + videoType + '}\n'
this.$store.dispatch('editor/insert', videoText)
this.$store.dispatch('alert', {
style: 'blue',
icon: 'media-1_action-74',
msg: self.$t('editor.videosuccess')
})
this.cancel()
} }
}, let videoText = '[video](' + this.link + '){.' + videoType + '}\n'
mounted () { this.$store.dispatch('editor/insert', videoText)
this.$root.$on('editorVideo/init', this.init) this.$store.dispatch('alert', {
style: 'blue',
icon: 'media-1_action-74',
msg: self.$t('editor.videosuccess')
})
this.cancel()
} }
},
mounted () {
this.$root.$on('editorVideo/init', this.init)
} }
}
</script> </script>
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
</template> </template>
<script> <script>
/* global wiki, Diff2HtmlUI */
let diffui let diffui
let diffuiIsReady = false let diffuiIsReady = false
export default { export default {
...@@ -98,7 +100,7 @@ export default { ...@@ -98,7 +100,7 @@ export default {
let self = this let self = this
diffuiIsReady = false diffuiIsReady = false
self.current = cm self.current = cm
self.$http.post(siteRoot + '/hist', { self.$http.post(wiki.siteRoot + '/hist', {
path: self.currentPath, path: self.currentPath,
commit: cm.commit commit: cm.commit
}).then(resp => { }).then(resp => {
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
export default { export default {
name: 'loading-spinner', name: 'loading-spinner',
computed: mapState(['loading']) computed: mapState(['loading'])
} }
</script> </script>
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
</template> </template>
<script> <script>
/* global CONSTANTS, graphQL, siteConfig */
export default { export default {
name: 'login', name: 'login',
data() { data() {
...@@ -67,4 +69,3 @@ export default { ...@@ -67,4 +69,3 @@ export default {
} }
} }
</script> </script>
...@@ -18,50 +18,50 @@ ...@@ -18,50 +18,50 @@
</template> </template>
<script> <script>
export default { export default {
name: 'modal-create-page', name: 'modal-create-page',
props: ['basepath'], props: ['basepath'],
data () { data () {
return { return {
currentPath: '', currentPath: '',
userPath: '', userPath: '',
isLoading: false, isLoading: false,
isInvalid: false isInvalid: false
}
},
computed: {
isShown () {
if (this.$store.state.modalCreatePage.shown) {
this.makeSelection()
} }
return this.$store.state.modalCreatePage.shown
}
},
methods: {
makeSelection: function () {
let self = this
self._.delay(() => {
let startPos = (self.currentPath.length > 0) ? self.currentPath.length + 1 : 0
self.$helpers.form.setInputSelection(self.$refs.createPageInput, startPos, self.userPath.length)
}, 100)
}, },
computed: { cancel: function () {
isShown () { this.$store.dispatch('modalCreatePage/close')
if(this.$store.state.modalCreatePage.shown) {
this.makeSelection()
}
return this.$store.state.modalCreatePage.shown
}
}, },
methods: { create: function () {
makeSelection: function () { this.isInvalid = false
let self = this; let newDocPath = this.$helpers.pages.makeSafePath(this.userPath)
self._.delay(() => { if (this._.isEmpty(newDocPath)) {
let startPos = (self.currentPath.length > 0) ? self.currentPath.length + 1 : 0 this.isInvalid = true
self.$helpers.form.setInputSelection(self.$refs.createPageInput, startPos, self.userPath.length) } else {
}, 100) this.isLoading = true
}, window.location.assign('/create/' + newDocPath)
cancel: function () {
this.$store.dispatch('modalCreatePage/close')
},
create: function () {
this.isInvalid = false
let newDocPath = this.$helpers.pages.makeSafePath(this.userPath)
if (this._.isEmpty(newDocPath)) {
this.isInvalid = true
} else {
this.isLoading = true
window.location.assign('/create/' + newDocPath)
}
} }
},
mounted () {
this.currentPath = (this.basepath === 'home') ? '' : this.basepath
this.userPath = (this._.isEmpty(this.currentPath)) ? 'new-page' : this.currentPath + '/new-page'
} }
},
mounted () {
this.currentPath = (this.basepath === 'home') ? '' : this.basepath
this.userPath = (this._.isEmpty(this.currentPath)) ? 'new-page' : this.currentPath + '/new-page'
} }
}
</script> </script>
...@@ -18,49 +18,49 @@ ...@@ -18,49 +18,49 @@
</template> </template>
<script> <script>
export default { export default {
name: 'modal-delete-page', name: 'modal-delete-page',
props: ['currentPath'], props: ['currentPath'],
data () { data () {
return { return {
isLoading: false isLoading: false
} }
}, },
computed: { computed: {
isShown () { isShown () {
return this.$store.state.modalDeletePage.shown return this.$store.state.modalDeletePage.shown
} }
},
methods: {
discard () {
this.isLoading = false
this.$store.dispatch('modalDeletePage/close')
}, },
methods: { deletePage () {
discard () { let self = this
this.isLoading = false this.isLoading = true
this.$store.dispatch('modalDeletePage/close') this.$http.delete(window.location.href).then(resp => {
}, return resp.json()
deletePage () { }).then(resp => {
let self = this if (resp.ok) {
this.isLoading = true window.location.assign('/')
this.$http.delete(window.location.href).then(resp => { } else {
return resp.json()
}).then(resp => {
if (resp.ok) {
window.location.assign('/')
} else {
self.isLoading = false
self.$store.dispatch('alert', {
style: 'red',
icon: 'ui-2_square-remove-09',
msg: resp.msg
})
}
}).catch(err => {
self.isLoading = false self.isLoading = false
self.$store.dispatch('alert', { self.$store.dispatch('alert', {
style: 'red', style: 'red',
icon: 'ui-2_square-remove-09', icon: 'ui-2_square-remove-09',
msg: 'Error: ' + err.body.msg msg: resp.msg
}) })
}
}).catch(err => {
self.isLoading = false
self.$store.dispatch('alert', {
style: 'red',
icon: 'ui-2_square-remove-09',
msg: 'Error: ' + err.body.msg
}) })
} })
} }
} }
}
</script> </script>
...@@ -16,28 +16,28 @@ ...@@ -16,28 +16,28 @@
</template> </template>
<script> <script>
export default { export default {
name: 'modal-discard-page', name: 'modal-discard-page',
props: ['mode', 'currentPath'], props: ['mode', 'currentPath'],
data () { data () {
return {} return {}
}, },
computed: { computed: {
isShown () { isShown () {
return this.$store.state.modalDiscardPage.shown return this.$store.state.modalDiscardPage.shown
} }
},
methods: {
stay: function () {
this.$store.dispatch('modalDiscardPage/close')
}, },
methods: { discard: function () {
stay: function () { if (this.mode === 'create') {
this.$store.dispatch('modalDiscardPage/close') window.location.assign('/')
}, } else {
discard: function () { window.location.assign('/' + this.currentPath)
if(this.mode === 'create') {
window.location.assign('/')
} else {
window.location.assign('/' + this.currentPath)
}
} }
} }
} }
}
</script> </script>
...@@ -19,68 +19,68 @@ ...@@ -19,68 +19,68 @@
</template> </template>
<script> <script>
export default { export default {
name: 'modal-move-page', name: 'modal-move-page',
props: ['currentPath'], props: ['currentPath'],
data () { data () {
return { return {
movePath: '', movePath: '',
isLoading: false, isLoading: false,
isInvalid: false isInvalid: false
}
},
computed: {
isShown () {
if (this.$store.state.modalMovePage.shown) {
this.movePath = this.currentPath
this.makeSelection()
} }
return this.$store.state.modalMovePage.shown
}
},
methods: {
makeSelection() {
let self = this
self._.delay(() => {
let startPos = (self._.includes(self.currentPath, '/')) ? self._.lastIndexOf(self.movePath, '/') + 1 : 0
self.$helpers.form.setInputSelection(self.$refs.movePageInput, startPos, self.movePath.length)
}, 100)
}, },
computed: { cancel() {
isShown () { this.$store.dispatch('modalMovePage/close')
if(this.$store.state.modalMovePage.shown) {
this.movePath = this.currentPath
this.makeSelection()
}
return this.$store.state.modalMovePage.shown
}
}, },
methods: { move () {
makeSelection() { this.isInvalid = false
let self = this; let newDocPath = this.$helpers.pages.makeSafePath(this.movePath)
self._.delay(() => { if (this._.isEmpty(newDocPath) || newDocPath === this.currentPath || newDocPath === 'home') {
let startPos = (self._.includes(self.currentPath, '/')) ? self._.lastIndexOf(self.movePath, '/') + 1 : 0 this.isInvalid = true
self.$helpers.form.setInputSelection(self.$refs.movePageInput, startPos, self.movePath.length) } else {
}, 100) this.isLoading = true
}, this.$http.put(window.location.href, {
cancel() { move: newDocPath
this.$store.dispatch('modalMovePage/close') }).then(resp => {
}, return resp.json()
move () { }).then(resp => {
this.isInvalid = false if (resp.ok) {
let newDocPath = this.$helpers.pages.makeSafePath(this.movePath) window.location.assign('/' + newDocPath)
if (this._.isEmpty(newDocPath) || newDocPath === this.currentPath || newDocPath === 'home') { } else {
this.isInvalid = true
} else {
this.isLoading = true
this.$http.put(window.location.href, {
move: newDocPath
}).then(resp => {
return resp.json()
}).then(resp => {
if (resp.ok) {
window.location.assign('/' + newDocPath)
} else {
this.loading = false
self.$store.dispatch('alert', {
style: 'red',
icon: 'ui-2_square-remove-09',
msg: resp.msg
})
}
}).catch(err => {
this.loading = false this.loading = false
self.$store.dispatch('alert', { self.$store.dispatch('alert', {
style: 'red', style: 'red',
icon: 'ui-2_square-remove-09', icon: 'ui-2_square-remove-09',
msg: 'Error: ' + err.body.msg msg: resp.msg
}) })
}
}).catch(err => {
this.loading = false
self.$store.dispatch('alert', {
style: 'red',
icon: 'ui-2_square-remove-09',
msg: 'Error: ' + err.body.msg
}) })
} })
} }
} }
} }
}
</script> </script>
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
</template> </template>
<script> <script>
/* global siteRoot, socket, $ */
export default { export default {
data() { data() {
return { return {
...@@ -57,9 +59,9 @@ export default { ...@@ -57,9 +59,9 @@ export default {
}, },
searchmoveidx: function (val, oldVal) { searchmoveidx: function (val, oldVal) {
if (val > 0) { if (val > 0) {
this.searchmovekey = (this.searchmovearr[val - 1]) this.searchmovekey = (this.searchmovearr[val - 1]) ?
? 'res.' + this.searchmovearr[val - 1].entryPath 'res.' + this.searchmovearr[val - 1].entryPath :
: 'sug.' + this.searchmovearr[val - 1] 'sug.' + this.searchmovearr[val - 1]
} else { } else {
this.searchmovekey = '' this.searchmovekey = ''
} }
......
...@@ -6,16 +6,16 @@ ...@@ -6,16 +6,16 @@
</template> </template>
<script> <script>
export default { export default {
name: 'toggle', name: 'toggle',
props: ['value', 'desc'], props: ['value', 'desc'],
data () { data () {
return { } return { }
}, },
methods: { methods: {
changeToggle() { changeToggle() {
this.$emit('input', !this.value) this.$emit('input', !this.value)
}
} }
} }
}
</script> </script>
...@@ -15,68 +15,70 @@ ...@@ -15,68 +15,70 @@
</template> </template>
<script> <script>
export default { /* global socket, siteRoot */
name: 'tree',
data () { export default {
return { name: 'tree',
tree: [] data () {
} return {
}, tree: []
methods: { }
fetch (basePath) { },
let self = this methods: {
self.$store.dispatch('startLoading') fetch (basePath) {
self.$nextTick(() => { let self = this
socket.emit('treeFetch', { basePath }, (data) => { self.$store.dispatch('startLoading')
if (self.tree.length > 0) { self.$nextTick(() => {
let branch = self._.last(self.tree) socket.emit('treeFetch', { basePath }, (data) => {
branch.hasChildren = true if (self.tree.length > 0) {
self._.find(branch.pages, { _id: basePath }).isActive = true let branch = self._.last(self.tree)
} branch.hasChildren = true
self.tree.push({ self._.find(branch.pages, { _id: basePath }).isActive = true
hasChildren: false,
pages: data
})
self.$store.dispatch('stopLoading')
})
})
},
goto (entryPath) {
window.location.assign(siteRoot + '/' + entryPath)
},
unfold (entryPath) {
let self = this
let lastIndex = 0
self._.forEach(self.tree, branch => {
lastIndex++
if (self._.find(branch.pages, { _id: entryPath }) !== undefined) {
return false
} }
self.tree.push({
hasChildren: false,
pages: data
})
self.$store.dispatch('stopLoading')
}) })
self.tree = self._.slice(self.tree, 0, lastIndex) })
let branch = self._.last(self.tree) },
branch.hasChildren = false goto (entryPath) {
branch.pages.forEach(page => { window.location.assign(siteRoot + '/' + entryPath)
page.isActive = false },
}) unfold (entryPath) {
}, let self = this
mainAction (page) { let lastIndex = 0
let self = this self._.forEach(self.tree, branch => {
if (page.isActive) { lastIndex++
self.unfold(page._id) if (self._.find(branch.pages, { _id: entryPath }) !== undefined) {
} else if (page.isDirectory) { return false
self.fetch(page._id)
} else {
self.goto(page._id)
} }
} })
self.tree = self._.slice(self.tree, 0, lastIndex)
let branch = self._.last(self.tree)
branch.hasChildren = false
branch.pages.forEach(page => {
page.isActive = false
})
}, },
mounted () { mainAction (page) {
let basePath = window.location.pathname.slice(0, -4) let self = this
if (basePath.length > 1) { if (page.isActive) {
basePath = basePath.slice(1) self.unfold(page._id)
} else if (page.isDirectory) {
self.fetch(page._id)
} else {
self.goto(page._id)
} }
this.fetch(basePath)
} }
},
mounted () {
let basePath = window.location.pathname.slice(0, -4)
if (basePath.length > 1) {
basePath = basePath.slice(1)
}
this.fetch(basePath)
} }
}
</script> </script>
'use strict'
/* global appconfig, runmode */
import jQuery from 'jquery'
import _ from 'lodash'
import Vue from 'vue'
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
}
})
jQuery(document).ready(function ($) {
new Vue({ // eslint-disable-line no-new
el: 'main',
data: {
loading: false,
state: 'welcome',
syscheck: {
ok: false,
error: '',
results: []
},
dbcheck: {
ok: false,
error: ''
},
gitcheck: {
ok: false,
error: ''
},
final: {
ok: false,
error: '',
results: []
},
conf: {
title: appconfig.title || 'Wiki',
host: appconfig.host || 'http://',
port: appconfig.port || 80,
lang: appconfig.lang || 'en',
public: (appconfig.public === true),
db: appconfig.db || 'mongodb://localhost:27017/wiki',
pathData: './data',
pathRepo: './repo',
gitUseRemote: (appconfig.git !== false),
gitUrl: '',
gitBranch: 'master',
gitAuthType: 'ssh',
gitAuthSSHKey: '',
gitAuthUser: '',
gitAuthPass: '',
gitAuthSSL: true,
gitShowUserEmail: true,
gitServerEmail: '',
adminEmail: '',
adminPassword: '',
adminPasswordConfirm: ''
},
considerations: {
https: false,
port: false,
localhost: false
}
},
computed: {
currentProgress: function () {
let perc = '0%'
switch (this.state) {
case 'welcome':
perc = '0%'
break
case 'syscheck':
perc = (this.syscheck.ok) ? '15%' : '5%'
break
case 'general':
perc = '20%'
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%'
break
case 'gitcheck':
perc = (this.gitcheck.ok) ? '75%' : '65%'
break
case 'admin':
perc = '80%'
break
}
return perc
}
},
mounted: function () {
if (appconfig.paths) {
this.conf.pathData = appconfig.paths.data || './data'
this.conf.pathRepo = appconfig.paths.repo || './repo'
}
if (appconfig.git !== false && _.isPlainObject(appconfig.git)) {
this.conf.gitUrl = appconfig.git.url || ''
this.conf.gitBranch = appconfig.git.branch || 'master'
this.conf.gitShowUserEmail = (appconfig.git.showUserEmail !== false)
this.conf.gitServerEmail = appconfig.git.serverEmail || ''
if (_.isPlainObject(appconfig.git.auth)) {
this.conf.gitAuthType = appconfig.git.auth.type || 'ssh'
this.conf.gitAuthSSHKey = appconfig.git.auth.privateKey || ''
this.conf.gitAuthUser = appconfig.git.auth.username || ''
this.conf.gitAuthPass = appconfig.git.auth.password || ''
this.conf.gitAuthSSL = (appconfig.git.auth.sslVerify !== false)
}
}
},
methods: {
proceedToWelcome: function (ev) {
this.state = 'welcome'
this.loading = false
},
proceedToSyscheck: function (ev) {
let self = this
this.state = 'syscheck'
this.loading = true
self.syscheck = {
ok: false,
error: '',
results: []
}
_.delay(() => {
axios.post('/syscheck').then(resp => {
if (resp.data.ok === true) {
self.syscheck.ok = true
self.syscheck.results = resp.data.results
} else {
self.syscheck.ok = false
self.syscheck.error = resp.data.error
}
self.loading = false
self.$nextTick()
}).catch(err => {
window.alert(err.message)
})
}, 1000)
},
proceedToGeneral: function (ev) {
let self = this
self.state = 'general'
self.loading = false
self.$nextTick(() => {
self.$validator.validateAll('general')
})
},
proceedToConsiderations: function (ev) {
this.considerations = {
https: !_.startsWith(this.conf.host, 'https'),
port: false, // TODO
localhost: _.includes(this.conf.host, 'localhost')
}
this.state = 'considerations'
this.loading = false
},
proceedToDb: function (ev) {
let self = this
if (runmode.staticMongo) {
return self.proceedToDbcheck()
}
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: ''
}
_.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'
self.loading = false
self.$nextTick(() => {
self.$validator.validateAll('git')
})
},
proceedToGitCheck: function (ev) {
let self = this
this.state = 'gitcheck'
this.loading = true
self.gitcheck = {
ok: false,
results: [],
error: ''
}
_.delay(() => {
axios.post('/gitcheck', self.conf).then(resp => {
if (resp.data.ok === true) {
self.gitcheck.ok = true
self.gitcheck.results = resp.data.results
} else {
self.gitcheck.ok = false
self.gitcheck.error = resp.data.error
}
self.loading = false
self.$nextTick()
}).catch(err => {
window.alert(err.message)
})
}, 1000)
},
proceedToAdmin: function (ev) {
let self = this
self.state = 'admin'
self.loading = false
self.$nextTick(() => {
self.$validator.validateAll('admin')
})
},
proceedToFinal: function (ev) {
let self = this
self.state = 'final'
self.loading = true
self.final = {
ok: false,
error: '',
results: []
}
_.delay(() => {
axios.post('/finalize', self.conf).then(resp => {
if (resp.data.ok === true) {
self.final.ok = true
self.final.results = resp.data.results
} else {
self.final.ok = false
self.final.error = resp.data.error
}
self.loading = false
self.$nextTick()
}).catch(err => {
window.alert(err.message)
})
}, 1000)
},
finish: function (ev) {
let self = this
self.state = 'restart'
_.delay(() => {
axios.post('/restart', {}).then(resp => {
_.delay(() => {
window.location.assign(self.conf.host)
}, 30000)
}).catch(err => {
window.alert(err.message)
})
}, 1000)
}
}
})
})
'use strict' /* global wikijs */
export default { export default {
namespaced: true, namespaced: true,
......
'use strict' /* global wikijs */
export default { export default {
namespaced: true, namespaced: true,
......
'use strict' /* global wikijs */
export default { export default {
namespaced: true, namespaced: true,
......
'use strict' /* global wikijs */
export default { export default {
namespaced: true, namespaced: true,
......
'use strict'
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
......
'use strict' /* global wikijs */
export default { export default {
namespaced: true, namespaced: true,
......
'use strict'
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
......
'use strict'
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
......
'use strict'
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
......
'use strict'
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
......
'use strict'
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
......
'use strict'
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"restart": "node wiki restart", "restart": "node wiki restart",
"build": "node tools/fuse", "build": "node tools/fuse",
"dev": "node tools/fuse -d", "dev": "node tools/fuse -d",
"test": "jest" "test": "eslint --ext .js,.vue . && jest"
}, },
"bin": { "bin": {
"wiki": "wiki.js" "wiki": "wiki.js"
...@@ -149,6 +149,7 @@ ...@@ -149,6 +149,7 @@
"eslint-plugin-node": "5.2.1", "eslint-plugin-node": "5.2.1",
"eslint-plugin-promise": "3.6.0", "eslint-plugin-promise": "3.6.0",
"eslint-plugin-standard": "3.0.1", "eslint-plugin-standard": "3.0.1",
"eslint-plugin-vue": "3.13.1",
"fuse-box": "2.4.0", "fuse-box": "2.4.0",
"graphql-tag": "^2.5.0", "graphql-tag": "^2.5.0",
"i18next-xhr-backend": "1.4.3", "i18next-xhr-backend": "1.4.3",
......
'use strict' /* global appdata, ROOTPATH */
const crypto = require('crypto') const crypto = require('crypto')
const path = require('path') const path = require('path')
......
'use strict' 'use strict'
/* global appdata, rights */ /* global rights */
/** /**
* Authentication middleware * Authentication middleware
......
/* global wiki */ /* global wiki, appconfig */
const Promise = require('bluebird') const Promise = require('bluebird')
const bcrypt = require('bcryptjs-then') const bcrypt = require('bcryptjs-then')
......
'use strict'
/* global wiki */ /* global wiki */
const Promise = require('bluebird') const Promise = require('bluebird')
...@@ -58,8 +56,7 @@ var mkdown = md({ ...@@ -58,8 +56,7 @@ var mkdown = md({
}) })
.use(mdAttrs) .use(mdAttrs)
// if (wiki.config.features.mathjax) { if (wiki.config.features.mathjax) {
if (true) {
mkdown.use(mdMathjax) mkdown.use(mdMathjax)
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
const Promise = require('bluebird') const Promise = require('bluebird')
const _ = require('lodash') const _ = require('lodash')
// const searchIndex = require('./search-index') // const searchIndex = require('./search-index')
const stopWord = require('stopword') // const stopWord = require('stopword')
const streamToPromise = require('stream-to-promise') const streamToPromise = require('stream-to-promise')
const searchAllowedChars = new RegExp('[^a-z0-9' + wiki.data.regex.cjk + wiki.data.regex.arabic + ' ]', 'g') const searchAllowedChars = new RegExp('[^a-z0-9' + wiki.data.regex.cjk + wiki.data.regex.arabic + ' ]', 'g')
...@@ -22,7 +22,7 @@ module.exports = { ...@@ -22,7 +22,7 @@ module.exports = {
init () { init () {
let self = this let self = this
self._isReady = new Promise((resolve, reject) => { self._isReady = new Promise((resolve, reject) => {
/*searchIndex({ /* searchIndex({
deletable: true, deletable: true,
fieldedSearch: true, fieldedSearch: true,
indexPath: 'wiki', indexPath: 'wiki',
......
'use strict' 'use strict'
/* global winston */ /* global winston, ROOTPATH, appconfig */
const Promise = require('bluebird') const Promise = require('bluebird')
const crypto = require('crypto') const crypto = require('crypto')
......
...@@ -26,7 +26,7 @@ block body ...@@ -26,7 +26,7 @@ block body
.panel-content.form-sections .panel-content.form-sections
section section
p p
svg.icons.is-18.is-outlined.has-right-pad.is-text: use(xlink:href="#nc-cd-reader") svg.icons.is-18.is-outlined.has-right-pad.is-text: use(xlink:href='#nc-cd-reader')
span You are about to install Wiki.js #[strong= packageObj.version]. span You are about to install Wiki.js #[strong= packageObj.version].
section section
p.control.is-fullwidth p.control.is-fullwidth
...@@ -51,14 +51,14 @@ block body ...@@ -51,14 +51,14 @@ block body
span System Check span System Check
i(v-if='loading') i(v-if='loading')
.panel-content.is-text .panel-content.is-text
p(v-if='loading') #[svg.icons.is-24.is-text: use(xlink:href="#nc-ms-dots")] Checking your system for compatibility... p(v-if='loading') #[svg.icons.is-24.is-text: use(xlink:href='#nc-ms-dots')] Checking your system for compatibility...
p(v-if='!loading && syscheck.ok') p(v-if='!loading && syscheck.ok')
ul ul
li(v-for='rs in syscheck.results') #[svg.icons.is-18.is-text: use(xlink:href="#nc-check-bold")] {{rs}} li(v-for='rs in syscheck.results') #[svg.icons.is-18.is-text: use(xlink:href='#nc-check-bold')] {{rs}}
p(v-if='!loading && syscheck.ok') p(v-if='!loading && syscheck.ok')
svg.icons.is-18.is-text: use(xlink:href="#nc-check-bold") svg.icons.is-18.is-text: use(xlink:href='#nc-check-bold')
strong Looks good! No issues so far. strong Looks good! No issues so far.
p(v-if='!loading && !syscheck.ok') #[svg.icons.is-18.is-text: use(xlink:href="#nc-square-remove-12")] Error: {{ syscheck.error }} p(v-if='!loading && !syscheck.ok') #[svg.icons.is-18.is-text: use(xlink:href='#nc-square-remove-12')] Error: {{ syscheck.error }}
.panel-footer .panel-footer
.progress-bar: div(v-bind:style='{width: currentProgress}') .progress-bar: div(v-bind:style='{width: currentProgress}')
button.button.is-small.is-light-blue.is-outlined(v-on:click='proceedToWelcome', v-bind:disabled='loading') Back button.button.is-small.is-light-blue.is-outlined(v-on:click='proceedToWelcome', v-bind:disabled='loading') Back
...@@ -218,14 +218,14 @@ block body ...@@ -218,14 +218,14 @@ block body
span Git Repository Check span Git Repository Check
i(v-if='loading') i(v-if='loading')
.panel-content.is-text .panel-content.is-text
p(v-if='loading') #[svg.icons.is-24.is-text: use(xlink:href="#nc-ms-dots")] Verifying Git repository settings... p(v-if='loading') #[svg.icons.is-24.is-text: use(xlink:href='#nc-ms-dots')] Verifying Git repository settings...
p(v-if='!loading && gitcheck.ok') p(v-if='!loading && gitcheck.ok')
ul ul
li(v-for='rs in gitcheck.results') #[svg.icons.is-18.is-text: use(xlink:href="#nc-check-bold")] {{rs}} li(v-for='rs in gitcheck.results') #[svg.icons.is-18.is-text: use(xlink:href='#nc-check-bold')] {{rs}}
p(v-if='!loading && gitcheck.ok') p(v-if='!loading && gitcheck.ok')
svg.icons.is-18.is-text: use(xlink:href="#nc-check-bold") svg.icons.is-18.is-text: use(xlink:href='#nc-check-bold')
strong Git settings are correct! strong Git settings are correct!
p(v-if='!loading && !gitcheck.ok') #[svg.icons.is-18.is-text: use(xlink:href="#nc-square-remove-12")] Error: {{ gitcheck.error }} p(v-if='!loading && !gitcheck.ok') #[svg.icons.is-18.is-text: use(xlink:href='#nc-square-remove-12')] Error: {{ gitcheck.error }}
.panel-footer .panel-footer
.progress-bar: div(v-bind:style='{width: currentProgress}') .progress-bar: div(v-bind:style='{width: currentProgress}')
button.button.is-small.is-light-blue.is-outlined(v-on:click='proceedToGit', v-bind:disabled='loading') Back button.button.is-small.is-light-blue.is-outlined(v-on:click='proceedToGit', v-bind:disabled='loading') Back
...@@ -280,11 +280,11 @@ block body ...@@ -280,11 +280,11 @@ block body
section section
p.control.is-fullwidth p.control.is-fullwidth
label.label Connection String to Wiki.js 1.x MongoDB database label.label Connection String to Wiki.js 1.x MongoDB database
input(type='text', placeholder='mongodb://', v-model='conf.mongo', data-vv-scope='mongo', name='ipt-mongo', v-validate='{ required: true, min: 2 }') input(type='text', placeholder='mongodb://', v-model='conf.mongo', data-vv-scope='upgrade', name='ipt-mongo', v-validate='{ required: true, min: 2 }')
span.desc A MongoDB database connection string where a Wiki.js 1.x installation is located. #[strong No alterations will be made to this database. ] span.desc A MongoDB database connection string where a Wiki.js 1.x installation is located. #[strong No alterations will be made to this database. ]
section section
p.control.is-fullwidth p.control.is-fullwidth
input#ipt-public(type='checkbox', v-model='conf.public', data-vv-scope='general', name='ipt-public') input#ipt-public(type='checkbox', v-model='conf.public', data-vv-scope='upgrade', name='ipt-public')
label.label(for='ipt-public') Create groups based on individual permissions label.label(for='ipt-public') Create groups based on individual permissions
span.desc User groups will be created based on existing users permissions. If multiple users have the exact same permission rules, they will be put in the same user group. span.desc User groups will be created based on existing users permissions. If multiple users have the exact same permission rules, they will be put in the same user group.
.panel-footer .panel-footer
...@@ -332,4 +332,4 @@ block body ...@@ -332,4 +332,4 @@ block body
.footer .footer
small Wiki.js Installation Wizard small Wiki.js Installation Wizard
small(v-if='conf.telemetry') Telemetry Client ID: !{telemetryClientID} small(v-if='conf.telemetry') Telemetry Client ID: !{telemetryClientID}
\ No newline at end of file
...@@ -59,12 +59,12 @@ expect.extend({ ...@@ -59,12 +59,12 @@ expect.extend({
}) })
describe('Code Linting', () => { describe('Code Linting', () => {
it('should pass ESLint validation', () => { // it('should pass ESLint validation', () => {
const CLIEngine = require('eslint').CLIEngine // const CLIEngine = require('eslint').CLIEngine
const cli = new CLIEngine() // const cli = new CLIEngine()
let report = cli.executeOnFiles(['**/*.js']) // let report = cli.executeOnFiles(['**/*.js', '**/*.vue'])
expect(report).toESLint() // expect(report).toESLint()
}) // })
it('should pass PugLint validation', () => { it('should pass PugLint validation', () => {
const PugLint = require('pug-lint') const PugLint = require('pug-lint')
......
'use strict'
const _ = require('lodash')
const Promise = require('bluebird') const Promise = require('bluebird')
const colors = require('colors/safe') const colors = require('colors/safe')
const fs = Promise.promisifyAll(require('fs-extra')) const fs = Promise.promisifyAll(require('fs-extra'))
......
This diff was suppressed by a .gitattributes entry.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment