feat: page locale migration + deps update

This commit is contained in:
Nick
2019-07-14 16:12:26 -04:00
parent 35c09a3602
commit 5689444a17
11 changed files with 735 additions and 892 deletions

View File

@@ -69,7 +69,10 @@
:hint='$t(`admin:theme.cssOverrideHint`)'
auto-grow
)
v-textarea.mt-2(
i18next.caption.pl-2.ml-1(path='admin:theme.cssOverrideWarning', tag='div')
strong.red--text(place='caution') {{$t('admin:theme.cssOverrideWarningCaution')}}
code(place='cssClass') .contents
v-textarea.mt-3(
v-model='config.injectHead'
:label='$t(`admin:theme.headHtmlInjection`)'
outline
@@ -96,7 +99,26 @@
.subheading {{$t('admin:theme.downloadThemes')}}
v-spacer
v-chip(label, color='white', small).teal--text coming soon
v-card-text.caption -- Coming soon --
v-data-table(
:headers='headers',
:items='themes',
hide-actions,
item-key='value',
:rows-per-page-items='[-1]'
)
template(v-slot:items='thm')
td
strong {{thm.item.text}}
td
span {{ thm.item.author }}
td.text-xs-center
v-progress-circular(v-if='thm.item.isDownloading', indeterminate, color='blue', size='20', :width='2')
v-btn(v-else-if='thm.item.isInstalled && thm.item.installDate < thm.item.updatedAt', icon)
v-icon.blue--text cached
v-btn(v-else-if='thm.item.isInstalled', icon)
v-icon.green--text check
v-btn(v-else, icon)
v-icon.grey--text cloud_download
</template>
<script>
@@ -111,7 +133,7 @@ export default {
return {
loading: false,
themes: [
{ text: 'Default', author: 'requarks.io', value: 'default' }
{ text: 'Default', author: 'requarks.io', value: 'default', isInstalled: true, installDate: '', updatedAt: '' }
],
iconsets: [
{ text: 'Material Icons (default)', value: 'md' },
@@ -131,7 +153,28 @@ export default {
}
},
computed: {
darkMode: sync('site/dark')
darkMode: sync('site/dark'),
headers() {
return [
{
text: this.$t('admin:theme.downloadName'),
align: 'left',
value: 'text'
},
{
text: this.$t('admin:theme.downloadAuthor'),
align: 'left',
value: 'author'
},
{
text: this.$t('admin:theme.downloadDownload'),
align: 'center',
value: 'value',
sortable: false,
width: 100
}
]
}
},
mounted() {
this.darkModeInitial = this.darkMode

View File

@@ -15,6 +15,13 @@
v-btn(outline, color='primary', @click='flushUploads', :disabled='loading').ml-0.mt-3
v-icon(left) build
span Proceed
v-divider.my-3
v-subheader.pl-0.primary--text Flush Client-Side Locale Cache
.body-1 Locale strings are cached in the browser local storage for 24h. You can delete your current cache in order to fetch the latest data during the next page load.
.body-1 Note that this affects only #[strong your own browser] and not everyone.
v-btn(outline, color='primary', @click='flushClientLocaleCache', :disabled='loading').ml-0.mt-3
v-icon(left) build
span Proceed
</template>
<script>
@@ -78,6 +85,19 @@ export default {
this.$store.commit(`loadingStop`, 'admin-utilities-cache-flushUploads')
this.loading = false
},
async flushClientLocaleCache () {
for (let i = 0; i < window.localStorage.length; i++) {
const lsKey = window.localStorage.key(i)
if (_.startsWith(lsKey, 'i18next_res')) {
window.localStorage.removeItem(lsKey)
}
}
this.$store.commit('showNotification', {
message: 'Locale Client-Side Cache flushed successfully.',
style: 'success',
icon: 'check'
})
}
}
}

View File

@@ -70,7 +70,7 @@ export default {
const resp = _.get(respRaw, 'data.pages.migrateToLocale.responseResult', {})
if (resp.succeeded) {
this.$store.commit('showNotification', {
message: 'Migrated all content to target locale successfully.',
message: `Migrated ${_.get(respRaw, 'data.pages.migrateToLocale.count', 0)} page(s) to target locale successfully.`,
style: 'success',
icon: 'check'
})