|
|
@ -41,20 +41,34 @@
|
|
|
|
<a-divider class="divider-transparent" />
|
|
|
|
<a-divider class="divider-transparent" />
|
|
|
|
<div class="bottom-control">
|
|
|
|
<div class="bottom-control">
|
|
|
|
<a-space>
|
|
|
|
<a-space>
|
|
|
|
|
|
|
|
<a-button type="primary" icon="download" @click="handleBackupClick">备份</a-button>
|
|
|
|
|
|
|
|
<a-button type="dashed" icon="reload" :loading="loading" @click="handleListBackups">刷新</a-button>
|
|
|
|
|
|
|
|
</a-space>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<a-modal v-model="optionsModal.visible" title="备份选项">
|
|
|
|
|
|
|
|
<template slot="footer">
|
|
|
|
|
|
|
|
<a-button @click="() => (optionsModal.visible = false)">取消</a-button>
|
|
|
|
<ReactiveButton
|
|
|
|
<ReactiveButton
|
|
|
|
type="primary"
|
|
|
|
type="primary"
|
|
|
|
icon="download"
|
|
|
|
@click="handleBackupConfirmed"
|
|
|
|
@click="handleBackupClick"
|
|
|
|
|
|
|
|
@callback="handleBackupedCallback"
|
|
|
|
@callback="handleBackupedCallback"
|
|
|
|
:loading="backuping"
|
|
|
|
:loading="backuping"
|
|
|
|
:errored="backupErrored"
|
|
|
|
:errored="backupErrored"
|
|
|
|
text="备份"
|
|
|
|
text="确认"
|
|
|
|
loadedText="备份成功"
|
|
|
|
loadedText="备份成功"
|
|
|
|
erroredText="备份失败"
|
|
|
|
erroredText="备份失败"
|
|
|
|
></ReactiveButton>
|
|
|
|
></ReactiveButton>
|
|
|
|
<a-button type="dashed" icon="reload" :loading="loading" @click="handleListBackups">刷新</a-button>
|
|
|
|
</template>
|
|
|
|
</a-space>
|
|
|
|
<a-checkbox-group v-model="optionsModal.selected" style="width: 100%">
|
|
|
|
</div>
|
|
|
|
<a-row>
|
|
|
|
|
|
|
|
<a-col :span="8" v-for="item in optionsModal.options" :key="item">
|
|
|
|
|
|
|
|
<a-checkbox :value="item">
|
|
|
|
|
|
|
|
{{ item }}
|
|
|
|
|
|
|
|
</a-checkbox>
|
|
|
|
|
|
|
|
</a-col>
|
|
|
|
|
|
|
|
</a-row>
|
|
|
|
|
|
|
|
</a-checkbox-group>
|
|
|
|
|
|
|
|
</a-modal>
|
|
|
|
</a-drawer>
|
|
|
|
</a-drawer>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
@ -68,7 +82,12 @@ export default {
|
|
|
|
backuping: false,
|
|
|
|
backuping: false,
|
|
|
|
loading: false,
|
|
|
|
loading: false,
|
|
|
|
backupErrored: false,
|
|
|
|
backupErrored: false,
|
|
|
|
backups: []
|
|
|
|
backups: [],
|
|
|
|
|
|
|
|
optionsModal: {
|
|
|
|
|
|
|
|
options: [],
|
|
|
|
|
|
|
|
visible: false,
|
|
|
|
|
|
|
|
selected: []
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
model: {
|
|
|
|
model: {
|
|
|
@ -102,9 +121,18 @@ export default {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
handleBackupClick() {
|
|
|
|
handleBackupClick() {
|
|
|
|
|
|
|
|
backupApi.listWorkDirOptions().then(response => {
|
|
|
|
|
|
|
|
this.optionsModal = {
|
|
|
|
|
|
|
|
visible: true,
|
|
|
|
|
|
|
|
options: response.data.data,
|
|
|
|
|
|
|
|
selected: response.data.data
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
handleBackupConfirmed() {
|
|
|
|
this.backuping = true
|
|
|
|
this.backuping = true
|
|
|
|
backupApi
|
|
|
|
backupApi
|
|
|
|
.backupWorkDir()
|
|
|
|
.backupWorkDir(this.optionsModal.selected)
|
|
|
|
.catch(() => {
|
|
|
|
.catch(() => {
|
|
|
|
this.backupErrored = true
|
|
|
|
this.backupErrored = true
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -118,6 +146,7 @@ export default {
|
|
|
|
if (this.backupErrored) {
|
|
|
|
if (this.backupErrored) {
|
|
|
|
this.backupErrored = false
|
|
|
|
this.backupErrored = false
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.optionsModal.visible = false
|
|
|
|
this.handleListBackups()
|
|
|
|
this.handleListBackups()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|