diff --git a/src/Gateway/Entities/ClusterEntity.cs b/src/Gateway/Entities/ClusterEntity.cs index 1e139fb..3cdabde 100644 --- a/src/Gateway/Entities/ClusterEntity.cs +++ b/src/Gateway/Entities/ClusterEntity.cs @@ -14,6 +14,7 @@ public sealed class ClusterEntity : Entity /// 集群描述 /// public string? Description { get; set; } + [Column(MapType = typeof(string), StringLength = -1)] public List DestinationsEntities { get; set; } = new(); @@ -26,4 +27,9 @@ public sealed class DestinationsEntity public string Address { get; set; } public string? Host { get; set; } + + /// + /// 接受活动运行状况检查探测的端点。例如 http://127.0.0.1:1234 。 + /// + public string? Health { get; set; } } \ No newline at end of file diff --git a/src/Gateway/Services/GatewayService.cs b/src/Gateway/Services/GatewayService.cs index a567de9..0fe7853 100644 --- a/src/Gateway/Services/GatewayService.cs +++ b/src/Gateway/Services/GatewayService.cs @@ -36,8 +36,9 @@ public class GatewayService( foreach (var cluster in from item in clusters let items = item.DestinationsEntities.ToDictionary(entity => entity.Id, - entity => new DestinationConfig() { Address = entity.Address, Host = entity.Host, }) - select new ClusterConfig() + entity => new DestinationConfig + { Address = entity.Address, Host = entity.Host, Health = entity.Health }) + select new ClusterConfig { ClusterId = item.ClusterId, Destinations = items @@ -137,7 +138,7 @@ public class GatewayService( entity.MaxRequestBodySize = routeEntity.MaxRequestBodySize; entity.Path = routeEntity.Path; entity.Hosts = routeEntity.Hosts; - + await freeSql.Update().SetSource(entity).ExecuteAffrowsAsync(); return ResultDto.Success(); @@ -224,16 +225,16 @@ public class GatewayService( { var entity = await freeSql.Select().Where(x => x.ClusterId == clusterEntity.ClusterId) .FirstAsync(); - + if (entity == null) { return ResultDto.Error("集群Id不存在"); } - + entity.ClusterName = clusterEntity.ClusterName; entity.Description = clusterEntity.Description; entity.DestinationsEntities = clusterEntity.DestinationsEntities; - + await freeSql.Update().SetSource(entity).ExecuteAffrowsAsync(); return ResultDto.Success(); diff --git a/web/src/components/Cluster-Gateway.tsx b/web/src/components/Cluster-Gateway.tsx index 2b093e8..23ac0c1 100644 --- a/web/src/components/Cluster-Gateway.tsx +++ b/web/src/components/Cluster-Gateway.tsx @@ -65,7 +65,6 @@ export default function ClusterGateway({ activeKey }: IProps) { header={item.clusterName} itemKey={item.clusterId}> <> -
{item.description}
- 集群地址: - {item.destinationsEntities.map((x: DestinationsEntity) => { - return ({x.address}) +
集群列表
+ {item.destinationsEntities.map((x: DestinationsEntity, i: number) => { + return (
+ 集群地址:{x.address} + 集群health:{x.health} +
) })}
diff --git a/web/src/components/Create-Cluster.tsx b/web/src/components/Create-Cluster.tsx index 5d16d4a..af4995c 100644 --- a/web/src/components/Create-Cluster.tsx +++ b/web/src/components/Create-Cluster.tsx @@ -38,7 +38,7 @@ export default function CreateCluster({ visible, onCancel, onSusccess }: IProps) } return ( - +
+ +