feat: locales remote fetch+ deps update + fixes
This commit is contained in:
		| @@ -34,12 +34,8 @@ | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import IconHomeAlert from 'mdi/home-alert' | ||||
|  | ||||
| export default { | ||||
|   components: { | ||||
|     IconHomeAlert | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       siteTitle: 'Wiki.js', | ||||
|   | ||||
| @@ -8,19 +8,35 @@ | ||||
|           v-layout(row wrap) | ||||
|             v-flex(lg6 xs12) | ||||
|               v-card | ||||
|                 v-toolbar(color='primary', dark, dense, flat) | ||||
|                 v-toolbar(color='grey darken-3', dark, dense, flat) | ||||
|                   v-toolbar-title | ||||
|                     .subheading Locale Settings | ||||
|                 v-card-text | ||||
|                   v-select(:items='locales', prepend-icon='public', v-model='selectedLocale', label='Site Locale', persistent-hint, hint='All UI text elements will be displayed in selected language.') | ||||
|                   v-select(:items='installedLocales' | ||||
|                     prepend-icon='public' | ||||
|                     v-model='selectedLocale' | ||||
|                     item-text='name' | ||||
|                     label='Site Locale' | ||||
|                     persistent-hint | ||||
|                     hint='All UI text elements will be displayed in selected language.' | ||||
|                   ) | ||||
|                     template(slot='item', slot-scope='data') | ||||
|                       v-list-tile-avatar | ||||
|                         v-avatar.blue.white--text(tile, size='40', v-html='data.item.value.toUpperCase()') | ||||
|                       v-list-tile-content | ||||
|                         v-list-tile-title(v-html='data.item.text') | ||||
|                         v-list-tile-sub-title(v-html='data.item.original') | ||||
|                       template(v-if='typeof data.item !== "object"') | ||||
|                         v-list-tile-content(v-text='data.item') | ||||
|                       template(v-else) | ||||
|                         v-list-tile-avatar | ||||
|                           v-avatar.blue.white--text(tile, size='40', v-html='data.item.code.toUpperCase()') | ||||
|                         v-list-tile-content | ||||
|                           v-list-tile-title(v-html='data.item.name') | ||||
|                           v-list-tile-sub-title(v-html='data.item.nativeName') | ||||
|                   v-divider | ||||
|                   v-switch(v-model='rtlEnabled', label='RTL Display Mode', color='primary', persistent-hint, hint='For Right-to-Left languages, e.g. Arabic') | ||||
|                   v-switch( | ||||
|                     v-model='autoUpdate' | ||||
|                     label='Update Automatically' | ||||
|                     color='primary' | ||||
|                     persistent-hint | ||||
|                     hint='Automatically download updates to this locale as they become available.' | ||||
|                   ) | ||||
|                 v-divider | ||||
|                 .px-3.pb-3 | ||||
|                   v-btn(color='primary') Save | ||||
| @@ -30,52 +46,46 @@ | ||||
|                   v-toolbar-title | ||||
|                     .subheading Download Locale | ||||
|                 v-list | ||||
|                   v-list-tile(@click='') | ||||
|                   v-list-tile(v-for='lc in locales') | ||||
|                     v-list-tile-avatar | ||||
|                       v-avatar.teal.white--text(tile, size='40') ZH | ||||
|                       v-avatar.teal.white--text(tile, size='40') {{lc.code.toUpperCase()}} | ||||
|                     v-list-tile-content | ||||
|                       v-list-tile-title Chinese | ||||
|                       v-list-tile-sub-title 中文 | ||||
|                     v-list-tile-action | ||||
|                       v-btn(icon) | ||||
|                       v-list-tile-title(v-html='lc.name') | ||||
|                       v-list-tile-sub-title(v-html='lc.nativeName') | ||||
|                     v-list-tile-action(v-if='lc.isInstalled && lc.installDate < lc.updatedAt') | ||||
|                       v-icon.blue--text cached | ||||
|                     v-list-tile-action(v-else-if='lc.isInstalled') | ||||
|                       v-icon.green--text check | ||||
|                     v-list-tile-action(v-else) | ||||
|                       v-btn(icon, @click='') | ||||
|                         v-icon.grey--text cloud_download | ||||
|                   v-list-tile(@click='') | ||||
|                     v-list-tile-avatar | ||||
|                       v-avatar.teal.white--text(tile, size='40') EN | ||||
|                     v-list-tile-content | ||||
|                       v-list-tile-title English | ||||
|                       v-list-tile-sub-title English | ||||
|                     v-list-tile-action | ||||
|                       v-icon.green--text check | ||||
|                   v-list-tile(@click='') | ||||
|                     v-list-tile-avatar | ||||
|                       v-avatar.teal.white--text(tile, size='40') FR | ||||
|                     v-list-tile-content | ||||
|                       v-list-tile-title French | ||||
|                       v-list-tile-sub-title Français | ||||
|                     v-list-tile-action | ||||
|                       v-icon.green--text check | ||||
|                   v-list-tile(@click='') | ||||
|                     v-list-tile-avatar | ||||
|                       v-avatar.teal.white--text(tile, size='40') RU | ||||
|                     v-list-tile-content | ||||
|                       v-list-tile-title Russian | ||||
|                       v-list-tile-sub-title Русский | ||||
|                     v-list-tile-action | ||||
|                       v-btn(icon) | ||||
|                         v-icon.blue--text update | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import _ from 'lodash' | ||||
|  | ||||
| import localesQuery from 'gql/admin-locale-query-list.gql' | ||||
|  | ||||
| export default { | ||||
|   data() { | ||||
|     return { | ||||
|       locales: [ | ||||
|         { text: 'English', original: 'English', value: 'en' }, | ||||
|         { text: 'French', original: 'Français', value: 'fr' } | ||||
|       ], | ||||
|       locales: [], | ||||
|       selectedLocale: 'en', | ||||
|       rtlEnabled: false | ||||
|       autoUpdate: true | ||||
|     } | ||||
|   }, | ||||
|   computed: { | ||||
|     installedLocales() { | ||||
|       return _.filter(this.locales, ['isInstalled', true]) | ||||
|     } | ||||
|   }, | ||||
|   apollo: { | ||||
|     locales: { | ||||
|       query: localesQuery, | ||||
|       update: (data) => data.localization.locales, | ||||
|       watchLoading (isLoading) { | ||||
|         this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-locale-refresh') | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
|           v-layout(row wrap) | ||||
|             v-flex(lg6 xs12) | ||||
|               v-card | ||||
|                 v-toolbar(color='primary', dark, dense, flat) | ||||
|                 v-toolbar(color='grey darken-3', dark, dense, flat) | ||||
|                   v-toolbar-title | ||||
|                     .subheading Theme | ||||
|                 v-card-text | ||||
| @@ -20,16 +20,16 @@ | ||||
|                         v-list-tile-title(v-html='data.item.text') | ||||
|                         v-list-tile-sub-title(v-html='data.item.author') | ||||
|                   v-divider | ||||
|                   v-switch(v-model='darkMode', label='Dark Mode', color='primary', persistent-hint, hint='Not recommended for accessibility') | ||||
|                   v-switch(v-model='darkMode', label='Dark Mode', color='primary', persistent-hint, hint='Not recommended for accessibility.') | ||||
|                 v-divider | ||||
|                 .px-3.pb-3 | ||||
|                   v-btn(color='primary') Save | ||||
|             v-flex(lg6 xs12) | ||||
|               v-card | ||||
|                 v-toolbar(color='primary', dark, dense, flat) | ||||
|                 v-toolbar(color='teal', dark, dense, flat) | ||||
|                   v-toolbar-title | ||||
|                     .subheading --- | ||||
|                 v-card-text --- | ||||
|                     .subheading Download Themes | ||||
|                 v-card-text.caption -- Coming soon -- | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   | ||||
| @@ -14,7 +14,7 @@ | ||||
|           v-layout(row, wrap) | ||||
|             v-flex(xs12, sm6) | ||||
|               v-card | ||||
|                 v-toolbar(color='primary', dark, dense, flat) | ||||
|                 v-toolbar(color='grey darken-3', dark, dense, flat) | ||||
|                   v-toolbar-title | ||||
|                     .subheading Authentication | ||||
|                 v-subheader Flush User Sessions | ||||
| @@ -31,14 +31,25 @@ | ||||
|                     span Proceed | ||||
|             v-flex(xs12, sm6) | ||||
|               v-card | ||||
|                 v-toolbar(color='primary', dark, dense, flat) | ||||
|                 v-toolbar(color='grey darken-3', dark, dense, flat) | ||||
|                   v-toolbar-title | ||||
|                     .subheading Maintenance Mode | ||||
|                 v-card-text | ||||
|                   .body-1 Maintenance mode restrict access to the site to administrators only, regarless of current permissions. | ||||
|                   v-btn.mt-3(color='orange darken-2', dark) | ||||
|                   v-btn.mt-3.ml-0(color='orange darken-2', depressed, dark) | ||||
|                     icon-home-alert.mr-2(fillColor='#FFFFFF') | ||||
|                     | Turn On Maintenance Mode | ||||
|               v-card.mt-3 | ||||
|                 v-toolbar(color='grey darken-3', dark, dense, flat) | ||||
|                   v-toolbar-title | ||||
|                     .subheading Graph Endpoint | ||||
|                 v-card-text | ||||
|                   .body-1 The Graph API Endpoint from which remote resources like locales, themes and plugins are fetched. | ||||
|                   .caption Do not change unless you know what you're doing! | ||||
|                   v-text-field.my-2.grey.lighten-3(solo, flat, label='Graph Endpoint', value='https://graph.requarks.io') | ||||
|                   v-btn.ml-0(color='primary', depressed, dark) | ||||
|                     v-icon(left) chevron_right | ||||
|                     span Save | ||||
|  | ||||
|       v-tab-item(key='telemetry', :transition='false', :reverse-transition='false') | ||||
|         v-card.pa-3 | ||||
| @@ -110,10 +121,12 @@ | ||||
|  | ||||
| <script> | ||||
| import IconGithubCircle from 'mdi/github-circle' | ||||
| import IconHomeAlert from 'mdi/home-alert' | ||||
|  | ||||
| export default { | ||||
|   components: { | ||||
|     IconGithubCircle | ||||
|     IconGithubCircle, | ||||
|     IconHomeAlert | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|   | ||||
| @@ -111,7 +111,7 @@ | ||||
|             v-form | ||||
|               v-container | ||||
|                 v-layout(row, wrap) | ||||
|                   v-flex(xs12) | ||||
|                   v-flex(xs12, sm6).pr-3 | ||||
|                     v-text-field( | ||||
|                       v-model='conf.title', | ||||
|                       label='Site Title', | ||||
| @@ -124,37 +124,7 @@ | ||||
|                       data-vv-scope='general', | ||||
|                       :error-messages='errors.collect(`siteTitle`)' | ||||
|                     ) | ||||
|                 v-layout(row, wrap).mt-3 | ||||
|                   v-flex.pr-3(xs12, sm4) | ||||
|                     v-select( | ||||
|                       v-model='conf.lang', | ||||
|                       :items='langs', | ||||
|                       label='Site UI Language', | ||||
|                       item-value='id', | ||||
|                       item-text='name', | ||||
|                       persistent-hint, | ||||
|                       hint='The language in which navigation, help and other UI elements will be displayed.' | ||||
|                     ) | ||||
|                       template(slot='item', slot-scope='data') | ||||
|                         v-list-tile-avatar | ||||
|                           v-avatar.blue.white--text(tile, size='40', v-html='data.item.id.toUpperCase()') | ||||
|                         v-list-tile-content | ||||
|                           v-list-tile-title(v-html='data.item.name') | ||||
|                           v-list-tile-sub-title(v-html='data.item.original') | ||||
|                   v-flex(xs12, sm8) | ||||
|                     v-text-field( | ||||
|                       v-model='conf.pathContent', | ||||
|                       label='Content Data Path', | ||||
|                       persistent-hint, | ||||
|                       hint='The path where content is stored (markdown files, uploads, etc.)', | ||||
|                       v-validate='{ required: true, min: 2 }', | ||||
|                       data-vv-name='pathContent', | ||||
|                       data-vv-as='Content Data Path', | ||||
|                       data-vv-scope='general', | ||||
|                       :error-messages='errors.collect(`pathContent`)' | ||||
|                     ) | ||||
|                 v-layout(row, wrap).mt-3 | ||||
|                   v-flex.pr-3(xs12, sm4) | ||||
|                   v-flex.pr-3(xs12, sm6) | ||||
|                     v-text-field( | ||||
|                       v-model='conf.port', | ||||
|                       label='Server Port', | ||||
| @@ -166,7 +136,20 @@ | ||||
|                       data-vv-scope='general', | ||||
|                       :error-messages='errors.collect(`port`)' | ||||
|                     ) | ||||
|                   v-flex(xs12, sm8) | ||||
|                 v-layout(row, wrap).mt-3 | ||||
|                   v-flex(xs12, sm6).pr-3 | ||||
|                     v-text-field( | ||||
|                       v-model='conf.pathContent', | ||||
|                       label='Content Data Path', | ||||
|                       persistent-hint, | ||||
|                       hint='The path where content is stored (markdown files, uploads, etc.)', | ||||
|                       v-validate='{ required: true, min: 2 }', | ||||
|                       data-vv-name='pathContent', | ||||
|                       data-vv-as='Content Data Path', | ||||
|                       data-vv-scope='general', | ||||
|                       :error-messages='errors.collect(`pathContent`)' | ||||
|                     ) | ||||
|                   v-flex(xs12, sm6) | ||||
|                     v-text-field( | ||||
|                       v-model='conf.pathData', | ||||
|                       label='Temporary Data Path', | ||||
|   | ||||
							
								
								
									
										14
									
								
								client/graph/admin-locale-query-list.gql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								client/graph/admin-locale-query-list.gql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| { | ||||
|   localization { | ||||
|     locales { | ||||
|       code | ||||
|       createdAt | ||||
|       isInstalled | ||||
|       installDate | ||||
|       isRTL | ||||
|       name | ||||
|       nativeName | ||||
|       updatedAt | ||||
|     } | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user