wikijs-fork/client/components/admin/admin-system.vue

163 lines
5.9 KiB
Vue
Raw Normal View History

<template lang='pug'>
v-container(fluid, grid-list-lg)
v-layout(row, wrap)
v-flex(xs12)
.admin-header
2019-03-17 17:39:58 +00:00
img.animated.fadeInUp(src='/svg/icon-tune.svg', alt='System Info', style='width: 80px;')
.admin-header-title
2019-03-17 17:39:58 +00:00
.headline.primary--text.animated.fadeInLeft {{ $t('admin:system.title') }}
.subheading.grey--text.animated.fadeInLeft.wait-p2s {{ $t('admin:system.subtitle') }}
v-layout.mt-3(row wrap)
v-flex(lg6 xs12)
2019-03-17 17:39:58 +00:00
v-card.animated.fadeInUp
2019-04-29 00:25:19 +00:00
v-btn.animated.fadeInLeft.wait-p2s.btn-animate-rotate(fab, absolute, right, top, small, light, @click='refresh'): v-icon refresh
v-list(two-line, dense)
v-subheader Wiki.js
2019-07-29 04:50:03 +00:00
v-list-item(avatar)
v-list-item-avatar
v-icon.blue.white--text system_update_alt
2019-07-29 04:50:03 +00:00
v-list-item-content
v-list-item-title {{ $t('admin:system.currentVersion') }}
v-list-item-sub-title {{ info.currentVersion }}
v-list-item(avatar)
v-list-item-avatar
v-icon.blue.white--text open_in_browser
2019-07-29 04:50:03 +00:00
v-list-item-content
v-list-item-title {{ $t('admin:system.latestVersion') }}
v-list-item-sub-title {{ info.latestVersion }}
v-list-item-action
v-list-item-action-text {{ $t('admin:system.published') }} {{ info.latestVersionReleaseDate | moment('from') }}
v-divider.mt-3
v-subheader {{ $t('admin:system.hostInfo') }}
2019-07-29 04:50:03 +00:00
v-list-item(avatar)
v-list-item-avatar
v-avatar.blue-grey(size='40')
img(:src='`/svg/icon-` + platformLogo + `-logo.svg`', alt='Platform', style='width: 24px;')
2019-07-29 04:50:03 +00:00
v-list-item-content
v-list-item-title {{ $t('admin:system.os') }}
v-list-item-sub-title {{ (info.platform === 'docker') ? 'Docker Container (Linux)' : info.operatingSystem }}
v-list-item(avatar)
v-list-item-avatar
v-icon.blue-grey.white--text computer
2019-07-29 04:50:03 +00:00
v-list-item-content
v-list-item-title {{ $t('admin:system.hostname') }}
v-list-item-sub-title {{ info.hostname }}
v-list-item(avatar)
v-list-item-avatar
v-icon.blue-grey.white--text nfc
2019-07-29 04:50:03 +00:00
v-list-item-content
v-list-item-title {{ $t('admin:system.cpuCores') }}
v-list-item-sub-title {{ info.cpuCores }}
v-list-item(avatar)
v-list-item-avatar
v-icon.blue-grey.white--text memory
2019-07-29 04:50:03 +00:00
v-list-item-content
v-list-item-title {{ $t('admin:system.totalRAM') }}
v-list-item-sub-title {{ info.ramTotal }}
v-list-item(avatar)
v-list-item-avatar
v-icon.blue-grey.white--text last_page
2019-07-29 04:50:03 +00:00
v-list-item-content
v-list-item-title {{ $t('admin:system.workingDirectory') }}
v-list-item-sub-title {{ info.workingDirectory }}
v-list-item(avatar)
v-list-item-avatar
v-icon.blue-grey.white--text settings
2019-07-29 04:50:03 +00:00
v-list-item-content
v-list-item-title {{ $t('admin:system.configFile') }}
v-list-item-sub-title {{ info.configFile }}
v-flex(lg6 xs12)
2019-03-17 17:39:58 +00:00
v-card.pb-3.animated.fadeInUp.wait-p4s
v-list(dense)
v-subheader Node.js
2019-07-29 04:50:03 +00:00
v-list-item(avatar)
v-list-item-avatar
v-avatar.light-green(size='40')
icon-node-js(fillColor='#FFFFFF')
2019-07-29 04:50:03 +00:00
v-list-item-content
v-list-item-title {{ info.nodeVersion }}
v-divider.mt-3
v-subheader {{ info.dbType }}
2019-07-29 04:50:03 +00:00
v-list-item(avatar)
v-list-item-avatar
v-avatar.indigo.darken-1(size='40')
icon-database(fillColor='#FFFFFF')
2019-07-29 04:50:03 +00:00
v-list-item-content
v-list-item-title(v-html='dbVersion')
v-list-item-sub-title {{ info.dbHost }}
2019-06-05 03:39:30 +00:00
v-alert.mt-3(:value='isDbLimited', color='deep-orange', icon='warning') {{ $t('admin:system.dbPartialSupport') }}
</template>
<script>
2018-09-08 19:49:36 +00:00
import _ from 'lodash'
2018-09-18 01:05:49 +00:00
import IconDatabase from 'mdi/Database'
import IconNodeJs from 'mdi/Nodejs'
import systemInfoQuery from 'gql/admin/system/system-query-info.gql'
export default {
components: {
IconDatabase,
IconNodeJs
},
data() {
2018-03-18 04:34:32 +00:00
return {
info: {}
2018-03-18 04:34:32 +00:00
}
},
2018-09-08 19:49:36 +00:00
computed: {
dbVersion() {
return _.get(this.info, 'dbVersion', '').replace(/(?:\r\n|\r|\n)/g, '<br />')
},
platformLogo() {
switch (this.info.platform) {
case 'docker':
return 'docker'
case 'darwin':
return 'apple'
case 'linux':
return 'linux'
case 'win32':
return 'windows'
default:
return ''
}
},
isDbLimited() {
return this.info.dbType === 'MySQL' && this.dbVersion.indexOf('5.') === 0
2018-09-08 19:49:36 +00:00
}
},
2018-03-18 04:34:32 +00:00
methods: {
async refresh() {
await this.$apollo.queries.info.refetch()
this.$store.commit('showNotification', {
2019-06-05 03:39:30 +00:00
message: this.$t('admin:system.refreshSuccess'),
style: 'success',
icon: 'cached'
})
}
},
apollo: {
info: {
query: systemInfoQuery,
2018-06-04 04:41:29 +00:00
fetchPolicy: 'network-only',
update: (data) => data.system.info,
watchLoading (isLoading) {
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-system-refresh')
}
2018-03-18 04:34:32 +00:00
}
}
}
</script>
<style lang='scss'>
</style>