Activities of "Leonardo.Willrich"

  • ABP Framework version: v4.3.0
  • UI type: Blazor
  • DB provider: EF Core

Hi,

The article below seems to be out-of-date. I am using the latest version 4.3.0 commercial license and I can't find the package .BasicTheme. Maybe that is only for the free template as commercial uses lepton themes.

Would you please review that and advise what I needs to be done to create a new theme copying an existing one bases on lepton package?

Article: https://community.abp.io/articles/creating-a-new-ui-theme-by-copying-the-basic-theme-for-blazor-ui-qaf5ho1b

I would like to go straightaway to the Login page and avoid that visual effect rendering Index page and then Login page, is that possible?

You cannot do this in the blazor front end, because in blazor applications, a refresh will reload the application(it will be slow). This solution should work: https://support.abp.io/QA/Questions/1152#answer-d2e834e0-4600-d3d0-eb47-39fbdb7edfc7

And:

Can you please try again to access https://avalancheocp.tvdinc.com/. I had stopped the server to do an update.

  • ABP Framework version: v4.3.0
  • UI type: Blazor
  • DB provider: EF Core

Hi,

Is there a way to have two different Startup pages, one for Tenant side (when user is logged as Tenant) and another one for Host side (when the user is logged as SaaS admin)?

I don't want to have the Home page, my main pages will be a different one.

How can I do that? I've tried to redirect from Index.razor, but the CurrentTenant.Id is always returning null.

public partial class Index
    {
        [Inject] public NavigationManager NavigationManager { get; set; }
        [Inject] ICurrentTenant CurrentTenant { get; set; }

        protected override void OnInitialized()
        {
            // https://support.abp.io/QA/Questions/1152/How-to-to-Login-page-when-accessing-the-app-and-after-logout
            // The CurrentUser.IsAuthenticated is not working properly, even if the user is logged, it redirects to login page
            
            if (!CurrentUser.IsAuthenticated)
            {
                Console.WriteLine("Redirecting to Login");
                NavigationManager.NavigateTo("/authentication/login");
            }
            
            // It doesn't work, CurrentTenantId is always Null
            /*
            if (CurrentTenant.Id.HasValue)
            {
                NavigationManager.NavigateTo("/outagereportmap");
            }
            else
            {
                NavigationManager.NavigateTo("/tenantactivity");
            }
            */
        }
    }

The issue with CurrentUser was fixed on version 4.3.0. In principle, it is working, however, the user not is redirect directly to the login page and it is rendering the Index page first and then navigating to the Login page. I would like to go straightaway to the Login page and avoid that visual effect rendering Index page and then Login page, is that possible? Access https://avalancheocp.tvdin.com and you will see what I am talking about.

When accessing the page, it is still redirecting to Index.razor. I'm waiting for the CurrentTenant.Id == null issue to be fixed to be able to test with the solution proposed on the first answer.

The solution above has worked partially. To redirect directly, I've just changed the return to be a Redirect. See the code below:

public override Task<IActionResult> OnGetAsync()
        {
            var blazorUrl = Configuration["App:BlazorUrl"];
            var selfUrl = Configuration["App:SelfUrl"];

            if (PostLogoutRedirectUri.StartsWith(blazorUrl))
            {
                PostLogoutRedirectUri = $"{selfUrl}/account/login?returnUrl={blazorUrl}";
                SignOutIframeUrl = null;
            }

            return Task.FromResult<IActionResult>(Redirect(PostLogoutRedirectUri));
            //return base.OnGetAsync();
        }

That worked, thank you! Do you have the reference for the documentation of that? PrincipalAncessor and Claims?

Hi @maliming,

Sorry, your answer it not 100% clear for me. I don't have the Volo.Abp.Features source code in my project, only the package reference for it. I haven't found that peace of code as your image. Where exactly do you want me to check if there is EditionId assigned or not? Besides, the instance for CurrentTenant doesn't have the field EditionId.

  • ABP Framework version: v4.3.0-rc.2
  • UI type: Blazor
  • DB provider: EF Core

Hi,

I have a backgroundJob method where I need to check if the Tenant Edition Feature is checked or not. The method does a loop in a table disabling IMultiTenant filter. And then, for each record, it sets the CurrentTenant using the method Change().

The problem is that the Features are not returning properly. For example, if one Editon has the feature Trial checked, it is returning false anyway.

I have tried to create a new instance for FeatureChecker after changing the tenant, but it is still not working.

What should I do to be able to change the tenant and get the features properly?

If I am logged as Tenant and check that in a Blazor page, that works fine. It means that my settings are right.

Another question, it seems that ServiceProvider is obsolete now and it suggests using LazyServiceProvider instead. But, how can I create an instance and release/dispose it properly? It doesn't have CreateScope() method.

I have researched in the documentation, but no success so far for my questions.

Bellow my code for reference:

public async Task RunNotificationCheck()
        {
            List<SupplyNetwork> networks;
            using (_dataFilter.Disable<IMultiTenant>())
            {
                networks = _supplyNetworkRepository.Where(x => x.Active).ToList();
            }
            foreach (var network in networks)
            {
                await CheckSupplyNetworkNotifications(network);
            }
        }

        private async Task CheckSupplyNetworkNotifications(SupplyNetwork supplyNetwork)
        {
            using (CurrentTenant.Change(supplyNetwork.TenantId))
            {
                using (var scope = ServiceProvider.CreateScope())
                { 
                    _featureChecker = ServiceProvider.GetRequiredService<IFeatureChecker>();
                    var trial = await _featureChecker.IsEnabledAsync(AvalancheOCPFeatures.Trial);
                    if (!trial)
                    {
                        var txtAlertEnabled = !await _featureChecker.IsEnabledAsync(AvalancheOCPFeatures.TXTAlerts);
                        var emailAlertEnabled = !await _featureChecker.IsEnabledAsync(AvalancheOCPFeatures.EmailAlerts);
                        var desktopAlertEnabled = !await _featureChecker.IsEnabledAsync(AvalancheOCPFeatures.DesktopAlerts);

                        if (supplyNetwork.EnableEmailNotification && emailAlertEnabled)
                        {
                            await CheckTenantEmailNotifications(supplyNetwork);
                        }

                        if (supplyNetwork.EnableTXTNotification && txtAlertEnabled)
                        {
                            await CheckTenantTXTNotifications(supplyNetwork);
                        }

                        if (supplyNetwork.EnableAlertNotification && desktopAlertEnabled)
                        {
                            await CheckTenantAlertNotifications(supplyNetwork);
                        }
                    }
                }
            }
        }

I've found the issue. It is requiring TenantId parameter to confirm the email. But, in my template I've removed the Tenant selection on Login Page. So, that is the reason why it is not working. I'll override the ConfirmUserModel to customize that as well.

Thank you!

Showing 121 to 130 of 192 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 08:30