refactor: dev optimizations + improvements
This commit is contained in:
@@ -4,49 +4,71 @@
|
||||
.pa-3.pt-4
|
||||
.headline.primary--text Developer Tools
|
||||
.subheading.grey--text ¯\_(ツ)_/¯
|
||||
v-tabs(color='grey lighten-4', fixed-tabs, slider-color='primary', show-arrows)
|
||||
v-tab Graph API Playground
|
||||
v-tab Graph API Map
|
||||
|
||||
v-tab-item(:transition='false', :reverse-transition='false')
|
||||
v-tabs(v-model='selectedTab', color='grey lighten-4', fixed-tabs, slider-color='primary', show-arrows, @input='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>
|
||||
|
||||
<script>
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import GraphiQL from 'graphiql'
|
||||
import { Voyager } from 'graphql-voyager'
|
||||
import 'graphiql/graphiql.css'
|
||||
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 {}
|
||||
return {
|
||||
selectedTab: '0'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.renderGraphiQL()
|
||||
},
|
||||
methods: {
|
||||
tabChanged (tabId) {
|
||||
switch (tabId) {
|
||||
case '1':
|
||||
this.renderVoyager()
|
||||
break
|
||||
}
|
||||
},
|
||||
renderGraphiQL() {
|
||||
ReactDOM.render(
|
||||
React.createElement(GraphiQL, {
|
||||
fetcher: graphQLParams => {
|
||||
return fetch('/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(graphQLParams),
|
||||
credentials: 'include'
|
||||
}).then(function (response) {
|
||||
return response.text()
|
||||
}).then(function (responseBody) {
|
||||
try {
|
||||
return JSON.parse(responseBody)
|
||||
} catch (error) {
|
||||
return responseBody
|
||||
}
|
||||
})
|
||||
},
|
||||
fetcher: qry => fetcher(qry, 'text'),
|
||||
query: null,
|
||||
response: null,
|
||||
variables: null,
|
||||
@@ -55,6 +77,15 @@ export default {
|
||||
}),
|
||||
document.getElementById('graphiql')
|
||||
)
|
||||
},
|
||||
renderVoyager() {
|
||||
ReactDOM.render(
|
||||
React.createElement(Voyager, {
|
||||
introspection: qry => fetcher({ query: qry }, 'json'),
|
||||
workerURI: '/js/voyager.worker.js'
|
||||
}),
|
||||
document.getElementById('voyager')
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,85 +110,9 @@ export default {
|
||||
background-color: initial;
|
||||
box-shadow: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.cm-s-wikijs-dark.CodeMirror {
|
||||
background: darken(mc('grey','900'), 3%);
|
||||
color: #e0e0e0;
|
||||
}
|
||||
.cm-s-wikijs-dark div.CodeMirror-selected {
|
||||
background: mc('blue','800');
|
||||
}
|
||||
.cm-s-wikijs-dark .cm-matchhighlight {
|
||||
background: mc('blue','800');
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-line::selection, .cm-s-wikijs-dark .CodeMirror-line > span::selection, .cm-s-wikijs-dark .CodeMirror-line > span > span::selection {
|
||||
background: mc('red', '500');
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-line::-moz-selection, .cm-s-wikijs-dark .CodeMirror-line > span::-moz-selection, .cm-s-wikijs-dark .CodeMirror-line > span > span::-moz-selection {
|
||||
background: mc('red', '500');
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-gutters {
|
||||
background: darken(mc('grey','900'), 6%);
|
||||
border-right: 1px solid mc('grey','900');
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-guttermarker {
|
||||
color: #ac4142;
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-guttermarker-subtle {
|
||||
color: #505050;
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-linenumber {
|
||||
color: mc('grey','800');
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-cursor {
|
||||
border-left: 1px solid #b0b0b0;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-comment {
|
||||
color: mc('orange','800');
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-atom {
|
||||
color: #aa759f;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-number {
|
||||
color: #aa759f;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-property, .cm-s-wikijs-dark span.cm-attribute {
|
||||
color: #90a959;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-keyword {
|
||||
color: #ac4142;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-string {
|
||||
color: #f4bf75;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-variable {
|
||||
color: #90a959;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-variable-2 {
|
||||
color: #6a9fb5;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-def {
|
||||
color: #d28445;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-bracket {
|
||||
color: #e0e0e0;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-tag {
|
||||
color: #ac4142;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-link {
|
||||
color: #aa759f;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-error {
|
||||
background: #ac4142;
|
||||
color: #b0b0b0;
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-activeline-background {
|
||||
background: mc('grey','900');
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-matchingbracket {
|
||||
text-decoration: underline;
|
||||
color: white !important;
|
||||
}
|
||||
#voyager {
|
||||
height: calc(100vh - 250px);
|
||||
}
|
||||
</style>
|
||||
|
45
client/components/admin-editor.vue
Normal file
45
client/components/admin-editor.vue
Normal file
@@ -0,0 +1,45 @@
|
||||
<template lang='pug'>
|
||||
v-card(flat)
|
||||
v-card(color='grey lighten-5')
|
||||
.pa-3.pt-4
|
||||
.headline.primary--text Editor
|
||||
.subheading.grey--text Configure the content editor
|
||||
v-tabs(color='grey lighten-4', fixed-tabs, slider-color='primary', show-arrows)
|
||||
v-tab(key='settings'): v-icon settings
|
||||
v-tab(key='code') Markdown
|
||||
|
||||
v-tab-item(key='settings', :transition='false', :reverse-transition='false')
|
||||
v-card.pa-3
|
||||
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-form
|
||||
v-subheader Editor Configuration
|
||||
.body-1 This editor has no configuration options you can modify.
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
editors: [
|
||||
{ text: 'Markdown (default)', value: 'code' }
|
||||
],
|
||||
selectedEditor: 'code'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
|
||||
</style>
|
108
client/components/admin-groups.vue
Normal file
108
client/components/admin-groups.vue
Normal file
@@ -0,0 +1,108 @@
|
||||
<template lang='pug'>
|
||||
v-card(flat)
|
||||
v-card(flat, color='grey lighten-5').pa-3.pt-4
|
||||
.headline.blue--text.text--darken-2 Groups
|
||||
.subheading.grey--text Manage groups
|
||||
v-card
|
||||
v-card-title
|
||||
v-btn(color='primary', dark)
|
||||
v-icon(left) add
|
||||
| New Group
|
||||
v-btn(icon)
|
||||
v-icon.grey--text refresh
|
||||
v-spacer
|
||||
v-text-field(append-icon='search', label='Search', single-line, hide-details, v-model='search')
|
||||
v-data-table(
|
||||
v-model='selected'
|
||||
:items='items',
|
||||
:headers='headers',
|
||||
:search='search',
|
||||
:pagination.sync='pagination',
|
||||
:rows-per-page-items='[15]'
|
||||
select-all,
|
||||
hide-actions,
|
||||
disable-initial-sort
|
||||
)
|
||||
template(slot='headers', slot-scope='props')
|
||||
tr
|
||||
th(width='50')
|
||||
th.text-xs-right(
|
||||
width='80'
|
||||
:class='[`column sortable`, pagination.descending ? `desc` : `asc`, pagination.sortBy === `id` ? `active` : ``]'
|
||||
@click='changeSort(`id`)'
|
||||
)
|
||||
v-icon(small) arrow_upward
|
||||
| ID
|
||||
th.text-xs-left(
|
||||
v-for='header in props.headers'
|
||||
:key='header.text'
|
||||
:width='header.width'
|
||||
:class='[`column sortable`, pagination.descending ? `desc` : `asc`, header.value === pagination.sortBy ? `active` : ``]'
|
||||
@click='changeSort(header.value)'
|
||||
)
|
||||
| {{ header.text }}
|
||||
v-icon(small) arrow_upward
|
||||
template(slot='items', slot-scope='props')
|
||||
tr(:active='props.selected')
|
||||
td
|
||||
v-checkbox(hide-details, :input-value='props.selected', color='blue darken-2', @click='props.selected = !props.selected')
|
||||
td.text-xs-right {{ props.item.id }}
|
||||
td {{ props.item.name }}
|
||||
td {{ props.item.userCount }}
|
||||
td: v-btn(icon): v-icon.grey--text.text--darken-1 more_horiz
|
||||
template(slot='no-data')
|
||||
v-alert(icon='warning', :value='true') No users to display!
|
||||
.text-xs-center.py-2(v-if='items.length > 15')
|
||||
v-pagination(v-model='pagination.page', :length='pages')
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
selected: [],
|
||||
pagination: {},
|
||||
items: [
|
||||
{ id: 1, name: 'Administrators', userCount: 1 },
|
||||
{ id: 2, name: 'Users', userCount: 23 }
|
||||
],
|
||||
headers: [
|
||||
{ text: 'Name', value: 'name' },
|
||||
{ text: 'Users', value: 'userCount', width: 200 },
|
||||
{ text: '', value: 'actions', sortable: false, width: 50 }
|
||||
],
|
||||
search: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pages () {
|
||||
if (this.pagination.rowsPerPage == null || this.pagination.totalItems == null) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return Math.ceil(this.pagination.totalItems / this.pagination.rowsPerPage)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeSort (column) {
|
||||
if (this.pagination.sortBy === column) {
|
||||
this.pagination.descending = !this.pagination.descending
|
||||
} else {
|
||||
this.pagination.sortBy = column
|
||||
this.pagination.descending = false
|
||||
}
|
||||
},
|
||||
toggleAll () {
|
||||
if (this.selected.length) {
|
||||
this.selected = []
|
||||
} else {
|
||||
this.selected = this.items.slice()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
|
||||
</style>
|
19
client/components/admin-rendering.vue
Normal file
19
client/components/admin-rendering.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<template lang='pug'>
|
||||
v-container(fluid, fill-height)
|
||||
v-layout(row wrap)
|
||||
v-flex(xs12)
|
||||
.headline.primary--text Content Rendering
|
||||
.subheading.grey--text Configure how content is rendered
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
|
||||
</style>
|
19
client/components/admin-stats.vue
Normal file
19
client/components/admin-stats.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<template lang='pug'>
|
||||
v-container(fluid, fill-height)
|
||||
v-layout(row wrap)
|
||||
v-flex(xs12)
|
||||
.headline.primary--text Statistics
|
||||
.subheading.grey--text Useful information about your wiki
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
|
||||
</style>
|
@@ -82,9 +82,13 @@ const router = new VueRouter({
|
||||
{ path: '/dashboard', component: () => import(/* webpackChunkName: "admin" */ './admin-dashboard.vue') },
|
||||
{ path: '/general', component: () => import(/* webpackChunkName: "admin" */ './admin-general.vue') },
|
||||
{ path: '/locale', component: () => import(/* webpackChunkName: "admin" */ './admin-locale.vue') },
|
||||
{ path: '/stats', component: () => import(/* webpackChunkName: "admin" */ './admin-stats.vue') },
|
||||
{ path: '/theme', component: () => import(/* webpackChunkName: "admin" */ './admin-theme.vue') },
|
||||
{ path: '/groups', component: () => import(/* webpackChunkName: "admin" */ './admin-groups.vue') },
|
||||
{ path: '/users', component: () => import(/* webpackChunkName: "admin" */ './admin-users.vue') },
|
||||
{ path: '/auth', component: () => import(/* webpackChunkName: "admin" */ './admin-auth.vue') },
|
||||
{ path: '/rendering', component: () => import(/* webpackChunkName: "admin" */ './admin-rendering.vue') },
|
||||
{ path: '/editor', component: () => import(/* webpackChunkName: "admin" */ './admin-editor.vue') },
|
||||
{ path: '/logging', component: () => import(/* webpackChunkName: "admin" */ './admin-logging.vue') },
|
||||
{ path: '/search', component: () => import(/* webpackChunkName: "admin" */ './admin-search.vue') },
|
||||
{ path: '/storage', component: () => import(/* webpackChunkName: "admin" */ './admin-storage.vue') },
|
||||
|
@@ -1,30 +1,39 @@
|
||||
<template lang="pug">
|
||||
.login(:class='{ "is-error": error }')
|
||||
.login-container(:class='{ "is-expanded": strategies.length > 1, "is-loading": isLoading }')
|
||||
.login-providers(v-show='strategies.length > 1')
|
||||
button(v-for='strategy in strategies', :class='{ "is-active": strategy.key === selectedStrategy }', @click='selectStrategy(strategy.key, strategy.useForm)', :title='strategy.title')
|
||||
em(v-html='strategy.icon')
|
||||
span {{ strategy.title }}
|
||||
.login-providers-fill
|
||||
.login-frame(v-show='screen === "login"')
|
||||
h1 {{ siteTitle }}
|
||||
h2 {{ $t('auth:loginRequired') }}
|
||||
input(type='text', ref='iptEmail', v-model='username', :placeholder='$t("auth:fields.emailUser")')
|
||||
input(type='password', ref='iptPassword', v-model='password', :placeholder='$t("auth:fields.password")', @keyup.enter='login')
|
||||
button.button.is-blue.is-fullwidth(@click='login')
|
||||
span {{ $t('auth:actions.login') }}
|
||||
.login-frame(v-show='screen === "tfa"')
|
||||
.login-frame-icon
|
||||
svg.icons.is-48(role='img')
|
||||
title {{ $t('auth:tfa.title') }}
|
||||
use(xlink:href='#nc-key')
|
||||
h2 {{ $t('auth:tfa.subtitle') }}
|
||||
input(type='text', ref='iptTFA', v-model='securityCode', :placeholder='$t("auth:tfa.placeholder")', @keyup.enter='verifySecurityCode')
|
||||
button.button.is-blue.is-fullwidth(@click='verifySecurityCode')
|
||||
span {{ $t('auth:tfa.verifyToken') }}
|
||||
.login-copyright
|
||||
span {{ $t('footer.poweredBy') }}
|
||||
a(href='https://wiki.js.org', rel='external', title='Wiki.js') Wiki.js
|
||||
v-app
|
||||
.login(:class='{ "is-error": error }')
|
||||
.login-container(:class='{ "is-expanded": strategies.length > 1, "is-loading": isLoading }')
|
||||
.login-providers(v-show='strategies.length > 1')
|
||||
button(v-for='strategy in strategies', :class='{ "is-active": strategy.key === selectedStrategy }', @click='selectStrategy(strategy.key, strategy.useForm)', :title='strategy.title')
|
||||
em(v-html='strategy.icon')
|
||||
span {{ strategy.title }}
|
||||
.login-providers-fill
|
||||
.login-frame(v-show='screen === "login"')
|
||||
h1.text-xs-center.display-1 {{ siteTitle }}
|
||||
h2.text-xs-center.subheading {{ $t('auth:loginRequired') }}
|
||||
v-text-field(solo, ref='iptEmail', v-model='username', :placeholder='$t("auth:fields.emailUser")')
|
||||
v-text-field.mt-2(
|
||||
solo,
|
||||
ref='iptPassword',
|
||||
v-model='password',
|
||||
:append-icon='hidePassword ? "visibility" : "visibility_off"',
|
||||
:append-icon-cb='() => (hidePassword = !hidePassword)',
|
||||
:type='hidePassword ? "password" : "text"',
|
||||
:placeholder='$t("auth:fields.password")',
|
||||
@keyup.enter='login'
|
||||
)
|
||||
v-btn.mt-3(block, large, color='primary', @click='login') {{ $t('auth:actions.login') }}
|
||||
.login-frame(v-show='screen === "tfa"')
|
||||
.login-frame-icon
|
||||
svg.icons.is-48(role='img')
|
||||
title {{ $t('auth:tfa.title') }}
|
||||
use(xlink:href='#nc-key')
|
||||
h2 {{ $t('auth:tfa.subtitle') }}
|
||||
input(type='text', ref='iptTFA', v-model='securityCode', :placeholder='$t("auth:tfa.placeholder")', @keyup.enter='verifySecurityCode')
|
||||
button.button.is-blue.is-fullwidth(@click='verifySecurityCode')
|
||||
span {{ $t('auth:tfa.verifyToken') }}
|
||||
.login-copyright
|
||||
span {{ $t('footer.poweredBy') }}
|
||||
a(href='https://wiki.js.org', rel='external', title='Wiki.js') Wiki.js
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -41,6 +50,7 @@ export default {
|
||||
screen: 'login',
|
||||
username: '',
|
||||
password: '',
|
||||
hidePassword: true,
|
||||
securityCode: '',
|
||||
loginToken: '',
|
||||
isLoading: false
|
||||
@@ -408,10 +418,7 @@ export default {
|
||||
width: 400px;
|
||||
padding: 1rem;
|
||||
color: mc('grey', '700');
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
display: block;
|
||||
|
||||
@include until($tablet) {
|
||||
width: 100%;
|
||||
@@ -421,7 +428,7 @@ export default {
|
||||
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 600;
|
||||
font-weight: 400;
|
||||
color: mc('light-blue', '700');
|
||||
text-shadow: 1px 1px 0 #FFF;
|
||||
padding: 0;
|
||||
@@ -436,47 +443,6 @@ export default {
|
||||
padding: 0;
|
||||
margin: 0 0 25px 0;
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
input[type=text], input[type=password] {
|
||||
width: 100%;
|
||||
border: 1px solid rgba(mc('blue-grey','500'), .5);
|
||||
border-radius: 3px;
|
||||
background-color: rgba(255,255,255,.9);
|
||||
box-shadow: inset 0 0 0 3px rgba(255,255,255, .25);
|
||||
padding: 0 15px;
|
||||
height: 40px;
|
||||
margin: 0 0 10px 0;
|
||||
color: mc('grey', '700');
|
||||
font-weight: 600;
|
||||
font-size: .8rem;
|
||||
transition: all 0.4s ease;
|
||||
text-align: center;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: mc('light-blue','500');
|
||||
background-color: rgba(255,255,255,1);
|
||||
box-shadow: inset 0 0 8px rgba(mc('light-blue','500'), .5);
|
||||
color: mc('light-blue', '800');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.button {
|
||||
background-image: linear-gradient(to bottom, mc('blue', '400') 0%, mc('blue', '600') 50%, mc('blue', '700') 100%);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 200%;
|
||||
|
||||
&:hover {
|
||||
background-position-y: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&-tfa {
|
||||
|
@@ -1,21 +0,0 @@
|
||||
<template lang="pug">
|
||||
.toggle(:class='{ "is-active": value }', @click='changeToggle')
|
||||
.toggle-container
|
||||
.toggle-pin
|
||||
.toggle-text {{ desc }}
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'toggle',
|
||||
props: ['value', 'desc'],
|
||||
data () {
|
||||
return { }
|
||||
},
|
||||
methods: {
|
||||
changeToggle() {
|
||||
this.$emit('input', !this.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Reference in New Issue
Block a user