Skip to content

Commit

Permalink
Fix #326 - Make fields disabled if builtin
Browse files Browse the repository at this point in the history
  • Loading branch information
kbeaugrand committed Feb 25, 2022
1 parent b1aef0d commit ed294fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
<MudCardActions Class="d-flex justify-center">
@if (imageDataUrl != null)
{
<MudButton OnClick="DeleteAvatar" Color="Color.Error">Delete Picture</MudButton>
<MudButton OnClick="DeleteAvatar" Color="Color.Error" Disabled="Model.IsBuiltin">Delete Picture</MudButton>
}
else
{
<InputFile id="fileInput" hidden accept=".jpg, .jpeg, .png" OnChange="UploadFiles" />
<MudButton HtmlTag="label" for="fileInput" Color="Color.Primary" StartIcon="@Icons.Filled.CloudUpload">Change Picture</MudButton>
<MudButton HtmlTag="label" for="fileInput" Color="Color.Primary" StartIcon="@Icons.Filled.CloudUpload" Disabled="Model.IsBuiltin">Change Picture</MudButton>
}
</MudCardActions>
</MudCard>
Expand All @@ -56,10 +56,10 @@
<MudCardContent>
<MudGrid>
<MudItem xs="12" md="6">
<MudTextField @bind-Value="@Model.Name" For="@(() => Model.Name)" Label="Name" Margin="Margin.Dense" Variant="Variant.Outlined" Required="true" />
<MudTextField @bind-Value="@Model.Name" For="@(() => Model.Name)" Label="Name" Margin="Margin.Dense" Variant="Variant.Outlined" Required="true" Disabled="Model.IsBuiltin" />
</MudItem>
<MudItem xs="12" md="6">
<MudTextField @bind-Value="@Model.Description" For="@(() => Model.Description)" Label="Description" Variant="Variant.Outlined" Lines="5" />
<MudTextField @bind-Value="@Model.Description" For="@(() => Model.Description)" Label="Description" Variant="Variant.Outlined" Lines="5" Disabled="Model.IsBuiltin" />
</MudItem>
</MudGrid>
</MudCardContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<MudCardContent>
<MudGrid>
<MudItem xs="12">
<MudTextField @bind-Value="@LoRaDeviceModel.AppEUI" Label="OTAA AppEUI" For="@(() => LoRaDeviceModel.AppEUI)" Margin="Margin.Dense" Variant="Variant.Outlined" Required="true"></MudTextField>
<MudTextField @bind-Value="@LoRaDeviceModel.AppEUI" Label="OTAA AppEUI" For="@(() => LoRaDeviceModel.AppEUI)" Margin="Margin.Dense" Variant="Variant.Outlined" Required="true" Disabled="LoRaDeviceModel.IsBuiltin"></MudTextField>
</MudItem>
<MudItem xs="12">
<MudTextField @bind-Value="@LoRaDeviceModel.SensorDecoderURL" Label="Sensor Decoder URL" For="@(() => LoRaDeviceModel.SensorDecoderURL)" Margin="Margin.Dense" Variant="Variant.Outlined"></MudTextField>
<MudTextField @bind-Value="@LoRaDeviceModel.SensorDecoderURL" Label="Sensor Decoder URL" For="@(() => LoRaDeviceModel.SensorDecoderURL)" Margin="Margin.Dense" Variant="Variant.Outlined" Disabled="LoRaDeviceModel.IsBuiltin"></MudTextField>
</MudItem>
<MudItem xs="12">
<MudTable Items="@Commands" Dense=true Hover=true Bordered=true Striped=true>
Expand All @@ -35,13 +35,13 @@
</HeaderContent>
<RowTemplate Context="CommandContext">
<MudTd DataLabel="Name" Style="word-break: break-all;">
<MudTextField @bind-Value="@CommandContext.Name" Label="Name" For="@(() => CommandContext.Name)" Margin="Margin.Dense" Variant="Variant.Outlined" Required="true"></MudTextField>
<MudTextField @bind-Value="@CommandContext.Name" Label="Name" For="@(() => CommandContext.Name)" Margin="Margin.Dense" Variant="Variant.Outlined" Required="true" Disabled="CommandContext.IsBuiltin"></MudTextField>
</MudTd>
<MudTd DataLabel="Frame" Style="word-break: break-all; ">
<MudTextField @bind-Value="@CommandContext.Frame" Label="Frame" For="@(() => CommandContext.Frame)" Margin="Margin.Dense" Variant="Variant.Outlined" Required="true"></MudTextField>
<MudTextField @bind-Value="@CommandContext.Frame" Label="Frame" For="@(() => CommandContext.Frame)" Margin="Margin.Dense" Variant="Variant.Outlined" Required="true" Disabled="CommandContext.IsBuiltin"></MudTextField>
</MudTd>
<MudTd DataLabel="Port" Style="text-align: center;">
<MudNumericField @bind-Value="@CommandContext.Port" Label="Port" For="@(() => CommandContext.Port)" Margin="Margin.Dense" Variant="Variant.Outlined"></MudNumericField>
<MudNumericField @bind-Value="@CommandContext.Port" Label="Port" For="@(() => CommandContext.Port)" Margin="Margin.Dense" Variant="Variant.Outlined" Disabled="CommandContext.IsBuiltin"></MudNumericField>
</MudTd>
<MudTd DataLabel="Delete" Style="text-align: center">
<MudIconButton Color="Color.Default" Icon="@Icons.Material.Filled.Delete" Size="Size.Medium" Disabled="@CommandContext.IsBuiltin" OnClick="@(() => DeleteCommand(CommandContext))"></MudIconButton>
Expand Down

0 comments on commit ed294fc

Please sign in to comment.