reorder the button display order
This commit is contained in:
+17
-17
@@ -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> {
|
export function clearApplicationCodeCache(): Promise<void> {
|
||||||
if (!window.caches) {
|
if (!window.caches) {
|
||||||
logger.error('caches API is not supported in this browser');
|
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> {
|
export function clearAllBrowserCaches(): Promise<void> {
|
||||||
if (!window.caches) {
|
if (!window.caches) {
|
||||||
logger.error('caches API is not supported in this browser');
|
logger.error('caches API is not supported in this browser');
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import { type BrowserCacheStatistics } from '@/core/cache.ts';
|
|||||||
import {
|
import {
|
||||||
loadBrowserCacheStatistics,
|
loadBrowserCacheStatistics,
|
||||||
updateMapCacheExpiration,
|
updateMapCacheExpiration,
|
||||||
clearMapDataCache,
|
|
||||||
clearApplicationCodeCache,
|
clearApplicationCodeCache,
|
||||||
|
clearMapDataCache,
|
||||||
clearAllBrowserCaches
|
clearAllBrowserCaches
|
||||||
} from '@/lib/cache.ts';
|
} from '@/lib/cache.ts';
|
||||||
|
|
||||||
@@ -115,8 +115,8 @@ export function useAppBrowserCacheSettingPageBase() {
|
|||||||
exchangeRatesDataCacheExpiration,
|
exchangeRatesDataCacheExpiration,
|
||||||
// functions
|
// functions
|
||||||
loadCacheStatistics,
|
loadCacheStatistics,
|
||||||
clearMapDataCache,
|
|
||||||
clearApplicationCodeCache,
|
clearApplicationCodeCache,
|
||||||
|
clearMapDataCache,
|
||||||
clearAllBrowserCaches,
|
clearAllBrowserCaches,
|
||||||
clearExchangeRatesDataCache
|
clearExchangeRatesDataCache
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -68,14 +68,14 @@
|
|||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
|
||||||
<v-card-text class="mt-2">
|
<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"
|
<v-btn color="secondary" variant="tonal"
|
||||||
:disabled="loading || !isSupportedFileCache || !fileCacheStatistics" @click="clearApplicationCodeFileCache()">
|
:disabled="loading || !isSupportedFileCache || !fileCacheStatistics" @click="clearApplicationCodeFileCache()">
|
||||||
{{ tt('Clear Application Code Cache') }}
|
{{ tt('Clear Application Code Cache') }}
|
||||||
</v-btn>
|
</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"
|
<v-btn class="ms-2" color="secondary" variant="tonal"
|
||||||
:disabled="loading || !isSupportedFileCache || !fileCacheStatistics" @click="clearAllFileCache()">
|
:disabled="loading || !isSupportedFileCache || !fileCacheStatistics" @click="clearAllFileCache()">
|
||||||
{{ tt('Clear All File Cache') }}
|
{{ tt('Clear All File Cache') }}
|
||||||
@@ -183,25 +183,25 @@ const {
|
|||||||
mapCacheExpiration,
|
mapCacheExpiration,
|
||||||
exchangeRatesDataCacheExpiration,
|
exchangeRatesDataCacheExpiration,
|
||||||
loadCacheStatistics,
|
loadCacheStatistics,
|
||||||
clearMapDataCache,
|
|
||||||
clearApplicationCodeCache,
|
clearApplicationCodeCache,
|
||||||
|
clearMapDataCache,
|
||||||
clearAllBrowserCaches,
|
clearAllBrowserCaches,
|
||||||
clearExchangeRatesDataCache
|
clearExchangeRatesDataCache
|
||||||
} = useAppBrowserCacheSettingPageBase();
|
} = useAppBrowserCacheSettingPageBase();
|
||||||
|
|
||||||
const confirmDialog = useTemplateRef<ConfirmDialogType>('confirmDialog');
|
const confirmDialog = useTemplateRef<ConfirmDialogType>('confirmDialog');
|
||||||
|
|
||||||
function clearMapCache(): void {
|
function clearApplicationCodeFileCache(): void {
|
||||||
confirmDialog.value?.open('Are you sure you want to clear map data cache?').then(() => {
|
confirmDialog.value?.open('Are you sure you want to clear application code cache?').then(() => {
|
||||||
clearMapDataCache().then(() => {
|
clearApplicationCodeCache().then(() => {
|
||||||
loadCacheStatistics(true);
|
loadCacheStatistics(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearApplicationCodeFileCache(): void {
|
function clearMapCache(): void {
|
||||||
confirmDialog.value?.open('Are you sure you want to clear application code cache?').then(() => {
|
confirmDialog.value?.open('Are you sure you want to clear map data cache?').then(() => {
|
||||||
clearApplicationCodeCache().then(() => {
|
clearMapDataCache().then(() => {
|
||||||
loadCacheStatistics(true);
|
loadCacheStatistics(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -99,10 +99,10 @@
|
|||||||
|
|
||||||
<f7-actions close-by-outside-click close-on-escape :opened="showMoreActionSheet" @actions:closed="showMoreActionSheet = false">
|
<f7-actions close-by-outside-click close-on-escape :opened="showMoreActionSheet" @actions:closed="showMoreActionSheet = false">
|
||||||
<f7-actions-group v-if="isSupportedFileCache && fileCacheStatistics">
|
<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 }"
|
<f7-actions-button :class="{ 'disabled': loading || !isSupportedFileCache || !fileCacheStatistics }"
|
||||||
@click="clearApplicationCodeFileCache">{{ tt('Clear Application Code Cache') }}</f7-actions-button>
|
@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 }"
|
<f7-actions-button :class="{ 'disabled': loading || !isSupportedFileCache || !fileCacheStatistics }"
|
||||||
@click="clearAllFileCache">{{ tt('Clear All File Cache') }}</f7-actions-button>
|
@click="clearAllFileCache">{{ tt('Clear All File Cache') }}</f7-actions-button>
|
||||||
</f7-actions-group>
|
</f7-actions-group>
|
||||||
@@ -160,17 +160,17 @@ function reloadCacheStatistics(done?: () => void): void {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearMapCache(): void {
|
function clearApplicationCodeFileCache(): void {
|
||||||
showConfirm('Are you sure you want to clear map data cache?', () => {
|
showConfirm('Are you sure you want to clear application code cache?', () => {
|
||||||
clearMapDataCache().then(() => {
|
clearApplicationCodeCache().then(() => {
|
||||||
loadCacheStatistics(true);
|
loadCacheStatistics(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearApplicationCodeFileCache(): void {
|
function clearMapCache(): void {
|
||||||
showConfirm('Are you sure you want to clear application code cache?', () => {
|
showConfirm('Are you sure you want to clear map data cache?', () => {
|
||||||
clearApplicationCodeCache().then(() => {
|
clearMapDataCache().then(() => {
|
||||||
loadCacheStatistics(true);
|
loadCacheStatistics(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user