-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic Functionalities work, filtering, Acknowledging, displaying.
pls try it out, perfomance issues, when too many msgs incoming
- Loading branch information
1 parent
12a64ce
commit c78f998
Showing
11 changed files
with
267 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
...Core.Blazor/TcoDiagnosticsAlternative/Helper/DateTimePicker/DateTimePickerComponent.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<div class="d-flex"> | ||
@if (UseNative) | ||
{ | ||
<input type="date" class="form-control w-auto d-inline" @bind-value="@Date" disabled="@IsDisabled" /> | ||
<TimePickerComponent @bind-SecondOfDay="SecondOfDay" UseNativeTimePicker="@UseNative" IsDisabled="IsDisabled" /> | ||
} | ||
else | ||
{ | ||
<input type="datetime-local" class="form-control w-auto d-inline" value="@(DateAndTime.ToString("yyyy-MM-ddTHH:mm"))" disabled="@IsDisabled" | ||
@onchange="async (e) => | ||
{ | ||
var dateString = e.Value.ToString(); | ||
if(!string.IsNullOrEmpty(dateString)) | ||
{ | ||
DateAndTime = DateTime.Parse(dateString); | ||
} | ||
else | ||
{ | ||
DateAndTime = new DateTime(2022, 01, 01, 12, 0, 0); | ||
} | ||
await NotifyChanged(); | ||
}" | ||
/> | ||
|
||
} | ||
</div> | ||
|
||
@code { | ||
|
||
[Parameter] | ||
public DateTime DateAndTime | ||
{ | ||
get; set; | ||
} | ||
|
||
[Parameter] | ||
public EventCallback<DateTime> DateAndTimeChanged | ||
{ | ||
get; set; | ||
} | ||
|
||
[Parameter] | ||
public bool IsDisabled | ||
{ | ||
get; set; | ||
} | ||
|
||
[Parameter] | ||
public bool UseNative | ||
{ | ||
get; set; | ||
} | ||
|
||
private DateTime Date | ||
{ | ||
get | ||
{ | ||
return DateAndTime.Date; | ||
} | ||
set | ||
{ | ||
DateAndTime = value.AddSeconds(SecondOfDay); | ||
_ = NotifyChanged(); | ||
} | ||
} | ||
|
||
private int SecondOfDay | ||
{ | ||
get | ||
{ | ||
return DateAndTime.Hour * 3600 + DateAndTime.Minute * 60; | ||
} | ||
set | ||
{ | ||
DateAndTime = DateAndTime.Date.AddSeconds(value); | ||
_ = NotifyChanged(); | ||
} | ||
} | ||
|
||
private Task NotifyChanged() | ||
{ | ||
return DateAndTimeChanged.InvokeAsync(DateAndTime); | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
....TcoCore.Blazor/TcoDiagnosticsAlternative/Helper/DateTimePicker/TimePickerComponent.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
@using Microsoft.AspNetCore.Components; | ||
|
||
@if (UseNativeTimePicker) | ||
{ | ||
<input type="time" value="@(new DateTime(2000, 1, 1).AddSeconds(SecondOfDay).ToString("HH:mm"))" | ||
class="form-control w-auto d-inline" disabled="@IsDisabled" | ||
@onchange="async (e) => | ||
{ | ||
var time = Convert.ToDateTime(e.Value); | ||
Hour = time.Hour; | ||
Minute = time.Minute; | ||
await NotifyChanged(); | ||
}" /> | ||
} | ||
else | ||
{ | ||
<select @onchange="async (e) => | ||
{ | ||
Hour = Convert.ToInt32(e.Value); | ||
await NotifyChanged(); | ||
}" @attributes="InputAttributes" disabled="@IsDisabled"> | ||
@foreach (var hour in Enumerable.Range(0, 24)) | ||
{ | ||
<option value="@hour" selected="@(hour == Hour)">@hour.ToString("00")</option> | ||
} | ||
</select> | ||
<span class="pl-0">:</span> | ||
<select @onchange="async (e) => | ||
{ | ||
Minute = Convert.ToInt32(e.Value); | ||
await NotifyChanged(); | ||
}" @attributes="InputAttributes" disabled="@IsDisabled"> | ||
|
||
@foreach (var minute in Enumerable.Range(0, 60)) | ||
{ | ||
<option value="@minute" selected="@(minute == Minute)">@(minute.ToString("00"))</option> | ||
} | ||
</select> | ||
} | ||
|
||
@code { | ||
[Parameter] | ||
public int SecondOfDay | ||
{ | ||
get | ||
{ | ||
return Hour * 3600 + Minute * 60; | ||
} | ||
|
||
set | ||
{ | ||
Hour = value / 3600; | ||
Minute = (value % 3600) / 60; | ||
} | ||
} | ||
|
||
[Parameter] | ||
public EventCallback<int> SecondOfDayChanged | ||
{ | ||
get; set; | ||
} | ||
|
||
[Parameter] | ||
public bool UseNativeTimePicker | ||
{ | ||
get; set; | ||
} | ||
|
||
[Parameter] | ||
public bool IsDisabled | ||
{ | ||
get; set; | ||
} | ||
|
||
public int Hour | ||
{ | ||
get; set; | ||
} | ||
|
||
public int Minute | ||
{ | ||
get; set; | ||
} | ||
|
||
private Task NotifyChanged() | ||
{ | ||
return SecondOfDayChanged.InvokeAsync(SecondOfDay); | ||
} | ||
|
||
public Dictionary<string, object> InputAttributes | ||
{ | ||
get; set; | ||
} = | ||
new Dictionary<string, object>() | ||
{ | ||
{ "class", "form-control w-auto d-inline" } | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.