You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

238 lines
8.8 KiB

  1. <template lang='pug'>
  2. v-container.admin-system(fluid, grid-list-lg)
  3. v-layout(row, wrap)
  4. v-flex(xs12)
  5. .admin-header
  6. img.animated.fadeInUp(src='/_assets/svg/icon-tune.svg', alt='System Info', style='width: 80px;')
  7. .admin-header-title
  8. .headline.primary--text.animated.fadeInLeft {{ $t('admin:system.title') }}
  9. .subtitle-1.grey--text.animated.fadeInLeft.wait-p2s {{ $t('admin:system.subtitle') }}
  10. v-layout.mt-3(row wrap)
  11. v-flex(lg6 xs12)
  12. v-card.animated.fadeInUp
  13. v-btn.animated.fadeInLeft.wait-p2s.btn-animate-rotate(fab, absolute, :right='!$vuetify.rtl', :left='$vuetify.rtl', top, small, light, @click='refresh'): v-icon(color='grey') mdi-refresh
  14. v-subheader Wiki.js
  15. v-list(two-line, dense)
  16. v-list-item
  17. v-list-item-avatar
  18. v-icon.blue.white--text mdi-application-export
  19. v-list-item-content
  20. v-list-item-title {{ $t('admin:system.currentVersion') }}
  21. v-list-item-subtitle {{ info.currentVersion }}
  22. v-list-item
  23. v-list-item-avatar
  24. v-icon.blue.white--text mdi-inbox-arrow-up
  25. v-list-item-content
  26. v-list-item-title {{ $t('admin:system.latestVersion') }}
  27. v-list-item-subtitle {{ info.latestVersion }}
  28. v-list-item-action
  29. v-list-item-action-text {{ $t('admin:system.published') }} {{ info.latestVersionReleaseDate | moment('from') }}
  30. v-card-actions(v-if='info.upgradeCapable && !isLatestVersion && info.platform === `docker`', :class='$vuetify.theme.dark ? `grey darken-3-d5` : `indigo lighten-5`')
  31. .caption.indigo--text.pl-3(:class='$vuetify.theme.dark ? `text--lighten-4` : ``') Wiki.js can perform the upgrade to the latest version for you.
  32. v-spacer
  33. v-btn.px-3(
  34. color='indigo'
  35. dark
  36. @click='performUpgrade'
  37. )
  38. v-icon(left) mdi-upload
  39. span Perform Upgrade
  40. v-card.mt-4.animated.fadeInUp.wait-p2s
  41. v-subheader {{ $t('admin:system.hostInfo') }}
  42. v-list(two-line, dense)
  43. v-list-item
  44. v-list-item-avatar
  45. v-avatar.blue-grey(size='40')
  46. v-icon(color='white') {{platformLogo}}
  47. v-list-item-content
  48. v-list-item-title {{ $t('admin:system.os') }}
  49. v-list-item-subtitle {{ (info.platform === 'docker') ? 'Docker Container (Linux)' : info.operatingSystem }}
  50. v-list-item
  51. v-list-item-avatar
  52. v-icon.blue-grey.white--text mdi-desktop-classic
  53. v-list-item-content
  54. v-list-item-title {{ $t('admin:system.hostname') }}
  55. v-list-item-subtitle {{ info.hostname }}
  56. v-list-item
  57. v-list-item-avatar
  58. v-icon.blue-grey.white--text mdi-cpu-64-bit
  59. v-list-item-content
  60. v-list-item-title {{ $t('admin:system.cpuCores') }}
  61. v-list-item-subtitle {{ info.cpuCores }}
  62. v-list-item
  63. v-list-item-avatar
  64. v-icon.blue-grey.white--text mdi-memory
  65. v-list-item-content
  66. v-list-item-title {{ $t('admin:system.totalRAM') }}
  67. v-list-item-subtitle {{ info.ramTotal }}
  68. v-list-item
  69. v-list-item-avatar
  70. v-icon.blue-grey.white--text mdi-iframe-outline
  71. v-list-item-content
  72. v-list-item-title {{ $t('admin:system.workingDirectory') }}
  73. v-list-item-subtitle {{ info.workingDirectory }}
  74. v-list-item
  75. v-list-item-avatar
  76. v-icon.blue-grey.white--text mdi-card-bulleted-settings-outline
  77. v-list-item-content
  78. v-list-item-title {{ $t('admin:system.configFile') }}
  79. v-list-item-subtitle {{ info.configFile }}
  80. v-flex(lg6 xs12)
  81. v-card.pb-3.animated.fadeInUp.wait-p4s
  82. v-subheader Node.js
  83. v-list(dense)
  84. v-list-item
  85. v-list-item-avatar
  86. v-avatar.light-green(size='40')
  87. v-icon(color='white') mdi-nodejs
  88. v-list-item-content
  89. v-list-item-title {{ info.nodeVersion }}
  90. v-divider.mt-3
  91. v-subheader {{ info.dbType }}
  92. v-list(dense)
  93. v-list-item
  94. v-list-item-avatar
  95. v-avatar.indigo.darken-1(size='40')
  96. v-icon(color='white') mdi-database
  97. v-list-item-content
  98. v-list-item-title(v-html='dbVersion')
  99. v-list-item-subtitle {{ info.dbHost }}
  100. v-alert.mt-3.mx-4(:value='isDbLimited', color='deep-orange darken-2', icon='mdi-alert', dark) {{ $t('admin:system.dbPartialSupport') }}
  101. v-dialog(
  102. v-model='isUpgrading'
  103. persistent
  104. width='450'
  105. )
  106. v-card.blue.darken-5(dark)
  107. v-card-text.text-center.pa-10
  108. self-building-square-spinner(
  109. :animation-duration='4000'
  110. :size='40'
  111. color='#FFF'
  112. style='margin: 0 auto;'
  113. )
  114. .body-2.mt-5.blue--text.text--lighten-4 Your Wiki.js container is being upgraded...
  115. .caption.blue--text.text--lighten-2 Please wait
  116. v-progress-linear.mt-5(
  117. color='blue lighten-2'
  118. :value='upgradeProgress'
  119. :buffer-value='upgradeProgress'
  120. rounded
  121. :stream='isUpgradingStarted'
  122. query
  123. :indeterminate='!isUpgradingStarted'
  124. )
  125. </template>
  126. <script>
  127. import _ from 'lodash'
  128. import { SelfBuildingSquareSpinner } from 'epic-spinners'
  129. import systemInfoQuery from 'gql/admin/system/system-query-info.gql'
  130. import performUpgradeMutation from 'gql/admin/system/system-mutation-upgrade.gql'
  131. export default {
  132. components: {
  133. SelfBuildingSquareSpinner
  134. },
  135. data () {
  136. return {
  137. isUpgrading: false,
  138. isUpgradingStarted: false,
  139. upgradeProgress: 0,
  140. info: {}
  141. }
  142. },
  143. computed: {
  144. dbVersion () {
  145. return _.get(this.info, 'dbVersion', '').replace(/(?:\r\n|\r|\n)/g, '<br />')
  146. },
  147. platformLogo () {
  148. switch (this.info.platform) {
  149. case 'docker':
  150. return 'mdi-docker'
  151. case 'darwin':
  152. return 'mdi-apple'
  153. case 'linux':
  154. if (this.info.operatingSystem.indexOf('Ubuntu')) {
  155. return 'mdi-ubuntu'
  156. } else {
  157. return 'mdi-linux'
  158. }
  159. case 'win32':
  160. return 'mdi-microsoft-windows'
  161. default:
  162. return ''
  163. }
  164. },
  165. isDbLimited () {
  166. return this.info.dbType === 'MySQL' && this.dbVersion.indexOf('5.') === 0
  167. },
  168. isLatestVersion () {
  169. return this.info.currentVersion === this.info.latestVersion
  170. }
  171. },
  172. methods: {
  173. async refresh () {
  174. await this.$apollo.queries.info.refetch()
  175. this.$store.commit('showNotification', {
  176. message: this.$t('admin:system.refreshSuccess'),
  177. style: 'success',
  178. icon: 'cached'
  179. })
  180. },
  181. async performUpgrade () {
  182. this.isUpgrading = true
  183. this.isUpgradingStarted = false
  184. this.upgradeProgress = 0
  185. this.$store.commit(`loadingStart`, 'admin-system-upgrade')
  186. try {
  187. const respRaw = await this.$apollo.mutate({
  188. mutation: performUpgradeMutation
  189. })
  190. const resp = _.get(respRaw, 'data.system.performUpgrade.responseResult', {})
  191. if (resp.succeeded) {
  192. this.isUpgradingStarted = true
  193. let progressInterval = setInterval(() => {
  194. this.upgradeProgress += 0.83
  195. }, 500)
  196. _.delay(() => {
  197. clearInterval(progressInterval)
  198. window.location.reload(true)
  199. }, 60000)
  200. } else {
  201. throw new Error(resp.message)
  202. }
  203. } catch (err) {
  204. this.$store.commit('pushGraphError', err)
  205. this.$store.commit(`loadingStop`, 'admin-system-upgrade')
  206. this.isUpgrading = false
  207. }
  208. }
  209. },
  210. apollo: {
  211. info: {
  212. query: systemInfoQuery,
  213. fetchPolicy: 'network-only',
  214. update: (data) => data.system.info,
  215. watchLoading (isLoading) {
  216. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-system-refresh')
  217. }
  218. }
  219. }
  220. }
  221. </script>
  222. <style lang='scss'>
  223. .admin-system {
  224. .v-list-item-title, .v-list-item__subtitle {
  225. user-select: text;
  226. }
  227. }
  228. </style>