Fix Disable edit server if the server is in a group

This commit is contained in:
ChsBuffer
2021-07-15 16:06:34 +08:00
parent 88f3a4940b
commit f8b1c4acd6
3 changed files with 10 additions and 14 deletions

View File

@@ -17,7 +17,7 @@ namespace Netch.Models
/// <summary>
/// 组
/// </summary>
public string Group { get; set; } = "None";
public string Group { get; set; } = Constants.DefaultGroup;
/// <summary>
/// 地址
@@ -62,18 +62,7 @@ namespace Netch.Models
{
var remark = string.IsNullOrWhiteSpace(Remark) ? $"{Hostname}:{Port}" : Remark;
if (Group.Equals("None") || Group.Equals(""))
Group = "NONE";
string shortName;
if (Type == string.Empty)
{
shortName = "WTF";
}
else
{
shortName = ServerHelper.GetUtilByTypeName(Type).ShortName;
}
var shortName = Type.IsNullOrEmpty() ? "WTF" : ServerHelper.GetUtilByTypeName(Type).ShortName;
return $"[{shortName}][{Group}] {remark}";
}
@@ -139,5 +128,10 @@ namespace Netch.Models
return false;
}
}
public static bool IsInGroup(this Server server)
{
return server.Group is not Constants.DefaultGroup;
}
}
}