From 4f4a72503476eaeb8fa337f7b4493a8cc7c5aba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AC=E6=98=8E?= <83812544+Ed1s0nZ@users.noreply.github.com> Date: Tue, 14 Apr 2026 19:02:28 +0800 Subject: [PATCH] Add files via upload --- web/static/css/style.css | 35 +++++++++++++++++++++++++++++++++++ web/static/i18n/en-US.json | 2 ++ web/static/i18n/zh-CN.json | 2 ++ web/static/js/settings.js | 17 +++++++++++++++++ web/templates/index.html | 5 +++++ 5 files changed, 61 insertions(+) diff --git a/web/static/css/style.css b/web/static/css/style.css index c09b5249..e49e162b 100644 --- a/web/static/css/style.css +++ b/web/static/css/style.css @@ -3826,6 +3826,41 @@ header { align-items: center; } +.tools-status-filter { + display: flex; + gap: 0; + flex-shrink: 0; + border: 1px solid var(--border-color); + border-radius: 6px; + overflow: hidden; +} + +.tools-status-filter .btn-filter { + padding: 6px 12px; + border: none; + border-right: 1px solid var(--border-color); + background: var(--bg-primary); + color: var(--text-secondary); + font-size: 0.8125rem; + cursor: pointer; + transition: all 0.2s; + white-space: nowrap; +} + +.tools-status-filter .btn-filter:last-child { + border-right: none; +} + +.tools-status-filter .btn-filter:hover { + background: var(--bg-tertiary); + color: var(--text-primary); +} + +.tools-status-filter .btn-filter.active { + background: var(--accent-color); + color: #fff; +} + .page-size-selector { display: flex; align-items: center; diff --git a/web/static/i18n/en-US.json b/web/static/i18n/en-US.json index 12ed9bb2..4d8a9609 100644 --- a/web/static/i18n/en-US.json +++ b/web/static/i18n/en-US.json @@ -507,6 +507,8 @@ "toolSearchPlaceholder": "Enter tool name...", "statusFilter": "Status filter", "filterAll": "All", + "filterEnabled": "Enabled", + "filterDisabled": "Disabled", "selectedCount": "{{count}} selected", "selectAll": "Select all", "deselectAll": "Deselect all", diff --git a/web/static/i18n/zh-CN.json b/web/static/i18n/zh-CN.json index 519bd59b..bf99d795 100644 --- a/web/static/i18n/zh-CN.json +++ b/web/static/i18n/zh-CN.json @@ -507,6 +507,8 @@ "toolSearchPlaceholder": "输入工具名称...", "statusFilter": "状态筛选", "filterAll": "全部", + "filterEnabled": "已启用", + "filterDisabled": "已停用", "selectedCount": "已选择 {{count}} 项", "selectAll": "全选", "deselectAll": "全不选", diff --git a/web/static/js/settings.js b/web/static/js/settings.js index e358b73c..7a1d75a1 100644 --- a/web/static/js/settings.js +++ b/web/static/js/settings.js @@ -273,6 +273,9 @@ async function loadConfig(loadTools = true) { // 工具搜索关键词 let toolsSearchKeyword = ''; +// 工具状态筛选: '' = 全部, 'true' = 已启用, 'false' = 已停用 +let toolsStatusFilter = ''; + // 加载工具列表(分页) async function loadToolsList(page = 1, searchKeyword = '') { const toolsList = document.getElementById('tools-list'); @@ -292,6 +295,9 @@ async function loadToolsList(page = 1, searchKeyword = '') { if (searchKeyword) { url += `&search=${encodeURIComponent(searchKeyword)}`; } + if (toolsStatusFilter !== '') { + url += `&enabled=${toolsStatusFilter}`; + } // 使用较短的超时时间(10秒),避免长时间等待 const controller = new AbortController(); @@ -387,6 +393,17 @@ function handleSearchKeyPress(event) { } } +// 按状态筛选工具 +function filterToolsByStatus(status) { + toolsStatusFilter = status; + // 更新按钮激活状态 + document.querySelectorAll('.tools-status-filter .btn-filter').forEach(btn => { + btn.classList.toggle('active', btn.dataset.filter === status); + }); + // 重置到第一页并重新加载 + loadToolsList(1, toolsSearchKeyword); +} + // 渲染工具列表 function renderToolsList() { const toolsList = document.getElementById('tools-list'); diff --git a/web/templates/index.html b/web/templates/index.html index c1c6364e..980c36af 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -725,6 +725,11 @@
+
+ + + +