diff --git a/internal/tasks/task_sync_api_nodes.go b/internal/tasks/task_sync_api_nodes.go index d4e5041a..ef533fc5 100644 --- a/internal/tasks/task_sync_api_nodes.go +++ b/internal/tasks/task_sync_api_nodes.go @@ -66,7 +66,7 @@ func (this *SyncAPINodesTask) Loop() error { } newEndpoints := []string{} - for _, node := range resp.Nodes { + for _, node := range resp.ApiNodes { if !node.IsOn { continue } diff --git a/internal/web/actions/default/api/delete.go b/internal/web/actions/default/api/delete.go index 3f4435de..2be931c3 100644 --- a/internal/web/actions/default/api/delete.go +++ b/internal/web/actions/default/api/delete.go @@ -17,12 +17,12 @@ func (this *DeleteAction) RunPost(params struct { defer this.CreateLog(oplogs.LevelInfo, "删除API节点 %d", params.NodeId) // 检查是否是唯一的节点 - nodeResp, err := this.RPC().APINodeRPC().FindEnabledAPINode(this.AdminContext(), &pb.FindEnabledAPINodeRequest{NodeId: params.NodeId}) + nodeResp, err := this.RPC().APINodeRPC().FindEnabledAPINode(this.AdminContext(), &pb.FindEnabledAPINodeRequest{ApiNodeId: params.NodeId}) if err != nil { this.ErrorPage(err) return } - var apiNode = nodeResp.Node + var apiNode = nodeResp.ApiNode if apiNode == nil { this.Success() } @@ -37,7 +37,7 @@ func (this *DeleteAction) RunPost(params struct { } } - _, err = this.RPC().APINodeRPC().DeleteAPINode(this.AdminContext(), &pb.DeleteAPINodeRequest{NodeId: params.NodeId}) + _, err = this.RPC().APINodeRPC().DeleteAPINode(this.AdminContext(), &pb.DeleteAPINodeRequest{ApiNodeId: params.NodeId}) if err != nil { this.ErrorPage(err) return diff --git a/internal/web/actions/default/api/index.go b/internal/web/actions/default/api/index.go index 79a33a58..7cda3313 100644 --- a/internal/web/actions/default/api/index.go +++ b/internal/web/actions/default/api/index.go @@ -41,7 +41,7 @@ func (this *IndexAction) RunGet(params struct{}) { return } - for _, node := range nodesResp.Nodes { + for _, node := range nodesResp.ApiNodes { // 状态 status := &nodeconfigs.NodeStatus{} if len(node.StatusJSON) > 0 { diff --git a/internal/web/actions/default/api/node/createPopup.go b/internal/web/actions/default/api/node/createPopup.go index 2599f249..493f0a41 100644 --- a/internal/web/actions/default/api/node/createPopup.go +++ b/internal/web/actions/default/api/node/createPopup.go @@ -180,7 +180,7 @@ func (this *CreatePopupAction) RunPost(params struct { } // 创建日志 - defer this.CreateLog(oplogs.LevelInfo, "创建API节点 %d", createResp.NodeId) + defer this.CreateLog(oplogs.LevelInfo, "创建API节点 %d", createResp.ApiNodeId) this.Success() } diff --git a/internal/web/actions/default/api/node/index.go b/internal/web/actions/default/api/node/index.go index be8e463a..1084e3f1 100644 --- a/internal/web/actions/default/api/node/index.go +++ b/internal/web/actions/default/api/node/index.go @@ -20,12 +20,12 @@ func (this *IndexAction) Init() { func (this *IndexAction) RunGet(params struct { NodeId int64 }) { - nodeResp, err := this.RPC().APINodeRPC().FindEnabledAPINode(this.AdminContext(), &pb.FindEnabledAPINodeRequest{NodeId: params.NodeId}) + nodeResp, err := this.RPC().APINodeRPC().FindEnabledAPINode(this.AdminContext(), &pb.FindEnabledAPINodeRequest{ApiNodeId: params.NodeId}) if err != nil { this.ErrorPage(err) return } - node := nodeResp.Node + node := nodeResp.ApiNode if node == nil { this.NotFound("apiNode", params.NodeId) return diff --git a/internal/web/actions/default/api/node/install.go b/internal/web/actions/default/api/node/install.go index 93625293..9704f38b 100644 --- a/internal/web/actions/default/api/node/install.go +++ b/internal/web/actions/default/api/node/install.go @@ -21,12 +21,12 @@ func (this *InstallAction) RunGet(params struct { NodeId int64 }) { // API节点信息 - nodeResp, err := this.RPC().APINodeRPC().FindEnabledAPINode(this.AdminContext(), &pb.FindEnabledAPINodeRequest{NodeId: params.NodeId}) + nodeResp, err := this.RPC().APINodeRPC().FindEnabledAPINode(this.AdminContext(), &pb.FindEnabledAPINodeRequest{ApiNodeId: params.NodeId}) if err != nil { this.ErrorPage(err) return } - node := nodeResp.Node + node := nodeResp.ApiNode if node == nil { this.NotFound("apiNode", params.NodeId) return diff --git a/internal/web/actions/default/api/node/logs.go b/internal/web/actions/default/api/node/logs.go index 274a1946..5018f1a2 100644 --- a/internal/web/actions/default/api/node/logs.go +++ b/internal/web/actions/default/api/node/logs.go @@ -31,12 +31,12 @@ func (this *LogsAction) RunGet(params struct { this.Data["keyword"] = params.Keyword this.Data["level"] = params.Level - apiNodeResp, err := this.RPC().APINodeRPC().FindEnabledAPINode(this.AdminContext(), &pb.FindEnabledAPINodeRequest{NodeId: params.NodeId}) + apiNodeResp, err := this.RPC().APINodeRPC().FindEnabledAPINode(this.AdminContext(), &pb.FindEnabledAPINodeRequest{ApiNodeId: params.NodeId}) if err != nil { this.ErrorPage(err) return } - apiNode := apiNodeResp.Node + apiNode := apiNodeResp.ApiNode if apiNode == nil { this.NotFound("apiNode", params.NodeId) return diff --git a/internal/web/actions/default/api/node/update.go b/internal/web/actions/default/api/node/update.go index bc71b4e6..4e1a0554 100644 --- a/internal/web/actions/default/api/node/update.go +++ b/internal/web/actions/default/api/node/update.go @@ -23,13 +23,13 @@ func (this *UpdateAction) RunGet(params struct { NodeId int64 }) { nodeResp, err := this.RPC().APINodeRPC().FindEnabledAPINode(this.AdminContext(), &pb.FindEnabledAPINodeRequest{ - NodeId: params.NodeId, + ApiNodeId: params.NodeId, }) if err != nil { this.ErrorPage(err) return } - node := nodeResp.Node + node := nodeResp.ApiNode if node == nil { this.WriteString("要操作的节点不存在") return @@ -281,7 +281,7 @@ func (this *UpdateAction) RunPost(params struct { } _, err = this.RPC().APINodeRPC().UpdateAPINode(this.AdminContext(), &pb.UpdateAPINodeRequest{ - NodeId: params.NodeId, + ApiNodeId: params.NodeId, Name: params.Name, Description: params.Description, HttpJSON: httpJSON, diff --git a/internal/web/actions/default/clusters/cluster/createNode.go b/internal/web/actions/default/clusters/cluster/createNode.go index efe459d5..e072a5c9 100644 --- a/internal/web/actions/default/clusters/cluster/createNode.go +++ b/internal/web/actions/default/clusters/cluster/createNode.go @@ -75,7 +75,7 @@ func (this *CreateNodeAction) RunGet(params struct { this.ErrorPage(err) return } - apiNodes := apiNodesResp.Nodes + apiNodes := apiNodesResp.ApiNodes apiEndpoints := []string{} for _, apiNode := range apiNodes { if !apiNode.IsOn { diff --git a/internal/web/actions/default/clusters/cluster/installNodes.go b/internal/web/actions/default/clusters/cluster/installNodes.go index bd7aec17..6e80bf9a 100644 --- a/internal/web/actions/default/clusters/cluster/installNodes.go +++ b/internal/web/actions/default/clusters/cluster/installNodes.go @@ -49,7 +49,7 @@ func (this *InstallNodesAction) RunGet(params struct { this.ErrorPage(err) return } - for _, apiNode := range apiNodesResp.Nodes { + for _, apiNode := range apiNodesResp.ApiNodes { if !apiNode.IsOn { continue } diff --git a/internal/web/actions/default/clusters/cluster/node/install.go b/internal/web/actions/default/clusters/cluster/node/install.go index 66b9f716..d4779b72 100644 --- a/internal/web/actions/default/clusters/cluster/node/install.go +++ b/internal/web/actions/default/clusters/cluster/node/install.go @@ -70,7 +70,7 @@ func (this *InstallAction) RunGet(params struct { this.ErrorPage(err) return } - apiNodes := apiNodesResp.Nodes + apiNodes := apiNodesResp.ApiNodes apiEndpoints := []string{} for _, apiNode := range apiNodes { if !apiNode.IsOn { diff --git a/internal/web/actions/default/nodes/nodeutils/utils.go b/internal/web/actions/default/nodes/nodeutils/utils.go index e59379f3..4c700ba7 100644 --- a/internal/web/actions/default/nodes/nodeutils/utils.go +++ b/internal/web/actions/default/nodes/nodeutils/utils.go @@ -68,7 +68,7 @@ func SendMessageToCluster(ctx context.Context, clusterId int64, code string, msg apiNodeId := node.ConnectedAPINodeIds[0] rpcClient, ok := rpcMap[apiNodeId] if !ok { - apiNodeResp, err := defaultRPCClient.APINodeRPC().FindEnabledAPINode(ctx, &pb.FindEnabledAPINodeRequest{NodeId: apiNodeId}) + apiNodeResp, err := defaultRPCClient.APINodeRPC().FindEnabledAPINode(ctx, &pb.FindEnabledAPINodeRequest{ApiNodeId: apiNodeId}) if err != nil { locker.Lock() results = append(results, &MessageResult{ @@ -82,7 +82,7 @@ func SendMessageToCluster(ctx context.Context, clusterId int64, code string, msg continue } - if apiNodeResp.Node == nil { + if apiNodeResp.ApiNode == nil { locker.Lock() results = append(results, &MessageResult{ NodeId: node.Id, @@ -94,7 +94,7 @@ func SendMessageToCluster(ctx context.Context, clusterId int64, code string, msg wg.Done() continue } - apiNode := apiNodeResp.Node + apiNode := apiNodeResp.ApiNode apiRPCClient, err := rpc.NewRPCClient(&configs.APIConfig{ RPC: struct { @@ -243,7 +243,7 @@ func SendMessageToNodeIds(ctx context.Context, nodeIds []int64, code string, msg apiNodeId := node.ConnectedAPINodeIds[0] rpcClient, ok := rpcMap[apiNodeId] if !ok { - apiNodeResp, err := defaultRPCClient.APINodeRPC().FindEnabledAPINode(ctx, &pb.FindEnabledAPINodeRequest{NodeId: apiNodeId}) + apiNodeResp, err := defaultRPCClient.APINodeRPC().FindEnabledAPINode(ctx, &pb.FindEnabledAPINodeRequest{ApiNodeId: apiNodeId}) if err != nil { locker.Lock() results = append(results, &MessageResult{ @@ -257,7 +257,7 @@ func SendMessageToNodeIds(ctx context.Context, nodeIds []int64, code string, msg continue } - if apiNodeResp.Node == nil { + if apiNodeResp.ApiNode == nil { locker.Lock() results = append(results, &MessageResult{ NodeId: node.Id, @@ -269,7 +269,7 @@ func SendMessageToNodeIds(ctx context.Context, nodeIds []int64, code string, msg wg.Done() continue } - apiNode := apiNodeResp.Node + apiNode := apiNodeResp.ApiNode apiRPCClient, err := rpc.NewRPCClient(&configs.APIConfig{ RPC: struct { diff --git a/internal/web/actions/default/ns/clusters/cluster/node/install.go b/internal/web/actions/default/ns/clusters/cluster/node/install.go index ce23c47d..6d437f03 100644 --- a/internal/web/actions/default/ns/clusters/cluster/node/install.go +++ b/internal/web/actions/default/ns/clusters/cluster/node/install.go @@ -73,7 +73,7 @@ func (this *InstallAction) RunGet(params struct { this.ErrorPage(err) return } - apiNodes := apiNodesResp.Nodes + apiNodes := apiNodesResp.ApiNodes apiEndpoints := []string{} for _, apiNode := range apiNodes { if !apiNode.IsOn { diff --git a/internal/web/actions/default/recover/updateHosts.go b/internal/web/actions/default/recover/updateHosts.go index bab3ffef..03d3b976 100644 --- a/internal/web/actions/default/recover/updateHosts.go +++ b/internal/web/actions/default/recover/updateHosts.go @@ -69,7 +69,7 @@ func (this *UpdateHostsAction) RunPost(params struct { this.Fail("获取API节点列表失败,错误信息:" + err.Error()) } var endpoints = []string{} - for _, node := range nodesResp.Nodes { + for _, node := range nodesResp.ApiNodes { if !node.IsOn { continue } @@ -144,7 +144,7 @@ func (this *UpdateHostsAction) RunPost(params struct { // 保存 _, err = client.APINodeRPC().UpdateAPINode(client.Context(0), &pb.UpdateAPINodeRequest{ - NodeId: node.Id, + ApiNodeId: node.Id, Name: node.Name, Description: node.Description, HttpJSON: node.HttpJSON, diff --git a/internal/web/actions/default/recover/validateApi.go b/internal/web/actions/default/recover/validateApi.go index 3ccfe13b..bfb926cc 100644 --- a/internal/web/actions/default/recover/validateApi.go +++ b/internal/web/actions/default/recover/validateApi.go @@ -64,7 +64,7 @@ func (this *ValidateApiAction) RunPost(params struct { this.Fail("获取API节点列表失败,错误信息:" + err.Error()) } var hosts = []string{} - for _, node := range nodesResp.Nodes { + for _, node := range nodesResp.ApiNodes { if !node.IsOn { continue } diff --git a/internal/web/actions/default/settings/authority/nodes/node/install.go b/internal/web/actions/default/settings/authority/nodes/node/install.go index 47f2675d..91ed23ca 100644 --- a/internal/web/actions/default/settings/authority/nodes/node/install.go +++ b/internal/web/actions/default/settings/authority/nodes/node/install.go @@ -43,7 +43,7 @@ func (this *InstallAction) RunGet(params struct { this.ErrorPage(err) return } - apiNodes := apiNodesResp.Nodes + apiNodes := apiNodesResp.ApiNodes apiEndpoints := []string{} for _, apiNode := range apiNodes { if !apiNode.IsOn { diff --git a/internal/web/actions/default/settings/monitor-nodes/node/install.go b/internal/web/actions/default/settings/monitor-nodes/node/install.go index a815528c..67748f39 100644 --- a/internal/web/actions/default/settings/monitor-nodes/node/install.go +++ b/internal/web/actions/default/settings/monitor-nodes/node/install.go @@ -43,7 +43,7 @@ func (this *InstallAction) RunGet(params struct { this.ErrorPage(err) return } - apiNodes := apiNodesResp.Nodes + apiNodes := apiNodesResp.ApiNodes apiEndpoints := []string{} for _, apiNode := range apiNodes { if !apiNode.IsOn { diff --git a/internal/web/actions/default/settings/user-nodes/node/install.go b/internal/web/actions/default/settings/user-nodes/node/install.go index bae78738..4ce8b8ce 100644 --- a/internal/web/actions/default/settings/user-nodes/node/install.go +++ b/internal/web/actions/default/settings/user-nodes/node/install.go @@ -43,7 +43,7 @@ func (this *InstallAction) RunGet(params struct { this.ErrorPage(err) return } - apiNodes := apiNodesResp.Nodes + apiNodes := apiNodesResp.ApiNodes apiEndpoints := []string{} for _, apiNode := range apiNodes { if !apiNode.IsOn {