admin-extensions.vue 3.82 KB
Newer Older
NGPixel's avatar
NGPixel committed
1 2 3 4 5
<template lang='pug'>
  v-container(fluid, grid-list-lg)
    v-layout(row wrap)
      v-flex(xs12)
        .admin-header
6
          img.animated.fadeInUp(src='/_assets/svg/icon-installing-updates.svg', alt='Extensions', style='width: 80px;')
NGPixel's avatar
NGPixel committed
7 8 9 10 11 12 13 14 15
          .admin-header-title
            .headline.primary--text.animated.fadeInLeft {{ $t('admin:extensions.title') }}
            .subtitle-1.grey--text.animated.fadeInLeft {{ $t('admin:extensions.subtitle') }}
        v-form.pt-3
          v-layout(row wrap)
            v-flex(xl6 lg8 xs12)
              v-alert.mb-4(outlined, color='error', icon='mdi-alert')
                span New extensions cannot be installed at the moment. This feature is coming in a future release.
              v-expansion-panels.admin-extensions-exp(hover, popout)
NGPixel's avatar
NGPixel committed
16
                v-expansion-panel(v-for='ext of extensions', :key='`ext-` + ext.key')
NGPixel's avatar
NGPixel committed
17 18 19
                  v-expansion-panel-header(disable-icon-rotate)
                    span {{ext.title}}
                    template(v-slot:actions)
20
                      v-chip(label, color='success', small, v-if='ext.isInstalled') Installed
NGPixel's avatar
NGPixel committed
21 22
                      v-chip(label, color='warning', small, v-else) Not Installed
                  v-expansion-panel-content.pa-0
23
                    v-card(flat, :class='$vuetify.theme.dark ? `grey darken-3` : `grey lighten-5`', tile)
NGPixel's avatar
NGPixel committed
24 25 26 27
                      v-card-text
                        .body-2 {{ext.description}}
                        v-divider.my-4
                        .body-2
28
                          strong.mr-2 This extension is
29 30 31
                          v-chip.mr-2(v-if='ext.isCompatible', label, outlined, small, color='success') compatible
                          v-chip.mr-2(v-else, label, small, color='error') not compatible
                          strong with your host.
NGPixel's avatar
NGPixel committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45
                      v-card-chin
                        v-spacer
                        v-btn(disabled)
                          v-icon(left) mdi-plus
                          span Install
</template>

<script>
import _ from 'lodash'
import gql from 'graphql-tag'

export default {
  data() {
    return {
46
      extensions: []
NGPixel's avatar
NGPixel committed
47 48 49 50
    }
  },
  methods: {
    async save () {
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
      // try {
      //   await this.$apollo.mutate({
      //     mutation: gql`
      //       mutation (
      //         $host: String!
      //       ) {
      //         site {
      //           updateConfig(
      //             host: $host
      //           ) {
      //             responseResult {
      //               succeeded
      //               errorCode
      //               slug
      //               message
      //             }
      //           }
      //         }
      //       }
      //     `,
      //     variables: {
      //       host: _.get(this.config, 'host', '')
      //     },
      //     watchLoading (isLoading) {
      //       this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-extensions-update')
      //     }
      //   })
      //   this.$store.commit('showNotification', {
      //     style: 'success',
      //     message: 'Configuration saved successfully.',
      //     icon: 'check'
      //   })
      // } catch (err) {
      //   this.$store.commit('pushGraphError', err)
      // }
    }
  },
  apollo: {
    extensions: {
      query: gql`
        {
          system {
            extensions {
              key
              title
              description
              isInstalled
              isCompatible
NGPixel's avatar
NGPixel committed
99 100
            }
          }
101 102 103 104 105 106
        }
      `,
      fetchPolicy: 'network-only',
      update: (data) => _.cloneDeep(data.system.extensions),
      watchLoading (isLoading) {
        this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-extensions-refresh')
NGPixel's avatar
NGPixel committed
107 108 109 110 111 112 113 114 115 116 117 118 119
      }
    }
  }
}
</script>

<style lang='scss'>
.admin-extensions-exp {
  .v-expansion-panel-content__wrap {
    padding: 0;
  }
}
</style>