Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "Jorahealth"

Hi @ismcagdas Exception Log from Mobile

{Flurl.Http.FlurlHttpException: Call failed with status code 500 (Internal Server Error): POST http://10.0.2.2:22742/api/TokenAuth/RefreshToken at Flurl.Http.FlurlRequest.HandleExceptionAsync (Flurl.Http.HttpCall call, System.Exception ex, System.Threading.CancellationToken token) [0x00105] in <7be22aadf26d4808b35d54cc18db202b>:0 at Flurl.Http.FlurlRequest.SendAsync (System.Net.Http.HttpMethod verb, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken, System.Net.Http.HttpCompletionOption completionOption) [0x003a1] in <7be22aadf26d4808b35d54cc18db202b>:0 at Flurl.Http.FlurlRequest.SendAsync (System.Net.Http.HttpMethod verb, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken, System.Net.Http.HttpCompletionOption completionOption) [0x004bb] in <7be22aadf26d4808b35d54cc18db202b>:0 at Flurl.Http.HttpResponseMessageExtensions.ReceiveJson[T] (System.Threading.Tasks.Task1[TResult] response) [0x0006e] in <7be22aadf26d4808b35d54cc18db202b>:0 at Decisively.ApiClient.AccessTokenManager.RefreshTokenAsync () [0x000a1] in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Application.Client\ApiClient\AccessTokenManager.cs:93 at Decisively.Configuration.UserConfigurationService.RefreshAccessTokenAndSendRequestAgain () [0x0003e] in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Application.Client\Configuration\UserConfigurationService.cs:63 at Decisively.Configuration.UserConfigurationService.GetAuthenticatedUserConfig () [0x00178] in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Application.Client\Configuration\UserConfigurationService.cs:46 at Decisively.Configuration.UserConfigurationService.GetAsync (System.Boolean isUserLoggedIn) [0x00036] in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Application.Client\Configuration\UserConfigurationService.cs:27 at Decisively.ViewModels.Base.UserConfigurationManager+<>c__DisplayClass4_0.<GetAsync>b__0 () [0x0002e] in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Mobile.Shared\ViewModels\Base\UserConfigurationManager.cs:41 at Decisively.Core.Threading.WebRequestExecuter.Execute[TResult] (System.Func1[TResult] func, System.Func2[T,TResult] successCallback, System.Func2[T,TResult] failCallback, System.Action finallyCallback) [0x002a1] in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Mobile.Shared\Core\Threading\WebRequestExecuter.cs:53 }


API Error Log

INFO 2020-09-25 14:59:19,169 [94 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request starting HTTP/1.1 POST http://localhost:22742/api/TokenAuth/RefreshToken?refreshToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aX.IVAwaBWY5IGKkSxHo_pnl4LHlcMFbAvgTW0RkfkIciE application/json 247 INFO 2020-09-25 14:59:19,170 [94 ] uthentication.JwtBearer.JwtBearerHandler - Bearer was not authenticated. Failure message: No SecurityTokenValidator available for token: AIzaSyBd_YpujEtRhFD1cTA9zL9FcWyEV0qACJo INFO 2020-09-25 14:59:19,170 [94 ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'Decisively.Web.Controllers.TokenAuthController.RefreshToken (Decisively.Web.Core)' INFO 2020-09-25 14:59:19,191 [94 ] c.Infrastructure.ControllerActionInvoker - Route matched with {action = "RefreshToken", controller = "TokenAuth", area = ""}. Executing controller action with signature System.Threading.Tasks.Task1[Decisively.Authorization.Accounts.Dto.RefreshTokenResult] RefreshToken(System.String) on controller Decisively.Web.Controllers.TokenAuthController (Decisively.Web.Core). ERROR 2020-09-25 14:59:19,271 [9 ] Mvc.ExceptionHandling.AbpExceptionFilter - Refresh token is not valid! System.ComponentModel.DataAnnotations.ValidationException: Refresh token is not valid! ---> System.InvalidOperationException: Navigation property 'Claims' on entity of type 'User' cannot be loaded because the entity is not being tracked. Navigation properties can only be loaded for tracked entities. at Microsoft.EntityFrameworkCore.Internal.EntityFinder1.LoadAsync(INavigation navigation, InternalEntityEntry entry, CancellationToken cancellationToken) at Abp.Domain.Repositories.RepositoryExtensions.EnsureCollectionLoadedAsync[TEntity,TPrimaryKey,TProperty](IRepository2 repository, TEntity entity, Expression1 collectionExpression, CancellationToken cancellationToken) at Abp.Authorization.Users.AbpUserStore2.GetClaimsAsync(TUser user, CancellationToken cancellationToken) at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Microsoft.AspNetCore.Identity.UserManager1.GetClaimsAsync(TUser user) at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Microsoft.AspNetCore.Identity.UserClaimsPrincipalFactory1.GenerateClaimsAsync(TUser user) at Microsoft.AspNetCore.Identity.UserClaimsPrincipalFactory2.GenerateClaimsAsync(TUser user) at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Microsoft.AspNetCore.Identity.UserClaimsPrincipalFactory1.CreateAsync(TUser user) at Abp.Authorization.AbpUserClaimsPrincipalFactory2.CreateAsync(TUser user) at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Decisively.Web.Controllers.TokenAuthController.RefreshToken(String refreshToken) in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Web.Core\Controllers\TokenAuthController.cs:line 238 --- End of inner exception stack trace --- at Decisively.Web.Controllers.TokenAuthController.RefreshToken(String refreshToken) in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Web.Core\Controllers\TokenAuthController.cs:line 250 at lambda_method(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.

Exception Log from Mobile

{Flurl.Http.FlurlHttpException: Call failed with status code 500 (Internal Server Error): POST http://10.0.2.2:22742/api/TokenAuth/RefreshToken at Flurl.Http.FlurlRequest.HandleExceptionAsync (Flurl.Http.HttpCall call, System.Exception ex, System.Threading.CancellationToken token) [0x00105] in <7be22aadf26d4808b35d54cc18db202b>:0 at Flurl.Http.FlurlRequest.SendAsync (System.Net.Http.HttpMethod verb, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken, System.Net.Http.HttpCompletionOption completionOption) [0x003a1] in <7be22aadf26d4808b35d54cc18db202b>:0 at Flurl.Http.FlurlRequest.SendAsync (System.Net.Http.HttpMethod verb, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken, System.Net.Http.HttpCompletionOption completionOption) [0x004bb] in <7be22aadf26d4808b35d54cc18db202b>:0 at Flurl.Http.HttpResponseMessageExtensions.ReceiveJson[T] (System.Threading.Tasks.Task1[TResult] response) [0x0006e] in &lt;7be22aadf26d4808b35d54cc18db202b&gt;:0 at Decisively.ApiClient.AccessTokenManager.RefreshTokenAsync () [0x000a1] in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Application.Client\ApiClient\AccessTokenManager.cs:93 at Decisively.Configuration.UserConfigurationService.RefreshAccessTokenAndSendRequestAgain () [0x0003e] in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Application.Client\Configuration\UserConfigurationService.cs:63 at Decisively.Configuration.UserConfigurationService.GetAuthenticatedUserConfig () [0x00178] in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Application.Client\Configuration\UserConfigurationService.cs:46 at Decisively.Configuration.UserConfigurationService.GetAsync (System.Boolean isUserLoggedIn) [0x00036] in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Application.Client\Configuration\UserConfigurationService.cs:27 at Decisively.ViewModels.Base.UserConfigurationManager+&lt;&gt;c__DisplayClass4_0.&lt;GetAsync&gt;b__0 () [0x0002e] in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Mobile.Shared\ViewModels\Base\UserConfigurationManager.cs:41 at Decisively.Core.Threading.WebRequestExecuter.Execute[TResult] (System.Func1[TResult] func, System.Func2[T,TResult] successCallback, System.Func2[T,TResult] failCallback, System.Action finallyCallback) [0x002a1] in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Mobile.Shared\Core\Threading\WebRequestExecuter.cs:53 }


API Error Log

INFO 2020-09-25 14:59:19,169 [94 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request starting HTTP/1.1 POST http://localhost:22742/api/TokenAuth/RefreshToken?refreshToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXeSJ9.IVAwaBWY5IGKkSxHo_pnl4LHlcMFbAvgTW0RkfkIciE application/json 247 INFO 2020-09-25 14:59:19,170 [94 ] uthentication.JwtBearer.JwtBearerHandler - Bearer was not authenticated. Failure message: No SecurityTokenValidator available for token: AIzaSyBd_YpujEtRhFD1cTA9zL9FcWyEV0qACJo INFO 2020-09-25 14:59:19,170 [94 ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'Decisively.Web.Controllers.TokenAuthController.RefreshToken (Decisively.Web.Core)' INFO 2020-09-25 14:59:19,191 [94 ] c.Infrastructure.ControllerActionInvoker - Route matched with {action = "RefreshToken", controller = "TokenAuth", area = ""}. Executing controller action with signature System.Threading.Tasks.Task1[Decisively.Authorization.Accounts.Dto.RefreshTokenResult] RefreshToken(System.String) on controller Decisively.Web.Controllers.TokenAuthController (Decisively.Web.Core). ERROR 2020-09-25 14:59:19,271 [9 ] Mvc.ExceptionHandling.AbpExceptionFilter - Refresh token is not valid! System.ComponentModel.DataAnnotations.ValidationException: Refresh token is not valid! ---> System.InvalidOperationException: Navigation property 'Claims' on entity of type 'User' cannot be loaded because the entity is not being tracked. Navigation properties can only be loaded for tracked entities. at Microsoft.EntityFrameworkCore.Internal.EntityFinder1.LoadAsync(INavigation navigation, InternalEntityEntry entry, CancellationToken cancellationToken) at Abp.Domain.Repositories.RepositoryExtensions.EnsureCollectionLoadedAsync[TEntity,TPrimaryKey,TProperty](IRepository2 repository, TEntity entity, Expression1 collectionExpression, CancellationToken cancellationToken) at Abp.Authorization.Users.AbpUserStore2.GetClaimsAsync(TUser user, CancellationToken cancellationToken) at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Microsoft.AspNetCore.Identity.UserManager1.GetClaimsAsync(TUser user) at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Microsoft.AspNetCore.Identity.UserClaimsPrincipalFactory1.GenerateClaimsAsync(TUser user) at Microsoft.AspNetCore.Identity.UserClaimsPrincipalFactory2.GenerateClaimsAsync(TUser user) at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Microsoft.AspNetCore.Identity.UserClaimsPrincipalFactory1.CreateAsync(TUser user) at Abp.Authorization.AbpUserClaimsPrincipalFactory2.CreateAsync(TUser user) at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Decisively.Web.Controllers.TokenAuthController.RefreshToken(String refreshToken) in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Web.Core\Controllers\TokenAuthController.cs:line 238 --- End of inner exception stack trace --- at Decisively.Web.Controllers.TokenAuthController.RefreshToken(String refreshToken) in C:\Decisively_8.9.2\Solution\Decisively\aspnet-core\src\Decisively.Web.Core\Controllers\TokenAuthController.cs:line 250 at lambda_method(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.

@Alper I cannot get into this, I get 404 error...I have an active subscription with you.

@alper The above code seems to be already there in v8.9.2 (our current vesrion) are there any other dependenceis or codes that need changed. Do we need to migrate to v9.1 or just make changes in our current codes.

Many Thanks in advance for your help

Thank you for your help.

Answer

@ismcagdas

Thank you, That worked

My team is getting the same issue, we were able to genertate entities till recently but since we upgraded to powertools to latest, unable to do so, we use .net core 3.1 framework, the above steps did not work.

This is the log I have....

DEBUG 2020-09-16 10:33:01,407 [1 ] lVisualStudioExtension.AspNetZeroRadTool - Menu item clicked with params > loadFromJson: False, loadFromDatabase: False, showAboutForm: False ERROR 2020-09-16 10:37:04,432 [1 ] ToolVisualStudioExtension.Helpers.Logger - ForeignKeySelectionForm > cbEntitySelector_SelectedIndexChanged throws exception System.ArgumentOutOfRangeException: InvalidArgument=Value of '0' is not valid for 'SelectedIndex'. Parameter name: SelectedIndex at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value) at AspNetZeroRadToolVisualStudioExtension.Dialogs.ForeignKeySelectionForm.cbEntitySelector_SelectedIndexChanged(Object sender, EventArgs e) in D:\github\aspnet-zero-rad\AspNetZeroRadToolVisualStudioExtension\AspNetZeroRadToolVisualStudioExtension\Dialogs\ForeignKeySelectionForm.cs:line 169 ERROR 2020-09-16 10:37:32,712 [1 ] ToolVisualStudioExtension.Helpers.Logger - ForeignKeySelectionForm > cbEntitySelector_SelectedIndexChanged throws exception System.ArgumentOutOfRangeException: InvalidArgument=Value of '0' is not valid for 'SelectedIndex'. Parameter name: SelectedIndex at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value) at AspNetZeroRadToolVisualStudioExtension.Dialogs.ForeignKeySelectionForm.cbEntitySelector_SelectedIndexChanged(Object sender, EventArgs e) in D:\github\aspnet-zero-rad\AspNetZeroRadToolVisualStudioExtension\AspNetZeroRadToolVisualStudioExtension\Dialogs\ForeignKeySelectionForm.cs:line 169 ERROR 2020-09-16 10:37:39,639 [1 ] ToolVisualStudioExtension.Helpers.Logger - ForeignKeySelectionForm > cbEntitySelector_SelectedIndexChanged throws exception System.ArgumentOutOfRangeException: InvalidArgument=Value of '0' is not valid for 'SelectedIndex'. Parameter name: SelectedIndex at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value) at AspNetZeroRadToolVisualStudioExtension.Dialogs.ForeignKeySelectionForm.cbEntitySelector_SelectedIndexChanged(Object sender, EventArgs e) in D:\github\aspnet-zero-rad\AspNetZeroRadToolVisualStudioExtension\AspNetZeroRadToolVisualStudioExtension\Dialogs\ForeignKeySelectionForm.cs:line 169 ERROR 2020-09-16 10:37:45,567 [1 ] ToolVisualStudioExtension.Helpers.Logger - ForeignKeySelectionForm > cbEntitySelector_SelectedIndexChanged throws exception System.ArgumentOutOfRangeException: InvalidArgument=Value of '0' is not valid for 'SelectedIndex'. Parameter name: SelectedIndex at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value) at AspNetZeroRadToolVisualStudioExtension.Dialogs.ForeignKeySelectionForm.cbEntitySelector_SelectedIndexChanged(Object sender, EventArgs e) in D:\github\aspnet-zero-rad\AspNetZeroRadToolVisualStudioExtension\AspNetZeroRadToolVisualStudioExtension\Dialogs\ForeignKeySelectionForm.cs:line 169 DEBUG 2020-09-16 10:38:59,038 [1 ] dioExtension.Dialogs.EntityGeneratorForm - Generate entity started. DEBUG 2020-09-16 10:38:59,558 [1 ] dioExtension.Dialogs.EntityGeneratorForm - Entity successfully generated. DEBUG 2020-09-16 10:43:31,722 [1 ] lVisualStudioExtension.AspNetZeroRadTool - Menu item clicked with params > loadFromJson: False, loadFromDatabase: False, showAboutForm: False DEBUG 2020-09-16 10:45:09,837 [1 ] dioExtension.Dialogs.EntityGeneratorForm - Generate entity started. DEBUG 2020-09-16 10:45:10,244 [1 ] dioExtension.Dialogs.EntityGeneratorForm - Entity successfully generated. DEBUG 2020-09-16 13:21:50,019 [1 ] lVisualStudioExtension.AspNetZeroRadTool - Menu item clicked with params > loadFromJson: False, loadFromDatabase: False, showAboutForm: True DEBUG 2020-09-16 13:27:06,055 [1 ] lVisualStudioExtension.AspNetZeroRadTool - Menu item clicked with params > loadFromJson: False, loadFromDatabase: False, showAboutForm: True

@ismcagdas could you kinly advice on when we would have a fix for the issue please?

HI @alper I am getting the same issue on Android application. On clicking above link I get a 404 error, could you please send me the issue link please.

I sent the project a few days back and got no response? Could you please advise?

role.component.ts

import { Component, Injector, ViewChild, OnInit } from '@angular/core';
import { appModuleAnimation } from '@shared/animations/routerTransition';
import { AppComponentBase } from '@shared/common/app-component-base';
import { RoleListDto, RoleServiceProxy, PermissionServiceProxy, FlatPermissionDto } from '@shared/service-proxies/service-proxies';
import { Table } from 'primeng/table';
import { CreateOrEditRoleModalComponent } from './create-or-edit-role-modal.component';
import { EntityTypeHistoryModalComponent } from '@app/shared/common/entityHistory/entity-type-history-modal.component';
import * as _ from 'lodash';
import { finalize } from 'rxjs/operators';
import { PermissionTreeModalComponent } from '../shared/permission-tree-modal.component';
import { Router } from '@angular/router';
@Component({
    templateUrl: './roles.component.html',
    animations: [appModuleAnimation()]
})
export class RolesComponent extends AppComponentBase implements OnInit {

    @ViewChild('createOrEditRoleModal', { static: true }) createOrEditRoleModal: CreateOrEditRoleModalComponent;
    @ViewChild('entityTypeHistoryModal', { static: true }) entityTypeHistoryModal: EntityTypeHistoryModalComponent;
    @ViewChild('dataTable', { static: true }) dataTable: Table;
    @ViewChild('permissionFilterTreeModal', { static: true }) permissionFilterTreeModal: PermissionTreeModalComponent;

    _entityTypeFullName = 'Decisively.Authorization.Roles.Role';
    entityHistoryEnabled = false;

    constructor(
        injector: Injector,
        private _roleService: RoleServiceProxy,
        private _router: Router
    ) {
        super(injector);
    }

    ngOnInit(): void {
        this.setIsEntityHistoryEnabled();
    }

    private setIsEntityHistoryEnabled(): void {
        let customSettings = (abp as any).custom;
        this.entityHistoryEnabled = customSettings.EntityHistory && customSettings.EntityHistory.isEnabled && _.filter(customSettings.EntityHistory.enabledEntities, entityType => entityType === this._entityTypeFullName).length === 1;
    }

    getRoles(): void {
        this.primengTableHelper.showLoadingIndicator();
        let selectedPermissions = this.permissionFilterTreeModal.getSelectedPermissions();

        this._roleService.getRoles(selectedPermissions)
            .pipe(finalize(() => this.primengTableHelper.hideLoadingIndicator()))
            .subscribe(result => {
                this.primengTableHelper.records = result.items;
                this.primengTableHelper.totalRecordsCount = result.items.length;
                this.primengTableHelper.hideLoadingIndicator();
            });
    }

    createRole(): void {
        this.createOrEditRoleModal.show();
    }

    showHistory(role: RoleListDto): void {
        this.entityTypeHistoryModal.show({
            entityId: role.id.toString(),
            entityTypeFullName: this._entityTypeFullName,
            entityTypeDescription: role.displayName
        });
    }

    deleteRole(role: RoleListDto): void {
        let self = this;
        self.message.confirm(
            self.l('RoleDeleteWarningMessage', role.displayName),
            this.l('AreYouSure'),
            isConfirmed => {
                if (isConfirmed) {
                    this._roleService.deleteRole(role.id).subscribe(() => {
                        this.getRoles();
                        abp.notify.success(this.l('SuccessfullyDeleted'));
                        this._router.navigate(['app/admin/users']);
                    });
                }
            }
        );
    }
}


root-routing.module.ts

import { NgModule } from '@angular/core';
import { NavigationEnd, Router, RouterModule, Routes, PreloadAllModules } from '@angular/router';
import { AppUiCustomizationService } from '@shared/common/ui/app-ui-customization.service';

const routes: Routes = [
    { path: '', redirectTo: '/app/main/dashboard', pathMatch: 'full' },
    {
        path: 'account',
        loadChildren: () => import('account/account.module').then(m => m.AccountModule), //Lazy load account module
        data: { preload: true }
    },
    { path: '**', redirectTo: '/app/main/dashboard' }
];

@NgModule({
    imports: [RouterModule.forRoot(routes,
        {
            preloadingStrategy: PreloadAllModules
        })],
    exports: [RouterModule],
    providers: []
})
export class RootRoutingModule {
    constructor(
        private router: Router,
        private _uiCustomizationService: AppUiCustomizationService) {
        router.events.subscribe((event: NavigationEnd) => {
            setTimeout(() => {
                this.toggleBodyCssClass(event.url);
            }, 0);
        });
    }

    toggleBodyCssClass(url: string): void {
        if (url) {
            if (url === '/') {
                if (abp.session.userId > 0) {
                    this.setAppModuleBodyClassInternal();
                } else {
                    this.setAccountModuleBodyClassInternal();
                }
            }

            if (url.indexOf('/account/') >= 0) {
                this.setAccountModuleBodyClassInternal();
            } else {
                this.setAppModuleBodyClassInternal();
            }
        }
    }

    setAppModuleBodyClassInternal(): void {
        let currentBodyClass = document.body.className;
        let classesToRemember = '';

        if (currentBodyClass.indexOf('m-brand--minimize') >= 0) {
            classesToRemember += ' m-brand--minimize ';
        }

        if (currentBodyClass.indexOf('m-aside-left--minimize') >= 0) {
            classesToRemember += ' m-aside-left--minimize';
        }

        if (currentBodyClass.indexOf('m-brand--hide') >= 0) {
            classesToRemember += ' m-brand--hide';
        }

        if (currentBodyClass.indexOf('m-aside-left--hide') >= 0) {
            classesToRemember += ' m-aside-left--hide';
        }

        if (currentBodyClass.indexOf('swal2-toast-shown') >= 0) {
            classesToRemember += ' swal2-toast-shown';
        }

        document.body.className = this._uiCustomizationService.getAppModuleBodyClass() + ' ' + classesToRemember;
    }

    setAccountModuleBodyClassInternal(): void {
        let currentBodyClass = document.body.className;
        let classesToRemember = '';

        if (currentBodyClass.indexOf('swal2-toast-shown') >= 0) {
            classesToRemember += ' swal2-toast-shown';
        }

        document.body.className = this._uiCustomizationService.getAccountModuleBodyClass() + ' ' + classesToRemember;
    }

    getSetting(key: string): string {
        return abp.setting.get(key);
    }
}

Showing 21 to 30 of 37 entries