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
e3cb33f8
Commit
e3cb33f8
authored
Feb 22, 2019
by
Nick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: admin dev pages modularity + storage state json fix
parent
3743777b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
198 additions
and
111 deletions
+198
-111
.gitignore
.gitignore
+1
-0
admin.vue
client/components/admin.vue
+19
-4
admin-dev-flags.vue
client/components/admin/admin-dev-flags.vue
+59
-0
admin-dev-graphiql.vue
client/components/admin/admin-dev-graphiql.vue
+25
-106
admin-dev-voyager.vue
client/components/admin/admin-dev-voyager.vue
+93
-0
storage.js
server/models/storage.js
+1
-1
No files found.
.gitignore
View file @
e3cb33f8
...
@@ -32,6 +32,7 @@ server/views/setup.pug
...
@@ -32,6 +32,7 @@ server/views/setup.pug
/data
/data
/uploads
/uploads
/content
/content
/temp
*.sqlite
*.sqlite
# IDE exclude
# IDE exclude
...
...
client/components/admin.vue
View file @
e3cb33f8
...
@@ -79,9 +79,22 @@
...
@@ -79,9 +79,22 @@
v-list-tile(to='/utilities', v-if='hasPermission(`manage:system`)', disabled)
v-list-tile(to='/utilities', v-if='hasPermission(`manage:system`)', disabled)
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-tile(to='/dev', v-if='hasPermission([`manage:system`, `manage:api`])')
v-list-group(
v-list-tile-avatar: v-icon weekend
prepend-icon='weekend'
v-list-tile-title
{{
$t
(
'admin:dev.title'
)
}}
value='true'
to='/dev'
no-action
v-if='hasPermission([`manage:system`, `manage:api`])'
)
v-list-tile(slot='activator')
v-list-tile-title
{{
$t
(
'admin:dev.title'
)
}}
v-list-tile(to='/dev-flags')
v-list-tile-title
{{
$t
(
'admin:dev.flags.title'
)
}}
v-list-tile(to='/dev-graphiql')
v-list-tile-title
{{
$t
(
'admin:dev.graphiql.title'
)
}}
v-list-tile(to='/dev-voyager')
v-list-tile-title
{{
$t
(
'admin:dev.voyager.title'
)
}}
v-divider.my-2
v-divider.my-2
v-list-tile(to='/contribute')
v-list-tile(to='/contribute')
v-list-tile-avatar: v-icon favorite
v-list-tile-avatar: v-icon favorite
...
@@ -132,7 +145,9 @@ const router = new VueRouter({
...
@@ -132,7 +145,9 @@ const router = new VueRouter({
{
path
:
'/mail'
,
component
:
()
=>
import
(
/* webpackChunkName: "admin" */
'./admin/admin-mail.vue'
)
},
{
path
:
'/mail'
,
component
:
()
=>
import
(
/* webpackChunkName: "admin" */
'./admin/admin-mail.vue'
)
},
{
path
:
'/system'
,
component
:
()
=>
import
(
/* webpackChunkName: "admin" */
'./admin/admin-system.vue'
)
},
{
path
:
'/system'
,
component
:
()
=>
import
(
/* webpackChunkName: "admin" */
'./admin/admin-system.vue'
)
},
{
path
:
'/utilities'
,
component
:
()
=>
import
(
/* webpackChunkName: "admin" */
'./admin/admin-utilities.vue'
)
},
{
path
:
'/utilities'
,
component
:
()
=>
import
(
/* webpackChunkName: "admin" */
'./admin/admin-utilities.vue'
)
},
{
path
:
'/dev'
,
component
:
()
=>
import
(
/* webpackChunkName: "admin-dev" */
'./admin/admin-dev.vue'
)
},
{
path
:
'/dev-flags'
,
component
:
()
=>
import
(
/* webpackChunkName: "admin-dev" */
'./admin/admin-dev-flags.vue'
)
},
{
path
:
'/dev-graphiql'
,
component
:
()
=>
import
(
/* webpackChunkName: "admin-dev" */
'./admin/admin-dev-graphiql.vue'
)
},
{
path
:
'/dev-voyager'
,
component
:
()
=>
import
(
/* webpackChunkName: "admin-dev" */
'./admin/admin-dev-voyager.vue'
)
},
{
path
:
'/contribute'
,
component
:
()
=>
import
(
/* webpackChunkName: "admin" */
'./admin/admin-contribute.vue'
)
}
{
path
:
'/contribute'
,
component
:
()
=>
import
(
/* webpackChunkName: "admin" */
'./admin/admin-contribute.vue'
)
}
]
]
})
})
...
...
client/components/admin/admin-dev-flags.vue
0 → 100644
View file @
e3cb33f8
<
template
lang=
'pug'
>
v-container(fluid, grid-list-lg)
v-layout(row, wrap)
v-flex(xs12)
.admin-header
img(src='/svg/icon-console.svg', alt='Developer Tools', style='width: 80px;')
.admin-header-title
.headline.primary--text Developer Tools
.subheading.grey--text Flags
v-spacer
v-btn(color='success', depressed, @click='save', large)
v-icon(left) check
span
{{
$t
(
'common:actions.apply'
)
}}
v-card.mt-3.white.grey--text.text--darken-3
v-alert(color='red', value='true', icon='warning')
span Do NOT enable these flags unless you know what you're doing!
.caption Doing so may result in data loss or broken installation!
v-card-text
v-switch.mt-3(
color='red'
hint='Log all queries made to the database to console.'
persistent-hint
label='SQL Query Logging'
v-model='flags.sqllog'
)
//- v-divider.mt-3
//- v-switch.mt-3(
//- color='primary'
//- hint='Log all queries made to the database to console.'
//- persistent-hint
//- label='SQL Query Log'
//- v-model='flags.sqllog'
//- )
</
template
>
<
script
>
import
_
from
'lodash'
export
default
{
data
()
{
return
{
flags
:
{
sqllog
:
false
}
}
},
methods
:
{
save
()
{
}
}
}
</
script
>
<
style
lang=
'scss'
>
</
style
>
client/components/admin/admin-dev.vue
→
client/components/admin/admin-dev
-graphiql
.vue
View file @
e3cb33f8
...
@@ -6,36 +6,10 @@
...
@@ -6,36 +6,10 @@
img(src='/svg/icon-console.svg', alt='Developer Tools', style='width: 80px;')
img(src='/svg/icon-console.svg', alt='Developer Tools', style='width: 80px;')
.admin-header-title
.admin-header-title
.headline.primary--text Developer Tools
.headline.primary--text Developer Tools
.subheading.grey--text ¯\_(ツ)_/¯
.subheading.grey--text GraphiQL
v-spacer
v-card.radius-7
v-card-text
.caption Enables extra dev options and removes many safeguards.
.caption.red--text Do not enable unless you know what you're doing!
v-switch.mt-1(
color='primary'
hide-details
label='Dev Mode'
)
v-card.mt-3.white.grey--text.text--darken-3
v-card.mt-3.white.grey--text.text--darken-3
v-tabs(
#graphiql
v-model='selectedTab'
color='grey darken-2'
fixed-tabs
slider-color='white'
show-arrows
dark
@change='tabChanged'
)
v-tab(key='0') Graph API Playground
v-tab(key='1') Graph API Map
v-tabs-items(v-model='selectedTab')
v-tab-item(key='0', :transition='false', :reverse-transition='false')
#graphiql
v-tab-item(key='1', :transition='false', :reverse-transition='false')
#voyager
</
template
>
</
template
>
...
@@ -44,9 +18,7 @@ import _ from 'lodash'
...
@@ -44,9 +18,7 @@ import _ from 'lodash'
import
React
from
'react'
import
React
from
'react'
import
ReactDOM
from
'react-dom'
import
ReactDOM
from
'react-dom'
import
GraphiQL
from
'graphiql'
import
GraphiQL
from
'graphiql'
import
{
Voyager
}
from
'graphql-voyager'
import
'graphiql/graphiql.css'
import
'graphiql/graphiql.css'
import
'graphql-voyager/dist/voyager.css'
const
fetcher
=
(
qry
,
respType
)
=>
{
const
fetcher
=
(
qry
,
respType
)
=>
{
return
fetch
(
'/graphql'
,
{
return
fetch
(
'/graphql'
,
{
...
@@ -72,63 +44,38 @@ const fetcher = (qry, respType) => {
...
@@ -72,63 +44,38 @@ const fetcher = (qry, respType) => {
})
})
}
}
let
graphiQLInstance
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
}
selectedTab
:
0
}
},
},
mounted
()
{
mounted
()
{
this
.
renderGraphiQL
()
let
graphiQLInstance
},
ReactDOM
.
render
(
methods
:
{
React
.
createElement
(
GraphiQL
,
{
tabChanged
(
tabId
)
{
ref
(
el
)
{
graphiQLInstance
=
el
},
switch
(
tabId
)
{
async
fetcher
(
qry
)
{
case
1
:
let
resp
=
await
fetcher
(
qry
,
'text'
)
this
.
renderVoyager
()
_
.
delay
(()
=>
{
break
graphiQLInstance
.
resultComponent
.
viewer
.
refresh
()
}
},
500
)
},
return
resp
renderGraphiQL
()
{
},
ReactDOM
.
render
(
response
:
null
,
React
.
createElement
(
GraphiQL
,
{
variables
:
'{}'
,
ref
(
el
)
{
graphiQLInstance
=
el
},
operationName
:
null
,
async
fetcher
(
qry
)
{
websocketConnectionParams
:
null
let
resp
=
await
fetcher
(
qry
,
'text'
)
}),
_
.
delay
(()
=>
{
document
.
getElementById
(
'graphiql'
)
graphiQLInstance
.
resultComponent
.
viewer
.
refresh
()
)
},
500
)
graphiQLInstance
.
queryEditorComponent
.
editor
.
refresh
()
return
resp
graphiQLInstance
.
variableEditorComponent
.
editor
.
refresh
()
},
graphiQLInstance
.
state
.
variableEditorOpen
=
true
response
:
null
,
graphiQLInstance
.
state
.
docExplorerOpen
=
true
variables
:
'{}'
,
operationName
:
null
,
websocketConnectionParams
:
null
}),
document
.
getElementById
(
'graphiql'
)
)
graphiQLInstance
.
queryEditorComponent
.
editor
.
refresh
()
graphiQLInstance
.
variableEditorComponent
.
editor
.
refresh
()
graphiQLInstance
.
state
.
variableEditorOpen
=
true
graphiQLInstance
.
state
.
docExplorerOpen
=
true
},
renderVoyager
()
{
ReactDOM
.
render
(
React
.
createElement
(
Voyager
,
{
introspection
:
qry
=>
fetcher
({
query
:
qry
},
'json'
),
workerURI
:
'/js/voyager.worker.js'
}),
document
.
getElementById
(
'voyager'
)
)
}
}
}
}
}
</
script
>
</
script
>
<
style
lang=
'scss'
>
<
style
lang=
'scss'
>
#graphiql
{
#graphiql
{
height
:
calc
(
100vh
-
270px
);
height
:
calc
(
100vh
-
270px
);
...
@@ -151,32 +98,4 @@ export default {
...
@@ -151,32 +98,4 @@ export default {
height
:
auto
;
height
:
auto
;
}
}
}
}
#voyager
{
height
:
calc
(
100vh
-
270px
);
.title-area
{
display
:
none
;
}
.type-doc
{
margin-top
:
5px
;
}
.doc-navigation
{
>
span
{
overflow-y
:
hidden
;
display
:
block
;
}
min-height
:
40px
;
}
.contents
{
padding-bottom
:
0
;
color
:
#666
;
}
.type-info-popover
{
display
:
none
;
}
}
</
style
>
</
style
>
client/components/admin/admin-dev-voyager.vue
0 → 100644
View file @
e3cb33f8
<
template
lang=
'pug'
>
v-container(fluid, grid-list-lg)
v-layout(row, wrap)
v-flex(xs12)
.admin-header
img(src='/svg/icon-console.svg', alt='Developer Tools', style='width: 80px;')
.admin-header-title
.headline.primary--text Developer Tools
.subheading.grey--text Voyager
v-card.mt-3.white.grey--text.text--darken-3
#voyager
</
template
>
<
script
>
import
_
from
'lodash'
import
React
from
'react'
import
ReactDOM
from
'react-dom'
import
{
Voyager
}
from
'graphql-voyager'
import
'graphql-voyager/dist/voyager.css'
const
fetcher
=
(
qry
,
respType
)
=>
{
return
fetch
(
'/graphql'
,
{
method
:
'post'
,
headers
:
{
'Accept'
:
'application/json'
,
'Content-Type'
:
'application/json'
},
body
:
JSON
.
stringify
(
qry
),
credentials
:
'include'
}).
then
(
response
=>
{
if
(
respType
===
'json'
)
{
return
response
.
json
()
}
else
{
return
response
.
text
()
}
}).
then
(
responseBody
=>
{
try
{
return
JSON
.
parse
(
responseBody
)
}
catch
(
error
)
{
return
responseBody
}
})
}
export
default
{
data
()
{
return
{}
},
mounted
()
{
_
.
delay
(()
=>
{
ReactDOM
.
render
(
React
.
createElement
(
Voyager
,
{
introspection
:
qry
=>
fetcher
({
query
:
qry
},
'json'
),
workerURI
:
'/js/voyager.worker.js'
}),
document
.
getElementById
(
'voyager'
)
)
},
500
)
}
}
</
script
>
<
style
lang=
'scss'
>
#voyager
{
height
:
calc
(
100vh
-
270px
);
.title-area
{
display
:
none
;
}
.type-doc
{
margin-top
:
5px
;
}
.doc-navigation
{
>
span
{
overflow-y
:
hidden
;
display
:
block
;
}
min-height
:
40px
;
}
.contents
{
padding-bottom
:
0
;
color
:
#666
;
}
.type-info-popover
{
display
:
none
;
}
}
</
style
>
server/models/storage.js
View file @
e3cb33f8
...
@@ -28,7 +28,7 @@ module.exports = class Storage extends Model {
...
@@ -28,7 +28,7 @@ module.exports = class Storage extends Model {
}
}
static
get
jsonAttributes
()
{
static
get
jsonAttributes
()
{
return
[
'config'
]
return
[
'config'
,
'state'
]
}
}
static
async
getTargets
()
{
static
async
getTargets
()
{
...
...
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