support setting exchange rate cache expiration time

This commit is contained in:
MaysWind
2026-02-28 21:36:00 +08:00
parent 247181830c
commit 8192a48bc5
27 changed files with 303 additions and 30 deletions
@@ -4,7 +4,7 @@
<f7-nav-left :class="{ 'disabled': loading }" :back-link="tt('Back')"></f7-nav-left>
<f7-nav-title :title="tt('Browser Cache Management')"></f7-nav-title>
<f7-nav-right :class="{ 'disabled': loading }">
<f7-link icon-f7="ellipsis" :class="{ 'disabled': loading || !isSupportedFileCache || !fileCacheStatistics }" @click="showMoreActionSheet = true"></f7-link>
<f7-link icon-f7="ellipsis" :class="{ 'disabled': loading || ((!isSupportedFileCache || !fileCacheStatistics) && !exchangeRatesCacheSize) }" @click="showMoreActionSheet = true"></f7-link>
</f7-nav-right>
</f7-navbar>
@@ -30,7 +30,8 @@
<f7-list-item group-title :sortable="false">
<small>{{ tt('Cache Expiration Time') }}</small>
</f7-list-item>
<f7-list-item title="Map Data" after="Disable Map Cache" v-if="getMapProvider()"></f7-list-item>
<f7-list-item title="Map Data" after="Disable Cache" v-if="getMapProvider()"></f7-list-item>
<f7-list-item title="Exchange Rates Data" after="Disable Cache"></f7-list-item>
</f7-list>
<f7-list strong inset dividers class="margin-vertical" v-if="!loading && isSupportedFileCache">
@@ -75,6 +76,25 @@
v-model="mapCacheExpiration">
</list-item-selection-popup>
</f7-list-item>
<f7-list-item
link="#"
:class="{ 'disabled': loading }"
:title="tt('Exchange Rates Data')"
:after="findNameByValue(allExchangeRatesDataCacheExpirationOptions, exchangeRatesDataCacheExpiration)"
@click="showExchangeRatesDataCacheExpirationPopup = true"
>
<list-item-selection-popup value-type="item"
key-field="value" value-field="value"
title-field="name"
:title="tt('Cache Expiration for Exchange Rates Data')"
:enable-filter="true"
:filter-placeholder="tt('Expiration Time')"
:filter-no-items-text="tt('No results')"
:items="allExchangeRatesDataCacheExpirationOptions"
v-model:show="showExchangeRatesDataCacheExpirationPopup"
v-model="exchangeRatesDataCacheExpiration">
</list-item-selection-popup>
</f7-list-item>
</f7-list>
<f7-actions close-by-outside-click close-on-escape :opened="showMoreActionSheet" @actions:closed="showMoreActionSheet = false">
@@ -84,6 +104,10 @@
<f7-actions-button :class="{ 'disabled': loading || !isSupportedFileCache || !fileCacheStatistics }"
@click="clearAllFileCache">{{ tt('Clear All File Cache') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group>
<f7-actions-button :class="{ 'disabled': loading || !exchangeRatesCacheSize }"
@click="clearExchangeRatesCache">{{ tt('Clear Exchange Rates Data Cache') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group>
<f7-actions-button bold close>{{ tt('Cancel') }}</f7-actions-button>
</f7-actions-group>
@@ -112,13 +136,17 @@ const {
fileCacheStatistics,
exchangeRatesCacheSize,
allMapCacheExpirationOptions,
allExchangeRatesDataCacheExpirationOptions,
mapCacheExpiration,
exchangeRatesDataCacheExpiration,
loadCacheStatistics,
clearMapDataCache,
clearAllBrowserCaches
clearAllBrowserCaches,
clearExchangeRatesDataCache
} = useAppBrowserCacheSettingPageBase();
const showMapDataCacheExpirationPopup = ref<boolean>(false);
const showExchangeRatesDataCacheExpirationPopup = ref<boolean>(false);
const showMoreActionSheet = ref<boolean>(false);
function reloadCacheStatistics(done?: () => void): void {
@@ -149,5 +177,11 @@ function clearAllFileCache(): void {
});
}
function clearExchangeRatesCache(): void {
showConfirm('Are you sure you want to clear exchange rates data cache?', () => {
clearExchangeRatesDataCache();
});
}
loadCacheStatistics();
</script>