[Front] Refresh cloud list on setting change

This commit is contained in:
SebClem 2024-04-18 10:50:03 +02:00
parent 073cf968a5
commit 363768f4ba
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50
2 changed files with 15 additions and 5 deletions

View File

@ -2,7 +2,7 @@
<v-app> <v-app>
<navbar-component></navbar-component> <navbar-component></navbar-component>
<message-bar></message-bar> <message-bar></message-bar>
<webdav-settings-menu></webdav-settings-menu> <webdav-config-menu @saved="cloudList?.refreshBackup"></webdav-config-menu>
<backup-config-menu></backup-config-menu> <backup-config-menu></backup-config-menu>
<alert-manager></alert-manager> <alert-manager></alert-manager>
<v-main class="mx-12"> <v-main class="mx-12">
@ -11,7 +11,7 @@
<ha-list></ha-list> <ha-list></ha-list>
</v-col> </v-col>
<v-col cols="6"> <v-col cols="6">
<cloud-list></cloud-list> <cloud-list ref="cloudList"></cloud-list>
</v-col> </v-col>
</v-row> </v-row>
</v-main> </v-main>
@ -19,13 +19,16 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue";
import AlertManager from "./components/AlertManager.vue"; import AlertManager from "./components/AlertManager.vue";
import CloudList from "./components/cloud/CloudList.vue"; import CloudList from "./components/cloud/CloudList.vue";
import HaList from "./components/homeAssistant/HaList.vue"; import HaList from "./components/homeAssistant/HaList.vue";
import MessageBar from "./components/MessageBar.vue"; import MessageBar from "./components/MessageBar.vue";
import NavbarComponent from "./components/NavbarComponent.vue"; import NavbarComponent from "./components/NavbarComponent.vue";
import BackupConfigMenu from "./components/settings/BackupConfigMenu.vue"; import BackupConfigMenu from "./components/settings/BackupConfigMenu.vue";
import WebdavSettingsMenu from "./components/settings/WebdavConfigMenu.vue"; import WebdavConfigMenu from "./components/settings/WebdavConfigMenu.vue";
import StatusComponent from "./components/StatusComponent.vue";
const cloudList = ref<InstanceType<typeof CloudList> | null>(null);
</script> </script>
<style scoped></style> <style scoped></style>

View File

@ -53,6 +53,10 @@ let saveLoading = computed(() => {
return saving.value || loading.value; return saving.value || loading.value;
}); });
const emit = defineEmits<{
(e: "saved"): void;
}>();
function save() { function save() {
saving.value = true; saving.value = true;
form.value?.save(); form.value?.save();
@ -60,13 +64,16 @@ function save() {
function fail() { function fail() {
saving.value = false; saving.value = false;
alertStore.add("error", "Fail to save cloud settings !"); alertStore.add(
"error",
"Fail to connect to Cloud<br>Please check credentials !"
);
} }
function saved() { function saved() {
dialogStatusStore.webdav = false; dialogStatusStore.webdav = false;
saving.value = false; saving.value = false;
alertStore.add("success", "Cloud settings saved !"); alertStore.add("success", "Cloud settings saved !");
emit("saved");
} }
</script> </script>
@/store/alert@/store/dialogStatus