Skip to content

Commit

Permalink
feat(RESTPvValueComponent): use MudText instead of default text field
Browse files Browse the repository at this point in the history
  • Loading branch information
pkuehnel committed Jan 2, 2024
1 parent c3245ad commit dfc37c7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
19 changes: 11 additions & 8 deletions TeslaSolarCharger/Client/Components/RestPvValueComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,21 @@ else
<div class="mb-3">
@if (Headers.Count > 0)
{
<label class="col-5 col-sm-4 col-md-3 col-lg-2">Key:</label>
<label class="col-6 col-sm-6 col-md-3 col-lg-2">Value:</label>
<h4>Headers</h4>
}
@for (var i = 0; i < Headers.Count; i++)
{
var header = Headers.ElementAt(i);
<div>
<input class="col-5 col-sm-4 col-md-3 col-lg-2" value="@header.Key" type="text" id="@($"{IdPrefix}headerKey{i}")" name="headerKey"
@onchange="@(e => UpdateHeaderKey(header.Key, e.Value?.ToString() ?? string.Empty))">
<input class="col-6 col-sm-6 col-md-3 col-lg-2" value="@header.Value" type="text" id="@($"{IdPrefix}headerValue{i}")" name="headerValue"
@onchange="@(e => Headers[header.Key] = e.Value?.ToString() ?? string.Empty)">
<button type="button" class="btn btn-danger" @onclick="() => RemoveHeader(header.Key)">DEL</button>
<div class="d-flex align-items-center">
<div class="p-2 flex-grow-1">
<MudTextField T="string" Label="@($"Key {i + 1}")" Variant="Variant.Outlined" Value="@header.Key" TextChanged="@(e => UpdateHeaderKey(header.Key, e.ToString()))"></MudTextField>
</div>
<div class="p-2 flex-grow-1">
<MudTextField T="string" Label="@($"Value {i + 1}")" Variant="Variant.Outlined" Value="@header.Value" TextChanged="@(e => Headers[header.Key] = e.ToString())"></MudTextField>
</div>
<div class="p-2">
<MudFab StartIcon="@Icons.Material.Filled.Delete" Color="Color.Error" OnClick="() => RemoveHeader(header.Key)"></MudFab>
</div>
</div>
}
</div>
Expand Down
7 changes: 4 additions & 3 deletions TeslaSolarCharger/Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
var coreService = app.Services.GetRequiredService<ICoreService>();
coreService.LogVersion();

//Do nothing before these lines as database is created here.
var teslaSolarChargerContext = app.Services.GetRequiredService<ITeslaSolarChargerContext>();
await teslaSolarChargerContext.Database.MigrateAsync().ConfigureAwait(false);

var backendApiService = app.Services.GetRequiredService<IBackendApiService>();
await backendApiService.PostInstallationInformation("Startup").ConfigureAwait(false);

Expand All @@ -70,9 +74,6 @@
coreService.KillAllServices().GetAwaiter().GetResult();
});

var teslaSolarChargerContext = app.Services.GetRequiredService<ITeslaSolarChargerContext>();
await teslaSolarChargerContext.Database.MigrateAsync().ConfigureAwait(false);

var tscConfigurationService = app.Services.GetRequiredService<ITscConfigurationService>();
var installationId = await tscConfigurationService.GetInstallationId().ConfigureAwait(false);
logger.LogTrace("Installation Id: {installationId}", installationId);
Expand Down

0 comments on commit dfc37c7

Please sign in to comment.