summaryrefslogblamecommitdiffstats
path: root/webapp/src/store/backends.js
blob: 43be8186a14328391631107d3ffc06e4aa09ed7d (plain) (tree)
1
2
3
4
5
6
7
8
9
10






                         
                

                  


                              
                          
      




                                



                            






                             


            
                        
                                                   












                                                                        
import axios from 'axios'

export default {
  namespaced: true,
  state: {
    backends: [],
    dialog: false,
    edit: false,
    backendId: '',
    sync: false
  },
  mutations: {
    setDialog (state, value) {
      state.dialog = value
    },
    setBackends (state, value) {
      state.backends = value
    },
    editBackend (state, value) {
      state.backendId = value
      state.edit = true
    },
    setEdit (state, value) {
      state.edit = value
    },
    setSync (state, value) {
      state.sync = value
    },
    editSync (state, value) {
      state.backendId = value
      state.sync = true
    }
  },
  actions: {
    loadData (context) {
      axios.get('/api/backends').then(response => {
        // Needed for initializing the diffrent dynamic loading buttons.
        var tmpItems = response.data
        tmpItems.forEach(function (item) {
          // Variable for the loading animation.
          item.loading = false
          // Variable for the test connection color
          item.connection = 'primary'
        })
        context.commit('setBackends', tmpItems)
      })
    }
  }
}