mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 16:29:17 +08:00
fix: 统一删除提示框 (#2711)
This commit is contained in:
parent
32c6826496
commit
5e27aa04dd
@ -327,8 +327,8 @@ func (u *SettingService) SystemCleanForCronjob() (string, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
timeNow := time.Now().Format("2006-01-02 15:04:05")
|
timeNow := time.Now().Format("2006-01-02 15:04:05")
|
||||||
logs += fmt.Sprintf("%s: total clean: %s, total count: %d", timeNow, common.LoadSizeUnit2F(float64(size)), fileCount)
|
|
||||||
dropFileOrDirWithLog(path.Join(global.CONF.System.BaseDir, dockerLogPath), &logs, &size, &fileCount)
|
dropFileOrDirWithLog(path.Join(global.CONF.System.BaseDir, dockerLogPath), &logs, &size, &fileCount)
|
||||||
|
logs += fmt.Sprintf("\n%s: total clean: %s, total count: %d", timeNow, common.LoadSizeUnit2F(float64(size)), fileCount)
|
||||||
|
|
||||||
_ = settingRepo.Update("LastCleanTime", timeNow)
|
_ = settingRepo.Update("LastCleanTime", timeNow)
|
||||||
_ = settingRepo.Update("LastCleanSize", fmt.Sprintf("%v", size))
|
_ = settingRepo.Update("LastCleanSize", fmt.Sprintf("%v", size))
|
||||||
|
@ -44,13 +44,15 @@
|
|||||||
<fu-table-operations width="230px" :buttons="buttons" :label="$t('commons.table.operate')" fix />
|
<fu-table-operations width="230px" :buttons="buttons" :label="$t('commons.table.operate')" fix />
|
||||||
</ComplexTable>
|
</ComplexTable>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import { dateFormat, downloadFile } from '@/utils/util';
|
import { dateFormat, downloadFile } from '@/utils/util';
|
||||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
|
||||||
import { handleBackup, handleRecover } from '@/api/modules/setting';
|
import { handleBackup, handleRecover } from '@/api/modules/setting';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||||
@ -60,6 +62,7 @@ import { MsgSuccess } from '@/utils/message';
|
|||||||
|
|
||||||
const selects = ref<any>([]);
|
const selects = ref<any>([]);
|
||||||
const loading = ref();
|
const loading = ref();
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
const data = ref();
|
const data = ref();
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
@ -153,15 +156,26 @@ const onDownload = async (row: Backup.RecordInfo) => {
|
|||||||
|
|
||||||
const onBatchDelete = async (row: Backup.RecordInfo | null) => {
|
const onBatchDelete = async (row: Backup.RecordInfo | null) => {
|
||||||
let ids: Array<number> = [];
|
let ids: Array<number> = [];
|
||||||
|
let names = [];
|
||||||
if (row) {
|
if (row) {
|
||||||
ids.push(row.id);
|
ids.push(row.id);
|
||||||
|
names.push(row.fileName);
|
||||||
} else {
|
} else {
|
||||||
selects.value.forEach((item: Backup.RecordInfo) => {
|
selects.value.forEach((item: Backup.RecordInfo) => {
|
||||||
ids.push(item.id);
|
ids.push(item.id);
|
||||||
|
names.push(item.fileName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await useDeleteData(deleteBackupRecord, { ids: ids }, 'commons.msg.delete');
|
opRef.value.acceptParams({
|
||||||
search();
|
names: names,
|
||||||
|
title: i18n.global.t('commons.button.delete'),
|
||||||
|
api: deleteBackupRecord,
|
||||||
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
|
i18n.global.t('commons.button.backup'),
|
||||||
|
i18n.global.t('commons.button.delete'),
|
||||||
|
]),
|
||||||
|
params: { ids: ids },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
|
@ -78,13 +78,15 @@
|
|||||||
</ComplexTable>
|
</ComplexTable>
|
||||||
</div>
|
</div>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { computeSize } from '@/utils/util';
|
import { computeSize } from '@/utils/util';
|
||||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import { handleRecoverByUpload } from '@/api/modules/setting';
|
import { handleRecoverByUpload } from '@/api/modules/setting';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { UploadFile, UploadFiles, UploadInstance } from 'element-plus';
|
import { UploadFile, UploadFiles, UploadInstance } from 'element-plus';
|
||||||
@ -99,6 +101,7 @@ const isUpload = ref();
|
|||||||
const uploadPercent = ref<number>(0);
|
const uploadPercent = ref<number>(0);
|
||||||
const selects = ref<any>([]);
|
const selects = ref<any>([]);
|
||||||
const baseDir = ref();
|
const baseDir = ref();
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
const data = ref();
|
const data = ref();
|
||||||
const title = ref();
|
const title = ref();
|
||||||
@ -279,15 +282,26 @@ const submitUpload = async (file: any) => {
|
|||||||
|
|
||||||
const onBatchDelete = async (row: File.File | null) => {
|
const onBatchDelete = async (row: File.File | null) => {
|
||||||
let files: Array<string> = [];
|
let files: Array<string> = [];
|
||||||
|
let names: Array<string> = [];
|
||||||
if (row) {
|
if (row) {
|
||||||
files.push(baseDir.value + row.name);
|
files.push(baseDir.value + row.name);
|
||||||
|
names.push(row.name);
|
||||||
} else {
|
} else {
|
||||||
selects.value.forEach((item: File.File) => {
|
selects.value.forEach((item: File.File) => {
|
||||||
files.push(baseDir.value + item.name);
|
files.push(baseDir.value + item.name);
|
||||||
|
names.push(item.name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await useDeleteData(BatchDeleteFile, { paths: files, isDir: false }, 'commons.msg.delete');
|
opRef.value.acceptParams({
|
||||||
search();
|
title: i18n.global.t('commons.button.delete'),
|
||||||
|
names: names,
|
||||||
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
|
i18n.global.t('commons.button.import'),
|
||||||
|
i18n.global.t('commons.button.delete'),
|
||||||
|
]),
|
||||||
|
api: BatchDeleteFile,
|
||||||
|
params: { paths: files, isDir: false },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
|
@ -107,11 +107,13 @@
|
|||||||
</ComplexTable>
|
</ComplexTable>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
<ConfirmDialog ref="confirmDialogRef" @confirm="onRecover"></ConfirmDialog>
|
<ConfirmDialog ref="confirmDialogRef" @confirm="onRecover"></ConfirmDialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import ConfirmDialog from '@/components/confirm-dialog/index.vue';
|
import ConfirmDialog from '@/components/confirm-dialog/index.vue';
|
||||||
import { Database } from '@/api/interface/database';
|
import { Database } from '@/api/interface/database';
|
||||||
import { redisPersistenceConf, updateRedisPersistenceConf } from '@/api/modules/database';
|
import { redisPersistenceConf, updateRedisPersistenceConf } from '@/api/modules/database';
|
||||||
@ -121,7 +123,6 @@ import { dateFormat } from '@/utils/util';
|
|||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { FormInstance } from 'element-plus';
|
import { FormInstance } from 'element-plus';
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
|
||||||
import { MsgInfo, MsgSuccess } from '@/utils/message';
|
import { MsgInfo, MsgSuccess } from '@/utils/message';
|
||||||
import { Backup } from '@/api/interface/backup';
|
import { Backup } from '@/api/interface/backup';
|
||||||
|
|
||||||
@ -139,6 +140,7 @@ const rules = reactive({
|
|||||||
appendfsync: [Rules.requiredSelect],
|
appendfsync: [Rules.requiredSelect],
|
||||||
});
|
});
|
||||||
const formRef = ref<FormInstance>();
|
const formRef = ref<FormInstance>();
|
||||||
|
const opRef = ref();
|
||||||
|
|
||||||
interface DialogProps {
|
interface DialogProps {
|
||||||
status: string;
|
status: string;
|
||||||
@ -220,15 +222,26 @@ const onRecover = async () => {
|
|||||||
|
|
||||||
const onBatchDelete = async (row: Backup.RecordInfo | null) => {
|
const onBatchDelete = async (row: Backup.RecordInfo | null) => {
|
||||||
let ids: Array<number> = [];
|
let ids: Array<number> = [];
|
||||||
|
let names: Array<string> = [];
|
||||||
if (row) {
|
if (row) {
|
||||||
ids.push(row.id);
|
ids.push(row.id);
|
||||||
|
names.push(row.fileName);
|
||||||
} else {
|
} else {
|
||||||
selects.value.forEach((item: Backup.RecordInfo) => {
|
selects.value.forEach((item: Backup.RecordInfo) => {
|
||||||
ids.push(item.id);
|
ids.push(item.id);
|
||||||
|
names.push(item.fileName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await useDeleteData(deleteBackupRecord, { ids: ids }, 'commons.msg.delete');
|
opRef.value.acceptParams({
|
||||||
search();
|
title: i18n.global.t('commons.button.delete'),
|
||||||
|
names: names,
|
||||||
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
|
i18n.global.t('commons.button.backup'),
|
||||||
|
i18n.global.t('commons.button.delete'),
|
||||||
|
]),
|
||||||
|
api: deleteBackupRecord,
|
||||||
|
params: { ids: ids },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
|
@ -368,19 +368,23 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
</LayoutContent>
|
</LayoutContent>
|
||||||
|
|
||||||
|
<OpDialog ref="opRef" @search="search" />
|
||||||
<DialogOperate ref="dialogRef" @search="search" />
|
<DialogOperate ref="dialogRef" @search="search" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { dateFormat } from '@/utils/util';
|
import { dateFormat } from '@/utils/util';
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
|
import OpDialog from '@/components/del-dialog/index.vue';
|
||||||
import { getBackupList, deleteBackup } from '@/api/modules/setting';
|
import { getBackupList, deleteBackup } from '@/api/modules/setting';
|
||||||
import DialogOperate from '@/views/setting/backup-account/operate/index.vue';
|
import DialogOperate from '@/views/setting/backup-account/operate/index.vue';
|
||||||
import { Backup } from '@/api/interface/backup';
|
import { Backup } from '@/api/interface/backup';
|
||||||
import { ElForm } from 'element-plus';
|
import { ElForm } from 'element-plus';
|
||||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
import i18n from '@/lang';
|
||||||
|
|
||||||
const data = ref();
|
const data = ref();
|
||||||
|
const opRef = ref();
|
||||||
const reflash = ref(false);
|
const reflash = ref(false);
|
||||||
const localData = ref<Backup.BackupInfo>({
|
const localData = ref<Backup.BackupInfo>({
|
||||||
id: 0,
|
id: 0,
|
||||||
@ -531,8 +535,16 @@ const search = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onDelete = async (row: Backup.BackupInfo) => {
|
const onDelete = async (row: Backup.BackupInfo) => {
|
||||||
await useDeleteData(deleteBackup, { id: row.id }, 'commons.msg.delete');
|
opRef.value.acceptParams({
|
||||||
search();
|
title: i18n.global.t('commons.button.delete'),
|
||||||
|
names: [row.type],
|
||||||
|
msg: i18n.global.t('commons.msg.operatorHelper', [
|
||||||
|
i18n.global.t('setting.backupAccount'),
|
||||||
|
i18n.global.t('commons.button.delete'),
|
||||||
|
]),
|
||||||
|
api: deleteBackup,
|
||||||
|
params: { id: row.id },
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const dialogRef = ref();
|
const dialogRef = ref();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user