admin-extensions.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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')
  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.grey.lighten-5.radius-7(flat)
  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. title: 'Git',
  50. description: 'Distributed version control system. Required for the Git storage module.',
  51. platforms: {
  52. 'linux-amd64': true,
  53. 'linux-arm64': true,
  54. 'linux-armv7': true,
  55. 'macos': true,
  56. 'windows': true
  57. },
  58. installed: true
  59. },
  60. {
  61. title: 'Pandoc',
  62. description: 'Convert between markup formats. Required for converting from other formats such as MediaWiki, AsciiDoc, Textile and other wikis.',
  63. platforms: {
  64. 'linux-amd64': true,
  65. 'linux-arm64': false,
  66. 'linux-armv7': false,
  67. 'macos': true,
  68. 'windows': true
  69. },
  70. installed: false
  71. },
  72. {
  73. title: 'Puppeteer',
  74. 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)',
  75. platforms: {
  76. 'linux-amd64': true,
  77. 'linux-arm64': false,
  78. 'linux-armv7': false,
  79. 'macos': true,
  80. 'windows': true
  81. },
  82. installed: false
  83. },
  84. {
  85. title: 'Sharp',
  86. description: 'Process and transform images. Required to generate thumbnails of uploaded images and perform transformations.',
  87. platforms: {
  88. 'linux-amd64': true,
  89. 'linux-arm64': false,
  90. 'linux-armv7': false,
  91. 'macos': true,
  92. 'windows': true
  93. },
  94. installed: false
  95. }
  96. ]
  97. }
  98. },
  99. computed: {
  100. },
  101. methods: {
  102. async save () {
  103. try {
  104. await this.$apollo.mutate({
  105. mutation: gql`
  106. mutation (
  107. $host: String!
  108. ) {
  109. site {
  110. updateConfig(
  111. host: $host
  112. ) {
  113. responseResult {
  114. succeeded
  115. errorCode
  116. slug
  117. message
  118. }
  119. }
  120. }
  121. }
  122. `,
  123. variables: {
  124. host: _.get(this.config, 'host', '')
  125. },
  126. watchLoading (isLoading) {
  127. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-update')
  128. }
  129. })
  130. this.$store.commit('showNotification', {
  131. style: 'success',
  132. message: 'Configuration saved successfully.',
  133. icon: 'check'
  134. })
  135. } catch (err) {
  136. this.$store.commit('pushGraphError', err)
  137. }
  138. }
  139. }
  140. // apollo: {
  141. // config: {
  142. // query: gql`
  143. // {
  144. // site {
  145. // config {
  146. // host
  147. // }
  148. // }
  149. // }
  150. // `,
  151. // fetchPolicy: 'network-only',
  152. // update: (data) => _.cloneDeep(data.site.config),
  153. // watchLoading (isLoading) {
  154. // this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-refresh')
  155. // }
  156. // }
  157. // }
  158. }
  159. </script>
  160. <style lang='scss'>
  161. .admin-extensions-exp {
  162. .v-expansion-panel-content__wrap {
  163. padding: 0;
  164. }
  165. }
  166. </style>