mirror of https://github.com/halo-dev/halo
style: remove useless code.
parent
ab7596a245
commit
b181b7c76b
|
@ -1,174 +0,0 @@
|
|||
<template>
|
||||
<a-card
|
||||
:bordered="false"
|
||||
:bodyStyle="{ padding: '16px' }"
|
||||
>
|
||||
<div slot="title">
|
||||
<a-icon type="hdd" />博客备份
|
||||
</div>
|
||||
<template
|
||||
class="ant-card-actions"
|
||||
slot="actions"
|
||||
>
|
||||
<a-button
|
||||
type="link"
|
||||
icon="download"
|
||||
:loading="backuping"
|
||||
@click="handleBackupClick"
|
||||
>备份</a-button>
|
||||
|
||||
<a-button
|
||||
type="link"
|
||||
icon="reload"
|
||||
:loading="loading"
|
||||
@click="handleBAckupRefreshClick"
|
||||
>刷新</a-button>
|
||||
</template>
|
||||
|
||||
<a-list
|
||||
itemLayout="horizontal"
|
||||
:dataSource="backupTips"
|
||||
>
|
||||
<a-list-item
|
||||
slot="renderItem"
|
||||
slot-scope="backupTip"
|
||||
>
|
||||
<a-list-item-meta :description="backupTip.description">
|
||||
<h4 slot="title">{{ backupTip.title }}</h4>
|
||||
</a-list-item-meta>
|
||||
<a-alert
|
||||
slot="extra"
|
||||
v-if="backupTip.alert"
|
||||
:message="backupTip.alert.message"
|
||||
:type="backupTip.alert.type"
|
||||
banner
|
||||
/>
|
||||
</a-list-item>
|
||||
</a-list>
|
||||
|
||||
<a-divider>历史备份</a-divider>
|
||||
|
||||
<a-list
|
||||
itemLayout="vertical"
|
||||
size="small"
|
||||
:dataSource="backups"
|
||||
>
|
||||
<a-list-item
|
||||
slot="renderItem"
|
||||
slot-scope="backup"
|
||||
>
|
||||
<a-button
|
||||
slot="extra"
|
||||
type="link"
|
||||
style="color: red"
|
||||
icon="delete"
|
||||
:loading="deleting"
|
||||
@click="handleBackupDeleteClick(backup.filename)"
|
||||
>删除</a-button>
|
||||
<a-list-item-meta>
|
||||
<a
|
||||
slot="title"
|
||||
:href="backup.downloadUrl"
|
||||
>
|
||||
<a-icon
|
||||
type="schedule"
|
||||
style="color: #52c41a"
|
||||
/>
|
||||
{{ backup.filename }}
|
||||
</a>
|
||||
<p slot="description">{{ backup.updateTime | timeAgo }}</p>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
<div
|
||||
v-if="loading"
|
||||
class="loading-container"
|
||||
>
|
||||
<a-spin />
|
||||
</div>
|
||||
</a-list>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import backupApi from '@/api/backup'
|
||||
|
||||
export default {
|
||||
name: 'Backup',
|
||||
data() {
|
||||
return {
|
||||
backuping: false,
|
||||
loading: false,
|
||||
deleting: false,
|
||||
backups: [],
|
||||
backupTips: [
|
||||
{
|
||||
title: '博客备份',
|
||||
description:
|
||||
'将会压缩 Halo 的工作目录到临时文件中,并提供下载链接。如果附件太多的话,可能会十分耗时,请耐心等待!',
|
||||
alert: {
|
||||
type: 'warning',
|
||||
message: '注意:备份后生成的压缩文件存储在临时文件中,重启服务器会造成备份文件的丢失,所以请尽快下载!'
|
||||
}
|
||||
},
|
||||
{ title: '备份查询', description: '查询近期的备份,按照备份时间递减排序。' },
|
||||
{ title: '备份删除', description: '删除已经备份的内容。' },
|
||||
{
|
||||
title: '版本要求',
|
||||
alert: {
|
||||
type: 'warning',
|
||||
message: '注意:要求 Halo server 版本大于 v1.1.1!你可以在 【系统 | 关于】 里面找到系统的版本信息。'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getBackups()
|
||||
},
|
||||
methods: {
|
||||
getBackups() {
|
||||
this.loading = true
|
||||
backupApi
|
||||
.listHaloBackups()
|
||||
.then(response => {
|
||||
this.backups = response.data.data
|
||||
})
|
||||
.finally(() => (this.loading = false))
|
||||
},
|
||||
handleBackupClick() {
|
||||
this.backuping = true
|
||||
backupApi
|
||||
.backupHalo()
|
||||
.then(response => {
|
||||
this.$notification.success({ message: 'Backup succeeded!' })
|
||||
this.getBackups()
|
||||
})
|
||||
.finally(() => {
|
||||
this.backuping = false
|
||||
})
|
||||
},
|
||||
handleBackupDeleteClick(filename) {
|
||||
this.deleting = true
|
||||
backupApi
|
||||
.deleteHaloBackup(filename)
|
||||
.then(response => {
|
||||
this.$notification.success({ message: 'Delete succeeded!' })
|
||||
this.getBackups()
|
||||
})
|
||||
.finally(() => (this.deleting = false))
|
||||
},
|
||||
handleBAckupRefreshClick() {
|
||||
this.getBackups()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="css" scoped>
|
||||
.loading-container {
|
||||
position: absolute;
|
||||
bottom: 40px;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
|
@ -1,186 +0,0 @@
|
|||
<template>
|
||||
<div class="page-header-index-wide">
|
||||
<div class="card-container">
|
||||
<a-tabs type="card">
|
||||
<a-tab-pane key="1">
|
||||
<span slot="tab">
|
||||
<a-icon type="folder" />资源文件备份
|
||||
</span>
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:dataSource="ResourcesData"
|
||||
>
|
||||
<span
|
||||
slot="action"
|
||||
slot-scope="text, record"
|
||||
>
|
||||
<a
|
||||
href="javascript:;"
|
||||
@click="downResources('ResourcesData',record.id)"
|
||||
>下载</a>
|
||||
<a-divider type="vertical" />
|
||||
<a
|
||||
href="javascript:;"
|
||||
@click="sendResources('ResourcesData',record.id)"
|
||||
>发送到邮箱</a>
|
||||
<a-divider type="vertical" />
|
||||
<a
|
||||
href="javascript:;"
|
||||
@click="deleteResources('ResourcesData',record.id)"
|
||||
>删除</a>
|
||||
</span>
|
||||
</a-table>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="backupData('ResourcesData')"
|
||||
>备份</a-button>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2">
|
||||
<span slot="tab">
|
||||
<a-icon type="database" />数据库备份
|
||||
</span>
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:dataSource="DataBaseData"
|
||||
>
|
||||
<span
|
||||
slot="action"
|
||||
slot-scope="text, record"
|
||||
>
|
||||
<a
|
||||
href="javascript:;"
|
||||
@click="downResources('DataBaseData',record.id)"
|
||||
>下载</a>
|
||||
<a-divider type="vertical" />
|
||||
<a
|
||||
href="javascript:;"
|
||||
@click="sendResources('DataBaseData',record.id)"
|
||||
>发送到邮箱</a>
|
||||
<a-divider type="vertical" />
|
||||
<a
|
||||
href="javascript:;"
|
||||
@click="deleteResources('DataBaseData',record.id)"
|
||||
>删除</a>
|
||||
</span>
|
||||
</a-table>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="backupData('DataBaseData')"
|
||||
>备份</a-button>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="3">
|
||||
<span slot="tab">
|
||||
<a-icon type="read" />文章备份
|
||||
</span>
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:dataSource="FileData"
|
||||
>
|
||||
<span
|
||||
slot="action"
|
||||
slot-scope="text, record"
|
||||
>
|
||||
<a
|
||||
href="javascript:;"
|
||||
@click="downResources('FileData',record.id)"
|
||||
>下载</a>
|
||||
<a-divider type="vertical" />
|
||||
<a
|
||||
href="javascript:;"
|
||||
@click="sendResources('FileData',record.id)"
|
||||
>发送到邮箱</a>
|
||||
<a-divider type="vertical" />
|
||||
<a
|
||||
href="javascript:;"
|
||||
@click="deleteResources('FileData',record.id)"
|
||||
>删除</a>
|
||||
</span>
|
||||
</a-table>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="backupData('FileData')"
|
||||
>备份</a-button>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
num: 0,
|
||||
columns: [
|
||||
{
|
||||
title: '文件名称',
|
||||
dataIndex: 'name'
|
||||
},
|
||||
{
|
||||
title: '日期',
|
||||
dataIndex: 'date'
|
||||
},
|
||||
{
|
||||
title: '文件大小',
|
||||
dataIndex: 'size'
|
||||
},
|
||||
{
|
||||
title: '文件类型',
|
||||
dataIndex: 'type'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
scopedSlots: { customRender: 'action' }
|
||||
}
|
||||
],
|
||||
ResourcesData: [],
|
||||
DataBaseData: [],
|
||||
FileData: []
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
// 下载
|
||||
downResources(type, id) {
|
||||
if (type === 'ResourcesData') {
|
||||
alert('资源文件下载' + id)
|
||||
} else if (type === 'DataBaseData') {
|
||||
alert('数据库文件下载' + id)
|
||||
} else {
|
||||
alert('文件下载' + id)
|
||||
}
|
||||
},
|
||||
// 发送到邮箱
|
||||
sendResources(type, id) {
|
||||
if (type === 'ResourcesData') {
|
||||
alert('资源文件发送到邮箱' + id)
|
||||
} else if (type === 'DataBaseData') {
|
||||
alert('数据库文件发送到邮箱' + id)
|
||||
} else {
|
||||
alert('文件发送到邮箱' + id)
|
||||
}
|
||||
},
|
||||
// 删除
|
||||
deleteResources(type, id) {
|
||||
if (type === 'ResourcesData') {
|
||||
alert('资源文件删除' + id)
|
||||
} else if (type === 'DataBaseData') {
|
||||
alert('数据库文件删除' + id)
|
||||
} else {
|
||||
alert('文件删除' + id)
|
||||
}
|
||||
},
|
||||
// 备份
|
||||
backupData(type) {
|
||||
if (type === 'ResourcesData') {
|
||||
alert('资源文件备份')
|
||||
} else if (type === 'DataBaseData') {
|
||||
alert('数据库文件备份')
|
||||
} else {
|
||||
alert('文件备份')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue