mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-26 19:06:55 +01:00
Compare commits
No commits in common. "d47ae5d5ccf46bfc4a794f0e7db7d0a421f72644" and "d508a8460d2a22fa58073a8cab102710c99cef17" have entirely different histories.
d47ae5d5cc
...
d508a8460d
@ -22,7 +22,7 @@
|
||||
"roboto-fontface": "*",
|
||||
"uuid": "^9.0.0",
|
||||
"vue": "^3.2.45",
|
||||
"vuetify": "3.1.3",
|
||||
"vuetify": "3.1.1",
|
||||
"webfontloader": "^1.6.28"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -27,7 +27,7 @@ specifiers:
|
||||
vite-plugin-vuetify: ^1.0.1
|
||||
vue: ^3.2.45
|
||||
vue-tsc: 1.0.7
|
||||
vuetify: 3.1.3
|
||||
vuetify: 3.1.1
|
||||
webfontloader: ^1.6.28
|
||||
|
||||
dependencies:
|
||||
@ -42,7 +42,7 @@ dependencies:
|
||||
roboto-fontface: 0.10.0
|
||||
uuid: 9.0.0
|
||||
vue: 3.2.45
|
||||
vuetify: 3.1.3_ihnv4ujwy6q3qcyepcitbzrajy
|
||||
vuetify: 3.1.1_ihnv4ujwy6q3qcyepcitbzrajy
|
||||
webfontloader: 1.6.28
|
||||
|
||||
devDependencies:
|
||||
@ -59,7 +59,7 @@ devDependencies:
|
||||
prettier: 2.8.2
|
||||
typescript: 4.7.4
|
||||
vite: 3.2.5_@types+node@16.18.11
|
||||
vite-plugin-vuetify: 1.0.1_bps52lyiebopdablgncd5xv5m4
|
||||
vite-plugin-vuetify: 1.0.1_mc6ujyzexjrcgjeph6am73m5wu
|
||||
vue-tsc: 1.0.7_typescript@4.7.4
|
||||
|
||||
packages:
|
||||
@ -497,7 +497,7 @@ packages:
|
||||
'@types/node': 16.18.11
|
||||
dev: true
|
||||
|
||||
/@vuetify/loader-shared/1.7.0_vue@3.2.45+vuetify@3.1.3:
|
||||
/@vuetify/loader-shared/1.7.0_vue@3.2.45+vuetify@3.1.1:
|
||||
resolution: {integrity: sha512-Db4K67wMhduDsbvdRBYkrYuomti+j0E/1vlz1lnDng5F9LYYBcXa60qypIazVGI6GX/CuY1vshN6XGtGQI4FKg==}
|
||||
peerDependencies:
|
||||
vue: ^3.0.0
|
||||
@ -506,7 +506,7 @@ packages:
|
||||
find-cache-dir: 3.3.2
|
||||
upath: 2.0.1
|
||||
vue: 3.2.45
|
||||
vuetify: 3.1.3_ihnv4ujwy6q3qcyepcitbzrajy
|
||||
vuetify: 3.1.1_ihnv4ujwy6q3qcyepcitbzrajy
|
||||
|
||||
/acorn-jsx/5.3.2_acorn@8.8.1:
|
||||
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
|
||||
@ -2260,18 +2260,18 @@ packages:
|
||||
spdx-expression-parse: 3.0.1
|
||||
dev: true
|
||||
|
||||
/vite-plugin-vuetify/1.0.1_bps52lyiebopdablgncd5xv5m4:
|
||||
/vite-plugin-vuetify/1.0.1_mc6ujyzexjrcgjeph6am73m5wu:
|
||||
resolution: {integrity: sha512-/xHsIDuHxq7f6fDqCBYxNascLhDi+X8dV3RzTwmo4mGPrSnGq9pHv8wJsXBIQIT3nY8s16V0lmd6sXMjm0F8wg==}
|
||||
engines: {node: '>=12'}
|
||||
peerDependencies:
|
||||
vite: ^2.7.0 || ^3.0.0 || ^4.0.0
|
||||
vuetify: ^3.0.0-beta.4
|
||||
dependencies:
|
||||
'@vuetify/loader-shared': 1.7.0_vue@3.2.45+vuetify@3.1.3
|
||||
'@vuetify/loader-shared': 1.7.0_vue@3.2.45+vuetify@3.1.1
|
||||
debug: 4.3.4
|
||||
upath: 2.0.1
|
||||
vite: 3.2.5_@types+node@16.18.11
|
||||
vuetify: 3.1.3_ihnv4ujwy6q3qcyepcitbzrajy
|
||||
vuetify: 3.1.1_ihnv4ujwy6q3qcyepcitbzrajy
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
- vue
|
||||
@ -2369,8 +2369,8 @@ packages:
|
||||
'@vue/server-renderer': 3.2.45_vue@3.2.45
|
||||
'@vue/shared': 3.2.45
|
||||
|
||||
/vuetify/3.1.3_ihnv4ujwy6q3qcyepcitbzrajy:
|
||||
resolution: {integrity: sha512-QE/yXvHKDnlK9sjjMoZy9cAovNabpI97xg9RD+mAEDgSUaZNCX/jy7Qn0bP1DjJNeAsR2oAlcO0C2WhrsYe9kw==}
|
||||
/vuetify/3.1.1_ihnv4ujwy6q3qcyepcitbzrajy:
|
||||
resolution: {integrity: sha512-BkfRQZ406xQORpgrcUjuPaT/woO96ef/+2zHCfL3an+CrUhjG/sIAptEybHruq3xwFM0uJibDFqGiridsXc99w==}
|
||||
engines: {node: ^12.20 || >=14.13}
|
||||
peerDependencies:
|
||||
vite-plugin-vuetify: ^1.0.0-alpha.12
|
||||
@ -2385,7 +2385,7 @@ packages:
|
||||
webpack-plugin-vuetify:
|
||||
optional: true
|
||||
dependencies:
|
||||
vite-plugin-vuetify: 1.0.1_bps52lyiebopdablgncd5xv5m4
|
||||
vite-plugin-vuetify: 1.0.1_mc6ujyzexjrcgjeph6am73m5wu
|
||||
vue: 3.2.45
|
||||
|
||||
/webfontloader/1.6.28:
|
||||
|
@ -3,8 +3,7 @@
|
||||
<navbar-component></navbar-component>
|
||||
<message-bar></message-bar>
|
||||
<webdav-settings-menu></webdav-settings-menu>
|
||||
<backup-config-menu></backup-config-menu>
|
||||
<alert-manager></alert-manager>
|
||||
<BackupConfigMenu></BackupConfigMenu>
|
||||
<v-main class="mx-12">
|
||||
<v-row>
|
||||
<v-col cols="6" offset="6">
|
||||
@ -16,12 +15,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import AlertManager from "./components/AlertManager.vue";
|
||||
import CloudList from "./components/cloud/CloudList.vue";
|
||||
import MessageBar from "./components/MessageBar.vue";
|
||||
import NavbarComponent from "./components/NavbarComponent.vue";
|
||||
import BackupConfigMenu from "./components/settings/BackupConfigMenu.vue";
|
||||
import MessageBar from "./components/MessageBar.vue";
|
||||
import WebdavSettingsMenu from "./components/settings/WebdavConfigMenu.vue";
|
||||
import CloudList from "./components/cloud/CloudList.vue";
|
||||
import BackupConfigMenu from "./components/settings/BackupConfigMenu.vue";
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
@ -1,56 +0,0 @@
|
||||
<template>
|
||||
<v-fade-transition>
|
||||
<div id="alertContainer" v-if="alertVisible">
|
||||
<v-slide-x-transition group tag="div">
|
||||
<v-alert
|
||||
v-for="alert of alertList"
|
||||
v-bind:key="alert.id"
|
||||
elevation="24"
|
||||
:type="alert.type"
|
||||
border="start"
|
||||
class="mb-2"
|
||||
>
|
||||
<v-row dense>
|
||||
<v-col>
|
||||
{{ alert.message }}
|
||||
</v-col>
|
||||
<v-col cols="2">
|
||||
<v-btn
|
||||
class="d-inline"
|
||||
size="30"
|
||||
variant="text"
|
||||
rounded
|
||||
icon="$close"
|
||||
@click="alertStore.remove(alert.id)"
|
||||
></v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-progress-linear
|
||||
:max="alertStore.timeOutValue"
|
||||
:model-value="alert.timeOut"
|
||||
></v-progress-linear>
|
||||
</v-alert>
|
||||
</v-slide-x-transition>
|
||||
</div>
|
||||
</v-fade-transition>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { useAlertStore } from "@/stores/alert";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { computed } from "vue";
|
||||
|
||||
const alertStore = useAlertStore();
|
||||
|
||||
const { alertList } = storeToRefs(alertStore);
|
||||
|
||||
const alertVisible = computed(() => alertList.value.length > 0);
|
||||
</script>
|
||||
<style>
|
||||
#alertContainer {
|
||||
position: absolute;
|
||||
top: 70px;
|
||||
right: 20px;
|
||||
z-index: 99999;
|
||||
}
|
||||
</style>
|
@ -32,21 +32,17 @@ import { watch } from "vue";
|
||||
defineProps<{ loading: boolean }>();
|
||||
const backupConfigStore = useBackupConfigStore();
|
||||
const { data, addons, invertedAddons } = storeToRefs(backupConfigStore);
|
||||
watch(invertedAddons, manageInverted);
|
||||
|
||||
manageInverted();
|
||||
|
||||
function manageInverted() {
|
||||
watch(invertedAddons, () => {
|
||||
if (!data.value.exclude) {
|
||||
backupConfigStore.initExcludes();
|
||||
data.value.exclude = { addon: [], folder: [] };
|
||||
}
|
||||
data.value.exclude!.addon = [];
|
||||
data.value.exclude.addon = [];
|
||||
for (const addon of addons.value) {
|
||||
if (!invertedAddons.value.includes(addon.slug)) {
|
||||
data.value.exclude!.addon.push(addon.slug);
|
||||
data.value.exclude.addon.push(addon.slug);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
@ -33,21 +33,14 @@ defineProps<{ loading: boolean }>();
|
||||
const backupConfigStore = useBackupConfigStore();
|
||||
|
||||
const { data, folders, invertedFolders } = storeToRefs(backupConfigStore);
|
||||
watch(invertedFolders, manageInverted);
|
||||
|
||||
manageInverted();
|
||||
|
||||
function manageInverted() {
|
||||
if (!data.value.exclude) {
|
||||
backupConfigStore.initExcludes();
|
||||
}
|
||||
data.value.exclude!.folder = [];
|
||||
watch(invertedFolders, () => {
|
||||
data.value.exclude.folder = [];
|
||||
for (const folder of folders.value) {
|
||||
if (!invertedFolders.value.includes(folder.slug)) {
|
||||
data.value.exclude!.folder.push(folder.slug);
|
||||
data.value.exclude.folder.push(folder.slug);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
@ -12,7 +12,7 @@
|
||||
<v-card-text>
|
||||
<backup-config-form
|
||||
ref="form"
|
||||
@fail="fail"
|
||||
@fail="saving = false"
|
||||
@success="saved"
|
||||
@loaded="loading = false"
|
||||
@loading="loading = true"
|
||||
@ -39,9 +39,6 @@ import { useDialogStatusStore } from "@/stores/dialogStatus";
|
||||
import { computed, ref } from "vue";
|
||||
import { useMenuSize } from "@/composable/menuSize";
|
||||
import BackupConfigForm from "./BackupConfigForm.vue";
|
||||
import { useAlertStore } from "@/stores/alert";
|
||||
|
||||
const alertStore = useAlertStore();
|
||||
|
||||
const dialogStatusStore = useDialogStatusStore();
|
||||
const form = ref<InstanceType<typeof BackupConfigForm> | null>(null);
|
||||
@ -58,14 +55,8 @@ function save() {
|
||||
form.value?.save();
|
||||
}
|
||||
|
||||
function fail() {
|
||||
saving.value = false;
|
||||
alertStore.add("error", "Fail to save backup settings !");
|
||||
}
|
||||
|
||||
function saved() {
|
||||
dialogStatusStore.backup = false;
|
||||
dialogStatusStore.webdav = false;
|
||||
saving.value = false;
|
||||
alertStore.add("success", "Backup settings saved !");
|
||||
}
|
||||
</script>
|
||||
|
@ -12,7 +12,7 @@
|
||||
<v-card-text>
|
||||
<webdav-settings-form
|
||||
ref="form"
|
||||
@fail="fail"
|
||||
@fail="saving = false"
|
||||
@success="saved"
|
||||
@loaded="loading = false"
|
||||
@loading="loading = true"
|
||||
@ -36,13 +36,10 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useMenuSize } from "@/composable/menuSize";
|
||||
import { useAlertStore } from "@/stores/alert";
|
||||
import { useDialogStatusStore } from "@/stores/dialogStatus";
|
||||
import { computed, ref } from "vue";
|
||||
import WebdavSettingsForm from "./WebdavConfigForm.vue";
|
||||
|
||||
const alertStore = useAlertStore();
|
||||
|
||||
const dialogStatusStore = useDialogStatusStore();
|
||||
const form = ref<InstanceType<typeof WebdavSettingsForm> | null>(null);
|
||||
const { width, isFullScreen } = useMenuSize();
|
||||
@ -58,14 +55,8 @@ function save() {
|
||||
form.value?.save();
|
||||
}
|
||||
|
||||
function fail() {
|
||||
saving.value = false;
|
||||
alertStore.add("error", "Fail to save cloud settings !");
|
||||
}
|
||||
|
||||
function saved() {
|
||||
dialogStatusStore.webdav = false;
|
||||
saving.value = false;
|
||||
alertStore.add("success", "Cloud settings saved !");
|
||||
}
|
||||
</script>
|
||||
|
@ -1,42 +0,0 @@
|
||||
import type { Alert } from "@/types/alert";
|
||||
import { defineStore } from "pinia";
|
||||
import { ref, type Ref } from "vue";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
export const useAlertStore = defineStore("alert", () => {
|
||||
const alertList = ref([]) as Ref<Alert[]>;
|
||||
const timeOutValue = ref(100);
|
||||
|
||||
function add(
|
||||
type: "error" | "success" | "warning" | "info",
|
||||
message: string
|
||||
) {
|
||||
const alert: Alert = {
|
||||
id: uuidv4(),
|
||||
timeOut: ref(timeOutValue.value),
|
||||
interval: setInterval(() => {
|
||||
timeout(alert);
|
||||
}, 50),
|
||||
type: type,
|
||||
message: message,
|
||||
};
|
||||
alertList.value.push(alert);
|
||||
}
|
||||
|
||||
function timeout(alert: Alert) {
|
||||
if (alert.timeOut.value <= 0) {
|
||||
remove(alert.id!);
|
||||
} else {
|
||||
alert.timeOut.value--;
|
||||
}
|
||||
}
|
||||
|
||||
function remove(id: string) {
|
||||
const alertToRemove = alertList.value.find((value) => value.id == id);
|
||||
if (alertToRemove) {
|
||||
clearInterval(alertToRemove.interval);
|
||||
}
|
||||
alertList.value = alertList.value.filter((value) => value.id != id);
|
||||
}
|
||||
return { alertList, timeOutValue, add, remove };
|
||||
});
|
@ -1,6 +1,6 @@
|
||||
import { getBackupConfig } from "@/services/configService";
|
||||
import { getAddons, getFolders } from "@/services/homeAssistantService";
|
||||
import { BackupType, CronMode, type BackupConfig } from "@/types/backupConfig";
|
||||
import { CronMode, type BackupConfig } from "@/types/backupConfig";
|
||||
import type { Folder, AddonModel } from "@/types/homeAssistant";
|
||||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
@ -20,7 +20,6 @@ export const useBackupConfigStore = defineStore("backupConfig", () => {
|
||||
const foldersProm = getFolders();
|
||||
const addonsProm = getAddons();
|
||||
return Promise.all([conf, foldersProm, addonsProm]).then((value) => {
|
||||
if (value[0].backupType == BackupType.Partial && value[0].exclude) {
|
||||
for (const folder of value[1]) {
|
||||
if (!value[0].exclude.folder.includes(folder.slug)) {
|
||||
invertedFolders.value.push(folder.slug);
|
||||
@ -31,8 +30,6 @@ export const useBackupConfigStore = defineStore("backupConfig", () => {
|
||||
invertedAddons.value.push(addon.slug);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.value = value[0];
|
||||
folders.value = value[1];
|
||||
addons.value = value[2].addons;
|
||||
@ -46,16 +43,6 @@ export const useBackupConfigStore = defineStore("backupConfig", () => {
|
||||
});
|
||||
}
|
||||
|
||||
function initExcludes() {
|
||||
data.value.exclude = { addon: [], folder: [] };
|
||||
addons.value.forEach((value) => {
|
||||
invertedAddons.value.push(value.slug);
|
||||
});
|
||||
folders.value.forEach((value) => {
|
||||
invertedFolders.value.push(value.slug);
|
||||
});
|
||||
}
|
||||
|
||||
function removeCron(id: string) {
|
||||
data.value.cron = data.value.cron.filter((value) => value.id != id);
|
||||
}
|
||||
@ -69,6 +56,5 @@ export const useBackupConfigStore = defineStore("backupConfig", () => {
|
||||
loadAll,
|
||||
addEmptyCron,
|
||||
removeCron,
|
||||
initExcludes,
|
||||
};
|
||||
});
|
||||
|
@ -1,9 +0,0 @@
|
||||
import type { Ref } from "vue";
|
||||
|
||||
export interface Alert {
|
||||
id: string;
|
||||
type: "error" | "success" | "warning" | "info";
|
||||
message: string;
|
||||
timeOut: Ref<number>;
|
||||
interval: number;
|
||||
}
|
Loading…
Reference in New Issue
Block a user