Skip to content

Commit bd3ad03

Browse files
authored
Merge pull request #1361 from AstrBotDevs/hotfix/webui-mcp
fix: 修复 MCP 页面的一些问题
2 parents a115114 + 5fa6788 commit bd3ad03

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

dashboard/src/components/shared/ItemCardGrid.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<v-row v-else>
1111
<v-col v-for="(item, index) in items" :key="index" cols="12" md="6" lg="4" xl="3">
1212
<v-card class="item-card hover-elevation" :color="getItemEnabled(item) ? '' : 'grey-lighten-4'">
13-
<!-- <div class="item-status-indicator" :class="{'active': getItemEnabled(item)}"></div> -->
13+
<div class="item-status-indicator" :class="{'active': getItemEnabled(item)}"></div>
1414
<v-card-title class="d-flex justify-space-between align-center pb-1 pt-3">
1515
<span class="text-h4 text-truncate" :title="getItemTitle(item)">{{ getItemTitle(item) }}</span>
1616
<v-tooltip location="top">

dashboard/src/views/ToolUsePage.vue

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<v-card-text class="px-4 py-3">
6161

6262
<item-card-grid :items="mcpServers || []" title-field="name" enabled-field="active"
63-
empty-icon="mdi-server-off" empty-text="暂无 MCP 服务器,点击 新增服务器 添加" @toggle-enabled="platformStatusChange"
63+
empty-icon="mdi-server-off" empty-text="暂无 MCP 服务器,点击 新增服务器 添加" @toggle-enabled="updateServerStatus"
6464
@delete="deleteServer" @edit="editServer">
6565
<template v-slot:item-details="{ item }">
6666

@@ -486,6 +486,7 @@ export default {
486486
},
487487
data() {
488488
return {
489+
refreshInterval: null,
489490
activeTab: 'local', // 当前激活的标签页
490491
mcpServers: [],
491492
tools: [],
@@ -568,13 +569,19 @@ export default {
568569
this.getTools();
569570
this.fetchMarketplaceServers();
570571
571-
// 定期刷新本地服务器列表
572-
setInterval(() => {
572+
this.refreshInterval = setInterval(() => {
573573
this.getServers();
574574
this.getTools();
575575
}, 5000);
576576
},
577577
578+
unmounted() {
579+
// 清除定时器 if it exists
580+
if (this.refreshInterval) {
581+
clearInterval(this.refreshInterval);
582+
}
583+
},
584+
578585
methods: {
579586
openurl(url) {
580587
window.open(url, '_blank');
@@ -724,6 +731,8 @@ export default {
724731
},
725732
726733
updateServerStatus(server) {
734+
// 切换服务器状态
735+
server.active = !server.active;
727736
axios.post('/api/tools/mcp/update', server)
728737
.then(response => {
729738
this.getServers();

0 commit comments

Comments
 (0)