|
15 | 15 | </TitleContent> |
16 | 16 | <DialogContent> |
17 | 17 | <MudForm @ref="form"> |
18 | | - @foreach (var condition in Rule.Conditions) |
19 | | - { |
20 | | - <ConditionForm Condition="condition" |
21 | | - OnDelete="@(() => RemoveCondition(condition))" /> |
22 | | - } |
23 | | - |
24 | | - <MudStack AlignItems="AlignItems.Start" Row> |
25 | | - <MudMenu Disabled="@(!CanAddCondition)" AnchorOrigin="Origin.BottomCenter" Class="mb-4"> |
26 | | - <ActivatorContent> |
27 | | - <MudTooltip Disabled="@(AllowedConditionTypes.Any())" Text="This protocol does not support rule conditions."> |
28 | | - <MudButton Disabled="@(!CanAddCondition)" Variant="Variant.Outlined" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Add"> |
29 | | - Add condition |
30 | | - </MudButton> |
31 | | - </MudTooltip> |
32 | | - </ActivatorContent> |
33 | | - <ChildContent> |
34 | | - @foreach (var type in AvailableConditionTypes) |
35 | | - { |
36 | | - <MudMenuItem OnClick="@(() => AddCondition(type))">@type.GetDescription()</MudMenuItem> |
37 | | - } |
38 | | - </ChildContent> |
39 | | - </MudMenu> |
40 | | - </MudStack> |
41 | | - <MudNumericField T="int" @bind-Value="Rule.Priority" Label="Priority" Variant="Variant.Outlined" HideSpinButtons="true" Required="true" Class="mb-4" /> |
42 | | - |
43 | | - <MudSelect T="RuleActionType" @bind-Value="Rule.Action.Type" Label="Action" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter" Required="true" Class="mb-4"> |
44 | | - @foreach (var type in AllowedActionTypes) |
45 | | - { |
46 | | - <MudSelectItem T="RuleActionType" Value="@type">@type.GetDescription()</MudSelectItem> |
47 | | - } |
48 | | - </MudSelect> |
49 | | - |
50 | | - @if (Rule.Action?.Type == RuleActionType.Forward) |
51 | | - { |
52 | | - <MudSelect T="Guid?" @bind-Value="SelectedTargetGroup" Label="Target group" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter" Required="true"> |
53 | | - @foreach (var group in TargetGroups) |
54 | | - { |
55 | | - <MudSelectItem T="Guid?" Value="@group.Id">@group.Name</MudSelectItem> |
56 | | - } |
57 | | - </MudSelect> |
58 | | - } |
59 | | - else if (Rule.Action?.Type == RuleActionType.Redirect) |
60 | | - { |
61 | | - <MudTextField T="string" @bind-Value="Rule.Action.RedirectUrl" Label="Redirect URL" Variant="Variant.Outlined" Required="true" Class="mb-4" /> |
62 | | - <MudNumericField T="int?" @bind-Value="Rule.Action.RedirectStatusCode" Label="Redirect status code" Variant="Variant.Outlined" HideSpinButtons="true" Required="true" /> |
63 | | - } |
64 | | - else if (Rule.Action?.Type == RuleActionType.FixedResponse) |
65 | | - { |
66 | | - <MudNumericField T="int?" @bind-Value="Rule.Action.FixedResponseStatusCode" Label="Response status code" Variant="Variant.Outlined" HideSpinButtons="true" Required="true" Class="mb-4" /> |
67 | | - <MudTextField T="string" @bind-Value="Rule.Action.FixedResponseContentType" Label="Content type" Variant="Variant.Outlined" Class="mb-4" /> |
68 | | - <MudTextField T="string" @bind-Value="Rule.Action.FixedResponseBody" Label="Response body" Variant="Variant.Outlined" Lines="3" /> |
69 | | - } |
| 18 | + <MudGrid Spacing="3"> |
| 19 | + <MudItem xs="12"> |
| 20 | + <MudCard Outlined="true"> |
| 21 | + <MudCardHeader> |
| 22 | + <CardHeaderContent> |
| 23 | + <MudText Typo="Typo.subtitle1"><strong>Details</strong></MudText> |
| 24 | + </CardHeaderContent> |
| 25 | + </MudCardHeader> |
| 26 | + <MudCardContent> |
| 27 | + <MudNumericField T="int" @bind-Value="Rule.Priority" Label="Priority" Variant="Variant.Outlined" |
| 28 | + HideSpinButtons="true" Required="true" Class="mb-4" /> |
| 29 | + </MudCardContent> |
| 30 | + </MudCard> |
| 31 | + </MudItem> |
| 32 | + |
| 33 | + <MudItem xs="12"> |
| 34 | + <MudCard Outlined="true"> |
| 35 | + <MudCardHeader> |
| 36 | + <CardHeaderContent> |
| 37 | + <MudText Typo="Typo.subtitle1"><strong>Conditions</strong></MudText> |
| 38 | + </CardHeaderContent> |
| 39 | + </MudCardHeader> |
| 40 | + <MudCardContent> |
| 41 | + @foreach (var condition in Rule.Conditions) |
| 42 | + { |
| 43 | + <ConditionForm Condition="condition" |
| 44 | + OnDelete="@(() => RemoveCondition(condition))" /> |
| 45 | + } |
| 46 | + |
| 47 | + <MudStack AlignItems="AlignItems.Start" Row> |
| 48 | + <MudMenu Disabled="@(!CanAddCondition)" AnchorOrigin="Origin.BottomCenter" Class="mb-4"> |
| 49 | + <ActivatorContent> |
| 50 | + <MudTooltip Disabled="@(AllowedConditionTypes.Any())" Text="This protocol does not support rule conditions."> |
| 51 | + <MudButton Disabled="@(!CanAddCondition)" Variant="Variant.Outlined" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Add"> |
| 52 | + Add condition |
| 53 | + </MudButton> |
| 54 | + </MudTooltip> |
| 55 | + </ActivatorContent> |
| 56 | + <ChildContent> |
| 57 | + @foreach (var type in AvailableConditionTypes) |
| 58 | + { |
| 59 | + <MudMenuItem OnClick="@(() => AddCondition(type))">@type.GetDescription()</MudMenuItem> |
| 60 | + } |
| 61 | + </ChildContent> |
| 62 | + </MudMenu> |
| 63 | + </MudStack> |
| 64 | + </MudCardContent> |
| 65 | + </MudCard> |
| 66 | + </MudItem> |
| 67 | + |
| 68 | + <MudItem xs="12"> |
| 69 | + <MudCard Outlined="true"> |
| 70 | + <MudCardHeader> |
| 71 | + <CardHeaderContent> |
| 72 | + <MudText Typo="Typo.subtitle1"><strong>Action</strong></MudText> |
| 73 | + </CardHeaderContent> |
| 74 | + </MudCardHeader> |
| 75 | + <MudCardContent> |
| 76 | + <MudSelect T="RuleActionType" @bind-Value="Rule.Action.Type" Label="Action" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter" Required="true" Class="mb-4"> |
| 77 | + @foreach (var type in AllowedActionTypes) |
| 78 | + { |
| 79 | + <MudSelectItem T="RuleActionType" Value="@type">@type.GetDescription()</MudSelectItem> |
| 80 | + } |
| 81 | + </MudSelect> |
| 82 | + |
| 83 | + @if (Rule.Action?.Type == RuleActionType.Forward) |
| 84 | + { |
| 85 | + <MudSelect T="Guid?" @bind-Value="SelectedTargetGroup" Label="Target group" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter" Required="true"> |
| 86 | + @foreach (var group in TargetGroups) |
| 87 | + { |
| 88 | + <MudSelectItem T="Guid?" Value="@group.Id">@group.Name</MudSelectItem> |
| 89 | + } |
| 90 | + </MudSelect> |
| 91 | + } |
| 92 | + else if (Rule.Action?.Type == RuleActionType.Redirect) |
| 93 | + { |
| 94 | + <MudTextField T="string" @bind-Value="Rule.Action.RedirectUrl" Label="Redirect URL" Variant="Variant.Outlined" Required="true" Class="mb-4" /> |
| 95 | + <MudNumericField T="int?" @bind-Value="Rule.Action.RedirectStatusCode" Label="Redirect status code" Variant="Variant.Outlined" HideSpinButtons="true" Required="true" /> |
| 96 | + } |
| 97 | + else if (Rule.Action?.Type == RuleActionType.FixedResponse) |
| 98 | + { |
| 99 | + <MudNumericField T="int?" @bind-Value="Rule.Action.FixedResponseStatusCode" Label="Response status code" Variant="Variant.Outlined" HideSpinButtons="true" Required="true" Class="mb-4" /> |
| 100 | + <MudTextField T="string" @bind-Value="Rule.Action.FixedResponseContentType" Label="Content type" Variant="Variant.Outlined" Class="mb-4" /> |
| 101 | + <MudTextField T="string" @bind-Value="Rule.Action.FixedResponseBody" Label="Response body" Variant="Variant.Outlined" Lines="3" /> |
| 102 | + } |
| 103 | + </MudCardContent> |
| 104 | + </MudCard> |
| 105 | + </MudItem> |
| 106 | + </MudGrid> |
70 | 107 | </MudForm> |
71 | 108 | </DialogContent> |
72 | 109 | <DialogActions> |
|
0 commit comments