admin-settings.component.js 1.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
'use strict'

import * as $ from 'jquery'

export default {
  name: 'admin-settings',
  data() {
    return {
      upgradeModal: {
        state: false,
        step: 'confirm',
        mode: 'upgrade',
        error: 'Something went wrong.'
      }
    }
  },
  methods: {
    upgrade() {
      this.upgradeModal.mode = 'upgrade'
      this.upgradeModal.step = 'confirm'
      this.upgradeModal.state = true
    },
    reinstall() {
      this.upgradeModal.mode = 're-install'
      this.upgradeModal.step = 'confirm'
      this.upgradeModal.state = true
    },
    upgradeCancel() {
      this.upgradeModal.state = false
    },
    upgradeStart() {
      this.upgradeModal.step = 'running'
      $.post('/admin/settings/install', {
        mode: this.upgradeModal.mode
      }).done((resp) => {
        // todo
      }).fail((jqXHR, txtStatus, resp) => {
        this.upgradeModal.step = 'error'
        this.upgradeModal.error = jqXHR.responseText
      })
    },
    flushcache() {
      window.alert('Coming soon!')
    },
    resetaccounts() {
      window.alert('Coming soon!')
    },
    flushsessions() {
      window.alert('Coming soon!')
    }
  }
}