Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue31 #39

Merged
merged 4 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/AzureIoTHub.Portal/Client/Pages/Gateways/Add.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<MudSelectItem Style="width:300px" Value="@("lora")">Lora</MudSelectItem>
<MudSelectItem Value="@("unknow")">Unknow</MudSelectItem>
</MudSelect>
<MudSelect Style="width:300px" Class="add-dialog-input" @bind-Value="gateway.Environement" Placeholder="Please Select the environement" OffsetY="true" AdornmentColor="Color.Primary">
<MudSelect Style="width:300px" Class="add-dialog-input" @bind-Value="gateway.Environment" Placeholder="Please Select the environement" OffsetY="true" AdornmentColor="Color.Primary">
<MudSelectItem Value="@("dev")">Développement</MudSelectItem>
<MudSelectItem Value="@("prod")">Production</MudSelectItem>
<MudSelectItem Value="@("indus")">Industrie</MudSelectItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ else
<MudText>Environement :</MudText>
</MudItem>
<MudItem xs="12" sm="10" md="4">
<MudTextField @bind-Value="@gateway.Environement" Margin="Margin.Dense" Class="custom-disabled" ReadOnly="true" Variant="Variant.Outlined"></MudTextField>
<MudTextField @bind-Value="@gateway.Environment" Margin="Margin.Dense" Class="custom-disabled" ReadOnly="true" Variant="Variant.Outlined"></MudTextField>

<MudSelect T="string" Label="env" Variant="Variant.Outlined">
<MudSelectItem Value="@("Dev")">Dévelopement</MudSelectItem>
Expand Down
11 changes: 9 additions & 2 deletions src/AzureIoTHub.Portal/Client/Pages/Gateways/Gateways.razor
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ else
{
<MudContainer MaxWidth="MaxWidth.False">
<MudGrid Class="search-panel">
<MudItem xs="12" md="6">
<MudItem xs="12">
<MudCard>
<MudCardHeader>
<CardHeaderContent>
Expand Down Expand Up @@ -77,6 +77,8 @@ else
</MudCard>
</MudItem>
</MudGrid>

@*lite des gateways*@
<MudGrid>
<MudItem xs="12">
<MudTable Items="@result" Dense=true Breakpoint="Breakpoint.Sm" Hover=true Bordered=true Striped=true Filter="new Func<GatewayListItem, bool>(FilterFunc)">
Expand Down Expand Up @@ -137,7 +139,7 @@ else
private int[] pageSizeOptions = new int[] { 2, 5, 10 };
DialogOptions maxWidth = new DialogOptions() { MaxWidth = MaxWidth.Small, FullWidth = true };

private SearchModel model = new SearchModel();
private SearchModel model = new SearchModel(null,"");

protected override async Task OnInitializedAsync()
{
Expand All @@ -158,6 +160,11 @@ else

private bool FilterFunc(GatewayListItem element)
{
if (element.Type == null)
{
element.Type = "unknow";
}

if (
(string.IsNullOrWhiteSpace(this.model.DeviceId) || element.DeviceId.Contains(model.DeviceId, StringComparison.OrdinalIgnoreCase))
&& (string.IsNullOrWhiteSpace(this.model.Type) || element.Type.Contains(model.Type, StringComparison.OrdinalIgnoreCase))
Expand Down
4 changes: 2 additions & 2 deletions src/AzureIoTHub.Portal/Client/wwwroot/scss/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
/*width: max-content;*/
/*padding: 5px;*/
/*margin-left: 25%;*/
justify-content: center;
margin-bottom: 15px;
/*justify-content: center;*/
/*margin-bottom: 15px;*/

/* .mud-grid-spacing-xs-3 {
display: contents;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public async Task<IActionResult> Get(string deviceId)
// SymmetricKey = DeviceHelper.RetrieveSymmetricKey(deviceTwin.DeviceId, this.devicesService.GetDpsAttestionMechanism().Result),
// We retrieve the values of tags
Type = DeviceHelper.RetrieveTagValue(deviceTwin, "purpose"),
Environement = DeviceHelper.RetrieveTagValue(deviceTwin, "env"),
Environment = DeviceHelper.RetrieveTagValue(deviceTwin, "env"),
// We retrieve the number of connected device
NbDevices = await this.RetrieveNbConnectedDevice(deviceTwin.DeviceId),
// récupération des informations sur le modules de la gateways²
Expand Down Expand Up @@ -152,7 +152,7 @@ public async Task<IActionResult> CreateGatewayAsync(Gateway gateway)
{
Twin deviceTwin = new (gateway.DeviceId);

deviceTwin.Tags["env"] = gateway.Environement;
deviceTwin.Tags["env"] = gateway.Environment;
deviceTwin.Tags["purpose"] = gateway.Type;

var result = await this.devicesService.CreateDeviceWithTwin(gateway.DeviceId, true, deviceTwin, DeviceStatus.Enabled);
Expand Down Expand Up @@ -191,7 +191,7 @@ public async Task<IActionResult> UpdateDeviceAsync(Gateway gateway)
device = await this.devicesService.UpdateDevice(device);

Twin deviceTwin = await this.devicesService.GetDeviceTwin(gateway.DeviceId);
deviceTwin.Tags["env"] = gateway.Environement;
deviceTwin.Tags["env"] = gateway.Environment;
deviceTwin = await this.devicesService.UpdateDeviceTwin(gateway.DeviceId, deviceTwin);

this.logger.LogInformation($"iot hub device was updated {device.Id}");
Expand Down
2 changes: 1 addition & 1 deletion src/AzureIoTHub.Portal/Shared/Models/Gateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class Gateway

public int NbModule { get; set; }

public string Environement { get; set; }
public string Environment { get; set; }

public ConfigItem LastDeployment { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/AzureIoTHub.Portal/Shared/Models/SearchModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SearchModel

public string Type { get; set; }

public SearchModel(string id = "", string status = "", string type = "")
public SearchModel(string id = null, string status = null, string type = null)
{
this.DeviceId = id;
this.Status = status;
Expand Down