Skip to content

Commit

Permalink
Fix Failed Tests + All tests for the update and the Get Deployment Done
Browse files Browse the repository at this point in the history
  • Loading branch information
ssgueye2 committed May 25, 2023
1 parent ea56b3e commit 7cd6b86
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
@using AzureIoTHub.Portal.Shared.Models.v10
@using AzureIoTHub.Portal.Client.Validators
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
@using AzureIoTHub.Portal.Shared.Constants


@attribute [Authorize]
@inject NavigationManager NavigationManager
@inject IEdgeModelClientService EdgeModelService
@inject ISnackbar Snackbar
@inject IDialogService DialogService
@inject PortalSettings Portal

<MudTooltip Text="Return" Placement="Placement.Left">
<MudFab StartIcon="@Icons.Material.Outlined.ArrowBack" Color="Color.Secondary" Size="Size.Small" OnClick="Return" id="returnButton" />
Expand Down Expand Up @@ -69,44 +72,46 @@
</MudExpansionPanel>
</MudItem>
</MudGrid>

<MudGrid>
<MudItem xs="12">
<MudExpansionPanel Text="System Modules" IsInitiallyExpanded="true">
<TitleContent><MudText Typo="Typo.h6">System Modules</MudText></TitleContent>
<ChildContent>
<MudItem xs="12">
<MudTable Items="EdgeModel.SystemModules" Dense=true Hover=true Bordered=true Striped=true Elevation=0>
<ColGroup>
<col style="width: 15%;" />
<col style="width: 50%;" />
<col style="width: 10%;" />
</ColGroup>

<HeaderContent>
<MudTh Style="text-align: center">Module name</MudTh>
<MudTh Style="text-align: center">Image URI</MudTh>
<MudTh Style="text-align: center">Detail</MudTh>
</HeaderContent>

<RowTemplate Context="sysModule">
<MudTd DataLabel="System module Name" Style="word-break: break-all;">
<MudTextField id=@nameof(EdgeModelSystemModule.Name) @bind-Value="@sysModule.Name" Margin="Margin.Dense" Label="Module name" For="@(() => sysModule.Name )" Variant="Variant.Outlined" Disabled />
</MudTd>
<MudTd DataLabel="System module Image URI" Style="word-break: break-all;">
<MudTextField id=@nameof(EdgeModelSystemModule.ImageUri) @bind-Value="@sysModule.ImageUri" Margin="Margin.Dense" Label="Image URI" For="@(() => sysModule.ImageUri )" Variant="Variant.Outlined" />
</MudTd>
<MudTd DataLabel="See detail" Style="text-align: center;">
<MudButton Variant="Variant.Filled" id="@("editSystModuleButton_"+sysModule.Name)" OnClick="@(async () => await ShowSystemModuleDetail(sysModule))">Detail</MudButton>
</MudTd>
</RowTemplate>
</MudTable>
</MudItem>
</ChildContent>
</MudExpansionPanel>
</MudItem>
</MudGrid>

@if (Portal.CloudProvider.Equals(CloudProviders.Azure))
{
<MudGrid>
<MudItem xs="12">
<MudExpansionPanel Text="System Modules" IsInitiallyExpanded="true">
<TitleContent><MudText Typo="Typo.h6">System Modules</MudText></TitleContent>
<ChildContent>
<MudItem xs="12">
<MudTable Items="EdgeModel.SystemModules" Dense=true Hover=true Bordered=true Striped=true Elevation=0>
<ColGroup>
<col style="width: 15%;" />
<col style="width: 50%;" />
<col style="width: 10%;" />
</ColGroup>

<HeaderContent>
<MudTh Style="text-align: center">Module name</MudTh>
<MudTh Style="text-align: center">Image URI</MudTh>
<MudTh Style="text-align: center">Detail</MudTh>
</HeaderContent>

<RowTemplate Context="sysModule">
<MudTd DataLabel="System module Name" Style="word-break: break-all;">
<MudTextField id=@nameof(EdgeModelSystemModule.Name) @bind-Value="@sysModule.Name" Margin="Margin.Dense" Label="Module name" For="@(() => sysModule.Name )" Variant="Variant.Outlined" Disabled />
</MudTd>
<MudTd DataLabel="System module Image URI" Style="word-break: break-all;">
<MudTextField id=@nameof(EdgeModelSystemModule.ImageUri) @bind-Value="@sysModule.ImageUri" Margin="Margin.Dense" Label="Image URI" For="@(() => sysModule.ImageUri )" Variant="Variant.Outlined" />
</MudTd>
<MudTd DataLabel="See detail" Style="text-align: center;">
<MudButton Variant="Variant.Filled" id="@("editSystModuleButton_"+sysModule.Name)" OnClick="@(async () => await ShowSystemModuleDetail(sysModule))">Detail</MudButton>
</MudTd>
</RowTemplate>
</MudTable>
</MudItem>
</ChildContent>
</MudExpansionPanel>
</MudItem>
</MudGrid>
}

<MudGrid>
<MudItem xs="12">
<MudExpansionPanel Text="Modules" IsInitiallyExpanded="true">
Expand Down Expand Up @@ -149,55 +154,57 @@
</MudExpansionPanel>
</MudItem>
</MudGrid>

<MudGrid>
<MudItem xs="12">
<MudExpansionPanel Text="Routes" IsInitiallyExpanded="true">
<TitleContent><MudText Typo="Typo.h6">Routes</MudText></TitleContent>
<ChildContent>
<MudItem xs="12">
<MudTable Items="@EdgeModel.EdgeRoutes" Dense=true Hover=true Bordered=true Striped=true Elevation=0>
<ColGroup>
<col style="width: 20%;" />
<col style="width: 20%;" />
<col style="width: 10%;" />
<col style="width: 10%;" />
<col style="width: 5%;" />
</ColGroup>
<HeaderContent>
<MudTh Style="text-align: center">Name</MudTh>
<MudTh Style="text-align: center">Value</MudTh>
<MudTh Style="text-align: center">Priority</MudTh>
<MudTh Style="text-align: center">Time To Live (Secs)</MudTh>
<MudTh Style="text-align: center">Delete</MudTh>
</HeaderContent>
<RowTemplate Context="RouteContext">
<MudTd DataLabel="Name" Style="word-break: break-all;">
<MudTextField id="@(nameof(IoTEdgeRoute.Name))" @bind-Value="@RouteContext.Name" Margin="Margin.Dense" Label="Name" For="@(() => RouteContext.Name )" Variant="Variant.Outlined" Required="true"></MudTextField>
</MudTd>
<MudTd DataLabel="Value" Style="word-break: break-all;">
<MudTextField id="@(nameof(IoTEdgeRoute.Value))" @bind-Value="@RouteContext.Value" Margin="Margin.Dense" Label="Value" For="@(() => RouteContext.Value )" Variant="Variant.Outlined" Required="true" />
</MudTd>
<MudTd DataLabel="Priority" Style="text-align: center;">
<MudNumericField @bind-Value="@RouteContext.Priority" Label="Priority" For="@(() => RouteContext.Priority)" Variant="Variant.Outlined"></MudNumericField>
</MudTd>
<MudTd DataLabel="Time To Live (Secs)" Style="text-align: center;">
<MudNumericField @bind-Value="@RouteContext.TimeToLive" Label="TTL" For="@(() => RouteContext.TimeToLive)" Variant="Variant.Outlined"></MudNumericField>
</MudTd>
<MudTd DataLabel="Delete" Style="text-align: center">
<MudIconButton Color="Color.Default" Class="deleteRouteButton" OnClick="( () => DeleteRoute(RouteContext))" Icon="@Icons.Material.Filled.Delete" Size="Size.Medium"></MudIconButton>
</MudTd>
</RowTemplate>
<FooterContent>
<MudButton StartIcon="@Icons.Material.Filled.Add" Size="Size.Medium" id="addRouteButton" OnClick="AddRoute" Color="Color.Success">Add new route</MudButton>
</FooterContent>
</MudTable>
</MudItem>
</ChildContent>
</MudExpansionPanel>
</MudItem>
</MudGrid>

@if (Portal.CloudProvider.Equals(CloudProviders.Azure))
{
<MudGrid>
<MudItem xs="12">
<MudExpansionPanel Text="Routes" IsInitiallyExpanded="true">
<TitleContent><MudText Typo="Typo.h6">Routes</MudText></TitleContent>
<ChildContent>
<MudItem xs="12">
<MudTable Items="@EdgeModel.EdgeRoutes" Dense=true Hover=true Bordered=true Striped=true Elevation=0>
<ColGroup>
<col style="width: 20%;" />
<col style="width: 20%;" />
<col style="width: 10%;" />
<col style="width: 10%;" />
<col style="width: 5%;" />
</ColGroup>
<HeaderContent>
<MudTh Style="text-align: center">Name</MudTh>
<MudTh Style="text-align: center">Value</MudTh>
<MudTh Style="text-align: center">Priority</MudTh>
<MudTh Style="text-align: center">Time To Live (Secs)</MudTh>
<MudTh Style="text-align: center">Delete</MudTh>
</HeaderContent>
<RowTemplate Context="RouteContext">
<MudTd DataLabel="Name" Style="word-break: break-all;">
<MudTextField id="@(nameof(IoTEdgeRoute.Name))" @bind-Value="@RouteContext.Name" Margin="Margin.Dense" Label="Name" For="@(() => RouteContext.Name )" Variant="Variant.Outlined" Required="true"></MudTextField>
</MudTd>
<MudTd DataLabel="Value" Style="word-break: break-all;">
<MudTextField id="@(nameof(IoTEdgeRoute.Value))" @bind-Value="@RouteContext.Value" Margin="Margin.Dense" Label="Value" For="@(() => RouteContext.Value )" Variant="Variant.Outlined" Required="true" />
</MudTd>
<MudTd DataLabel="Priority" Style="text-align: center;">
<MudNumericField @bind-Value="@RouteContext.Priority" Label="Priority" For="@(() => RouteContext.Priority)" Variant="Variant.Outlined"></MudNumericField>
</MudTd>
<MudTd DataLabel="Time To Live (Secs)" Style="text-align: center;">
<MudNumericField @bind-Value="@RouteContext.TimeToLive" Label="TTL" For="@(() => RouteContext.TimeToLive)" Variant="Variant.Outlined"></MudNumericField>
</MudTd>
<MudTd DataLabel="Delete" Style="text-align: center">
<MudIconButton Color="Color.Default" Class="deleteRouteButton" OnClick="( () => DeleteRoute(RouteContext))" Icon="@Icons.Material.Filled.Delete" Size="Size.Medium"></MudIconButton>
</MudTd>
</RowTemplate>
<FooterContent>
<MudButton StartIcon="@Icons.Material.Filled.Add" Size="Size.Medium" id="addRouteButton" OnClick="AddRoute" Color="Color.Success">Add new route</MudButton>
</FooterContent>
</MudTable>
</MudItem>
</ChildContent>
</MudExpansionPanel>
</MudItem>
</MudGrid>
}

<MudGrid>
<MudItem xs="12">
<MudExpansionPanel Text="Labels">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@
id=@nameof(IoTEdgeModule.Version)
Label="Version Number"
Variant="Variant.Outlined"
For="@(() => Module.Version)" />
For="@(() => Module.Version)"
Required="true"/>
</MudItem>
<MudItem xs="12">
<MudAlert Severity="Severity.Warning">The Version should be incremented when updating the component</MudAlert>
</MudItem>
}

Expand Down Expand Up @@ -87,7 +91,7 @@
private string currentModuleName = default!;
private string currentImageUri = default!;
private string currentContainerCreateOptions = default!;
private string currentNumVersion = default!;
private string currentNumVersion = "1.0.0";

private List<IoTEdgeModuleEnvironmentVariable> currentEnvironmentVariables = new();
private List<IoTEdgeModuleTwinSetting> currentModuleIdentityTwinSettings = new();
Expand All @@ -103,7 +107,7 @@
currentModuleName = Module.ModuleName;
currentImageUri = Module.ImageURI;
currentContainerCreateOptions = Module.ContainerCreateOptions;
currentNumVersion = "1.0.0";
currentNumVersion = Module.Version;
currentEnvironmentVariables = new List<IoTEdgeModuleEnvironmentVariable>(Module.EnvironmentVariables.ToArray());
currentModuleIdentityTwinSettings = new List<IoTEdgeModuleTwinSetting>(Module.ModuleIdentityTwinSettings.ToArray());
currentCommands = new List<IoTEdgeModuleCommand>(Module.Commands.ToArray());
Expand Down
1 change: 1 addition & 0 deletions src/AzureIoTHub.Portal.Shared/Models/v1.0/IoTEdgeModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class IoTEdgeModule
/// </summary>
public List<IoTEdgeModuleCommand> Commands { get; set; } = new List<IoTEdgeModuleCommand>();

[Required(ErrorMessage = "The component version is required.")]
public string Version { get; set; } = default!;
}
}
Loading

0 comments on commit 7cd6b86

Please sign in to comment.