|
|
|
|
@ -18,6 +18,7 @@ import { computed, ref } from 'vue';
|
|
|
|
|
import { $t, loadLocaleMessages } from '@vben/locales';
|
|
|
|
|
import { IcRoundFolderCopy, IcRoundRestartAlt } from '@vben-core/iconify';
|
|
|
|
|
import {
|
|
|
|
|
clearPreferencesCache,
|
|
|
|
|
preferences,
|
|
|
|
|
resetPreferences,
|
|
|
|
|
usePreferences,
|
|
|
|
|
@ -53,6 +54,8 @@ import {
|
|
|
|
|
import Trigger from './trigger.vue';
|
|
|
|
|
import { useOpenPreferences } from './use-open-preferences';
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{ clearPreferencesAndLogout: [] }>();
|
|
|
|
|
|
|
|
|
|
const appLocale = defineModel<SupportedLanguagesType>('appLocale');
|
|
|
|
|
const appDynamicTitle = defineModel<boolean>('appDynamicTitle');
|
|
|
|
|
const appAiAssistant = defineModel<boolean>('appAiAssistant');
|
|
|
|
|
@ -166,6 +169,12 @@ async function handleCopy() {
|
|
|
|
|
toast($t('preferences.copy-success'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function handleClearCache() {
|
|
|
|
|
resetPreferences();
|
|
|
|
|
clearPreferencesCache();
|
|
|
|
|
emit('clearPreferencesAndLogout');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function handleReset() {
|
|
|
|
|
if (!diffPreference.value) {
|
|
|
|
|
return;
|
|
|
|
|
@ -187,6 +196,7 @@ async function handleReset() {
|
|
|
|
|
<Trigger />
|
|
|
|
|
</template>
|
|
|
|
|
<template #extra>
|
|
|
|
|
<div class="flex items-center">
|
|
|
|
|
<VbenIconButton
|
|
|
|
|
:disabled="!diffPreference"
|
|
|
|
|
:tooltip="$t('preferences.reset-tip')"
|
|
|
|
|
@ -198,6 +208,7 @@ async function handleReset() {
|
|
|
|
|
></span>
|
|
|
|
|
<IcRoundRestartAlt class="size-5" @click="handleReset" />
|
|
|
|
|
</VbenIconButton>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<div class="p-4 pt-4">
|
|
|
|
|
@ -328,9 +339,18 @@ async function handleReset() {
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
<VbenButton
|
|
|
|
|
class="mx-4 w-full"
|
|
|
|
|
size="sm"
|
|
|
|
|
variant="outline"
|
|
|
|
|
@click="handleClearCache"
|
|
|
|
|
>
|
|
|
|
|
<IcRoundRestartAlt class="mr-2 size-4" />
|
|
|
|
|
{{ $t('preferences.clear-and-logout') }}
|
|
|
|
|
</VbenButton>
|
|
|
|
|
<VbenButton
|
|
|
|
|
:disabled="!diffPreference"
|
|
|
|
|
class="mx-6 w-full"
|
|
|
|
|
class="mr-4 w-full"
|
|
|
|
|
size="sm"
|
|
|
|
|
variant="default"
|
|
|
|
|
@click="handleCopy"
|
|
|
|
|
|