Bouton Actualiser

This commit is contained in:
Friend2868
2023-06-07 08:50:47 +02:00
parent 1028cbfb40
commit 14fa374bb7
5 changed files with 10 additions and 10 deletions
@@ -127,7 +127,7 @@
</Row> </Row>
<Row Padding="Padding.Is3"> <Row Padding="Padding.Is3">
<Column> <Column>
<Button Color="Color.Primary" Style="border-radius: 0px" Clicked="@(async () => await HandleRedraw())">Aktualisieren</Button> <Button Color="Color.Primary" Style="border-radius: 0px" Clicked="@(async () => await HandleRedraw())">Bouton Actualiser</Button>
<LineChart Height="Height.Is100" Width="Width.Is100" @ref="lineChart" TItem="double" /> <LineChart Height="Height.Is100" Width="Width.Is100" @ref="lineChart" TItem="double" />
</Column> </Column>
</Row> </Row>
@@ -64,9 +64,9 @@ public partial class Dashboard
double energyPrice = MainDatabaseContext.EnergyPriceChanges.OrderByDescending(e =>e.DateTime).FirstOrDefault()?.EnergyPrice ?? 0; double energyPrice = MainDatabaseContext.EnergyPriceChanges.OrderByDescending(e =>e.DateTime).FirstOrDefault()?.EnergyPrice ?? 0;
PrometheusDataWrapper? deviceData = (await promQueryer.Query($$"""sum(power{sensor=~"{{plugnames}}"})[1h:1m]"""))?.Data; PrometheusDataWrapper? deviceData = (await promQueryer.Query($$"""sum(power{sensor=~"{{plugnames}}"})[1h:1m]"""))?.Data;
PrometheusDataWrapper? priceData = (await promQueryer.Query($$"""sum(sum_over_time(power{sensor=~"{{plugnames}}"}[1y])*{{energyPrice}})"""))?.Data; //PrometheusDataWrapper? priceData = (await promQueryer.Query($$"""sum(sum_over_time(power{sensor=~"{{plugnames}}"}[1y])*{{energyPrice}})"""))?.Data;
Console.WriteLine(priceData.VectorTypeToTimestampFloatTuple()); //Console.WriteLine(priceData.VectorTypeToTimestampFloatTuple());
var r = new Random(DateTime.Now.Millisecond); var r = new Random(DateTime.Now.Millisecond);
@@ -92,7 +92,7 @@
Here you can change the name of your plug Here you can change the name of your plug
</Paragraph> </Paragraph>
</FieldLabel> </FieldLabel>
<TextEdit MaxLength="30" @bind-Text="@DeviceCopy.Name" Placeholder="Enter Name" /> <TextEdit MaxLength="20" @bind-Text="@DeviceCopy.Name" Placeholder="Enter Name" />
</Field> </Field>
<br /> <br />
<br /> <br />
@@ -171,8 +171,8 @@
{ {
if (hideButtonSettings) if (hideButtonSettings)
{ {
MainDatabaseContext.ChangeTracker.Clear();
MainDatabaseContext.EnergyPriceChanges.Add(new EnergyPriceChange(electricityPrice)); MainDatabaseContext.EnergyPriceChanges.Add(new EnergyPriceChange(electricityPrice));
await MainDatabaseContext.SaveChangesAsync(); await MainDatabaseContext.SaveChangesAsync();
} }
else if(DeviceCopy is not null && SelectedDevice is not null) else if(DeviceCopy is not null && SelectedDevice is not null)
@@ -27,8 +27,8 @@ public class UpdateService : IUpdateService
} }
} }
public DateTime FirstExecutionTime { get; } = DateTime.Now.AddSeconds(15); public DateTime FirstExecutionTime { get; } = DateTime.Now.AddSeconds(10);
public TimeSpan ExecutionRepeatDelay { get; } = TimeSpan.FromSeconds(15); public TimeSpan ExecutionRepeatDelay { get; } = TimeSpan.FromSeconds(1);
public async void Update() public async void Update()
{ {
@@ -1,6 +1,6 @@
global: global:
scrape_interval: 15s scrape_interval: 1s
evaluation_interval: 15s evaluation_interval: 1s
rule_files: rule_files:
# - "first.rules" # - "first.rules"