Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi committed Nov 8, 2024
2 parents 65a3de0 + 9de018d commit f1b03c8
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@inherits AppComponentBase

<div>
<BitModal @bind-IsOpen="isOpen" FullSize>
<BitModal @bind-IsOpen="isOpen" FullSize Class="modal">
<BitStack FillContent Class="container">
<BitStack Horizontal AutoHeight VerticalAlign="BitAlignment.Center">
<BitText Typography="BitTypography.H3">Diagnostic</BitText>
Expand All @@ -13,6 +13,22 @@
IconName="@BitIconName.ChromeClose" />
</BitStack>

<BitAccordion Title="Telemetry Context">
<BitButton IconOnly
Color="BitColor.Info"
OnClick="CopyTelemetry"
Variant="BitVariant.Text"
IconName="@BitIconName.Copy" />
<BitScrollablePane>
<BitStack>
@foreach (var (key, value) in telemetryContext.ToDictionary())
{
<BitText NoWrap><b>@key</b>: @value</BitText>
}
</BitStack>
</BitScrollablePane>
</BitAccordion>

<BitStack Horizontal FitHeight Wrap>
<BitSearchBox Immediate DebounceTime="500" OnChange="HandleOnSearchChange" />
<BitDropdown FitWidth IsMultiSelect
Expand All @@ -31,7 +47,7 @@
Items="filteredLogs.Indexed().ToArray()">
<EmptyContent>Nothing to show!</EmptyContent>
<RowTemplate Context="logIndex">
<BitStack @key="logIndex.item.CreatedOn" Horizontal AutoHeight Gap="0">
<BitStack @key="logIndex.item.CreatedOn" Horizontal AutoHeight Gap="0" VerticalAlign="BitAlignment.Center">
<BitText Style="min-width:7rem">@($"{logIndex.index + 1}. [{logIndex.item.CreatedOn.ToString("HH:mm:ss")}]")</BitText>
<BitButton IconOnly
Title="Copy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public partial class DiagnosticModal : IDisposable


[AutoInject] private Clipboard clipboard = default!;
[AutoInject] private ITelemetryContext telemetryContext = default!;


protected override Task OnInitAsync()
Expand Down Expand Up @@ -75,6 +76,11 @@ private void FilterLogs()
}
}

private async Task CopyTelemetry()
{
await clipboard.WriteText(string.Join(Environment.NewLine, telemetryContext.ToDictionary().Select(c => $"{c.Key}: {c.Value}")));
}

private async Task CopyException(DiagnosticLog log)
{
var stateToCopy = string.Join(Environment.NewLine, log.State?.Select(i => $"{i.Key}: {i.Value}") ?? []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ section {
}

::deep {
.modal {
width: unset;
top: var(--app-inset-top);
left: var(--app-inset-left);
right: var(--app-inset-right);
bottom: var(--app-inset-bottom);
}

.container {
padding: 1rem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ protected override async Task OnInitializedAsync()
SetCurrentUrl();
currentTheme = await themeService.GetCurrentTheme();

await keyboard.Add(ButilKeyCodes.KeyX, OpenDiagnosticModal, ButilModifiers.Ctrl | ButilModifiers.Shift);
await base.OnInitializedAsync();
}
catch (Exception exp)
Expand All @@ -75,6 +74,16 @@ protected override void OnParametersSet()
base.OnParametersSet();
}

protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await keyboard.Add(ButilKeyCodes.KeyX, OpenDiagnosticModal, ButilModifiers.Ctrl | ButilModifiers.Shift);
}

await base.OnAfterRenderAsync(firstRender);
}


private async void AuthenticationStateChanged(Task<AuthenticationState> task)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@inherits AppComponentBase

<BitSnackBar @ref="snackbarRef" AutoDismiss Multiline
AutoDismissTime="TimeSpan.FromSeconds(10)"
Style="bottom:calc(var(--app-inset-bottom) + var(--bit-spa-scaling-factor))" />
<BitSnackBar @ref="snackbarRef"
Multiline
AutoDismiss
Class="snackbar"
AutoDismissTime="TimeSpan.FromSeconds(10)" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.snackbar {
bottom: calc(var(--app-inset-bottom) + var(--bit-spa-scaling-factor));
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class AppTelemetryContext : ITelemetryContext

public string? Culture { get; set; } = CultureInfo.CurrentCulture.Name;

public string? Environment { get; set; } = AppEnvironment.Current;

//#if (signalr == true)
public bool IsOnline { get; set; }
//#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public static ITelemetryContext? Current
public string? TimeZone { get; set; }
public string? Culture { get; set; }

public string? Environment { get; set; }

//#if (signalr == true)
public bool IsOnline { get; set; }
//#endif
Expand All @@ -58,6 +60,7 @@ public static ITelemetryContext? Current
{ nameof(UserAgent), UserAgent },
{ nameof(TimeZone), TimeZone },
{ nameof(Culture), Culture },
{ nameof(Environment), Environment },
//#if (signalr == true)
{ nameof(IsOnline), IsOnline }
//#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
@import '../Styles/abstracts/_media-queries.scss';

:root[bit-theme="dark"] {
//--bit-clr-bg-pri: #010409;
// In case you need to change the background color, make sure to also update ThemeColors.cs's PrimaryDarkBgColor accordingly.
}

:root {
--app-inset-top: env(safe-area-inset-top);
--app-inset-left: env(safe-area-inset-left);
Expand All @@ -22,11 +27,6 @@
}
}

:root[bit-theme="dark"] {
//--bit-clr-bg-pri: #010409;
// In case you need to change the background color, make sure to also update ThemeColors.cs's PrimaryDarkBgColor accordingly.
}

* {
box-sizing: border-box;
font-family: "Segoe UI";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
</ItemGroup>

<ItemGroup>

<Using Include="Microsoft.AspNetCore.Components.WebView.Maui" />
<Using Include="Boilerplate.Client.Core.Components.Layout" />
<Using Include="Boilerplate.Client.Core.Components.Pages" />
Expand Down Expand Up @@ -161,7 +161,7 @@
<PackageReference Condition=" '$(notification)' == 'true' OR '$(notification)' == ''" Include="Plugin.LocalNotification" />
<!--/-:msbuild-conditional:noEmit -->
</ItemGroup>

<Target Name="BeforeBuildTasks" AfterTargets="CoreCompile">
<Error Text="Enable long paths in Windows. https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell#enable-long-paths-in-windows-10-version-1607-and-later" Condition=" $([MSBuild]::IsOSPlatform('windows')) AND $([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem', 'LongPathsEnabled', null, RegistryView.Registry64)) != '1' " />
<CallTarget Targets="BuildCssFiles" />
Expand All @@ -171,4 +171,11 @@
<Exec Command="../Boilerplate.Client.Core/node_modules/.bin/sass .:. --style compressed --load-path=. --silence-deprecation=import" StandardOutputImportance="high" StandardErrorImportance="high" LogStandardErrorAsError="true" />
</Target>

<!-- https://github.com/dotnet/runtime/issues/104599 -->
<Target Name="_FixAndroidAotInputs" DependsOnTargets="_AndroidAotInputs" BeforeTargets="_AndroidAotCompilation">
<ItemGroup Condition="$(EnableLLVM)">
<_AndroidAotInputs Remove="$(IntermediateLinkDir)**\System.Net.Sockets.dll" />
</ItemGroup>
</Target>

</Project>

0 comments on commit f1b03c8

Please sign in to comment.