Base solution for your next web application
Open Closed

How to populate a new user's dashboard with default widgets #9260


User avatar
0
SASIMEXICO created

We've been working on some custom widgets that we'd like to have appear in the dashboard by default every time a user is created. We did what seemed the most logic and modified defaultTenantDashboard in DashboardConfiguration.cs adding the Ids for our widgets and comenting the the default ones out. This however doesn't seem to work.

What is the intended way of archieving this?

EDIT: After more digging, we've found that the file DashboardViewConfiguration contains definitions for (we asume) the visual parts of the widgets. There are some base paths defined:

        var jsAndCssFileRoot = "/Areas/App/Views/CustomizableDashboard/Widgets/";
        var viewFileRoot = "~/Areas/App/Views/Shared/Components/CustomizableDashboard/Widgets/";

And specifics for each widget:

        WidgetViewDefinitions.Add(GenTimeDashboardCustomizationConsts.Widgets.Tenant.DailySales,
            new WidgetViewDefinition(
                GenTimeDashboardCustomizationConsts.Widgets.Tenant.DailySales,
                viewFileRoot + "DailySales.cshtml",
                jsAndCssFileRoot + "DailySales/DailySales.min.js",
                jsAndCssFileRoot + "DailySales/DailySales.min.css"));

Those paths do, however, make no sense, there's no "Areas" directory in the Angular solution nor the ASP solution. What are those paths refering to?


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Did you follow this document https://docs.aspnetzero.com/en/aspnet-core-mvc/latest/Developing-Mvc-Core-Customizable-Dashboard ? If so, does your widget has a permission ?

  • User Avatar
    0
    SASIMEXICO created

    Hi,

    Yes, every widget has a permission, in fact, they all have "tenantWidgetsDefaultPermission" as their permission.

  • User Avatar
    0
    musa.demir created

    What new users see in dashboard is default dashboard and it is setted in here by default. https://github.com/aspnetzero/aspnet-zero-core/blob/7b48ab6dd9b7aad3bde44f4a331b56c85d222a77/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/Configuration/AppSettingProvider.cs#L535

    You can add your widget here.


    Those paths do, however, make no sense, there's no "Areas" directory in the Angular solution nor the ASP solution. What are those paths refering to?

    You are right. It comes from mvc project. It shouldn't be here. I have created an issue about it: https://github.com/aspnetzero/aspnet-zero-core/issues/3400.