feat: katex + admin SSL UI (wip) + dev warning

This commit is contained in:
NGPixel
2019-12-18 23:45:19 -05:00
parent d407312caa
commit aa5368b2a1
24 changed files with 1076 additions and 346 deletions

View File

@@ -19,7 +19,7 @@
easing='easeOutQuint'
)
v-flex(xs12 md6 lg4 xl3 d-flex)
v-card.green.lighten-1.dashboard-card.animated.fadeInUp.wait-p2s(dark)
v-card.blue.darken-3.dashboard-card.animated.fadeInUp.wait-p2s(dark)
v-card-text
v-icon.dashboard-icon mdi-account
.overline {{$t('admin:dashboard.users')}}
@@ -30,7 +30,7 @@
easing='easeOutQuint'
)
v-flex(xs12 md6 lg4 xl3 d-flex)
v-card.indigo.lighten-1.dashboard-card.animated.fadeInUp.wait-p4s(dark)
v-card.blue.darken-4.dashboard-card.animated.fadeInUp.wait-p4s(dark)
v-card-text
v-icon.dashboard-icon mdi-account-group
.overline {{$t('admin:dashboard.groups')}}
@@ -42,11 +42,11 @@
)
v-flex(xs12 md6 lg12 xl3 d-flex)
v-card.dashboard-card.animated.fadeInUp.wait-p6s(
:class='isLatestVersion ? "teal lighten-2" : "red lighten-2"'
:class='isLatestVersion ? "green" : "red lighten-2"'
dark
)
v-btn.btn-animate-wrench(fab, absolute, :right='!$vuetify.rtl', :left='$vuetify.rtl', top, small, light, to='system', v-if='hasPermission(`manage:system`)')
v-icon(:color='isLatestVersion ? `teal` : `red darken-4`', small) mdi-wrench
v-icon(:color='isLatestVersion ? `green` : `red darken-4`', small) mdi-wrench
v-card-text
v-icon.dashboard-icon mdi-blur
.subtitle-1 Wiki.js {{info.currentVersion}}

View File

@@ -41,19 +41,26 @@
persistent-hint
)
v-divider
.overline.grey--text.pa-4 {{$t('admin:general.logo')}} #[v-chip.ml-2(label, color='grey', small, outlined) coming soon]
v-card-text.pb-4.pl-5
v-layout.px-3(row, align-center)
v-avatar(size='100', :color='$vuetify.theme.dark ? `grey darken-2` : `grey lighten-3`', :tile='config.logoIsSquare')
.ml-4
v-btn.mr-3(color='teal', depressed, disabled)
v-icon(left) mdi-cloud-upload
span {{$t('admin:general.uploadLogo')}}
v-btn(color='teal', depressed, disabled)
v-icon(left) mdi-close
span {{$t('admin:general.uploadClear')}}
.caption.mt-3.grey--text {{$t('admin:general.uploadSizeHint', { size: '120x120' })}}
.caption.grey--text {{$t('admin:general.uploadTypesHint', { typeList: 'SVG, PNG', lastType: 'JPG' })}}.
.overline.grey--text.pa-4 {{$t('admin:general.logo')}}
.pt-2.pb-7.pl-10.pr-3
.d-flex.align-center
v-avatar(size='100', tile)
v-img(
:src='config.logoUrl'
lazy-src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNcWQ8AAdcBKrJda2oAAAAASUVORK5CYII='
aspect-ratio='1'
)
.ml-4(style='flex: 1 1 auto;')
v-text-field(
outlined
:label='$t(`admin:general.logoUrl`)'
v-model='config.logoUrl'
:hint='$t(`admin:general.logoUrlHint`)'
persistent-hint
append-icon='mdi-folder-image'
@click:append='browseLogo'
@keyup.enter='refreshLogo'
)
v-divider
.overline.grey--text.pa-4 {{$t('admin:general.footerCopyright')}}
.px-3.pb-3
@@ -236,6 +243,7 @@
hint='One directive per line.'
disabled
)
component(:is='activeModal')
</template>
@@ -245,7 +253,17 @@ import { get, sync } from 'vuex-pathify'
import siteConfigQuery from 'gql/admin/site/site-query-config.gql'
import siteUpdateConfigMutation from 'gql/admin/site/site-mutation-save-config.gql'
import editorStore from '../../store/editor'
/* global WIKI */
WIKI.$store.registerModule('editor', editorStore)
export default {
i18nOptions: { namespaces: 'editor' },
components: {
editorModalMedia: () => import(/* webpackChunkName: "editor", webpackMode: "lazy" */ '../editor/editor-modal-media.vue')
},
data() {
return {
analyticsServices: [
@@ -262,8 +280,7 @@ export default {
analyticsService: '',
analyticsId: '',
company: '',
hasLogo: false,
logoIsSquare: false,
logoUrl: '',
featureAnalytics: false,
featurePageRatings: false,
featurePageComments: false,
@@ -297,7 +314,9 @@ export default {
computed: {
darkMode: get('site/dark'),
siteTitle: sync('site/title'),
company: sync('site/company')
logoUrl: sync('site/logoUrl'),
company: sync('site/company'),
activeModal: sync('editor/activeModal')
},
methods: {
async save () {
@@ -312,8 +331,7 @@ export default {
analyticsService: _.get(this.config, 'analyticsService', ''),
analyticsId: _.get(this.config, 'analyticsId', ''),
company: _.get(this.config, 'company', ''),
hasLogo: _.get(this.config, 'hasLogo', false),
logoIsSquare: _.get(this.config, 'logoIsSquare', false),
logoUrl: _.get(this.config, 'logoUrl', ''),
featurePageRatings: _.get(this.config, 'featurePageRatings', false),
featurePageComments: _.get(this.config, 'featurePageComments', false),
featurePersonalWikis: _.get(this.config, 'featurePersonalWikis', false),
@@ -337,11 +355,27 @@ export default {
})
this.siteTitle = this.config.title
this.company = this.config.company
this.logoUrl = this.config.logoUrl
} catch (err) {
this.$store.commit('pushGraphError', err)
}
},
browseLogo () {
this.$store.set('editor/editorKey', 'common')
this.activeModal = 'editorModalMedia'
},
refreshLogo () {
this.$forceUpdate()
}
},
mounted () {
this.$root.$on('editorInsert', opts => {
this.config.logoUrl = opts.path
})
},
beforeDestroy() {
this.$root.$off('editorInsert')
},
apollo: {
config: {
query: siteConfigQuery,

View File

@@ -6,7 +6,6 @@
img.animated.fadeInUp(src='/svg/icon-process.svg', alt='Rendering', style='width: 80px;')
.admin-header-title
.headline.primary--text.animated.fadeInLeft Rendering
.subtitle-1.grey--text.animated.fadeInLeft.wait-p4s Configure how content is rendered #[v-chip(label, color='primary', small).white--text coming soon]
v-spacer
v-btn.mx-3.animated.fadeInDown.wait-p2s(outlined, color='grey', @click='refresh', large)
v-icon mdi-refresh

View File

@@ -0,0 +1,173 @@
<template lang='pug'>
v-container(fluid, grid-list-lg)
v-layout(row wrap)
v-flex(xs12)
.admin-header
img.animated.fadeInUp(src='/svg/icon-validation.svg', alt='SSL', style='width: 80px;')
.admin-header-title
.headline.primary--text.animated.fadeInLeft {{ $t('admin:ssl.title') }}
.subtitle-1.grey--text.animated.fadeInLeft {{ $t('admin:ssl.subtitle') }}
v-spacer
v-btn.animated.fadeInDown(color='success', depressed, @click='save', large)
v-icon(left) mdi-check
span {{$t('common:actions.apply')}}
v-form.pt-3
v-layout(row wrap)
v-flex(lg6 xs12)
v-form
v-card.animated.fadeInUp
v-toolbar(color='primary', dark, dense, flat)
v-toolbar-title.subtitle-1 {{ $t('admin:ssl.provider') }}
v-card-text
v-select(
:items='providers'
outlined
:label='$t(`admin:ssl.provider`)'
required
:counter='255'
v-model='config.provider'
prepend-icon='mdi-handshake'
:hint='$t(`admin:ssl.providerHint`)'
persistent-hint
)
v-text-field.mt-3(
outlined
:label='$t(`admin:ssl.domain`)'
required
:counter='255'
v-model='config.domain'
prepend-icon='mdi-earth'
:hint='$t(`admin:ssl.domainHint`)'
persistent-hint
:disabled='config.provider === ``'
)
v-card.animated.fadeInUp.wait-p2s.mt-3(v-if='config.provider !== ``')
v-toolbar(color='primary', dark, dense, flat)
v-toolbar-title.subtitle-1 {{$t('admin:ssl.providerOptions')}}
v-card-text ---
v-flex(lg6 xs12)
v-card.animated.fadeInUp.wait-p2s
v-toolbar(color='primary', dark, dense, flat)
v-toolbar-title.subtitle-1 {{ $t('admin:ssl.ports') }}
v-card-text
v-row
v-col(cols='6')
v-text-field(
outlined
:label='$t(`admin:ssl.httpPort`)'
v-model='config.httpPort'
prepend-icon='mdi-lock-open-variant-outline'
:hint='$t(`admin:ssl.httpPortHint`)'
persistent-hint
)
v-col(cols='6')
v-checkbox(
:label='$t(`admin:ssl.httpPortRedirect`)'
v-model='config.httpRedirect'
:hint='$t(`admin:ssl.httpPortRedirectHint`)'
:disabled='config.provider === ``'
persistent-hint
color='primary'
)
v-col(cols='6')
v-text-field(
outlined
:label='$t(`admin:ssl.httpsPort`)'
v-model='config.httpsPort'
prepend-icon='mdi-lock'
:hint='$t(`admin:ssl.httpsPortHint`)'
persistent-hint
:disabled='config.provider === ``'
)
v-card-text.grey(:class='$vuetify.theme.dark ? `darken-4-l5` : `lighten-4`')
.caption {{$t(`admin:ssl.writableConfigFileWarning`)}}
</template>
<script>
import _ from 'lodash'
import siteConfigQuery from 'gql/admin/site/site-query-config.gql'
import siteUpdateConfigMutation from 'gql/admin/site/site-mutation-save-config.gql'
export default {
data() {
return {
config: {
provider: '',
domain: '',
httpPort: 3000,
httpPortRedirect: true,
httpsPort: 443
}
}
},
computed: {
providers () {
return [
{ text: this.$t('admin:ssl.providerDisabled'), value: '' },
{ text: this.$t('admin:ssl.providerLetsEncrypt'), value: 'letsencrypt' },
{ text: this.$t('admin:ssl.providerCustomCertificate'), value: 'custom' }
]
}
},
methods: {
async save () {
try {
await this.$apollo.mutate({
mutation: siteUpdateConfigMutation,
variables: {
host: _.get(this.config, 'host', ''),
title: _.get(this.config, 'title', ''),
description: _.get(this.config, 'description', ''),
robots: _.get(this.config, 'robots', []),
analyticsService: _.get(this.config, 'analyticsService', ''),
analyticsId: _.get(this.config, 'analyticsId', ''),
company: _.get(this.config, 'company', ''),
hasLogo: _.get(this.config, 'hasLogo', false),
logoIsSquare: _.get(this.config, 'logoIsSquare', false),
featurePageRatings: _.get(this.config, 'featurePageRatings', false),
featurePageComments: _.get(this.config, 'featurePageComments', false),
featurePersonalWikis: _.get(this.config, 'featurePersonalWikis', false),
securityIframe: _.get(this.config, 'securityIframe', false),
securityReferrerPolicy: _.get(this.config, 'securityReferrerPolicy', false),
securityTrustProxy: _.get(this.config, 'securityTrustProxy', false),
securitySRI: _.get(this.config, 'securitySRI', false),
securityHSTS: _.get(this.config, 'securityHSTS', false),
securityHSTSDuration: _.get(this.config, 'securityHSTSDuration', 0),
securityCSP: _.get(this.config, 'securityCSP', false),
securityCSPDirectives: _.get(this.config, 'securityCSPDirectives', '')
},
watchLoading (isLoading) {
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-update')
}
})
this.$store.commit('showNotification', {
style: 'success',
message: 'Configuration saved successfully.',
icon: 'check'
})
this.siteTitle = this.config.title
this.company = this.config.company
} catch (err) {
this.$store.commit('pushGraphError', err)
}
}
}
// apollo: {
// config: {
// query: siteConfigQuery,
// fetchPolicy: 'network-only',
// update: (data) => _.cloneDeep(data.site.config),
// watchLoading (isLoading) {
// this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-refresh')
// }
// }
// }
}
</script>
<style lang='scss'>
</style>