build version 400

This commit is contained in:
Mohit Panjwani
2020-12-02 17:54:08 +05:30
parent 326508e567
commit 89ee58590c
963 changed files with 62887 additions and 48868 deletions

View File

@ -0,0 +1,41 @@
import * as types from './mutation-types'
export const fetchBackups = ({ commit, dispatch, state }, params) => {
return new Promise((resolve, reject) => {
window.axios
.get(`/api/v1/backups`, { params })
.then((response) => {
commit(types.SET_BACKUPS, response.data)
resolve(response)
})
.catch((err) => {
reject(err)
})
})
}
export const createBackup = ({ commit, dispatch, state }, data) => {
return new Promise((resolve, reject) => {
window.axios
.post(`/api/v1/backups`, data)
.then((response) => {
resolve(response)
})
.catch((err) => {
reject(err)
})
})
}
export const removeBackup = ({ commit, dispatch, state }, params) => {
return new Promise((resolve, reject) => {
window.axios
.delete(`/api/v1/backups/${params.disk}`, { params })
.then((response) => {
resolve(response)
})
.catch((err) => {
reject(err)
})
})
}

View File

@ -0,0 +1,3 @@
export const getBackups = (state) => state.backups
export const getBackupDisks = (state) => state.backupDisks
export const getBackupDisksInfo = (state) => state.backupDisksInfo

View File

@ -0,0 +1,21 @@
import mutations from './mutations'
import * as actions from './actions'
import * as getters from './getters'
const initialState = {
backups: [],
backupDisks: [],
backupDisksInfo: [],
}
export default {
namespaced: true,
state: initialState,
getters: getters,
actions: actions,
mutations: mutations,
}

View File

@ -0,0 +1,4 @@
export const SET_BACKUPS = 'SET_BACKUPS'
export const ADD_BACKUPS = 'ADD_BACKUPS'
export const DELETE_BACKUPS = 'DELETE_BACKUPS'
export const SET_BACKUP_DISKS = 'SET_BACKUP_DISKS'

View File

@ -0,0 +1,21 @@
import * as types from './mutation-types'
export default {
[types.SET_BACKUPS](state, data) {
state.backups = data.backups
state.backupDisks = data.disks
},
[types.SET_BACKUP_DISKS](state, data) {
state.backupDisksInfo = data.disks
},
[types.ADD_BACKUPS](state, data) {
state.backups.push(data.backup)
},
[types.DELETE_BACKUPS](state, id) {
let index = state.backups.findIndex((backup) => backup.id === id)
state.backups.splice(index, 1)
},
}