< Summary

Information
Class: UIBlazor.Components.Settings.MCPShemaProperties
Assembly: UIBlazor
File(s): /home/runner/work/InvAit/InvAit/UIBlazor/Components/Settings/MCPShemaProperties.razor
Tag: 71_26091983037
Line coverage
0%
Covered lines: 0
Uncovered lines: 25
Coverable lines: 25
Total lines: 60
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 32
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
BuildRenderTree(...)0%210140%
get_SchemaProperty()100%210%
get_Values()100%210%

File(s)

/home/runner/work/InvAit/InvAit/UIBlazor/Components/Settings/MCPShemaProperties.razor

#LineLine coverage
 01@if (SchemaProperty?.Properties != null)
 2{
 03    foreach (var property in SchemaProperty.Properties)
 4    {
 05        var key = property.Key;
 06        var value = property.Value;
 7
 08        if (!Values.ContainsKey(key))
 9        {
 010            Values[key] = null;
 11        }
 12
 013        var isReq = SchemaProperty.Required.Contains(key);
 014        var desc = value.Description;
 015        var placeholder = value.Type switch
 016        {
 017            "array" => $"array of {value.Items?.Type}",
 018            _ => value.Type
 019        };
 20
 21        <RadzenFormField Text="@desc" Variant="Variant.Outlined" AllowFloatingLabel="false" class="@(isReq ? "required" 
 22            <End>
 23                <RadzenLabel Text="@key" Style="padding-inline: 0.5em" />
 24            </End>
 25            <ChildContent>
 026                @if (value.Type == "number")
 27                {
 028                    <RadzenNumeric TValue="double?" Placeholder="@placeholder" ValueChanged="(v) => Values[key] = v" />
 29                }
 030                else if (value.Type == "integer")
 31                {
 032                    <RadzenNumeric TValue="int?" Placeholder="@placeholder" ValueChanged="(v) => Values[key] = v" />
 33                }
 034                else if (value.Type == "boolean")
 35                {
 36                    <RadzenStack Orientation="Orientation.Horizontal" Style="margin:0.5em;">
 037                        <RadzenSwitch ValueChanged="(v) => Values[key] = v" />
 38                    </RadzenStack>
 39                }
 040                else if (value.Type == "object" && value.Properties != null)
 41                {
 042                    var dict = new Dictionary<string, object?>();
 043                    Values[key] = dict;
 44                    <RadzenStack Gap="0.5em" Style="margin:0.5em;">
 45                        <MCPShemaProperties SchemaProperty="@value" Values="@dict" />
 46                    </RadzenStack>
 47                }
 48                else
 49                {
 050                    <RadzenTextBox Placeholder="@placeholder" ValueChanged="(v) => Values[key] = v" />
 51                }
 52            </ChildContent>
 53        </RadzenFormField>
 54    }
 55}
 56
 57@code {
 058    [Parameter] public JsonSchemaProperty? SchemaProperty { get; set; }
 059    [Parameter] public Dictionary<string, object?> Values { get; set; } = [];
 60}