แก้ restore ส่ง name
This commit is contained in:
parent
9e44592a1e
commit
fc1f30b6b4
1 changed files with 18 additions and 1 deletions
|
|
@ -79,7 +79,7 @@ export const useDataStore = defineStore("systemStore", () => {
|
|||
async function restore(filename: string) {
|
||||
await http
|
||||
.post<string>(config.API.restore, {
|
||||
filename: filename,
|
||||
name: filename,
|
||||
})
|
||||
.then(async (res) => {
|
||||
const tempValue = dataBackUp.value.find((item) => {
|
||||
|
|
@ -122,6 +122,8 @@ export const useDataStore = defineStore("systemStore", () => {
|
|||
dataBackUp.value.unshift({
|
||||
id: item.created_at.toString(),
|
||||
name: "-",
|
||||
databaseSize: 0,
|
||||
storageSize: 0,
|
||||
timestamp: item.created_at,
|
||||
status: item.running ? "running" : "success",
|
||||
});
|
||||
|
|
@ -163,6 +165,19 @@ export const useDataStore = defineStore("systemStore", () => {
|
|||
});
|
||||
}
|
||||
|
||||
function getSize(size: number): string {
|
||||
if (size === undefined) return "Unknow size";
|
||||
|
||||
const units = ["B", "KB", "MB", "GB", "TB"];
|
||||
|
||||
let i = 0;
|
||||
let sizeNumber = typeof size === "string" ? parseFloat(size) : size;
|
||||
while (sizeNumber >= 1024 && i++ < units.length - 1) {
|
||||
sizeNumber /= 1024;
|
||||
}
|
||||
return sizeNumber.toFixed(2) + " " + units[i];
|
||||
}
|
||||
|
||||
return {
|
||||
dataBackUp,
|
||||
backupRunTotal,
|
||||
|
|
@ -175,5 +190,7 @@ export const useDataStore = defineStore("systemStore", () => {
|
|||
|
||||
backupRunningList,
|
||||
restoreRunningList,
|
||||
|
||||
getSize,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue