refactor: logging + search modules PH

This commit is contained in:
Nicolas Giard 2018-08-31 23:42:14 -04:00
parent 23f07381c2
commit 9c6a4f6c20
34 changed files with 327 additions and 189 deletions

View File

@ -1,6 +1,6 @@
<template lang='pug'>
v-card(flat)
v-card(flat, :color='$vuetify.dark ? "grey darken-4" : "grey lighten-5"').pa-3.pt-4
v-card(tile, :color='$vuetify.dark ? "grey darken-4" : "grey lighten-5"')
.pa-3.pt-4
.headline.primary--text Editor
.subheading.grey--text Configure the content editor
v-tabs(:color='$vuetify.dark ? "primary" : "grey lighten-4"', fixed-tabs, :slider-color='$vuetify.dark ? "white" : "primary"', show-arrows)
@ -8,21 +8,24 @@
v-tab(key='code') Markdown
v-tab-item(key='settings', :transition='false', :reverse-transition='false')
v-card.pa-3
v-card.pa-3(flat, tile)
.body-2.grey--text.text--darken-1 Select which editors to enable:
.caption.grey--text.pb-2 Some editors require additional configuration in their dedicated tab (when selected).
v-form
v-radio-group(v-model='selectedEditor')
v-radio(v-for='(editor, n) in editors', :key='n', :label='editor.text', :value='editor.value', color='primary')
v-divider
v-btn(color='primary')
v-icon(left) chevron_right
| Set Editor
v-btn(icon)
v-icon.grey--text refresh
v-tab-item(key='code', :transition='false', :reverse-transition='false')
v-card.pa-3
v-card.pa-3(flat, tile)
v-form
v-subheader Editor Configuration
.body-1 This editor has no configuration options you can modify.
.body-1.ml-3 This editor has no configuration options you can modify.
v-card-chin
v-btn(color='primary', @click='save')
v-icon(left) chevron_right
span Apply Configuration
v-spacer
v-btn(icon, @click='refresh')
v-icon.grey--text refresh
</template>
@ -35,6 +38,10 @@ export default {
],
selectedEditor: 'code'
}
},
methods: {
save() {},
refresh() {}
}
}
</script>

View File

@ -1,6 +1,6 @@
<template lang='pug'>
v-card(flat)
v-card(flat, :color='$vuetify.dark ? "grey darken-4" : "grey lighten-5"').pa-3.pt-4
v-card(tile, :color='$vuetify.dark ? "grey darken-4" : "grey lighten-5"')
.pa-3.pt-4
.headline.primary--text Logging
.subheading.grey--text Configure the system logger(s)
v-tabs(:color='$vuetify.dark ? "primary" : "grey lighten-4"', fixed-tabs, :slider-color='$vuetify.dark ? "white" : "primary"', show-arrows)
@ -8,7 +8,7 @@
v-tab(v-for='svc in activeServices', :key='svc.key') {{ svc.title }}
v-tab-item(key='settings', :transition='false', :reverse-transition='false')
v-card.pa-3
v-card.pa-3(flat, tile)
.body-2.pb-2 Select which logging service to enable:
v-form
v-checkbox(
@ -21,29 +21,27 @@
:disabled='svc.key === `console`'
hide-details
)
v-divider
v-btn(color='primary')
v-icon(left) chevron_right
| Set Services
v-btn(color='black', dark, @click='toggleConsole')
v-icon(left) keyboard
| View Console
v-btn(color='black', dark)
v-icon(left) layers_clear
| Purge Logs
v-btn(icon, @click='refresh')
v-icon.grey--text refresh
v-tab-item(v-for='(svc, n) in activeServices', :key='svc.key', :transition='false', :reverse-transition='false')
v-card.pa-3
v-card.pa-3(flat, tile)
v-form
v-subheader Service Configuration
.body-1(v-if='!svc.props || svc.props.length < 1') This logging service has no configuration options you can modify.
v-text-field(v-else, v-for='prop in svc.props', :key='prop', :label='prop', prepend-icon='mode_edit')
v-divider
v-btn(color='primary')
v-icon(left) chevron_right
| Save Configuration
v-card-chin
v-btn(color='primary', @click='save')
v-icon(left) chevron_right
span Apply Configuration
v-btn(color='black', dark, @click='toggleConsole')
v-icon(left) keyboard
span View Console
v-btn(color='black', dark)
v-icon(left) layers_clear
span Purge Logs
v-spacer
v-btn(icon, @click='refresh')
v-icon.grey--text refresh
logging-console(v-model='showConsole')
</template>

View File

@ -1,6 +1,6 @@
<template lang='pug'>
v-card(flat)
v-card(flat, tile, :color='$vuetify.dark ? "grey darken-4" : "grey lighten-5"').pa-3.pt-4
v-card(tile, :color='$vuetify.dark ? "grey darken-4" : "grey lighten-5"')
.pa-3.pt-4
.headline.primary--text Search Engine
.subheading.grey--text Configure the search capabilities of your wiki
v-tabs(:color='$vuetify.dark ? "primary" : "grey lighten-4"', fixed-tabs, :slider-color='$vuetify.dark ? "white" : "primary"', show-arrows)
@ -11,17 +11,12 @@
v-tab(key='solr') Solr
v-tab-item(key='settings')
v-card.pa-3
v-card.pa-3(flat, tile)
v-form
.body-2.grey--text.text--darken-1 Select the search engine to use:
.caption.grey--text.pb-2 Some engines require additional configuration in their dedicated tab (when selected).
v-radio-group(v-model='selectedEngine')
v-radio(v-for='(engine, n) in engines', :key='n', :label='engine.text', :value='engine.value', color='primary')
v-divider
v-btn(color='primary')
v-icon(left) chevron_right
| Set Engine
v-btn(color='black', dark)
v-icon(left) refresh
| Rebuild Index
v-tab-item(key='db')
v-card.pa-3 TODO
v-tab-item(key='algolia')
@ -31,6 +26,17 @@
v-tab-item(key='solr')
v-card.pa-3 TODO
v-card-chin
v-btn(color='primary', @click='save')
v-icon(left) chevron_right
span Apply Configuration
v-btn(color='black', dark)
v-icon(left) refresh
| Rebuild Index
v-spacer
v-btn(icon, @click='refresh')
v-icon.grey--text refresh
</template>
<script>

View File

@ -11,12 +11,11 @@
port: 80
# ---------------------------------------------------------------------
# Data Directories
# IP address the server should listen to
# ---------------------------------------------------------------------
# Do not change unless you know what you are doing!
paths:
content: ./content
data: ./data
bindIP: 0.0.0.0
# ---------------------------------------------------------------------
# Database

View File

@ -7,9 +7,7 @@ defaults:
config:
# File defaults
port: 80
paths:
repo: ./repo
data: ./data
bindIP: 0.0.0.0
db:
type: postgres
host: localhost

View File

@ -170,7 +170,7 @@ module.exports = async () => {
app.set('port', WIKI.config.port)
WIKI.server = http.createServer(app)
WIKI.server.listen(WIKI.config.port)
WIKI.server.listen(WIKI.config.port, WIKI.config.bindIP)
WIKI.server.on('error', (error) => {
if (error.syscall !== 'listen') {
throw error

View File

@ -1,26 +0,0 @@
module.exports = {
key: 'algolia',
title: 'Algolia',
props: ['applicationID', 'adminAPIKey'],
activate(opts) {
},
deactivate(opts) {
},
query(opts) {
},
created(opts) {
},
updated(opts) {
},
deleted(opts) {
},
renamed(opts) {
}
}

View File

@ -0,0 +1,7 @@
key: algolia
title: Algolia
description: Algolia is a powerful search-as-a-service solution, made easy to use with API clients, UI libraries, and pre-built integrations.
author: requarks.io
logo: https://static.requarks.io/logo/algolia.svg
website: https://www.algolia.com/
props: {}

View File

@ -0,0 +1,26 @@
module.exports = {
activate() {
},
deactivate() {
},
query() {
},
created() {
},
updated() {
},
deleted() {
},
renamed() {
},
rebuild() {
}
}

View File

@ -0,0 +1,7 @@
key: aws
title: AWS CloudSearch
description: Amazon CloudSearch is a managed service in the AWS Cloud that makes it simple and cost-effective to set up, manage, and scale a search solution for your website or application.
author: requarks.io
logo: https://static.requarks.io/logo/aws.svg
website: https://aws.amazon.com/cloudsearch/
props: {}

View File

@ -0,0 +1,26 @@
module.exports = {
activate() {
},
deactivate() {
},
query() {
},
created() {
},
updated() {
},
deleted() {
},
renamed() {
},
rebuild() {
}
}

View File

@ -1,26 +0,0 @@
module.exports = {
key: 'azure',
title: 'Azure Search',
props: ['apiKey', 'applicationID'],
activate(opts) {
},
deactivate(opts) {
},
query(opts) {
},
created(opts) {
},
updated(opts) {
},
deleted(opts) {
},
renamed(opts) {
}
}

View File

@ -0,0 +1,7 @@
key: azure
title: Azure Search
description: AI-Powered cloud search service for web and mobile app development.
author: requarks.io
logo: https://static.requarks.io/logo/azure.svg
website: https://azure.microsoft.com/services/search/
props: {}

View File

@ -0,0 +1,26 @@
module.exports = {
activate() {
},
deactivate() {
},
query() {
},
created() {
},
updated() {
},
deleted() {
},
renamed() {
},
rebuild() {
}
}

View File

@ -1,26 +0,0 @@
module.exports = {
key: 'db',
title: 'Database (built-in)',
props: [],
activate(opts) {
},
deactivate(opts) {
},
query(opts) {
},
created(opts) {
},
updated(opts) {
},
deleted(opts) {
},
renamed(opts) {
}
}

View File

@ -0,0 +1,7 @@
key: db
title: Database (built-in)
description: Default database-based search engine.
author: requarks.io
logo: https://static.requarks.io/logo/db.svg
website: https://www.requarks.io/
props: {}

View File

@ -0,0 +1,26 @@
module.exports = {
activate() {
},
deactivate() {
},
query() {
},
created() {
},
updated() {
},
deleted() {
},
renamed() {
},
rebuild() {
}
}

View File

@ -1,26 +0,0 @@
module.exports = {
key: 'elasticsearch',
title: 'Elasticsearch',
props: [],
activate(opts) {
},
deactivate(opts) {
},
query(opts) {
},
created(opts) {
},
updated(opts) {
},
deleted(opts) {
},
renamed(opts) {
}
}

View File

@ -0,0 +1,7 @@
key: elasticsearch
title: Elasticsearch
description: Elasticsearch is a distributed, RESTful search and analytics engine capable of solving a growing number of use cases.
author: requarks.io
logo: https://static.requarks.io/logo/elasticsearch.svg
website: https://www.elastic.co/products/elasticsearch
props: {}

View File

@ -0,0 +1,26 @@
module.exports = {
activate() {
},
deactivate() {
},
query() {
},
created() {
},
updated() {
},
deleted() {
},
renamed() {
},
rebuild() {
}
}

View File

@ -0,0 +1,7 @@
key: manticore
title: Manticore Search
description: High performance full-text search engine with SQL and JSON support.
author: requarks.io
logo: https://static.requarks.io/logo/manticore.svg
website: https://manticoresearch.com/
props: {}

View File

@ -0,0 +1,26 @@
module.exports = {
activate() {
},
deactivate() {
},
query() {
},
created() {
},
updated() {
},
deleted() {
},
renamed() {
},
rebuild() {
}
}

View File

@ -1,26 +0,0 @@
module.exports = {
key: 'solr',
title: 'Solr',
props: [],
activate(opts) {
},
deactivate(opts) {
},
query(opts) {
},
created(opts) {
},
updated(opts) {
},
deleted(opts) {
},
renamed(opts) {
}
}

View File

@ -0,0 +1,7 @@
key: solr
title: Solr
description: Solr is the popular, blazing-fast, open source enterprise search platform built on Apache Lucene.
author: requarks.io
logo: https://static.requarks.io/logo/solr.svg
website: http://lucene.apache.org/solr/
props: {}

View File

@ -0,0 +1,26 @@
module.exports = {
activate() {
},
deactivate() {
},
query() {
},
created() {
},
updated() {
},
deleted() {
},
renamed() {
},
rebuild() {
}
}

View File

@ -0,0 +1,7 @@
key: sphinx
title: Sphinx
description: Sphinx is an open source full text search server, designed from the ground up with performance, relevance and integration simplicity in mind.
author: requarks.io
logo: https://static.requarks.io/logo/sphinx.svg
website: http://sphinxsearch.com/
props: {}

View File

@ -0,0 +1,26 @@
module.exports = {
activate() {
},
deactivate() {
},
query() {
},
created() {
},
updated() {
},
deleted() {
},
renamed() {
},
rebuild() {
}
}

View File

@ -1,4 +1,5 @@
const path = require('path')
const os = require('os')
/* global WIKI */
@ -89,16 +90,11 @@ module.exports = () => {
})
}
// Update config file
WIKI.logger.info('Writing config file to disk...')
let confRaw = await fs.readFileAsync(path.join(WIKI.ROOTPATH, 'config.yml'), 'utf8')
let conf = yaml.safeLoad(confRaw)
// Create directory structure
await fs.ensureDir(conf.paths.data)
await fs.ensureDir(path.join(conf.paths.data, 'cache'))
await fs.ensureDir(path.join(conf.paths.data, 'temp-upload'))
await fs.ensureDir(conf.paths.content)
const tmpPath = path.join(os.tmpdir(), 'wikijs')
await fs.ensureDir(tmpPath)
await fs.ensureDir(path.join(tmpPath, 'cache'))
await fs.ensureDir(path.join(tmpPath, 'uploads'))
// Set config
_.set(WIKI.config, 'defaultEditor', 'markdown')
@ -237,7 +233,7 @@ module.exports = () => {
app.set('port', WIKI.config.port)
WIKI.server = http.createServer(app)
WIKI.server.listen(WIKI.config.port)
WIKI.server.listen(WIKI.config.port, WIKI.config.bindIP)
var openConnections = []