mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-04 16:42:58 +01:00
[Front] Remove auto refresh and add refresh button
This commit is contained in:
parent
16c76b80e1
commit
1b9d9d7aad
@ -1,7 +1,20 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-card elevation="10" class="mt-10" border>
|
||||
<v-card elevation="10" border>
|
||||
<v-row align="center" justify="center">
|
||||
<v-col offset="2">
|
||||
<v-card-title class="text-center"> Cloud </v-card-title>
|
||||
</v-col>
|
||||
<v-col cols="2">
|
||||
<v-btn
|
||||
class="float-right mr-2"
|
||||
icon="mdi-refresh"
|
||||
variant="text"
|
||||
@click="refreshBackup"
|
||||
:loading="loading"
|
||||
></v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider></v-divider>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
@ -81,12 +94,22 @@ const deleteDialog = ref<InstanceType<typeof CloudDeleteDialog> | null>(null);
|
||||
const deleteItem = ref<WebdavBackup | null>(null);
|
||||
const autoBackups = ref<WebdavBackup[]>([]);
|
||||
const manualBackups = ref<WebdavBackup[]>([]);
|
||||
|
||||
const loading = ref<boolean>(true);
|
||||
|
||||
function refreshBackup() {
|
||||
getAutoBackupList().then((value) => {
|
||||
loading.value = true;
|
||||
getAutoBackupList()
|
||||
.then((value) => {
|
||||
autoBackups.value = value;
|
||||
});
|
||||
getManualBackupList().then((value) => {
|
||||
return getManualBackupList();
|
||||
})
|
||||
.then((value) => {
|
||||
manualBackups.value = value;
|
||||
loading.value = false;
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
@ -95,10 +118,5 @@ function deleteBackup(item: WebdavBackup) {
|
||||
deleteDialog.value?.open(item);
|
||||
}
|
||||
refreshBackup();
|
||||
|
||||
const interval = setInterval(refreshBackup, 2000);
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
clearInterval(interval);
|
||||
});
|
||||
defineExpose({ refreshBackup });
|
||||
</script>
|
||||
|
@ -1,7 +1,20 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-card elevation="10" class="mt-10" border>
|
||||
<v-card elevation="10" border>
|
||||
<v-row align="center" justify="center">
|
||||
<v-col offset="2">
|
||||
<v-card-title class="text-center"> Home Assistant </v-card-title>
|
||||
</v-col>
|
||||
<v-col cols="2">
|
||||
<v-btn
|
||||
class="float-right mr-2"
|
||||
icon="mdi-refresh"
|
||||
variant="text"
|
||||
@click="refreshBackup"
|
||||
:loading="loading"
|
||||
></v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider></v-divider>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
@ -43,19 +56,17 @@ import { getBackups } from "@/services/homeAssistantService";
|
||||
import HaListItem from "./HaListItem.vue";
|
||||
|
||||
const backups = ref<BackupModel[]>([]);
|
||||
const loading = ref<boolean>(true);
|
||||
|
||||
function refreshBackup() {
|
||||
loading.value = true;
|
||||
getBackups().then((value) => {
|
||||
backups.value = value;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
refreshBackup();
|
||||
const interval = setInterval(refreshBackup, 2000);
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
clearInterval(interval);
|
||||
});
|
||||
|
||||
// TODO Manage delete
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user