fix: fix bug with mcp-server status error (#8349)

This commit is contained in:
zhengkunwang 2025-04-08 17:21:53 +08:00 committed by GitHub
parent c0ccc0318d
commit 515d6ca500
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 1 deletions

View file

@ -52,6 +52,7 @@ func (m McpServerService) Page(req request.McpServerSearch) response.McpServersR
total, data, _ := mcpServerRepo.Page(req.PageInfo.Page, req.PageInfo.PageSize)
for _, item := range data {
_ = syncMcpServerContainerStatus(&item)
serverDTO := response.McpServerDTO{
McpServer: item,
Environments: make([]request.Environment, 0),
@ -158,6 +159,7 @@ func (m McpServerService) Create(create request.McpServerCreate) error {
BaseURL: create.BaseURL,
SsePath: create.SsePath,
Dir: mcpDir,
HostIP: create.HostIP,
}
if err := handleCreateParams(mcpServer, create.Environments, create.Volumes); err != nil {
return err
@ -616,6 +618,8 @@ func syncMcpServerContainerStatus(mcpServer *model.McpServer) error {
mcpServer.Status = constant.RuntimeRunning
case "paused":
mcpServer.Status = constant.RuntimeStopped
case "restarting":
mcpServer.Status = constant.RuntimeReStarting
default:
if mcpServer.Status != constant.RuntimeBuildIng {
mcpServer.Status = constant.RuntimeStopped

View file

@ -13,6 +13,7 @@ const (
RuntimeStopped = "stopped"
RuntimeUnhealthy = "unhealthy"
RuntimeCreating = "creating"
RuntimeReStarting = "restarting"
RuntimePHP = "php"
RuntimeNode = "node"

View file

@ -58,7 +58,9 @@
@click="openLog(row)"
link
type="primary"
:disabled="row.status !== 'running' && row.status !== 'error'"
:disabled="
row.status !== 'running' && row.status !== 'error' && row.status !== 'restarting'
"
>
{{ $t('website.check') }}
</el-button>