Add rule type selection to routing rules (#8007)

* Add rule type selection to routing rules

* Use enum

---------

Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
This commit is contained in:
DHR60
2025-10-08 10:40:26 +08:00
committed by GitHub
co-authored by 2dust
parent 64c7fea2bc
commit 31b5b4ca0c
11 changed files with 82 additions and 15 deletions
@@ -21,6 +21,9 @@ public class RoutingRuleDetailsViewModel : MyReactiveObject
[Reactive]
public string Process { get; set; }
[Reactive]
public string? RuleType { get; set; }
[Reactive]
public bool AutoSort { get; set; }
@@ -51,6 +54,7 @@ public class RoutingRuleDetailsViewModel : MyReactiveObject
Domain = Utils.List2String(SelectedSource.Domain, true);
IP = Utils.List2String(SelectedSource.Ip, true);
Process = Utils.List2String(SelectedSource.Process, true);
RuleType = SelectedSource.RuleType?.ToString();
}
private async Task SaveRulesAsync()
@@ -73,6 +77,7 @@ public class RoutingRuleDetailsViewModel : MyReactiveObject
}
SelectedSource.Protocol = ProtocolItems?.ToList();
SelectedSource.InboundTag = InboundTagItems?.ToList();
SelectedSource.RuleType = RuleType.IsNullOrEmpty() ? null : (ERuleType)Enum.Parse(typeof(ERuleType), RuleType);
var hasRule = SelectedSource.Domain?.Count > 0
|| SelectedSource.Ip?.Count > 0