Merge branch 'dev-log' into develop

This commit is contained in:
Net 2024-07-25 17:16:51 +07:00
commit a1a5e613c9
3 changed files with 25 additions and 7 deletions

View file

@ -214,9 +214,9 @@ function onRestore(name: string) {
? col.value
: col.value === "สำเร็จ"
? "สำเร็จ"
: i === 2 || i === 3
? getSize(col.value)
: ""
: // : i === 2 || i === 3
// ? getSize(col.value)
""
}}
<q-circular-progress
@ -231,6 +231,7 @@ function onRestore(name: string) {
</q-td>
<q-td>
<q-btn
v-if="props.row.status !== 'running'"
dense
flat
round
@ -243,6 +244,7 @@ function onRestore(name: string) {
</q-btn>
<q-btn
v-if="props.row.status !== 'running'"
dense
flat
round

View file

@ -76,7 +76,12 @@ export const useDataStore = defineStore("systemStore", () => {
data: { name: filename },
})
.then(async (res) => {
await fetchListBackup();
if (res.status < 400) {
dataBackUp.value = dataBackUp.value.filter((item) => {
if (item.name !== filename) return true;
return false;
});
}
})
.finally(() => {
hideLoader();
@ -109,8 +114,8 @@ export const useDataStore = defineStore("systemStore", () => {
.then(async (res) => {
backupRunTotal.value = res.data.length;
if (backupRunTotal.value === 0 && prevBackupRunTotal.value !== 0) {
cb();
if (backupRunTotal.value === 0) {
if (prevBackupRunTotal.value !== -1) cb();
prevBackupRunTotal.value = backupRunTotal.value;
return;
}
@ -147,7 +152,7 @@ export const useDataStore = defineStore("systemStore", () => {
.get<BackUpRunning[]>(config.API.backup + "/restore-running-list")
.then(async (res) => {
restoreRunTotal.value = res.data.length;
if (restoreRunTotal.value === 0 && prevRestoreRunTotal.value !== 0) {
if (restoreRunTotal.value === 0) {
cb();
prevRestoreRunTotal.value = restoreRunTotal.value;
return;
@ -324,9 +329,13 @@ export const useDataStore = defineStore("systemStore", () => {
return {
dataBackUp,
backupRunTotal,
restoreRunTotal,
prevBackupRunTotal,
prevRestoreRunTotal,
dataSchedule,
fetchListBackup,

View file

@ -13,12 +13,17 @@ import Card from "@/modules/04_system/components/cardBackupRestore.vue";
import CardAutoBackup from "@/modules/04_system/components/cardAutoBackup.vue";
import { useDataStore } from "@/modules/04_system/stores/main";
import { storeToRefs } from "pinia";
const { fetchListBackup, backupRunningList, restoreRunningList } =
useDataStore();
/**
* วแปร
*/
const storeData = useDataStore();
const { prevBackupRunTotal, prevRestoreRunTotal } = storeToRefs(storeData);
const tab = ref<string>("backup");
const tabItems = ref<ItemsTeb[]>([
{ name: "backup", label: "Backup & Restore", icon: "mdi-database" },
@ -26,6 +31,8 @@ const tabItems = ref<ItemsTeb[]>([
]);
onMounted(async () => {
prevBackupRunTotal.value = -1;
prevRestoreRunTotal.value = -1;
await fetchListBackup();
await backupRunningList(fetchListBackup);
await restoreRunningList(() => {});