mirror of https://github.com/1Panel-dev/1Panel
fix: 应用备份页面修改
parent
1496403ce9
commit
6d9217d419
|
@ -246,8 +246,8 @@ func backupInstall(ctx context.Context, install model.AppInstall) error {
|
||||||
backupDir := path.Join(constant.BackupDir, install.App.Key, install.Name)
|
backupDir := path.Join(constant.BackupDir, install.App.Key, install.Name)
|
||||||
fileOp := files.NewFileOp()
|
fileOp := files.NewFileOp()
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
day := now.Format("2006-01-02-15-04")
|
day := now.Format("20060102150405")
|
||||||
fileName := fmt.Sprintf("%s-%s-%s%s", install.Name, install.Version, day, ".tar.gz")
|
fileName := fmt.Sprintf("%s_%s%s", install.Name, day, ".tar.gz")
|
||||||
if err := fileOp.Compress([]string{appPath}, backupDir, fileName, files.TarGz); err != nil {
|
if err := fileOp.Compress([]string{appPath}, backupDir, fileName, files.TarGz); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -724,8 +724,8 @@ export default {
|
||||||
backupName: '文件名称',
|
backupName: '文件名称',
|
||||||
backupPath: '文件路径',
|
backupPath: '文件路径',
|
||||||
backupdate: '备份时间',
|
backupdate: '备份时间',
|
||||||
restore: '回滚',
|
restore: '恢复',
|
||||||
restoreWarn: '回滚操作会重启应用,并替换数据,此操作不可回滚,是否继续?',
|
restoreWarn: '恢复操作会重启应用,并替换数据,此操作不可回滚,是否继续?',
|
||||||
update: '升级',
|
update: '升级',
|
||||||
versioneSelect: '请选择版本',
|
versioneSelect: '请选择版本',
|
||||||
operatorHelper: '将对选中应用进行 {0} 操作,是否继续?',
|
operatorHelper: '将对选中应用进行 {0} 操作,是否继续?',
|
||||||
|
|
|
@ -1,11 +1,38 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="open" :title="$t('app.backup')" width="70%" :before-close="handleClose">
|
<el-dialog
|
||||||
<ComplexTable :pagination-config="paginationConfig" :data="data" @search="search" v-loading="loading">
|
v-model="open"
|
||||||
|
:title="$t('app.backup') + ' - ' + installData.appInstallName"
|
||||||
|
width="70%"
|
||||||
|
:before-close="handleClose"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<ComplexTable
|
||||||
|
:pagination-config="paginationConfig"
|
||||||
|
:data="data"
|
||||||
|
@search="search"
|
||||||
|
v-loading="loading"
|
||||||
|
v-model:selects="selects"
|
||||||
|
>
|
||||||
<template #toolbar>
|
<template #toolbar>
|
||||||
<el-button type="primary" plain @click="backup">{{ $t('app.backup') }}</el-button>
|
<el-button type="primary" @click="backup">{{ $t('app.backup') }}</el-button>
|
||||||
|
<el-button type="danger" plain :disabled="selects.length === 0" @click="onBatchDelete()">
|
||||||
|
{{ $t('commons.button.delete') }}
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<el-table-column :label="$t('app.backupName')" prop="name"></el-table-column>
|
<el-table-column type="selection" fix />
|
||||||
<el-table-column :label="$t('app.backupPath')" prop="path"></el-table-column>
|
|
||||||
|
<el-table-column
|
||||||
|
:label="$t('app.backupName')"
|
||||||
|
min-width="120px"
|
||||||
|
prop="name"
|
||||||
|
show-overflow-tooltip
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
:label="$t('app.backupPath')"
|
||||||
|
min-width="120px"
|
||||||
|
prop="path"
|
||||||
|
show-overflow-tooltip
|
||||||
|
></el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="createdAt"
|
prop="createdAt"
|
||||||
:label="$t('app.backupdate')"
|
:label="$t('app.backupdate')"
|
||||||
|
@ -48,10 +75,13 @@ import { useDeleteData } from '@/hooks/use-delete-data';
|
||||||
|
|
||||||
interface InstallRrops {
|
interface InstallRrops {
|
||||||
appInstallId: number;
|
appInstallId: number;
|
||||||
|
appInstallName: string;
|
||||||
}
|
}
|
||||||
const installData = ref<InstallRrops>({
|
const installData = ref<InstallRrops>({
|
||||||
appInstallId: 0,
|
appInstallId: 0,
|
||||||
|
appInstallName: '',
|
||||||
});
|
});
|
||||||
|
const selects = ref<any>([]);
|
||||||
let open = ref(false);
|
let open = ref(false);
|
||||||
let loading = ref(false);
|
let loading = ref(false);
|
||||||
let data = ref<any>();
|
let data = ref<any>();
|
||||||
|
@ -75,6 +105,7 @@ const handleClose = () => {
|
||||||
|
|
||||||
const acceptParams = (props: InstallRrops) => {
|
const acceptParams = (props: InstallRrops) => {
|
||||||
installData.value.appInstallId = props.appInstallId;
|
installData.value.appInstallId = props.appInstallId;
|
||||||
|
installData.value.appInstallName = props.appInstallName;
|
||||||
search();
|
search();
|
||||||
open.value = true;
|
open.value = true;
|
||||||
};
|
};
|
||||||
|
@ -128,13 +159,18 @@ const restore = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteBackup = async (ids: number[]) => {
|
const deleteBackup = async (ids: number[]) => {
|
||||||
const req = {
|
await useDeleteData(DelAppBackups, { ids: ids }, 'commons.msg.delete', loading.value);
|
||||||
ids: ids,
|
|
||||||
};
|
|
||||||
await useDeleteData(DelAppBackups, req, 'commons.msg.delete', loading.value);
|
|
||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onBatchDelete = () => {
|
||||||
|
let ids: Array<number> = [];
|
||||||
|
selects.value.forEach((item: any) => {
|
||||||
|
ids.push(item.id);
|
||||||
|
});
|
||||||
|
deleteBackup(ids);
|
||||||
|
};
|
||||||
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
{
|
{
|
||||||
label: i18n.global.t('app.delete'),
|
label: i18n.global.t('app.delete'),
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<el-table-column :label="$t('website.port')" prop="httpPort"></el-table-column>
|
<el-table-column :label="$t('website.port')" prop="httpPort"></el-table-column>
|
||||||
<el-table-column :label="$t('app.backup')">
|
<el-table-column :label="$t('app.backup')">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-link :underline="false" @click="openBackups(row.id)" type="primary">
|
<el-link :underline="false" @click="openBackups(row.id, row.name)" type="primary">
|
||||||
{{ $t('app.backup') }} ({{ row.backups.length }})
|
{{ $t('app.backup') }} ({{ row.backups.length }})
|
||||||
</el-link>
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
|
@ -261,9 +261,10 @@ const buttons = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const openBackups = (installId: number) => {
|
const openBackups = (installId: number, installName: string) => {
|
||||||
let params = {
|
let params = {
|
||||||
appInstallId: installId,
|
appInstallId: installId,
|
||||||
|
appInstallName: installName,
|
||||||
};
|
};
|
||||||
backupRef.value.acceptParams(params);
|
backupRef.value.acceptParams(params);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue