diff --git a/VERSION b/VERSION index d15723f..1c09c74 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.2 +0.3.3 diff --git a/static/js/views/providers.js b/static/js/views/providers.js index 2689eb0..5763090 100644 --- a/static/js/views/providers.js +++ b/static/js/views/providers.js @@ -6,13 +6,14 @@ const ProvidersView = {
🏢 平台 = 资产的服务商(Vultr / 新网 / OpenAI…)。在「资产」中添加项目时选择归属平台;支持 API 对接的平台配置好密钥后,可「测试连接」或「同步资产」拉取真实数据。
-
+
+
-
+
{{ p.name }}
@@ -44,6 +45,9 @@ const ProvidersView = {
{{ results[p.id].text }}
+
`, setup() { const testing = Vue.reactive({}); @@ -67,6 +71,18 @@ const ProvidersView = { function accountsCountOf(p) { return store.accounts.filter(a => a.platform === p.slug).length; } + // 在用判定:有资产/有账号/已配置 API 任一即算在用 + function isUsed(p) { + return countOf(p) > 0 || accountsCountOf(p) > 0 || p.has_api_config; + } + // 默认隐藏未使用平台,避免预设平台撑满屏幕;偏好持久化到 localStorage + const showAll = Vue.ref(localStorage.getItem('vps_show_all_providers') === '1'); + function toggleShowAll() { + showAll.value = !showAll.value; + localStorage.setItem('vps_show_all_providers', showAll.value ? '1' : '0'); + } + const visibleProviders = Vue.computed(() => showAll.value ? store.providers : store.providers.filter(isUsed)); + const hiddenCount = Vue.computed(() => store.providers.length - visibleProviders.value.length); function serviceList(p) { return (p.services || '').split(',').map(s => s.trim()).filter(Boolean); } @@ -102,6 +118,6 @@ const ProvidersView = { } catch (e) { results[p.id] = { ok: false, text: '✗ ' + e.message }; } finally { syncing[p.id] = false; } } - return { store, Fmt, testing, syncing, results, countOf, accountsCountOf, serviceList, isSupported, canSync, fmtTime, test, sync, seed: seedProviders, create: openProviderCreate, edit: openProviderEdit, del: deleteProvider, openAccounts: (p) => openAccountsView(p.slug), manageAccounts: () => openAccountsView(null) }; + return { store, Fmt, testing, syncing, results, countOf, accountsCountOf, serviceList, showAll, toggleShowAll, visibleProviders, hiddenCount, isSupported, canSync, fmtTime, test, sync, seed: seedProviders, create: openProviderCreate, edit: openProviderEdit, del: deleteProvider, openAccounts: (p) => openAccountsView(p.slug), manageAccounts: () => openAccountsView(null) }; }, };