reorder the button display order

This commit is contained in:
MaysWind
2026-03-11 01:08:11 +08:00
parent 13488efdaf
commit dd63500202
4 changed files with 38 additions and 38 deletions
+17 -17
View File
@@ -212,23 +212,6 @@ export function updateMapCacheExpiration(expireSeconds: number): void {
}
}
export function clearMapDataCache(): Promise<void> {
if (!window.caches) {
logger.error('caches API is not supported in this browser');
return Promise.reject();
}
return window.caches.delete(SW_MAP_CACHE_NAME).then(success => {
if (success) {
logger.info(`cache "${SW_MAP_CACHE_NAME}" cleared successfully`);
} else {
logger.warn(`failed to clear cache "${SW_MAP_CACHE_NAME}"`);
}
}).catch(error => {
logger.error(`failed to clear cache "${SW_MAP_CACHE_NAME}"`, error);
});
}
export function clearApplicationCodeCache(): Promise<void> {
if (!window.caches) {
logger.error('caches API is not supported in this browser');
@@ -246,6 +229,23 @@ export function clearApplicationCodeCache(): Promise<void> {
});
}
export function clearMapDataCache(): Promise<void> {
if (!window.caches) {
logger.error('caches API is not supported in this browser');
return Promise.reject();
}
return window.caches.delete(SW_MAP_CACHE_NAME).then(success => {
if (success) {
logger.info(`cache "${SW_MAP_CACHE_NAME}" cleared successfully`);
} else {
logger.warn(`failed to clear cache "${SW_MAP_CACHE_NAME}"`);
}
}).catch(error => {
logger.error(`failed to clear cache "${SW_MAP_CACHE_NAME}"`, error);
});
}
export function clearAllBrowserCaches(): Promise<void> {
if (!window.caches) {
logger.error('caches API is not supported in this browser');
@@ -11,8 +11,8 @@ import { type BrowserCacheStatistics } from '@/core/cache.ts';
import {
loadBrowserCacheStatistics,
updateMapCacheExpiration,
clearMapDataCache,
clearApplicationCodeCache,
clearMapDataCache,
clearAllBrowserCaches
} from '@/lib/cache.ts';
@@ -115,8 +115,8 @@ export function useAppBrowserCacheSettingPageBase() {
exchangeRatesDataCacheExpiration,
// functions
loadCacheStatistics,
clearMapDataCache,
clearApplicationCodeCache,
clearMapDataCache,
clearAllBrowserCaches,
clearExchangeRatesDataCache
};
@@ -68,14 +68,14 @@
</v-card-text>
<v-card-text class="mt-2">
<v-btn color="secondary" variant="tonal"
:disabled="loading || !isSupportedFileCache || !fileCacheStatistics" @click="clearMapCache()">
{{ tt('Clear Map Data Cache') }}
</v-btn>
<v-btn color="secondary" variant="tonal"
:disabled="loading || !isSupportedFileCache || !fileCacheStatistics" @click="clearApplicationCodeFileCache()">
{{ tt('Clear Application Code Cache') }}
</v-btn>
<v-btn class="ms-2" color="secondary" variant="tonal"
:disabled="loading || !isSupportedFileCache || !fileCacheStatistics" @click="clearMapCache()">
{{ tt('Clear Map Data Cache') }}
</v-btn>
<v-btn class="ms-2" color="secondary" variant="tonal"
:disabled="loading || !isSupportedFileCache || !fileCacheStatistics" @click="clearAllFileCache()">
{{ tt('Clear All File Cache') }}
@@ -183,25 +183,25 @@ const {
mapCacheExpiration,
exchangeRatesDataCacheExpiration,
loadCacheStatistics,
clearMapDataCache,
clearApplicationCodeCache,
clearMapDataCache,
clearAllBrowserCaches,
clearExchangeRatesDataCache
} = useAppBrowserCacheSettingPageBase();
const confirmDialog = useTemplateRef<ConfirmDialogType>('confirmDialog');
function clearMapCache(): void {
confirmDialog.value?.open('Are you sure you want to clear map data cache?').then(() => {
clearMapDataCache().then(() => {
function clearApplicationCodeFileCache(): void {
confirmDialog.value?.open('Are you sure you want to clear application code cache?').then(() => {
clearApplicationCodeCache().then(() => {
loadCacheStatistics(true);
});
});
}
function clearApplicationCodeFileCache(): void {
confirmDialog.value?.open('Are you sure you want to clear application code cache?').then(() => {
clearApplicationCodeCache().then(() => {
function clearMapCache(): void {
confirmDialog.value?.open('Are you sure you want to clear map data cache?').then(() => {
clearMapDataCache().then(() => {
loadCacheStatistics(true);
});
});
@@ -99,10 +99,10 @@
<f7-actions close-by-outside-click close-on-escape :opened="showMoreActionSheet" @actions:closed="showMoreActionSheet = false">
<f7-actions-group v-if="isSupportedFileCache && fileCacheStatistics">
<f7-actions-button :class="{ 'disabled': loading || !isSupportedFileCache || !fileCacheStatistics }"
@click="clearMapCache">{{ tt('Clear Map Data Cache') }}</f7-actions-button>
<f7-actions-button :class="{ 'disabled': loading || !isSupportedFileCache || !fileCacheStatistics }"
@click="clearApplicationCodeFileCache">{{ tt('Clear Application Code Cache') }}</f7-actions-button>
<f7-actions-button :class="{ 'disabled': loading || !isSupportedFileCache || !fileCacheStatistics }"
@click="clearMapCache">{{ tt('Clear Map Data Cache') }}</f7-actions-button>
<f7-actions-button :class="{ 'disabled': loading || !isSupportedFileCache || !fileCacheStatistics }"
@click="clearAllFileCache">{{ tt('Clear All File Cache') }}</f7-actions-button>
</f7-actions-group>
@@ -160,17 +160,17 @@ function reloadCacheStatistics(done?: () => void): void {
});
}
function clearMapCache(): void {
showConfirm('Are you sure you want to clear map data cache?', () => {
clearMapDataCache().then(() => {
function clearApplicationCodeFileCache(): void {
showConfirm('Are you sure you want to clear application code cache?', () => {
clearApplicationCodeCache().then(() => {
loadCacheStatistics(true);
});
});
}
function clearApplicationCodeFileCache(): void {
showConfirm('Are you sure you want to clear application code cache?', () => {
clearApplicationCodeCache().then(() => {
function clearMapCache(): void {
showConfirm('Are you sure you want to clear map data cache?', () => {
clearMapDataCache().then(() => {
loadCacheStatistics(true);
});
});