admin-extensions.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template lang='pug'>
  2. v-container(fluid, grid-list-lg)
  3. v-layout(row wrap)
  4. v-flex(xs12)
  5. .admin-header
  6. img.animated.fadeInUp(src='/_assets/svg/icon-installing-updates.svg', alt='Extensions', style='width: 80px;')
  7. .admin-header-title
  8. .headline.primary--text.animated.fadeInLeft {{ $t('admin:extensions.title') }}
  9. .subtitle-1.grey--text.animated.fadeInLeft {{ $t('admin:extensions.subtitle') }}
  10. v-form.pt-3
  11. v-layout(row wrap)
  12. v-flex(xl6 lg8 xs12)
  13. v-alert.mb-4(outlined, color='error', icon='mdi-alert')
  14. span New extensions cannot be installed at the moment. This feature is coming in a future release.
  15. v-expansion-panels.admin-extensions-exp(hover, popout)
  16. v-expansion-panel(v-for='ext of extensions', :key='`ext-` + ext.key')
  17. v-expansion-panel-header(disable-icon-rotate)
  18. span {{ext.title}}
  19. template(v-slot:actions)
  20. v-chip(label, color='success', small, v-if='ext.installed') Installed
  21. v-chip(label, color='warning', small, v-else) Not Installed
  22. v-expansion-panel-content.pa-0
  23. v-card(flat, :class='$vuetify.theme.dark ? `grey darken-3` : `grey lighten-5`', tile)
  24. v-card-text
  25. .body-2 {{ext.description}}
  26. v-divider.my-4
  27. .body-2
  28. strong.mr-3 Supported Platforms:
  29. v-chip.mr-1(label, small, :color='ext.platforms[`linux-amd64`] ? `success` : `error`') Linux (x64)
  30. v-chip.mr-1(label, small, :color='ext.platforms[`linux-arm64`] ? `success` : `error`') Linux (arm64)
  31. v-chip.mr-1(label, small, :color='ext.platforms[`linux-armv7`] ? `success` : `error`') Linux (armv7)
  32. v-chip.mr-1(label, small, :color='ext.platforms.macos ? `success` : `error`') MacOS
  33. v-chip.mr-1(label, small, :color='ext.platforms.windows ? `success` : `error`') Windows
  34. v-card-chin
  35. v-spacer
  36. v-btn(disabled)
  37. v-icon(left) mdi-plus
  38. span Install
  39. </template>
  40. <script>
  41. import _ from 'lodash'
  42. import gql from 'graphql-tag'
  43. export default {
  44. data() {
  45. return {
  46. config: {},
  47. extensions: [
  48. {
  49. key: 'git',
  50. title: 'Git',
  51. description: 'Distributed version control system. Required for the Git storage module.',
  52. platforms: {
  53. 'linux-amd64': true,
  54. 'linux-arm64': true,
  55. 'linux-armv7': true,
  56. 'macos': true,
  57. 'windows': true
  58. },
  59. installed: true
  60. },
  61. {
  62. key: 'pandoc',
  63. title: 'Pandoc',
  64. description: 'Convert between markup formats. Required for converting from other formats such as MediaWiki, AsciiDoc, Textile and other wikis.',
  65. platforms: {
  66. 'linux-amd64': true,
  67. 'linux-arm64': false,
  68. 'linux-armv7': false,
  69. 'macos': true,
  70. 'windows': true
  71. },
  72. installed: false
  73. },
  74. {
  75. key: 'puppeteer',
  76. title: 'Puppeteer',
  77. description: 'Headless chromium browser for server-side rendering. Required for generating PDF versions of pages and render content elements on the server (e.g. Mermaid diagrams)',
  78. platforms: {
  79. 'linux-amd64': true,
  80. 'linux-arm64': false,
  81. 'linux-armv7': false,
  82. 'macos': true,
  83. 'windows': true
  84. },
  85. installed: false
  86. },
  87. {
  88. key: 'sharp',
  89. title: 'Sharp',
  90. description: 'Process and transform images. Required to generate thumbnails of uploaded images and perform transformations.',
  91. platforms: {
  92. 'linux-amd64': true,
  93. 'linux-arm64': false,
  94. 'linux-armv7': false,
  95. 'macos': true,
  96. 'windows': true
  97. },
  98. installed: false
  99. }
  100. ]
  101. }
  102. },
  103. computed: {
  104. },
  105. methods: {
  106. async save () {
  107. try {
  108. await this.$apollo.mutate({
  109. mutation: gql`
  110. mutation (
  111. $host: String!
  112. ) {
  113. site {
  114. updateConfig(
  115. host: $host
  116. ) {
  117. responseResult {
  118. succeeded
  119. errorCode
  120. slug
  121. message
  122. }
  123. }
  124. }
  125. }
  126. `,
  127. variables: {
  128. host: _.get(this.config, 'host', '')
  129. },
  130. watchLoading (isLoading) {
  131. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-update')
  132. }
  133. })
  134. this.$store.commit('showNotification', {
  135. style: 'success',
  136. message: 'Configuration saved successfully.',
  137. icon: 'check'
  138. })
  139. } catch (err) {
  140. this.$store.commit('pushGraphError', err)
  141. }
  142. }
  143. }
  144. // apollo: {
  145. // config: {
  146. // query: gql`
  147. // {
  148. // site {
  149. // config {
  150. // host
  151. // }
  152. // }
  153. // }
  154. // `,
  155. // fetchPolicy: 'network-only',
  156. // update: (data) => _.cloneDeep(data.site.config),
  157. // watchLoading (isLoading) {
  158. // this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-refresh')
  159. // }
  160. // }
  161. // }
  162. }
  163. </script>
  164. <style lang='scss'>
  165. .admin-extensions-exp {
  166. .v-expansion-panel-content__wrap {
  167. padding: 0;
  168. }
  169. }
  170. </style>