From 7bbec29c5bfd24ef3f0823e832e4637c318a7d38 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Wed, 28 Jun 2023 21:44:01 +0800 Subject: [PATCH] show whether data is updated after click refresh button --- .../settings/UserDataManagementSettingTab.vue | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/views/desktop/user/settings/UserDataManagementSettingTab.vue b/src/views/desktop/user/settings/UserDataManagementSettingTab.vue index 4fe9ac95..74c147a9 100644 --- a/src/views/desktop/user/settings/UserDataManagementSettingTab.vue +++ b/src/views/desktop/user/settings/UserDataManagementSettingTab.vue @@ -6,7 +6,7 @@ {{ $t('Data Management') }} + v-if="!loadingDataStatistics" @click="reloadUserDataStatistics(true)"> {{ $t('Refresh') }} @@ -145,7 +145,7 @@ import { mapStores } from 'pinia'; import { useRootStore } from '@/stores/index.js'; import { useUserStore } from '@/stores/user.js'; -import { appendThousandsSeparator } from '@/lib/common.js'; +import {appendThousandsSeparator, isEquals} from '@/lib/common.js'; import { isDataExportingEnabled } from '@/lib/server_settings.js'; import { startDownloadFile } from '@/lib/ui.js'; @@ -213,15 +213,23 @@ export default { } }, created() { - this.reloadUserDataStatistics(); + this.reloadUserDataStatistics(false); }, methods: { - reloadUserDataStatistics() { + reloadUserDataStatistics(force) { const self = this; self.loadingDataStatistics = true; self.userStore.getUserDataStatistics().then(dataStatistics => { + if (force) { + if (isEquals(self.dataStatistics, dataStatistics)) { + self.$refs.snackbar.showMessage('Data is up to date'); + } else { + self.$refs.snackbar.showMessage('Data has been updated'); + } + } + self.dataStatistics = dataStatistics; self.loadingDataStatistics = false; }).catch(error => {