Files
ostandari/pages/admin/backup/index.vue
T
2024-10-21 10:22:26 +03:30

74 lines
2.1 KiB
Vue

<template>
<div>
<CustomSubHeader>
<CBreadcrumb class="border-0 mb-0">{{ title }}</CBreadcrumb>
<CButton size="sm" color="primary" class="mr-auto" :to="{ name: 'admin' }">برگشت به صفحه داشبورد</CButton>
</CustomSubHeader>
<CCard>
<CCardBody>
<CRow>
<CCol>
<h2>پشتیبان گیری</h2>
<el-divider></el-divider>
<a :href="`/api/public/backup/${$auth.user.token}`" target="_blank">
<el-button type="success">تهیه و دریافت فایل پشتیبان</el-button>
</a>
<el-button type="danger" @click="clearBackups">پاک کردن فایل های بکاپ آپ قبلی</el-button>
</CCol>
</CRow>
</CCardBody>
</CCard>
</div>
</template>
<script>
export default {
data() {
return {
title: 'پشتیبان گیری از اطلاعات سایت'
}
},
head() {
return {
title: this.title
}
},
methods: {
// getBackup() {
// const loading = this.$loading({
// lock: true,
// text: 'سایت در حال پشتیبان گیری میباشد',
// spinner: 'el-icon-loading',
// background: 'rgba(0, 0, 0, 0.7)'
// })
//
// this.$axios.get(`/api/public/backup/${this.$auth.user.token}`)
// .then(res => {
// loading.close()
// console.log(res.data)
// })
// .catch(err => {
// loading.close()
// console.log(err)
// })
// },
clearBackups() {
this.$axios.post('/api/admin/clearBackups')
.then(res => {
this.$message({
type: 'success',
message: 'فایل های پشتیبان قبلی با موفقیت از روی سیستم حذف شدند'
})
})
.catch(err => {
this.$message({
type: 'error',
message: 'مشکلی در اجرای عملیات پیش آمده، لطفا دوباره امتحان کنید.'
})
})
}
},
layout: "admin"
}
</script>