mirror of
https://github.com/netchx/netch.git
synced 2026-04-01 19:15:09 +08:00
Fix Disable edit server if the server is in a group
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
public const string OutputTemplate = @"[{Timestamp:yyyy-MM-dd HH:mm:ss}][{Level}] {Message:lj}{NewLine}{Exception}";
|
||||
public const string EOF = "\r\n";
|
||||
|
||||
public const string DefaultGroup = "NONE";
|
||||
|
||||
public static class Parameter
|
||||
{
|
||||
public const string Show = "-show";
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Netch.Forms
|
||||
AddSaveButton();
|
||||
i18N.TranslateForm(this);
|
||||
|
||||
ConfigurationGroupBox.Enabled = string.IsNullOrEmpty(Server.Remark);
|
||||
ConfigurationGroupBox.Enabled = !Server.IsInGroup();
|
||||
|
||||
ConfigurationGroupBox.ResumeLayout(false);
|
||||
ConfigurationGroupBox.PerformLayout();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user