Add files via upload

This commit is contained in:
公明
2026-04-14 19:02:28 +08:00
committed by GitHub
parent 3e689a5dcb
commit 4f4a725034
5 changed files with 61 additions and 0 deletions
+35
View File
@@ -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;
+2
View File
@@ -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",
+2
View File
@@ -507,6 +507,8 @@
"toolSearchPlaceholder": "输入工具名称...",
"statusFilter": "状态筛选",
"filterAll": "全部",
"filterEnabled": "已启用",
"filterDisabled": "已停用",
"selectedCount": "已选择 {{count}} 项",
"selectAll": "全选",
"deselectAll": "全不选",
+17
View File
@@ -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');
+5
View File
@@ -725,6 +725,11 @@
<div class="tools-actions">
<button class="btn-secondary" onclick="selectAllTools()" data-i18n="mcp.selectAll">全选</button>
<button class="btn-secondary" onclick="deselectAllTools()" data-i18n="mcp.deselectAll">全不选</button>
<div class="tools-status-filter">
<button class="btn-filter active" data-filter="" onclick="filterToolsByStatus('')" data-i18n="mcp.filterAll">全部</button>
<button class="btn-filter" data-filter="true" onclick="filterToolsByStatus('true')" data-i18n="mcp.filterEnabled">已启用</button>
<button class="btn-filter" data-filter="false" onclick="filterToolsByStatus('false')" data-i18n="mcp.filterDisabled">已停用</button>
</div>
<div class="search-box">
<input type="text" id="tools-search" data-i18n="mcp.toolSearchPlaceholder" data-i18n-attr="placeholder" placeholder="搜索工具..." onkeypress="handleSearchKeyPress(event)" oninput="if(this.value.trim() === '') clearSearch()" />
<button class="btn-search" onclick="searchTools()" data-i18n="common.search" data-i18n-attr="title" title="搜索">🔍</button>