From 309de5bc17d09affd8f8646feee4a0b8b62c4920 Mon Sep 17 00:00:00 2001 From: Nick Date: Sun, 15 Sep 2019 23:20:40 -0400 Subject: [PATCH] misc: deps cleanup + form validation fixes --- client/client-app.js | 22 +- client/client-setup.js | 2 - client/components/admin.vue | 10 +- .../components/admin/admin-dev-graphiql.vue | 101 --- client/components/admin/admin-dev-voyager.vue | 93 -- .../admin/admin-logging-console.vue | 8 +- client/components/admin/admin-navigation.vue | 1 + .../components/admin/admin-users-create.vue | 68 +- .../admin/admin-utilities-importv1.vue | 46 +- client/components/admin/admin-utilities.vue | 2 +- client/components/common/search-results.vue | 4 + client/components/editor.vue | 1 - client/components/editor/editor-code.vue | 285 +++++- .../editor/editor-modal-editorselect.vue | 39 +- .../components/editor/editor-modal-media.vue | 10 + client/components/editor/editor-wysiwyg.vue | 62 -- client/components/setup.vue | 83 +- .../admin/search/search-query-engines.gql | 2 +- client/scss/app.scss | 4 +- client/static/svg/logo-wikijs-full.svg | 157 ++++ client/store/index.js | 2 +- dev/webpack/webpack.dev.js | 19 +- dev/webpack/webpack.prod.js | 19 +- package.json | 58 +- server/core/telemetry.js | 8 +- server/graph/resolvers/logging.js | 4 +- server/graph/resolvers/rendering.js | 4 +- server/graph/resolvers/search.js | 4 +- server/graph/resolvers/storage.js | 4 +- server/helpers/graph.js | 9 - server/modules/editor/code/definition.yml | 6 + yarn.lock | 817 +++--------------- 32 files changed, 761 insertions(+), 1193 deletions(-) delete mode 100644 client/components/admin/admin-dev-graphiql.vue delete mode 100644 client/components/admin/admin-dev-voyager.vue delete mode 100644 client/components/editor/editor-wysiwyg.vue create mode 100644 client/static/svg/logo-wikijs-full.svg create mode 100644 server/modules/editor/code/definition.yml diff --git a/client/client-app.js b/client/client-app.js index 79a86a2f..5847393e 100644 --- a/client/client-app.js +++ b/client/client-app.js @@ -3,7 +3,6 @@ import Vue from 'vue' import VueRouter from 'vue-router' import VueClipboards from 'vue-clipboards' -import VeeValidate from 'vee-validate' import { ApolloClient } from 'apollo-client' import { BatchHttpLink } from 'apollo-link-batch-http' import { ApolloLink, split } from 'apollo-link' @@ -18,7 +17,6 @@ import Vuescroll from 'vuescroll/dist/vuescroll-native' import Hammer from 'hammerjs' import moment from 'moment' import VueMoment from 'vue-moment' -import VueTour from 'vue-tour' import store from './store' import Cookies from 'js-cookie' @@ -57,15 +55,17 @@ const graphQLWSEndpoint = ((window.location.protocol === 'https:') ? 'wss:' : 'w const graphQLLink = ApolloLink.from([ new ErrorLink(({ graphQLErrors, networkError }) => { if (graphQLErrors) { - graphQLErrors.map(({ message, locations, path }) => - console.error( - `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}` - ) - ) + let isAuthError = false + graphQLErrors.map(({ message, locations, path }) => { + if (message === `Forbidden`) { + isAuthError = true + } + console.error(`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`) + }) store.commit('showNotification', { style: 'red', - message: `An unexpected error occured.`, - icon: 'warning' + message: isAuthError ? `You are not authorized to access this resource.` : `An unexpected error occured.`, + icon: 'alert' }) } if (networkError) { @@ -73,7 +73,7 @@ const graphQLLink = ApolloLink.from([ store.commit('showNotification', { style: 'red', message: `Network Error: ${networkError.message}`, - icon: 'error' + icon: 'alert' }) } }), @@ -138,11 +138,9 @@ Vue.use(VueApollo) Vue.use(VueClipboards) Vue.use(localization.VueI18Next) Vue.use(helpers) -Vue.use(VeeValidate, { mode: 'eager' }) Vue.use(Vuetify) Vue.use(VueMoment, { moment }) Vue.use(Vuescroll) -Vue.use(VueTour) Vue.prototype.Velocity = Velocity diff --git a/client/client-setup.js b/client/client-setup.js index f0624c9d..2eb68371 100644 --- a/client/client-setup.js +++ b/client/client-setup.js @@ -1,7 +1,6 @@ /* eslint-disable import/first */ import Vue from 'vue' import Vuetify from 'vuetify/lib' -import VeeValidate from 'vee-validate' import boot from './modules/boot' /* eslint-enable import/first */ @@ -9,7 +8,6 @@ window.WIKI = null window.boot = boot Vue.use(Vuetify) -Vue.use(VeeValidate, { events: '' }) Vue.component('setup', () => import(/* webpackMode: "eager" */ './components/setup.vue')) diff --git a/client/components/admin.vue b/client/components/admin.vue index 359c311a..d633e817 100644 --- a/client/components/admin.vue +++ b/client/components/admin.vue @@ -103,10 +103,12 @@ v-list-item(to='/dev-flags') v-list-item-title {{ $t('admin:dev.flags.title') }} - v-list-item(to='/dev-graphiql') + v-list-item(href='/graphql') v-list-item-title {{ $t('admin:dev.graphiql.title') }} - v-list-item(to='/dev-voyager') - v-list-item-title {{ $t('admin:dev.voyager.title') }} + //- v-list-item(to='/dev-graphiql') + //- v-list-item-title {{ $t('admin:dev.graphiql.title') }} + //- v-list-item(to='/dev-voyager') + //- v-list-item-title {{ $t('admin:dev.voyager.title') }} v-divider.my-2 v-list-item(to='/contribute') v-list-item-avatar(size='24'): v-icon mdi-heart-outline @@ -163,8 +165,6 @@ const router = new VueRouter({ { path: '/utilities', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-utilities.vue') }, { path: '/webhooks', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-webhooks.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') } ] }) diff --git a/client/components/admin/admin-dev-graphiql.vue b/client/components/admin/admin-dev-graphiql.vue deleted file mode 100644 index 3b3d8cd0..00000000 --- a/client/components/admin/admin-dev-graphiql.vue +++ /dev/null @@ -1,101 +0,0 @@ - - - - - diff --git a/client/components/admin/admin-dev-voyager.vue b/client/components/admin/admin-dev-voyager.vue deleted file mode 100644 index a3d075a0..00000000 --- a/client/components/admin/admin-dev-voyager.vue +++ /dev/null @@ -1,93 +0,0 @@ - - - - - diff --git a/client/components/admin/admin-logging-console.vue b/client/components/admin/admin-logging-console.vue index 0ac0958f..5e14553c 100644 --- a/client/components/admin/admin-logging-console.vue +++ b/client/components/admin/admin-logging-console.vue @@ -23,12 +23,12 @@ diff --git a/client/components/admin/admin-utilities.vue b/client/components/admin/admin-utilities.vue index a51ac3fc..358d55a8 100644 --- a/client/components/admin/admin-utilities.vue +++ b/client/components/admin/admin-utilities.vue @@ -72,7 +72,7 @@ export default { key: 'UtilityImportv1', icon: 'mdi-database-import', i18nKey: 'importv1', - isAvailable: false + isAvailable: true }, { key: 'UtilityTelemetry', diff --git a/client/components/common/search-results.vue b/client/components/common/search-results.vue index b222cbee..95d57464 100644 --- a/client/components/common/search-results.vue +++ b/client/components/common/search-results.vue @@ -209,6 +209,10 @@ export default { .highlighted { background: #FFF linear-gradient(to bottom, #FFF, mc('orange', '100')); + + @at-root .theme--dark & { + background: mc('grey', '900') linear-gradient(to bottom, mc('orange', '900'), darken(mc('orange', '900'), 15%)); + } } } diff --git a/client/components/editor.vue b/client/components/editor.vue index 83d52d82..c8c46ebb 100644 --- a/client/components/editor.vue +++ b/client/components/editor.vue @@ -65,7 +65,6 @@ export default { editorCode: () => import(/* webpackChunkName: "editor-code", webpackMode: "lazy" */ './editor/editor-code.vue'), editorCkeditor: () => import(/* webpackChunkName: "editor-ckeditor", webpackMode: "lazy" */ './editor/editor-ckeditor.vue'), editorMarkdown: () => import(/* webpackChunkName: "editor-markdown", webpackMode: "lazy" */ './editor/editor-markdown.vue'), - editorWysiwyg: () => import(/* webpackChunkName: "editor-wysiwyg", webpackMode: "lazy" */ './editor/editor-wysiwyg.vue'), editorModalEditorselect: () => import(/* webpackChunkName: "editor", webpackMode: "eager" */ './editor/editor-modal-editorselect.vue'), editorModalProperties: () => import(/* webpackChunkName: "editor", webpackMode: "eager" */ './editor/editor-modal-properties.vue'), editorModalUnsaved: () => import(/* webpackChunkName: "editor", webpackMode: "eager" */ './editor/editor-modal-unsaved.vue'), diff --git a/client/components/editor/editor-code.vue b/client/components/editor/editor-code.vue index 91b6cdf9..5ddde546 100644 --- a/client/components/editor/editor-code.vue +++ b/client/components/editor/editor-code.vue @@ -1,12 +1,64 @@ diff --git a/client/components/setup.vue b/client/components/setup.vue index 1a0b2f0b..310387c3 100644 --- a/client/components/setup.vue +++ b/client/components/setup.vue @@ -4,15 +4,16 @@ v-container v-layout v-flex(xs12, lg6, offset-lg3) - v-card.radius-7 + v-card.radius-7.animated.fadeInUp .text-center - img.setup-logo(src='/svg/logo-wikijs.svg', alt='Wiki.js Logo') - v-alert(tile, color='indigo lighten-5', :value='true') + img.setup-logo.animated.fadeInUp.wait-p2s(src='/svg/logo-wikijs-full.svg', alt='Wiki.js Logo') + v-alert(v-model='error', type='error', icon='mdi-alert', tile, dismissible) {{ errorMessage }} + v-alert(v-if='!error', tile, color='indigo lighten-5', :value='true') v-icon.mr-3(color='indigo') mdi-package-variant span.indigo--text You are about to install Wiki.js #[strong {{wikiVersion}}]. v-card-text - .overline.pl-3 Create Administrator Account - v-container.pa-3(grid-list-xl) + .overline.pl-3 Administrator Account + v-container.pa-3.mt-3(grid-list-xl) v-layout(row, wrap) v-flex(xs12) v-text-field( @@ -21,11 +22,7 @@ label='Administrator Email', hint='The email address of the administrator account.', persistent-hint - v-validate='{ required: true, email: true }', - data-vv-name='adminEmail', - data-vv-as='Administrator Email', - data-vv-scope='admin', - :error-messages='errors.collect(`admin.adminEmail`)' + required ref='adminEmailInput' ) v-flex(xs6) @@ -40,11 +37,6 @@ :type="pwdMode ? 'password' : 'text'" hint='At least 8 characters long.', persistent-hint - v-validate='{ required: true, min: 8 }', - data-vv-name='adminPassword', - data-vv-as='Password', - data-vv-scope='admin', - :error-messages='errors.collect(`admin.adminPassword`)' ) v-flex(xs6) v-text-field( @@ -58,11 +50,6 @@ :type="pwdConfirmMode ? 'password' : 'text'" hint='Verify your password again.', persistent-hint - v-validate='{ required: true, min: 8 }', - data-vv-name='adminPasswordConfirm', - data-vv-as='Confirm Password', - data-vv-scope='admin', - :error-messages='errors.collect(`admin.adminPasswordConfirm`)' @keyup.enter='install' ) v-divider.mb-4 @@ -73,10 +60,9 @@ persistent-hint, hint='Help Wiki.js developers improve this app with anonymized telemetry.' ) - v-alert(:value='error', type='error', icon='mdi-alert') {{ errorMessage }} - v-divider.mt-3(v-if='!error') + v-divider.mt-2 v-card-actions - v-btn(color='primary', @click='install', :disabled='loading', x-large, flat, block) + v-btn(color='primary', @click='install', :disabled='loading', x-large, depressed, block) v-icon(left) mdi-check span Install @@ -98,8 +84,8 @@