Basically our issue is : we are unable to call applicationService which is created in Application project. We have created a menu in DashBoarMenuContributor.cs now we want to call the method from the appservice as show in the shared image repository returns null value we are unable to get current user in DashboardContributor.cs file
I am sharing the AppService and the MenuContributor files code here :
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
namespace Pulsar.Dashboard.Account
{
public class AccountInfoAppService : ApplicationService, IAccountInfoAppService
{
private readonly IRepository<UserAccountsMapping, Guid> _accountRepository;
public AccountInfoAppService(IRepository<UserAccountsMapping, Guid> accountRepository )
{
_accountRepository = accountRepository;
}
public List<string> GetAccId()
{
var list = _accountRepository
.Where(p => p.UserId == CurrentUser.Id.ToString()).Select(x => x.AccountId)
.ToList();
return list;
}
}
}
DashboardMenuContributor.cs
using Abp.Domain.Repositories;
using Pulsar.Dashboard.Account;
using Pulsar.Dashboard.Localization;
using Pulsar.Dashboard.Permissions;
using Pulsar.Dashboard.PulsarEnums;
using Pulsar.Dashboard.PulsarModel;
using Pulsar.Dashboard.Users;
using System;
using System.Threading.Tasks;
using Volo.Abp.Account;
using Volo.Abp.AuditLogging.Web.Navigation;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity.Web.Navigation;
using Volo.Abp.IdentityServer.Web.Navigation;
using Volo.Abp.LanguageManagement.Navigation;
using Volo.Abp.SettingManagement.Web.Navigation;
using Volo.Abp.TextTemplateManagement.Web.Navigation;
using Volo.Abp.UI.Navigation;
using Volo.Abp.Users;
using Volo.Saas.Host.Navigation;
namespace Pulsar.Dashboard.Web.Menus
{
public class DashboardMenuContributor : IMenuContributor
{
private readonly IAccountInfoAppService _accountAppService;
public async Task ConfigureMenuAsync(MenuConfigurationContext context)
{
if (context.Menu.Name == StandardMenus.Main)
{
await ConfigureMainMenuAsync(context);
}
}
private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
{
var l = context.GetLocalizer<DashboardResource>();
//Home
context.Menu.AddItem(
new ApplicationMenuItem(
DashboardMenus.Home,
l["Menu:Home"],
"~/",
icon: "fa fa-home",
order: 1
)
);
context.Menu.AddItem(
new ApplicationMenuItem(
DashboardMenus.Trades,
l["Menu:Trades"],
"~/",
icon: "fa fa-home",
order: 2
)
);
//Trades
context.Menu.AddItem(
new ApplicationMenuItem(
DashboardMenus.Brokers,
l["Menu:Brokers"],
"~/",
icon: "fa fa-home",
order: 3
)
);
if (await context.IsGrantedAsync(DashboardPermissions.Dashboard.Host))
{
//HostDashboard
context.Menu.AddItem(
new ApplicationMenuItem(
DashboardMenus.HostDashboard,
l["Menu:Dashboard"],
"~/HostDashboard",
icon: "fa fa-line-chart",
order: 3
)
);
}
if (await context.IsGrantedAsync(DashboardPermissions.Dashboard.Tenant))
{
//TenantDashboard
var dashboardMenu = context.Menu.AddItem(
new ApplicationMenuItem(
DashboardMenus.TenantDashboard,
l["Menu:Dashboard"],
"~/Dashboard",
icon: "fa fa-line-chart",
order: 3
)
);
var result = _accountAppService.GetAccId();
Console.WriteLine(result);
}
//Administration
var administration = context.Menu.GetAdministration();
administration.Order = 4;
//Administration->Saas
administration.SetSubItemOrder(SaasHostMenuNames.GroupName, 1);
//Administration->Identity
administration.SetSubItemOrder(IdentityMenuNames.GroupName, 2);
//Administration->Identity Server
administration.SetSubItemOrder(AbpIdentityServerMenuNames.GroupName, 3);
//Administration->Language Management
administration.SetSubItemOrder(LanguageManagementMenuNames.GroupName, 4);
//Administration->Text Template Management
administration.SetSubItemOrder(TextTemplateManagementMainMenuNames.GroupName, 5);
//Administration->Audit Logs
administration.SetSubItemOrder(AbpAuditLoggingMainMenuNames.GroupName, 6);
//Administration->Settings
administration.SetSubItemOrder(SettingManagementMenuNames.GroupName, 7);
}
}
}
Please check where _accountAppService.GetAccId(); is called.
Thanks...
What is the process to uninstall Volo.Identity: Open source module ? Can we do it from abp cli ? What is the command ?
I tried that also, but still it shows me null.
using Org.BouncyCastle.Math.EC.Rfc7748;
using Pulsar.Dashboard.Account.Dto;
using Pulsar.Dashboard.PulsarModel;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
namespace Pulsar.Dashboard.Account
{
public class AccountInfoAppService : ApplicationService, IAccountInfoAppService
{
private readonly IRepository<UserAccountsMapping, Guid> _accountRepository;
public AccountInfoAppService(IRepository<UserAccountsMapping, Guid> accountRepository )
{
_accountRepository = accountRepository;
}
public List<string> GetAccId()
{
var list = _accountRepository
.Where(p => p.UserId == CurrentUser.Id.ToString()).Select(x => x.AccountId)
.ToList();
return list;
}
}
}
Here is the code for MenuContributor.cs where i want to use the AccountInfoAppService.
Is there another way to do this ?
Thanks
ok. Let me uninstall the pro module and check. Thanks.
I am getting several errors after adding the source code module for Volo.Identity , particularly in the tests project and menucontributor file. Do not know where i can find the version 1.0.0.0 dll that is mentioned in the error. .NET COre + MVC JQuery.
I just want to add the action menu item to users table. Can you help urgently please ?
Yes i removed the above code and its working now. I can see the following dashboard
**I want to build a custom layout like the figure below for the dashboard. What is the best way to go ahead ? which source code module will i need to download to 1. modify existing dashboard layout or 2. To build a custom layout. Can you please provide some pointers ? **
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
I am getting the following eeror while running the Dashboard Demo from abp-samples.master
I just opened and run the demo without any changes.
I need to run this for refrence in order to build a custom dashboard.
BTW my solution is not Tiered.
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
Getting this error continuously when i run any project with Razor and entity framework template.
I tried from customers license too. Same error . When i turn MultiTenancy=false , it works and allows me to login as host but not as tenant since tenant selection does not show up. Earlier i did nor get this error. But since morning today i have tried several time but getting the same error.
Could you help ? Are any Nuget packages updated resulting in this error ?
Thanks