Compare commits
No commits in common. "8ed185299fb69b22c0e614bc47cc51a21b17d347" and "89c5f76797e13ac4fa27b99c2440a056722d20b3" have entirely different histories.
8ed185299f
...
89c5f76797
|
|
@ -51,13 +51,13 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
//}
|
//}
|
||||||
componentUpdateService.CallRequestRefresh();
|
componentUpdateService.CallRequestRefresh();
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|
||||||
//throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnAfterRender(bool firstRender)
|
protected override void OnAfterRender(bool firstRender)
|
||||||
{
|
{
|
||||||
base.OnAfterRender(firstRender);
|
base.OnAfterRender(firstRender);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleAuthComponent(Microsoft.AspNetCore.Components.Web.MouseEventArgs e)
|
private void ToggleAuthComponent(Microsoft.AspNetCore.Components.Web.MouseEventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,9 @@
|
||||||
@using TIAM.Models.Dtos.Users
|
@using TIAM.Models.Dtos.Users
|
||||||
@using TIAMWebApp.Shared.Application.Interfaces
|
@using TIAMWebApp.Shared.Application.Interfaces
|
||||||
@using TIAMWebApp.Shared.Application.Utility
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
@using AyCode.Services.Loggers
|
@inject IUserDataService NwindDataService
|
||||||
@using TIAM.Core.Loggers
|
|
||||||
@inject IServiceProviderDataService serviceProviderDataService
|
@inject IServiceProviderDataService serviceProviderDataService
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject BrowserConsoleLogWriter BrowserConsoleLogWriter
|
||||||
|
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
UserProductMapping
|
UserProductMapping
|
||||||
|
|
@ -67,11 +66,8 @@
|
||||||
|
|
||||||
public UserModelDtoDetail UserInfo;
|
public UserModelDtoDetail UserInfo;
|
||||||
|
|
||||||
ILogger _logger;
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<UserGrid_MasterDetail_NestedGrid_ServiceProviders>(LogWriters.ToArray());
|
|
||||||
|
|
||||||
//get userproductmappings by customer id
|
//get userproductmappings by customer id
|
||||||
if (Customer.ServiceProviders == null)
|
if (Customer.ServiceProviders == null)
|
||||||
|
|
@ -80,7 +76,7 @@
|
||||||
DetailGridData = Customer.ServiceProviders;
|
DetailGridData = Customer.ServiceProviders;
|
||||||
|
|
||||||
AvailableServices = await serviceProviderDataService.GetServiceProvidersAsync();
|
AvailableServices = await serviceProviderDataService.GetServiceProvidersAsync();
|
||||||
_logger.Info($"DetailGridData: {DetailGridData.Count}");
|
BrowserConsoleLogWriter.Info($"DetailGridData: {DetailGridData.Count}");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
|
@ -100,10 +96,10 @@
|
||||||
{
|
{
|
||||||
if (e.IsNew)
|
if (e.IsNew)
|
||||||
//add new orderData to orderData array
|
//add new orderData to orderData array
|
||||||
_logger.Info("New orderData added");
|
BrowserConsoleLogWriter.Info("New orderData added");
|
||||||
//await NwindDataService.InsertEmployeeAsync((EditableEmployee)e.EditModel);
|
//await NwindDataService.InsertEmployeeAsync((EditableEmployee)e.EditModel);
|
||||||
else
|
else
|
||||||
_logger.Info("orderData updated");
|
BrowserConsoleLogWriter.Info("orderData updated");
|
||||||
|
|
||||||
//await NwindDataService.UpdateEmployeeAsync((EditableEmployee)e.DataItem, (EditableEmployee)e.EditModel);
|
//await NwindDataService.UpdateEmployeeAsync((EditableEmployee)e.DataItem, (EditableEmployee)e.EditModel);
|
||||||
|
|
||||||
|
|
@ -113,14 +109,14 @@
|
||||||
{
|
{
|
||||||
//await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem);
|
//await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem);
|
||||||
//remove orderData from orderData array
|
//remove orderData from orderData array
|
||||||
_logger.Info("orderData deleted");
|
BrowserConsoleLogWriter.Info("orderData deleted");
|
||||||
//await UpdateDataAsync();
|
//await UpdateDataAsync();
|
||||||
}
|
}
|
||||||
async Task UpdateDataAsync()
|
async Task UpdateDataAsync()
|
||||||
{
|
{
|
||||||
//DataSource = await NwindDataService.GetEmployeesEditableAsync();
|
//DataSource = await NwindDataService.GetEmployeesEditableAsync();
|
||||||
//refresh grid
|
//refresh grid
|
||||||
_logger.Info("orderData grid refreshed");
|
BrowserConsoleLogWriter.Info("orderData grid refreshed");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -13,7 +13,7 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private Exception? _currentError;
|
private Exception _currentError;
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public EventCallback<Exception> OnError { get; set; }
|
public EventCallback<Exception> OnError { get; set; }
|
||||||
|
|
@ -21,8 +21,11 @@ else
|
||||||
protected override Task OnErrorAsync(Exception exception)
|
protected override Task OnErrorAsync(Exception exception)
|
||||||
{
|
{
|
||||||
_currentError = exception;
|
_currentError = exception;
|
||||||
|
if (OnError.HasDelegate)
|
||||||
return OnError.HasDelegate ? OnError.InvokeAsync(exception) : base.OnErrorAsync(exception);
|
{
|
||||||
|
return OnError.InvokeAsync(exception);
|
||||||
|
}
|
||||||
|
return base.OnErrorAsync(exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
@using AyCode.Core.Extensions
|
|
||||||
@using AyCode.Interfaces.StorageHandlers;
|
@using AyCode.Interfaces.StorageHandlers;
|
||||||
@using AyCode.Services.Loggers
|
@using AyCode.Services.Loggers
|
||||||
@using Newtonsoft.Json;
|
@using Newtonsoft.Json;
|
||||||
|
|
@ -11,10 +10,7 @@
|
||||||
@using TIAMWebApp.Shared.Application.Models;
|
@using TIAMWebApp.Shared.Application.Models;
|
||||||
@using TIAMWebApp.Shared.Application.Utility;
|
@using TIAMWebApp.Shared.Application.Utility;
|
||||||
@using System.IdentityModel.Tokens.Jwt;
|
@using System.IdentityModel.Tokens.Jwt;
|
||||||
@using System.Runtime.CompilerServices
|
|
||||||
@using TIAM.Core.Loggers;
|
@using TIAM.Core.Loggers;
|
||||||
@using System.Diagnostics
|
|
||||||
@using AyCode.Utils.Extensions
|
|
||||||
@inject NavigationManager NavManager
|
@inject NavigationManager NavManager
|
||||||
@inject IJSRuntime jsRuntime
|
@inject IJSRuntime jsRuntime
|
||||||
@inject ISecureStorageHandler SecureStorageHandler
|
@inject ISecureStorageHandler SecureStorageHandler
|
||||||
|
|
@ -53,50 +49,28 @@
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private ILogger _logger;
|
|
||||||
|
|
||||||
public PopupMessageBox PopupMessageBox { get; private set; } = default!;
|
public PopupMessageBox PopupMessageBox { get; private set; } = default!;
|
||||||
|
ILogger _logger;
|
||||||
|
|
||||||
|
|
||||||
protected override void OnInitialized()
|
private void HandleError(Exception exception)
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<MainLayout>(LogWriters.ToArray());
|
|
||||||
|
|
||||||
base.OnInitialized();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleError(Exception exception)//, [CallerMemberName] string? memberName = null)
|
|
||||||
{
|
|
||||||
exception.GetCategoryAndMemberNameFromStackTraceString(out var memberName, out var categoryName);
|
|
||||||
|
|
||||||
if (memberName.IsNullOrWhiteSpace()) memberName = "..."; //ne "HandleError" memberName-el logoljunk! - J.
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.Error($"An error occurred: {exception.Message}", exception, categoryName, memberName);
|
|
||||||
}
|
|
||||||
catch (Exception loggerException)
|
|
||||||
{
|
|
||||||
jsRuntime.InvokeVoidAsync("console.error", $"{nameof(MainLayout)}->HandleError; Logger error! {loggerException.Message}");
|
|
||||||
|
|
||||||
jsRuntime.InvokeVoidAsync("console.error", $"{nameof(MainLayout)}->{memberName}; An error occurred: {exception.Message}");
|
|
||||||
jsRuntime.InvokeVoidAsync("console.warn", $"{nameof(MainLayout)}->{memberName}; Error details: {exception.StackTrace}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log the error to server
|
// Log the error to server
|
||||||
//LogErrorToServer(exception);
|
LogErrorToServer(exception);
|
||||||
|
|
||||||
// Show a notification on UI
|
// Show a notification on UI
|
||||||
ShowErrorNotification("An unexpected error occurred. Please try again later.");
|
ShowErrorNotification("An unexpected error occurred. Please try again later.");
|
||||||
|
|
||||||
//jsRuntime.InvokeVoidAsync("console.error", $"An error occurred: {exception.Message}");
|
jsRuntime.InvokeVoidAsync("console.error", $"An error occurred: {exception.Message}");
|
||||||
//jsRuntime.InvokeVoidAsync("console.warn", $"Error details: {exception.StackTrace}");
|
jsRuntime.InvokeVoidAsync("console.warn", $"Error details: {exception.StackTrace}");
|
||||||
|
_logger.Info($"An error occurred: {exception.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void LogErrorToServer(Exception exception)
|
private void LogErrorToServer(Exception exception)
|
||||||
// {
|
{
|
||||||
// //_logger.Error($"An error occurred: {exception.Message}");
|
//_logger.Error($"An error occurred: {exception.Message}");
|
||||||
// }
|
}
|
||||||
|
|
||||||
private void ShowErrorNotification(string message)
|
private void ShowErrorNotification(string message)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
using AyCode.Core.Loggers;
|
using AyCode.Interfaces.StorageHandlers;
|
||||||
using AyCode.Interfaces.StorageHandlers;
|
|
||||||
using Microsoft.JSInterop;
|
using Microsoft.JSInterop;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
using AyCode.Services.Loggers;
|
|
||||||
using TIAM.Core.Loggers;
|
|
||||||
using TIAM.Database.DataLayers.Users;
|
using TIAM.Database.DataLayers.Users;
|
||||||
using TIAM.Entities.Products;
|
using TIAM.Entities.Products;
|
||||||
using TIAM.Entities.ServiceProviders;
|
using TIAM.Entities.ServiceProviders;
|
||||||
|
|
@ -21,14 +18,16 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
{
|
{
|
||||||
private readonly HttpClient http;
|
private readonly HttpClient http;
|
||||||
private readonly ISecureStorageHandler secureStorageHandler;
|
private readonly ISecureStorageHandler secureStorageHandler;
|
||||||
private readonly ILogger _logger;
|
private readonly IJSRuntime jsRuntime;
|
||||||
|
private readonly BrowserConsoleLogWriter _browserConsoleLogWriter;
|
||||||
|
|
||||||
|
|
||||||
public ServiceProviderDataService(HttpClient http, ISecureStorageHandler secureStorageHandler, IEnumerable<IAcLogWriterClientBase> logWriters)
|
public ServiceProviderDataService(HttpClient http, ISecureStorageHandler secureStorageHandler, IJSRuntime jSRuntime)
|
||||||
{
|
{
|
||||||
this.http = http;
|
this.http = http;
|
||||||
this.secureStorageHandler = secureStorageHandler;
|
this.secureStorageHandler = secureStorageHandler;
|
||||||
_logger = new LoggerClient<ServiceProviderDataService>(logWriters.ToArray());
|
this.jsRuntime = jSRuntime;
|
||||||
|
this._browserConsoleLogWriter = new BrowserConsoleLogWriter(jsRuntime);
|
||||||
}
|
}
|
||||||
|
|
||||||
//22.
|
//22.
|
||||||
|
|
@ -75,7 +74,7 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
var result = await response.Content.ReadFromJsonAsync<Dictionary<Guid, string>>();
|
var result = await response.Content.ReadFromJsonAsync<Dictionary<Guid, string>>();
|
||||||
_logger.Debug(result.FirstOrDefault().Value);
|
_browserConsoleLogWriter.Info(result.FirstOrDefault().Value);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -124,7 +123,7 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
var result = await response.Content.ReadAsStringAsync();
|
var result = await response.Content.ReadAsStringAsync();
|
||||||
_logger.Debug("SKBitmap width: " + result);
|
_browserConsoleLogWriter.Info("SKBitmap width: " + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -140,9 +139,8 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
var result = await response.Content.ReadAsStringAsync();
|
var result = await response.Content.ReadAsStringAsync();
|
||||||
//_logger.Detail("Json: " + result);
|
_browserConsoleLogWriter.Info("Json: " + result);
|
||||||
var data = JsonConvert.DeserializeObject<IEnumerable<Product>>(result);
|
var data = JsonConvert.DeserializeObject<IEnumerable<Product>>(result);
|
||||||
|
|
||||||
if (data != null)
|
if (data != null)
|
||||||
{
|
{
|
||||||
return data;
|
return data;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
using AyCode.Core.Enums;
|
using System.Globalization;
|
||||||
|
using AyCode.Core.Consts;
|
||||||
|
using AyCode.Core.Enums;
|
||||||
using AyCode.Core.Loggers;
|
using AyCode.Core.Loggers;
|
||||||
using AyCode.Services.Loggers;
|
using AyCode.Services.Loggers;
|
||||||
using Microsoft.JSInterop;
|
using Microsoft.JSInterop;
|
||||||
|
using TIAMWebApp.Shared.Application.Models.ClientSide;
|
||||||
|
|
||||||
namespace TIAMWebApp.Shared.Application.Utility;
|
namespace TIAMWebApp.Shared.Application.Utility;
|
||||||
|
|
||||||
|
|
@ -18,25 +21,19 @@ public class BrowserConsoleLogWriter : AcTextLogWriterBase, IAcLogWriterClientBa
|
||||||
{
|
{
|
||||||
private readonly IJSRuntime _jsRuntime;
|
private readonly IJSRuntime _jsRuntime;
|
||||||
|
|
||||||
private readonly Dictionary<LogLevel, string> _invokeConsoleNames = new()
|
//public BrowserConsoleLogWriter() : base(AppType.Web, LogLevel.Debug)
|
||||||
{
|
//{
|
||||||
[LogLevel.Detail] = "console.info", //trace
|
// _jsRuntime = Services.GetRequiredService<IJSRuntime>();
|
||||||
[LogLevel.Trace] = "console.info",
|
//}
|
||||||
[LogLevel.Debug] = "console.info",
|
|
||||||
[LogLevel.Info] = "console.info",
|
|
||||||
[LogLevel.Suggest] = "console.info",
|
|
||||||
[LogLevel.Warning] = "console.warn",
|
|
||||||
[LogLevel.Error] = "console.error"
|
|
||||||
};
|
|
||||||
|
|
||||||
public BrowserConsoleLogWriter(IJSRuntime jsRuntime) : base(AppType.Web, LogLevel.Info)
|
public BrowserConsoleLogWriter(IJSRuntime jsRuntime) : base(AppType.Web, LogLevel.Debug)
|
||||||
{
|
{
|
||||||
_jsRuntime = jsRuntime;
|
_jsRuntime = jsRuntime;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void WriteText(string? logText, LogLevel logLevel)
|
protected override void WriteText(string? logText, LogLevel logLevel)
|
||||||
{
|
{
|
||||||
_jsRuntime.InvokeVoidAsync(_invokeConsoleNames[logLevel], logText);
|
_jsRuntime.InvokeVoidAsync("console.log", logText);
|
||||||
}
|
}
|
||||||
|
|
||||||
//public void Info(string message)
|
//public void Info(string message)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue