|
|
@ -62,7 +62,7 @@
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
|
|
<el-form-item>
|
|
|
|
<el-button @click="dialogVisible = true" type="primary">
|
|
|
|
<el-button @click="recoverSnapshot(false)" type="primary">
|
|
|
|
{{ $t('commons.button.retry') }}
|
|
|
|
{{ $t('commons.button.retry') }}
|
|
|
|
</el-button>
|
|
|
|
</el-button>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
@ -138,30 +138,6 @@
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
</el-drawer>
|
|
|
|
</el-drawer>
|
|
|
|
<el-dialog v-model="dialogVisible" :destroy-on-close="true" :close-on-click-modal="false" width="30%">
|
|
|
|
|
|
|
|
<template #header>
|
|
|
|
|
|
|
|
<div class="card-header">
|
|
|
|
|
|
|
|
<span>{{ $t('commons.button.retry') }}</span>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
<span>{{ $t('setting.reDownload') }}</span>
|
|
|
|
|
|
|
|
<el-switch style="margin-left: 15px" v-model="reDownload" />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style="margin-top: 15px">
|
|
|
|
|
|
|
|
<span>{{ $t('setting.recoverHelper', [snapInfo.name]) }}</span>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
|
|
<span class="dialog-footer">
|
|
|
|
|
|
|
|
<el-button :disabled="loading" @click="dialogVisible = false">
|
|
|
|
|
|
|
|
{{ $t('commons.button.cancel') }}
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
<el-button :disabled="loading" type="primary" @click="doRecover(false)">
|
|
|
|
|
|
|
|
{{ $t('commons.button.confirm') }}
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<SnapRecover ref="recoverRef" @close="handleClose" />
|
|
|
|
<SnapRecover ref="recoverRef" @close="handleClose" />
|
|
|
@ -174,7 +150,7 @@ import { ElMessageBox } from 'element-plus';
|
|
|
|
import i18n from '@/lang';
|
|
|
|
import i18n from '@/lang';
|
|
|
|
import DrawerHeader from '@/components/drawer-header/index.vue';
|
|
|
|
import DrawerHeader from '@/components/drawer-header/index.vue';
|
|
|
|
import { snapshotRollback } from '@/api/modules/setting';
|
|
|
|
import { snapshotRollback } from '@/api/modules/setting';
|
|
|
|
import { MsgError, MsgSuccess } from '@/utils/message';
|
|
|
|
import { MsgSuccess } from '@/utils/message';
|
|
|
|
import { loadOsInfo } from '@/api/modules/dashboard';
|
|
|
|
import { loadOsInfo } from '@/api/modules/dashboard';
|
|
|
|
import SnapRecover from '@/views/setting/snapshot/recover/index.vue';
|
|
|
|
import SnapRecover from '@/views/setting/snapshot/recover/index.vue';
|
|
|
|
|
|
|
|
|
|
|
@ -182,8 +158,6 @@ const drawerVisible = ref(false);
|
|
|
|
const snapInfo = ref();
|
|
|
|
const snapInfo = ref();
|
|
|
|
const loading = ref();
|
|
|
|
const loading = ref();
|
|
|
|
|
|
|
|
|
|
|
|
const dialogVisible = ref();
|
|
|
|
|
|
|
|
const reDownload = ref();
|
|
|
|
|
|
|
|
const recoverRef = ref();
|
|
|
|
const recoverRef = ref();
|
|
|
|
|
|
|
|
|
|
|
|
interface DialogProps {
|
|
|
|
interface DialogProps {
|
|
|
@ -197,61 +171,42 @@ const emit = defineEmits(['search']);
|
|
|
|
|
|
|
|
|
|
|
|
const handleClose = () => {
|
|
|
|
const handleClose = () => {
|
|
|
|
drawerVisible.value = false;
|
|
|
|
drawerVisible.value = false;
|
|
|
|
dialogVisible.value = false;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const doRecover = async (isNew: boolean) => {
|
|
|
|
|
|
|
|
let params = {
|
|
|
|
|
|
|
|
id: snapInfo.value.id,
|
|
|
|
|
|
|
|
isNew: isNew,
|
|
|
|
|
|
|
|
reDownload: reDownload.value,
|
|
|
|
|
|
|
|
secret: snapInfo.value.secret,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
recoverRef.value.acceptParams(params);
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const recoverSnapshot = async (isNew: boolean) => {
|
|
|
|
const recoverSnapshot = async (isNew: boolean) => {
|
|
|
|
let msg = i18n.global.t('setting.recoverHelper', [snapInfo.value.name]);
|
|
|
|
loading.value = true;
|
|
|
|
if (
|
|
|
|
await loadOsInfo()
|
|
|
|
snapInfo.value.name.indexOf('amd64') === -1 &&
|
|
|
|
.then((res) => {
|
|
|
|
snapInfo.value.name.indexOf('arm64') === -1 &&
|
|
|
|
loading.value = false;
|
|
|
|
snapInfo.value.name.indexOf('armv7') === -1 &&
|
|
|
|
let params = {
|
|
|
|
snapInfo.value.name.indexOf('ppc64le') === -1 &&
|
|
|
|
id: snapInfo.value.id,
|
|
|
|
snapInfo.value.name.indexOf('s390x') === -1
|
|
|
|
isNew: isNew,
|
|
|
|
) {
|
|
|
|
name: snapInfo.value.name,
|
|
|
|
msg = i18n.global.t('setting.recoverHelper1', [snapInfo.value.name]);
|
|
|
|
reDownload: false,
|
|
|
|
} else {
|
|
|
|
secret: snapInfo.value.secret,
|
|
|
|
const res = await loadOsInfo();
|
|
|
|
|
|
|
|
let osVal = res.data.kernelArch;
|
|
|
|
|
|
|
|
if (osVal === '') {
|
|
|
|
|
|
|
|
msg = i18n.global.t('setting.recoverHelper1', [snapInfo.value.name]);
|
|
|
|
|
|
|
|
} else if (snapInfo.value.name.indexOf(osVal) === -1) {
|
|
|
|
|
|
|
|
MsgError(i18n.global.t('setting.recoverHelper2'));
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ElMessageBox.confirm(msg, i18n.global.t('commons.button.recover'), {
|
|
|
|
arch: res.data.kernelArch,
|
|
|
|
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
|
|
|
size: snapInfo.value.size,
|
|
|
|
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
|
|
|
freeSize: res.data.diskSize,
|
|
|
|
type: 'info',
|
|
|
|
};
|
|
|
|
}).then(async () => {
|
|
|
|
recoverRef.value.acceptParams(params);
|
|
|
|
doRecover(isNew);
|
|
|
|
})
|
|
|
|
});
|
|
|
|
.catch(() => {
|
|
|
|
|
|
|
|
loading.value = false;
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const rollbackSnapshot = async () => {
|
|
|
|
const rollbackSnapshot = async () => {
|
|
|
|
ElMessageBox.confirm(i18n.global.t('setting.rollbackHelper'), {
|
|
|
|
ElMessageBox.confirm(i18n.global.t('setting.rollbackHelper'), i18n.global.t('setting.rollback'), {
|
|
|
|
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
|
|
|
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
|
|
|
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
|
|
|
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
|
|
|
type: 'info',
|
|
|
|
type: 'info',
|
|
|
|
}).then(async () => {
|
|
|
|
}).then(async () => {
|
|
|
|
loading.value = true;
|
|
|
|
loading.value = true;
|
|
|
|
await snapshotRollback({ id: snapInfo.value.id, isNew: false, reDownload: false })
|
|
|
|
await snapshotRollback({ id: snapInfo.value.id, isNew: false, reDownload: false, secret: '' })
|
|
|
|
.then(() => {
|
|
|
|
.then(() => {
|
|
|
|
emit('search');
|
|
|
|
emit('search');
|
|
|
|
loading.value = false;
|
|
|
|
loading.value = false;
|
|
|
|
dialogVisible.value = false;
|
|
|
|
|
|
|
|
drawerVisible.value = false;
|
|
|
|
drawerVisible.value = false;
|
|
|
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
|
|
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -284,7 +239,4 @@ defineExpose({
|
|
|
|
line-height: 25px;
|
|
|
|
line-height: 25px;
|
|
|
|
color: var(--el-button-text-color, var(--el-text-color-regular));
|
|
|
|
color: var(--el-button-text-color, var(--el-text-color-regular));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.card-logo {
|
|
|
|
|
|
|
|
font-size: 7px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|