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

Activities of "ISTeam"

To store and use widget settings for every tenant differently, I have tried above code.

Above code does not store the default settings in the database. So, to store the default settings in the database, I have created repository as mentioned in ticket 5077

And to finally store in the database, added code to store the settings in AppSettings table in project EntityFrameWorkCore => Migrations => Seed => Host => InitialHostDbBuilder.cs like few template setting (e.g. SMTP)

Is it the correct way to store default tenant widget settings in database or it could be simplified?

Thanks

The solution to change from "abp-src" to "src" is right for normal pages. But

For widgets as we are defining widget with specific min.js file only as target in DashboardCustomization.cs file. So, here we have to make changes in min file and after we are done we need to copy the changes back in regular .js file to be committed to git.

Is there any work around in the case of Widget? As we have 15 widgets and its hard for front end/UX developer to remember and copy any changes related to widgets.

I found the answer from ticket #9235.

Is there any other way to get it or the one mentioned is the best way?

Thank you. Your answer helped me to get the connection string in appservice to use raw SQL using dapper!

App info

  • What is your product version? .NET Core MVC & jQuery 8.3
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? .NET Core

Issue

I need to perform left out join with group by and sum between two tables/repository using dapper and raw SQL query. But I am not able to get connection string to use dapper module in the Application project in WidgetAppService.

private readonly IConfiguration _appConfiguration;

is not getting initialized with appsettings.json data and so I am not able to get the connection string information in the Application project. Is it possible? If yes, how?

`string sqlQuery = $";WITH CTE_POItems AS(SELECT SONo, SUM(ISNULL(Quantity, 0)) AS Quantity, SUM(ISNULL(Amount, 0)) AS Amount FROM app_PurchaseOrderItem GROUP BY SONo), CTE_POS AS(SELECT DATEPART(MONTH, P.OrderDate) AS Month, SUM(ISNULL(I.Amount,0)) AS OrdersValue, SUM(ISNULL(I.Quantity, 0)) AS Units, COUNT(ISNULL(I.SONo, 0)) AS TotalSOs FROM app_PurchaseOrder P LEFT JOIN CTE_POItems I ON P.SONo = I.SONo WHERE P.CustomerNo IN({associatedClients}) AND P.OrderDate BETWEEN '{CurrentYearStartDate.ToShortDateString()}' AND '{TomorrowDate.ToShortDateString()}' GROUP BY DATEPART(MONTH, P.OrderDate)) SELECT* FROM CTE_POS";

        using (SqlConnection db = new SqlConnection(***DefaultConnString***))
        {
            db.Open();
            data.AddRange(db.Query<OrdersInLastNMonths>(sqlQuery));
            db.Close();
        }`

Thanks.

App launches for two ports :

  1. http => 5000
  2. https => 5001

As per first answer by @Riaan.Smit I just updated the appsettings.json with https://localhost:5001/ instead of all http URLs and the issue is now fixed. It was happening only in Chrome and continuous request to signalr-chat service/hub stopped after putting correct URLs. Now prefereing to use only https URL even in development environment because of Chrome security updates.

Ref of Chrome issue.

Thank you for your answer @musa.demir. But I am not sure why I think there could be some better alternative available.

The issue is, I have three scenarios as below :

  1. < 3 months (0,2)
  2. 3 to 12 months (3,12)
  3. > 12 months (12, null)

Now, in the default service method generated using PowerTools, contains getAll() method. I need to apply filter on one of the field/column inside this service method. In last case, it seems hard to configure null scenario and I am getting below exception:

While on the UI it works like below:

Filter applied in the service method is as below :

var validInventory = _inventoryItemRepository.GetAll() ..... .WhereIf(input.MinMonthsRemainingFilter != null, e => e.MonthsRemaining >= input.MinMonthsRemainingFilter) .WhereIf(input.MaxMonthsRemainingFilter != null, e => e.MonthsRemaining <= input.MaxMonthsRemainingFilter) .....

Not sure why the abp.ajax method should not work or there is any other elegant way for this?

We have developed few widgets using morris.js library to display bar charts and pie charts.

We need to redirect the user to specific page when user clicks on some portion of the chart. Currentlly, on all pages service methods are being called with get* methods to retrieve data from the server.

But unable to find a way how to redirect to another page by calling a controller action method from jQuery of some widget.

  • I have tried, this way but unable to redirect to different page.

Faced errors like,

  1. HttpPost method issue
  2. [FormBody] attribute
  3. Mvc.ExceptionHandling.AbpExceptionFilter - A non-empty request body is required. () - Mvc.ExceptionHandling.AbpExceptionFilter - Method arguments are not valid! See ValidationErrors for details.
  4. Resource not found etc.

Sample attempts of JS code :

    try {
        var test = JSON.stringify({ MinMonthsRemaining: minMonth, MaxMonthsRemaining: maxMonth });
        $.ajax({
            type: 'GET',
            //type: 'POST',
            //url: abp.appPath + 'App/Inventories/IndexFiltered',
            url: '@Url.Action("Inventories","IndexFiltered")',
            data: test,
            success: function () { }
        });
    } catch (e) {
        // never reached here!
        console.log(e);
    }

Controller action :

    //[HttpPost]
    public ActionResult IndexFiltered(InventoryItemsModel input)
    {
        var model = new InventoryItemsViewModel
        {
            FilterText = string.Empty,
            MinMonthsRemainingFilter = input.MinMonthsRemaining,
            MaxMonthsRemainingFilter = input.MaxMonthsRemaining
        };

        return View("Index",model);
    }

To use HTTPs URL is a good option. This issue persist even in development machine!

@ismcagdas this issue is still present in MVC Core & jQuery template. I followed exact steps to create my first dashboard widget mentioned in the documentation then I got an error :

abpexception there is no permission with name "HelloWorld".

And in fact in the documentation URL there is no mention of how to setup the permission for this particular Widget which they are describing.

So, in addition to adding ".ToList()" change for generalStats, I had to completely remove the HelloWorld permission. Because all the permissions setup are for pages and there is no specific permission for particular Widget. (i.e. tenantWidgetsDefaultPermission is nothing but AppPermissions.Pages_Tenant_Dashboard)

And yes even today, the tenant dashboard is empty because of the AuditLog permission mentioned above!

Thanks @dmux for your explaination and sharing the solution as well!

Showing 11 to 20 of 32 entries