hassio-nextcloud-backup/nextcloud_backup/frontend/src/components/settings/WebdavConfigMenu.vue

72 lines
1.8 KiB
Vue
Raw Normal View History

2022-10-24 22:58:19 +02:00
<template>
<v-dialog
v-model="dialogStatusStore.webdav"
persistent
:width="width"
2023-01-13 16:18:27 +01:00
:fullscreen="isFullScreen"
2022-10-24 22:58:19 +02:00
scrollable
>
<v-card>
<v-card-title class="text-center">Cloud Settings</v-card-title>
<v-divider></v-divider>
<v-card-text>
<webdav-settings-form
ref="form"
2023-02-05 18:58:58 +01:00
@fail="fail"
2023-01-13 16:18:27 +01:00
@success="saved"
2022-10-24 22:58:19 +02:00
@loaded="loading = false"
@loading="loading = true"
2022-10-24 22:58:19 +02:00
></webdav-settings-form>
</v-card-text>
<v-divider></v-divider>
<v-card-actions class="justify-end">
<v-btn
color="red"
@click="dialogStatusStore.webdav = false"
:disabled="saving"
>Cancel</v-btn
>
<v-btn color="success" @click="save()" :loading="saveLoading"
>Save</v-btn
>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script setup lang="ts">
2023-01-13 16:18:27 +01:00
import { useMenuSize } from "@/composable/menuSize";
2023-02-05 18:58:58 +01:00
import { useAlertStore } from "@/stores/alert";
2022-10-24 22:58:19 +02:00
import { useDialogStatusStore } from "@/stores/dialogStatus";
import { computed, ref } from "vue";
import WebdavSettingsForm from "./WebdavConfigForm.vue";
2023-02-05 18:58:58 +01:00
const alertStore = useAlertStore();
2022-10-24 22:58:19 +02:00
const dialogStatusStore = useDialogStatusStore();
const form = ref<InstanceType<typeof WebdavSettingsForm> | null>(null);
2023-01-13 16:18:27 +01:00
const { width, isFullScreen } = useMenuSize();
2022-10-24 22:58:19 +02:00
const loading = ref(true);
const saving = ref(false);
let saveLoading = computed(() => {
return saving.value || loading.value;
});
function save() {
saving.value = true;
form.value?.save();
}
2023-01-13 16:18:27 +01:00
2023-02-05 18:58:58 +01:00
function fail() {
saving.value = false;
alertStore.add("error", "Fail to save cloud settings !");
}
2023-01-13 16:18:27 +01:00
function saved() {
dialogStatusStore.webdav = false;
saving.value = false;
2023-02-05 18:58:58 +01:00
alertStore.add("success", "Cloud settings saved !");
2023-01-13 16:18:27 +01:00
}
2022-10-24 22:58:19 +02:00
</script>