fix: setup issues + webpack improvements
This commit is contained in:
@@ -77,6 +77,12 @@ exports.up = knex => {
|
||||
table.string('level').notNullable().defaultTo('warn')
|
||||
table.json('config')
|
||||
})
|
||||
// NAVIGATION ----------------------------
|
||||
.createTable('navigation', table => {
|
||||
table.charset('utf8mb4')
|
||||
table.string('key').notNullable().primary()
|
||||
table.json('config')
|
||||
})
|
||||
// PAGE HISTORY ------------------------
|
||||
.createTable('pageHistory', table => {
|
||||
table.charset('utf8mb4')
|
||||
@@ -236,6 +242,7 @@ exports.down = knex => {
|
||||
.dropTableIfExists('editors')
|
||||
.dropTableIfExists('groups')
|
||||
.dropTableIfExists('locales')
|
||||
.dropTableIfExists('navigation')
|
||||
.dropTableIfExists('pages')
|
||||
.dropTableIfExists('renderers')
|
||||
.dropTableIfExists('settings')
|
||||
|
39
server/graph/resolvers/navigation.js
Normal file
39
server/graph/resolvers/navigation.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const _ = require('lodash')
|
||||
const graphHelper = require('../../helpers/graph')
|
||||
|
||||
/* global WIKI */
|
||||
|
||||
module.exports = {
|
||||
Query: {
|
||||
async navigation() { return {} }
|
||||
},
|
||||
Mutation: {
|
||||
async navigation() { return {} }
|
||||
},
|
||||
NavigationQuery: {
|
||||
async tree(obj, args, context, info) {
|
||||
// let renderers = await WIKI.models.renderers.getRenderers()
|
||||
return []
|
||||
}
|
||||
},
|
||||
NavigationMutation: {
|
||||
async updateTree(obj, args, context) {
|
||||
try {
|
||||
// for (let rdr of args.renderers) {
|
||||
// await WIKI.models.storage.query().patch({
|
||||
// isEnabled: rdr.isEnabled,
|
||||
// config: _.reduce(rdr.config, (result, value, key) => {
|
||||
// _.set(result, `${value.key}`, value.value)
|
||||
// return result
|
||||
// }, {})
|
||||
// }).where('key', rdr.key)
|
||||
// }
|
||||
return {
|
||||
responseResult: graphHelper.generateSuccess('Navigation updated successfully')
|
||||
}
|
||||
} catch (err) {
|
||||
return graphHelper.generateError(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
51
server/graph/schemas/navigation.graphql
Normal file
51
server/graph/schemas/navigation.graphql
Normal file
@@ -0,0 +1,51 @@
|
||||
# ===============================================
|
||||
# NAVIGATION
|
||||
# ===============================================
|
||||
|
||||
extend type Query {
|
||||
navigation: NavigationQuery
|
||||
}
|
||||
|
||||
extend type Mutation {
|
||||
navigation: NavigationMutation
|
||||
}
|
||||
|
||||
# -----------------------------------------------
|
||||
# QUERIES
|
||||
# -----------------------------------------------
|
||||
|
||||
type NavigationQuery {
|
||||
tree: [NavigationItem]!
|
||||
}
|
||||
|
||||
# -----------------------------------------------
|
||||
# MUTATIONS
|
||||
# -----------------------------------------------
|
||||
|
||||
type NavigationMutation {
|
||||
updateTree(
|
||||
tree: [NavigationItemInput]!
|
||||
): DefaultResponse
|
||||
}
|
||||
|
||||
# -----------------------------------------------
|
||||
# TYPES
|
||||
# -----------------------------------------------
|
||||
|
||||
type NavigationItem {
|
||||
id: String!
|
||||
kind: String!
|
||||
label: String
|
||||
icon: String
|
||||
targetType: String
|
||||
target: String
|
||||
}
|
||||
|
||||
input NavigationItemInput {
|
||||
id: String!
|
||||
kind: String!
|
||||
label: String
|
||||
icon: String
|
||||
targetType: String
|
||||
target: String
|
||||
}
|
@@ -1,4 +1,12 @@
|
||||
{
|
||||
"common": {
|
||||
"footer": {
|
||||
"poweredBy": "Powered by"
|
||||
},
|
||||
"welcome": {
|
||||
"title": "Welcome to your wiki!"
|
||||
}
|
||||
},
|
||||
"auth": {
|
||||
"actions": {
|
||||
"login": "Log In"
|
||||
|
@@ -32,6 +32,7 @@ module.exports = class Editor extends Model {
|
||||
}
|
||||
|
||||
static async refreshEditorsFromDisk() {
|
||||
let trx
|
||||
try {
|
||||
const dbEditors = await WIKI.models.editors.query()
|
||||
|
||||
@@ -72,7 +73,11 @@ module.exports = class Editor extends Model {
|
||||
}
|
||||
}
|
||||
if (newEditors.length > 0) {
|
||||
await WIKI.models.editors.query().insert(newEditors)
|
||||
trx = await WIKI.models.Objection.transaction.start(WIKI.models.knex)
|
||||
for (let editor of newEditors) {
|
||||
await WIKI.models.editors.query(trx).insert(editor)
|
||||
}
|
||||
await trx.commit()
|
||||
WIKI.logger.info(`Loaded ${newEditors.length} new editors: [ OK ]`)
|
||||
} else {
|
||||
WIKI.logger.info(`No new editors found: [ SKIPPED ]`)
|
||||
|
27
server/models/navigation.js
Normal file
27
server/models/navigation.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const Model = require('objection').Model
|
||||
|
||||
/* global WIKI */
|
||||
|
||||
/**
|
||||
* Navigation model
|
||||
*/
|
||||
module.exports = class Navigation extends Model {
|
||||
static get tableName() { return 'navigation' }
|
||||
static get idColumn() { return 'key' }
|
||||
|
||||
static get jsonSchema () {
|
||||
return {
|
||||
type: 'object',
|
||||
required: ['key'],
|
||||
|
||||
properties: {
|
||||
key: {type: 'string'},
|
||||
config: {type: 'object'}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static async getTree() {
|
||||
return WIKI.models.navigation.query()
|
||||
}
|
||||
}
|
@@ -277,5 +277,8 @@ module.exports = () => {
|
||||
|
||||
WIKI.server.on('listening', () => {
|
||||
WIKI.logger.info('HTTP Server: [ RUNNING ]')
|
||||
WIKI.logger.info('========================================')
|
||||
WIKI.logger.info(`Browse to http://localhost:${WIKI.config.port}/`)
|
||||
WIKI.logger.info('========================================')
|
||||
})
|
||||
}
|
||||
|
@@ -24,10 +24,26 @@ html
|
||||
//- CSS
|
||||
link(type='text/css', rel='stylesheet', href='https://fonts.googleapis.com/icon?family=Roboto:400,500,700|Source+Code+Pro:400,700|Material+Icons')
|
||||
link(type='text/css', rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css')
|
||||
|
||||
|
||||
//- JS
|
||||
|
||||
|
||||
script(
|
||||
type='text/javascript'
|
||||
src='/js/runtime.js'
|
||||
)
|
||||
|
||||
|
||||
|
||||
script(
|
||||
type='text/javascript'
|
||||
src='/js/app.js'
|
||||
)
|
||||
|
||||
|
||||
|
||||
block head
|
||||
|
||||
script(type="text/javascript" src="/js/runtime.js")
|
||||
script(type="text/javascript" src="/js/client.js")
|
||||
body
|
||||
block body
|
||||
|
@@ -1,5 +1,48 @@
|
||||
extends master.pug
|
||||
doctype html
|
||||
html
|
||||
head
|
||||
meta(http-equiv='X-UA-Compatible', content='IE=edge')
|
||||
meta(charset='UTF-8')
|
||||
meta(name='viewport', content='user-scalable=yes, width=device-width, initial-scale=1, maximum-scale=5')
|
||||
meta(name='theme-color', content='#333333')
|
||||
meta(name='msapplication-TileColor', content='#333333')
|
||||
meta(name='msapplication-TileImage', content='/favicons/ms-icon-144x144.png')
|
||||
title Wiki.js Setup
|
||||
|
||||
block body
|
||||
#root
|
||||
setup(telemetry-id=telemetryClientID, wiki-version=packageObj.version)
|
||||
//- Favicon
|
||||
each favsize in [57, 60, 72, 76, 114, 120, 144, 152, 180]
|
||||
link(rel='apple-touch-icon', sizes=favsize + 'x' + favsize, href='/favicons/apple-icon-' + favsize + 'x' + favsize + '.png')
|
||||
link(rel='icon', type='image/png', sizes='192x192', href='/favicons/android-icon-192x192.png')
|
||||
each favsize in [32, 96, 16]
|
||||
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href='/favicons/favicon-' + favsize + 'x' + favsize + '.png')
|
||||
link(rel='manifest', href='/manifest.json')
|
||||
|
||||
//- Site Lang
|
||||
script.
|
||||
var siteConfig = !{JSON.stringify({ title: config.title })}
|
||||
|
||||
//- CSS
|
||||
link(type='text/css', rel='stylesheet', href='https://fonts.googleapis.com/icon?family=Roboto:400,500,700|Source+Code+Pro:400,700|Material+Icons')
|
||||
link(type='text/css', rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css')
|
||||
|
||||
|
||||
//- JS
|
||||
|
||||
|
||||
script(
|
||||
type='text/javascript'
|
||||
src='/js/runtime.js'
|
||||
)
|
||||
|
||||
|
||||
|
||||
script(
|
||||
type='text/javascript'
|
||||
src='/js/setup.js'
|
||||
)
|
||||
|
||||
|
||||
|
||||
body
|
||||
#root
|
||||
setup(telemetry-id=telemetryClientID, wiki-version=packageObj.version)
|
||||
|
Reference in New Issue
Block a user