Skip to content

Commit

Permalink
remove udeless code
Browse files Browse the repository at this point in the history
  • Loading branch information
Sben65 committed Aug 19, 2022
1 parent e4c10c5 commit 5dd1877
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void ClickOnSaveChangesShouldUpdateTheData()

_ = this.mockSnackbarService
.Setup(c => c.Add($"Edge model successfully updated.", Severity.Success, null))
.Returns((Snackbar)null);
.Returns(value: null);

var cut = RenderComponent<EdgeModelDetailPage>(ComponentParameter.CreateParameter("ModelID", this.mockEdgeModleId));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,20 @@
<col style="width: 5%;" />
</ColGroup>
<HeaderContent>
<MudTh Style="text-align: center">Module Name</MudTh>
<MudTh Style="text-align: center">Module name</MudTh>
<MudTh Style="text-align: center">Image URI</MudTh>
<MudTh Style="text-align: center">See detail</MudTh>
<MudTh Style="text-align: center">Delete</MudTh>
</HeaderContent>
<RowTemplate Context="moduleContext">
<MudTd DataLabel="module Name" Style="word-break: break-all;">
<MudTextField id="@(nameof(IoTEdgeModule.ModuleName))" @bind-Value="@moduleContext.ModuleName" Margin="Margin.Dense" Label="Name" For="@(() => moduleContext.ModuleName )" Variant="Variant.Outlined" Required="true"></MudTextField>
<MudTextField id="@(nameof(IoTEdgeModule.ModuleName))" @bind-Value="@moduleContext.ModuleName" Margin="Margin.Dense" Label="Module name" For="@(() => moduleContext.ModuleName )" Variant="Variant.Outlined" Required="true"></MudTextField>
</MudTd>
<MudTd DataLabel="module Image URI" Style="word-break: break-all;">
<MudTextField id="@(nameof(IoTEdgeModule.ImageURI))" @bind-Value="@moduleContext.ImageURI" Margin="Margin.Dense" Label="ImageURI" For="@(() => moduleContext.ImageURI )" Variant="Variant.Outlined" Required="true" />
<MudTextField id="@(nameof(IoTEdgeModule.ImageURI))" @bind-Value="@moduleContext.ImageURI" Margin="Margin.Dense" Label="Image URI" For="@(() => moduleContext.ImageURI )" Variant="Variant.Outlined" Required="true" />
</MudTd>
<MudTd DataLabel="See detail" Style="text-align: center;">
<MudButton Variant="Variant.Filled" id="editButton" OnClick="@(async () => await ShowAddEdgeModuleDialog(moduleContext))">Edit</MudButton>
<MudButton Variant="Variant.Filled" id="editButton" OnClick="@(async () => await ShowAddEdgeModuleDialog(moduleContext))">Detail</MudButton>
</MudTd>
<MudTd DataLabel="Delete" Style="text-align: center">
<MudIconButton Class="deleteModuleButton" Color="Color.Default" Icon="@Icons.Material.Filled.Delete" Size="Size.Medium" OnClick="@(() => DeleteModule(moduleContext))"></MudIconButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,20 @@
<col style="width: 5%;" />
</ColGroup>
<HeaderContent>
<MudTh Style="text-align: center">Module Name</MudTh>
<MudTh Style="text-align: center">Image uri</MudTh>
<MudTh Style="text-align: center">Module name</MudTh>
<MudTh Style="text-align: center">Image URI</MudTh>
<MudTh Style="text-align: center">See detail</MudTh>
<MudTh Style="text-align: center">Delete</MudTh>
</HeaderContent>
<RowTemplate Context="ModuleContext">
<MudTd DataLabel="Module Name" Style="word-break: break-all;">
<MudTextField id="@(nameof(IoTEdgeModule.ModuleName))" @bind-Value="@ModuleContext.ModuleName" Margin="Margin.Dense" Label="Name" For="@(() => ModuleContext.ModuleName )" Variant="Variant.Outlined" Required="true"></MudTextField>
<MudTextField id="@(nameof(IoTEdgeModule.ModuleName))" @bind-Value="@ModuleContext.ModuleName" Margin="Margin.Dense" Label="Module name" For="@(() => ModuleContext.ModuleName )" Variant="Variant.Outlined" Required="true"></MudTextField>
</MudTd>
<MudTd DataLabel="Image Uri" Style="word-break: break-all;">
<MudTextField id="@(nameof(IoTEdgeModule.ImageURI))" @bind-Value="@ModuleContext.ImageURI" Margin="Margin.Dense" Label="ImageURI" For="@(() => ModuleContext.ImageURI )" Variant="Variant.Outlined" Required="true" />
<MudTextField id="@(nameof(IoTEdgeModule.ImageURI))" @bind-Value="@ModuleContext.ImageURI" Margin="Margin.Dense" Label="Image URI" For="@(() => ModuleContext.ImageURI )" Variant="Variant.Outlined" Required="true" />
</MudTd>
<MudTd DataLabel="See detail" Style="text-align: center;">
<MudButton Variant="Variant.Filled" id="editButton" OnClick="(async () => await ShowEditEdgeModuleDialog(ModuleContext))">Edit</MudButton>
<MudButton Variant="Variant.Filled" id="editButton" OnClick="(async () => await ShowEditEdgeModuleDialog(ModuleContext))">Detail</MudButton>
</MudTd>
<MudTd DataLabel="Delete" Style="text-align: center">
<MudIconButton Color="Color.Default" Class="deleteModuleButton" OnClick="( () => DeleteModule(ModuleContext))" Icon="@Icons.Material.Filled.Delete" Size="Size.Medium"></MudIconButton>
Expand Down Expand Up @@ -245,7 +245,7 @@
var parameters = new DialogParameters();
parameters.Add("module", module);

DialogOptions options = new DialogOptions() { MaxWidth = MaxWidth.Medium, FullWidth = true, CloseButton = true };
DialogOptions options = new DialogOptions() { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true };

if (!string.IsNullOrWhiteSpace(module.ModuleName))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<MudItem xs="12" md="6">
<MudTextField @bind-Value="@currentModuleName"
id=@nameof(IoTEdgeModule.ModuleName)
Label="Module Name"
Label="Module name"
Variant="Variant.Outlined"
For="@(()=> Module.ModuleName)"
Required="true" />
Expand Down
4 changes: 2 additions & 2 deletions src/AzureIoTHub.Portal/Server/Helpers/ConfigHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ public static Dictionary<string, IDictionary<string, object>> GenerateModulesCon
var configModule = new ConfigModule
{
Type = "docker",
Status = module.Status,
Status = "running",
Settings = new ModuleSettings()
{
Image = module.ImageURI
},
Version = module.Version,
Version = "1.0",
RestarPolicy = "always",
EnvironmentVariables = new Dictionary<string, EnvironmentVariable>()
};
Expand Down
10 changes: 0 additions & 10 deletions src/AzureIoTHub.Portal/Server/Services/ConfigService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,6 @@ public async Task<List<IoTEdgeModule>> GetConfigModuleList(string modelId)
moduleList.Add(newModule);
}
}

// Adds system modules to the list of modules
//if (modObject.TryGetValue("systemModules", out var systemModulesToken))
//{
// foreach (var sm in systemModulesToken.Values<JProperty>())
// {
// var newModule = ConfigHelper.CreateGatewayModule(config, sm);
// moduleList.Add(newModule);
// }
//}
}

return moduleList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ namespace AzureIoTHub.Portal.Shared.Models.v10.IoTEdgeModule

public class ConfigModule
{
[JsonProperty(PropertyName = "settings")]
public ModuleSettings Settings { get; set; }

[JsonProperty(PropertyName = "type")]
public string Type { get; set; }

[JsonProperty(PropertyName = "env")]
public IDictionary<string, EnvironmentVariable>? EnvironmentVariables { get; set; }

[JsonProperty(PropertyName = "status")]
public string? Status { get; set; }

[JsonProperty(PropertyName = "restarPolicy")]
public string? RestarPolicy { get; set; }

public string? Version { get; set; }
Expand All @@ -29,14 +33,11 @@ public ConfigModule()

public class ModuleSettings
{
[JsonProperty(PropertyName = "image")]
public string Image { get; set; }

[JsonProperty(PropertyName = "createOptions")]
public string CreateOptions { get; set; }

public ModuleSettings()
{
CreateOptions = "{ }";
}
}

public class EnvironmentVariable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ namespace AzureIoTHub.Portal.Shared.Models.v10.IoTEdgeModule

public class EdgeAgentPropertiesDesired
{
[JsonProperty(PropertyName = "modules")]
public IDictionary<string, ConfigModule> Modules { get; set; }

[JsonProperty(PropertyName = "runtime")]
public Runtime Runtime { get; set; }

[JsonProperty(PropertyName = "shemaVersion")]
public string SchemaVersion { get; set; }

[JsonProperty(PropertyName = "systemModules")]
public SystemModules SystemModules { get; set; }

public EdgeAgentPropertiesDesired()
Expand All @@ -27,8 +31,10 @@ public EdgeAgentPropertiesDesired()

public class Runtime
{
[JsonProperty(PropertyName = "settings")]
public RuntimeSettings Settings { get; set; }

[JsonProperty(PropertyName = "type")]
public string Type { get; set; }

public Runtime()
Expand All @@ -40,6 +46,7 @@ public Runtime()

public class RuntimeSettings
{
[JsonProperty(PropertyName = "minDockerVersion")]
public string MinDockerVersion { get; set; }

public RuntimeSettings()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
namespace AzureIoTHub.Portal.Shared.Models.v10.IoTEdgeModule
{
using System.Collections.Generic;
using Newtonsoft.Json;

public class EdgeHubPropertiesDesired
{
[JsonProperty(PropertyName = "routes")]
public IDictionary<string, object> Routes { get; set; }

[JsonProperty(PropertyName = "shemaVersion")]
public string SchemaVersion { get; set; }

[JsonProperty(PropertyName = "storeAndForwardConfiguration")]
public StoreAndForwardConfiguration StoreAndForwardConfiguration { get; set; }

public EdgeHubPropertiesDesired()
Expand All @@ -23,6 +27,7 @@ public EdgeHubPropertiesDesired()

public class StoreAndForwardConfiguration
{
[JsonProperty(PropertyName = "timeToLiveSecs")]
public int TimeToLiveSecs { get; set; }

public StoreAndForwardConfiguration()
Expand Down

0 comments on commit 5dd1877

Please sign in to comment.