Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
21413663
You need to sign in or sign up before continuing.
Commit
21413663
authored
Feb 23, 2019
by
Nick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: dev flags
parent
bf505e69
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
124 additions
and
6 deletions
+124
-6
admin.vue
client/components/admin.vue
+1
-2
admin-contribute.vue
client/components/admin/admin-contribute.vue
+11
-1
admin-dev-flags.vue
client/components/admin/admin-dev-flags.vue
+36
-2
dev-mutation-save-flags.gql
client/graph/admin/dev/dev-mutation-save-flags.gql
+16
-0
dev-query-flags.gql
client/graph/admin/dev/dev-query-flags.gql
+8
-0
config.yml
dev/build/config.yml
+1
-1
data.yml
server/app/data.yml
+2
-0
config.js
server/core/config.js
+6
-0
kernel.js
server/core/kernel.js
+1
-0
system.js
server/graph/resolvers/system.js
+21
-0
system.graphql
server/graph/schemas/system.graphql
+21
-0
No files found.
client/components/admin.vue
View file @
21413663
...
@@ -80,13 +80,12 @@
...
@@ -80,13 +80,12 @@
v-list-tile-avatar: v-icon(color='grey lighten-2') build
v-list-tile-avatar: v-icon(color='grey lighten-2') build
v-list-tile-title
{{
$t
(
'admin:utilities.title'
)
}}
v-list-tile-title
{{
$t
(
'admin:utilities.title'
)
}}
v-list-group(
v-list-group(
prepend-icon='weekend'
value='true'
to='/dev'
to='/dev'
no-action
no-action
v-if='hasPermission([`manage:system`, `manage:api`])'
v-if='hasPermission([`manage:system`, `manage:api`])'
)
)
v-list-tile(slot='activator')
v-list-tile(slot='activator')
v-list-tile-avatar: v-icon weekend
v-list-tile-title
{{
$t
(
'admin:dev.title'
)
}}
v-list-tile-title
{{
$t
(
'admin:dev.title'
)
}}
v-list-tile(to='/dev-flags')
v-list-tile(to='/dev-flags')
...
...
client/components/admin/admin-contribute.vue
View file @
21413663
...
@@ -133,7 +133,7 @@
...
@@ -133,7 +133,7 @@
v-icon(color='grey') public
v-icon(color='grey') public
v-divider
v-divider
v-list-tile
v-list-tile
v-list-tile-avatar
v-list-tile-avatar
(tile)
img(src='/svg/logo-icons8.svg', alt='Icons8')
img(src='/svg/logo-icons8.svg', alt='Icons8')
v-list-tile-content
v-list-tile-content
v-list-tile-title Icons8
v-list-tile-title Icons8
...
@@ -141,6 +141,16 @@
...
@@ -141,6 +141,16 @@
v-list-tile-action
v-list-tile-action
v-btn(icon, href='https://icons8.com', target='_blank')
v-btn(icon, href='https://icons8.com', target='_blank')
v-icon(color='grey') public
v-icon(color='grey') public
v-divider
v-list-tile
v-list-tile-avatar(tile)
img(src='https://static.requarks.io/logo/lokalise.png', alt='Lokalise')
v-list-tile-content
v-list-tile-title Lokalise
v-list-tile-sub-title Lokalise is a translation management system built for agile teams who want to automate their localization process.
v-list-tile-action
v-btn(icon, href='https://lokalise.co', target='_blank')
v-icon(color='grey') public
</
template
>
</
template
>
...
...
client/components/admin/admin-dev-flags.vue
View file @
21413663
...
@@ -38,6 +38,9 @@
...
@@ -38,6 +38,9 @@
<
script
>
<
script
>
import
_
from
'lodash'
import
_
from
'lodash'
import
flagsQuery
from
'gql/admin/dev/dev-query-flags.gql'
import
flagsMutation
from
'gql/admin/dev/dev-mutation-save-flags.gql'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
@@ -47,8 +50,39 @@ export default {
...
@@ -47,8 +50,39 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
save
()
{
async
save
()
{
try
{
await
this
.
$apollo
.
mutate
({
mutation
:
flagsMutation
,
variables
:
{
flags
:
_
.
transform
(
this
.
flags
,
(
result
,
value
,
key
)
=>
{
result
.
push
({
key
,
value
})
},
[])
},
watchLoading
(
isLoading
)
{
this
.
$store
.
commit
(
`loading
${
isLoading
?
'Start'
:
'Stop'
}
`
,
'admin-dev-flags-update'
)
}
})
this
.
$store
.
commit
(
'showNotification'
,
{
style
:
'success'
,
message
:
'Flags applied successfully.'
,
icon
:
'check'
})
}
catch
(
err
)
{
this
.
$store
.
commit
(
'pushGraphError'
,
err
)
}
}
},
apollo
:
{
flags
:
{
query
:
flagsQuery
,
fetchPolicy
:
'network-only'
,
update
:
(
data
)
=>
_
.
transform
(
data
.
system
.
flags
,
(
result
,
row
)
=>
{
_
.
set
(
result
,
row
.
key
,
row
.
value
)
},
{}),
watchLoading
(
isLoading
)
{
this
.
$store
.
commit
(
`loading
${
isLoading
?
'Start'
:
'Stop'
}
`
,
'admin-dev-flags-refresh'
)
}
}
}
}
}
}
}
...
...
client/graph/admin/dev/dev-mutation-save-flags.gql
0 → 100644
View file @
21413663
mutation
(
$flags
:
[
SystemFlagInput
]!
)
{
system
{
updateFlags
(
flags
:
$flags
)
{
responseResult
{
succeeded
errorCode
slug
message
}
}
}
}
client/graph/admin/dev/dev-query-flags.gql
0 → 100644
View file @
21413663
{
system
{
flags
{
key
value
}
}
}
dev/build/config.yml
View file @
21413663
port
:
$(PORT)
port
:
3000
bindIP
:
0.0.0.0
bindIP
:
0.0.0.0
db
:
db
:
type
:
$(DB_TYPE)
type
:
$(DB_TYPE)
...
...
server/app/data.yml
View file @
21413663
...
@@ -33,6 +33,8 @@ defaults:
...
@@ -33,6 +33,8 @@ defaults:
theming
:
theming
:
theme
:
'
default'
theme
:
'
default'
darkMode
:
false
darkMode
:
false
flags
:
sqllog
:
false
# System defaults
# System defaults
setup
:
false
setup
:
false
paths
:
paths
:
...
...
server/core/config.js
View file @
21413663
...
@@ -96,5 +96,11 @@ module.exports = {
...
@@ -96,5 +96,11 @@ module.exports = {
}
}
return
true
return
true
},
/**
* Apply Dev Flags
*/
async
applyFlags
()
{
WIKI
.
models
.
knex
.
client
.
config
.
debug
=
WIKI
.
config
.
flags
.
sqllog
}
}
}
}
server/core/kernel.js
View file @
21413663
...
@@ -14,6 +14,7 @@ module.exports = {
...
@@ -14,6 +14,7 @@ module.exports = {
try
{
try
{
await
WIKI
.
models
.
onReady
await
WIKI
.
models
.
onReady
await
WIKI
.
configSvc
.
loadFromDb
()
await
WIKI
.
configSvc
.
loadFromDb
()
await
WIKI
.
configSvc
.
applyFlags
()
}
catch
(
err
)
{
}
catch
(
err
)
{
WIKI
.
logger
.
error
(
'Database Initialization Error: '
+
err
.
message
)
WIKI
.
logger
.
error
(
'Database Initialization Error: '
+
err
.
message
)
if
(
WIKI
.
IS_DEBUG
)
{
if
(
WIKI
.
IS_DEBUG
)
{
...
...
server/graph/resolvers/system.js
View file @
21413663
...
@@ -6,6 +6,7 @@ const filesize = require('filesize')
...
@@ -6,6 +6,7 @@ const filesize = require('filesize')
const
path
=
require
(
'path'
)
const
path
=
require
(
'path'
)
const
fs
=
require
(
'fs-extra'
)
const
fs
=
require
(
'fs-extra'
)
const
moment
=
require
(
'moment'
)
const
moment
=
require
(
'moment'
)
const
graphHelper
=
require
(
'../../helpers/graph'
)
/* global WIKI */
/* global WIKI */
...
@@ -21,9 +22,29 @@ module.exports = {
...
@@ -21,9 +22,29 @@ module.exports = {
Query
:
{
Query
:
{
async
system
()
{
return
{}
}
async
system
()
{
return
{}
}
},
},
Mutation
:
{
async
system
()
{
return
{}
}
},
SystemQuery
:
{
SystemQuery
:
{
flags
()
{
return
_
.
transform
(
WIKI
.
config
.
flags
,
(
result
,
value
,
key
)
=>
{
result
.
push
({
key
,
value
})
},
[])
},
async
info
()
{
return
{}
}
async
info
()
{
return
{}
}
},
},
SystemMutation
:
{
async
updateFlags
(
obj
,
args
,
context
)
{
WIKI
.
config
.
flags
=
_
.
transform
(
args
.
flags
,
(
result
,
row
)
=>
{
_
.
set
(
result
,
row
.
key
,
row
.
value
)
},
{})
await
WIKI
.
configSvc
.
applyFlags
()
await
WIKI
.
configSvc
.
saveToDb
([
'flags'
])
return
{
responseResult
:
graphHelper
.
generateSuccess
(
'System Flags applied successfully'
)
}
}
},
SystemInfo
:
{
SystemInfo
:
{
configFile
()
{
configFile
()
{
return
path
.
join
(
process
.
cwd
(),
'config.yml'
)
return
path
.
join
(
process
.
cwd
(),
'config.yml'
)
...
...
server/graph/schemas/system.graphql
View file @
21413663
...
@@ -6,11 +6,16 @@ extend type Query {
...
@@ -6,11 +6,16 @@ extend type Query {
system
:
SystemQuery
system
:
SystemQuery
}
}
extend
type
Mutation
{
system
:
SystemMutation
}
# -----------------------------------------------
# -----------------------------------------------
# QUERIES
# QUERIES
# -----------------------------------------------
# -----------------------------------------------
type
SystemQuery
{
type
SystemQuery
{
flags
:
[
SystemFlag
]
@
auth
(
requires
:
[
"
manage
:
system
"
])
info
:
SystemInfo
info
:
SystemInfo
}
}
...
@@ -18,10 +23,26 @@ type SystemQuery {
...
@@ -18,10 +23,26 @@ type SystemQuery {
# MUTATIONS
# MUTATIONS
# -----------------------------------------------
# -----------------------------------------------
type
SystemMutation
{
updateFlags
(
flags
:
[
SystemFlagInput
]!
):
DefaultResponse
@
auth
(
requires
:
[
"
manage
:
system
"
])
}
# -----------------------------------------------
# -----------------------------------------------
# TYPES
# TYPES
# -----------------------------------------------
# -----------------------------------------------
type
SystemFlag
{
key
:
String
!
value
:
Boolean
!
}
input
SystemFlagInput
{
key
:
String
!
value
:
Boolean
!
}
type
SystemInfo
{
type
SystemInfo
{
configFile
:
String
@
auth
(
requires
:
[
"
manage
:
system
"
])
configFile
:
String
@
auth
(
requires
:
[
"
manage
:
system
"
])
cpuCores
:
Int
@
auth
(
requires
:
[
"
manage
:
system
"
])
cpuCores
:
Int
@
auth
(
requires
:
[
"
manage
:
system
"
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment